Skip to content

Commit

Permalink
fix(region): avoid purge zone (#19936)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Apr 11, 2024
1 parent 0ad64ba commit e461c3d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/compute/models/zones.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit e461c3d

Please sign in to comment.