mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix delete disk panic
This commit is contained in:
@@ -1395,7 +1395,8 @@ func (self *SDisk) PerformPurge(ctx context.Context, userCred mcclient.TokenCred
|
||||
}
|
||||
|
||||
func (self *SDisk) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error {
|
||||
if self.GetCloudprovider().Provider == CLOUD_PROVIDER_HUAWEI && self.GetSnapshotCount() > 0 {
|
||||
provider := self.GetCloudprovider()
|
||||
if provider != nil && provider.Provider == CLOUD_PROVIDER_HUAWEI && self.GetSnapshotCount() > 0 {
|
||||
return httperrors.NewForbiddenError("not allow to delete. Virtual disk must not have snapshots")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user