mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
rbd类型disk需要path路径
This commit is contained in:
@@ -207,21 +207,9 @@ func (self *SDisk) GetCloudprovider() *SCloudprovider {
|
||||
}
|
||||
|
||||
func (self *SDisk) GetPathAtHost(host *SHost) string {
|
||||
storage := self.GetStorage()
|
||||
if storage.StorageType == STORAGE_RBD {
|
||||
pool, _ := storage.StorageConf.GetString("pool")
|
||||
monHost, _ := storage.StorageConf.GetString("mon_host")
|
||||
key, _ := storage.StorageConf.GetString("key")
|
||||
for _, keyword := range []string{"@", ":", "="} {
|
||||
monHost = strings.Replace(monHost, keyword, fmt.Sprintf("\\%s", keyword), -1)
|
||||
key = strings.Replace(key, keyword, fmt.Sprintf("\\%s", keyword), -1)
|
||||
}
|
||||
return fmt.Sprintf("rbd:%s/%s:mon_host=%s:key=%s", pool, self.Id, monHost, key)
|
||||
} else if storage.StorageType == STORAGE_LOCAL || storage.StorageType == STORAGE_NAS {
|
||||
hostStorage := host.GetHoststorageOfId(self.StorageId)
|
||||
if hostStorage != nil {
|
||||
return path.Join(hostStorage.MountPoint, self.Id)
|
||||
}
|
||||
hostStorage := host.GetHoststorageOfId(self.StorageId)
|
||||
if hostStorage != nil {
|
||||
return path.Join(hostStorage.MountPoint, self.Id)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -115,7 +115,8 @@ func (self *SGuestdisk) GetJsonDescAtHost(host *SHost) jsonutils.JSONObject {
|
||||
// if hostcachedimg is not None:
|
||||
// desc['image_path'] = hostcachedimg.path
|
||||
}
|
||||
if host.HostType == HOST_TYPE_HYPERVISOR && disk.IsLocal() {
|
||||
storage := disk.GetStorage()
|
||||
if host.HostType == HOST_TYPE_HYPERVISOR && disk.IsLocal() || (storage != nil && storage.StorageType == STORAGE_RBD) {
|
||||
desc.Add(jsonutils.NewString(disk.StorageId), "storage_id")
|
||||
localpath := disk.GetPathAtHost(host)
|
||||
if len(localpath) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user