mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #12491 from ioito/hotfix/qx-change-config-with-snapshot
fix(region): set storage with snapshot id when change vm disk config
This commit is contained in:
@@ -2545,7 +2545,15 @@ func (self *SGuest) PerformChangeConfig(ctx context.Context, userCred mcclient.T
|
||||
var diskIdx = 1
|
||||
for i := range input.Disks {
|
||||
disk := input.Disks[i]
|
||||
if len(disk.Backend) == 0 {
|
||||
if len(disk.SnapshotId) > 0 {
|
||||
snapObj, err := SnapshotManager.FetchById(disk.SnapshotId)
|
||||
if err != nil {
|
||||
return nil, httperrors.NewResourceNotFoundError("snapshot %s not found", disk.SnapshotId)
|
||||
}
|
||||
snap := snapObj.(*SSnapshot)
|
||||
disk.Storage = snap.StorageId
|
||||
}
|
||||
if len(disk.Backend) == 0 && len(disk.Storage) == 0 {
|
||||
disk.Backend = self.getDefaultStorageType()
|
||||
}
|
||||
if disk.SizeMb > 0 {
|
||||
|
||||
Reference in New Issue
Block a user