mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
make dissociate action idempotennt
This commit is contained in:
@@ -641,8 +641,13 @@ func (self *SElasticip) AllowPerformDissociate(ctx context.Context, userCred mcc
|
||||
}
|
||||
|
||||
func (self *SElasticip) PerformDissociate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) {
|
||||
if len(self.AssociateId) == 0 {
|
||||
return nil, nil // success
|
||||
}
|
||||
|
||||
// associate with an invalid vm
|
||||
if !self.IsAssociated() {
|
||||
return nil, httperrors.NewConflictError("eip is not associated with instance")
|
||||
return nil, self.Dissociate(ctx, userCred)
|
||||
}
|
||||
|
||||
if self.Status != EIP_STATUS_READY {
|
||||
|
||||
Reference in New Issue
Block a user