fix(region): lvm disk path add dev prefix (#22105)

This commit is contained in:
wanyaoqi
2025-02-21 10:23:15 +08:00
committed by GitHub
parent 4420290011
commit 1f2d2863b4
2 changed files with 12 additions and 4 deletions
+1
View File
@@ -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}
+11 -4
View File
@@ -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 ""
}