mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #9123 from ioito/hotfix/qx-bucket-delete-condition
fix(region): allow delete resource which status is unknown
This commit is contained in:
@@ -1181,6 +1181,9 @@ func (bucket *SBucket) ValidatePurgeCondition(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (bucket *SBucket) ValidateDeleteCondition(ctx context.Context) error {
|
||||
if bucket.Status == api.BUCKET_STATUS_UNKNOWN {
|
||||
return bucket.SSharableVirtualResourceBase.ValidateDeleteCondition(ctx)
|
||||
}
|
||||
if bucket.ObjectCnt > 0 {
|
||||
return httperrors.NewNotEmptyError("not an empty bucket")
|
||||
}
|
||||
|
||||
@@ -209,6 +209,13 @@ func (self *SVpc) ValidateUpdateData(ctx context.Context, userCred mcclient.Toke
|
||||
}
|
||||
|
||||
func (self *SVpc) ValidateDeleteCondition(ctx context.Context) error {
|
||||
if self.Id == api.DEFAULT_VPC_ID {
|
||||
return httperrors.NewProtectedResourceError("not allow to delete default vpc")
|
||||
}
|
||||
if self.Status == api.VPC_STATUS_UNKNOWN {
|
||||
return self.SEnabledStatusInfrasResourceBase.ValidateDeleteCondition(ctx)
|
||||
}
|
||||
|
||||
cnt, err := self.GetNetworkCount()
|
||||
if err != nil {
|
||||
return httperrors.NewInternalServerError("GetNetworkCount fail %s", err)
|
||||
@@ -223,9 +230,6 @@ func (self *SVpc) ValidateDeleteCondition(ctx context.Context) error {
|
||||
if cnt > 0 {
|
||||
return httperrors.NewNotEmptyError("VPC not empty, please delete nat gateway first")
|
||||
}
|
||||
if self.Id == api.DEFAULT_VPC_ID {
|
||||
return httperrors.NewProtectedResourceError("not allow to delete default vpc")
|
||||
}
|
||||
cnt, err = self.GetVpcPeeringConnectionCount()
|
||||
if err != nil {
|
||||
return httperrors.NewInternalServerError("GetRequesterVpcPeeringConnections fail %v", err)
|
||||
|
||||
Reference in New Issue
Block a user