mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(region): prohibit resizing the disk of a esxi vm with instance snapshots
This commit is contained in:
@@ -862,6 +862,15 @@ func (disk *SDisk) PerformResize(ctx context.Context, userCred mcclient.TokenCre
|
||||
if guest != nil {
|
||||
return nil, httperrors.NewUnsupportOperationError("try use /servers/<%s>/resize-disk API", guest.Id)
|
||||
}
|
||||
if guest.Hypervisor == api.HYPERVISOR_ESXI {
|
||||
c, err := guest.GetInstanceSnapshotCount()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "unable to GetInstanceSnapshotCount for guest %s", guest.GetName())
|
||||
}
|
||||
if c > 0 {
|
||||
return nil, httperrors.NewUnsupportOperationError("the disk of a esxi virtual machine with instance snapshots does not support resizing")
|
||||
}
|
||||
}
|
||||
sizeMb, err := input.SizeMb()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user