mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): lvm disk path add dev prefix (#22105)
This commit is contained in:
@@ -181,6 +181,7 @@ var (
|
||||
|
||||
SHARED_FILE_STORAGE = []string{STORAGE_NFS, STORAGE_GPFS}
|
||||
FIEL_STORAGE = []string{STORAGE_LOCAL, STORAGE_NFS, STORAGE_GPFS, STORAGE_LVM, STORAGE_CLVM, STORAGE_SLVM}
|
||||
LVM_STORAGE = []string{STORAGE_LVM, STORAGE_CLVM, STORAGE_SLVM}
|
||||
|
||||
// supported shared storage types
|
||||
SHARED_STORAGE = []string{STORAGE_NFS, STORAGE_GPFS, STORAGE_RBD, STORAGE_CLVM, STORAGE_SLVM}
|
||||
|
||||
@@ -1384,15 +1384,22 @@ func (self *SDisk) GetCloudprovider() *SCloudprovider {
|
||||
}
|
||||
|
||||
func (self *SDisk) GetPathAtHost(host *SHost) string {
|
||||
usedStorageId := self.StorageId
|
||||
hostStorage := host.GetHoststorageOfId(self.StorageId)
|
||||
if hostStorage != nil {
|
||||
return path.Join(hostStorage.MountPoint, self.Id)
|
||||
} else if len(self.BackupStorageId) > 0 {
|
||||
if hostStorage == nil {
|
||||
hostStorage = host.GetHoststorageOfId(self.BackupStorageId)
|
||||
if hostStorage != nil {
|
||||
return path.Join(hostStorage.MountPoint, self.Id)
|
||||
usedStorageId = self.BackupStorageId
|
||||
}
|
||||
}
|
||||
if hostStorage != nil {
|
||||
storage := StorageManager.FetchStorageById(usedStorageId)
|
||||
hostpath := path.Join(hostStorage.MountPoint, self.Id)
|
||||
if storage != nil && utils.IsInStringArray(storage.StorageType, api.LVM_STORAGE) {
|
||||
hostpath = path.Join("/dev", hostpath)
|
||||
}
|
||||
return hostpath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user