fix(region): avoid purge zone (#19936)

This commit is contained in:
屈轩
2024-04-11 13:57:52 +08:00
committed by GitHub
parent 0ad64ba062
commit e461c3debe

View File

@@ -346,6 +346,13 @@ func (self *SZone) syncRemoveCloudZone(ctx context.Context, userCred mcclient.To
lockman.LockObject(ctx, self)
defer lockman.ReleaseObject(ctx, self)
cnt, err := self.getNetworkCount(ctx)
if err != nil {
return errors.Wrapf(err, "getNetworkCount")
}
if cnt > 0 {
return httperrors.NewNotEmptyError("contains %d networks", cnt)
}
return self.purgeAll(ctx, provider.Id)
}