get eip bugfix

This commit is contained in:
TangBin
2020-01-04 18:22:08 +08:00
parent a75fc6b37d
commit 4f3498959e
2 changed files with 17 additions and 13 deletions
+16 -12
View File
@@ -1038,13 +1038,15 @@ func (self *SDisk) StartDiskSaveTask(ctx context.Context, userCred mcclient.Toke
func (self *SDisk) ValidateDeleteCondition(ctx context.Context) error {
provider := self.GetCloudprovider()
if provider != nil && !provider.IsAvailable() {
return httperrors.NewNotSufficientPrivilegeError("cloud provider %s is not available", provider.GetName())
}
if provider != nil {
if !provider.IsAvailable() {
return httperrors.NewNotSufficientPrivilegeError("cloud provider %s is not available", provider.GetName())
}
account := provider.GetCloudaccount()
if account != nil && !account.IsAvailable() {
return httperrors.NewNotSufficientPrivilegeError("cloud account %s is not available", account.GetName())
account := provider.GetCloudaccount()
if account != nil && !account.IsAvailable() {
return httperrors.NewNotSufficientPrivilegeError("cloud account %s is not available", account.GetName())
}
}
return self.validateDeleteCondition(ctx, false)
@@ -1070,13 +1072,15 @@ func (self *SDisk) validateDeleteCondition(ctx context.Context, isPurge bool) er
func (self *SDisk) AllowDeleteItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool {
provider := self.GetCloudprovider()
if provider != nil && !provider.IsAvailable() {
return false
}
if provider != nil {
if !provider.IsAvailable() {
return false
}
account := provider.GetCloudaccount()
if account != nil && !account.IsAvailable() {
return false
account := provider.GetCloudaccount()
if account != nil && !account.IsAvailable() {
return false
}
}
overridePendingDelete := false
+1 -1
View File
@@ -692,7 +692,7 @@ func (self *SLoadbalancer) DeleteEip(ctx context.Context, userCred mcclient.Toke
}
func (self *SLoadbalancer) GetEip() (*SElasticip, error) {
return ElasticipManager.getEipForInstance(api.EIP_ASSOCIATE_TYPE_LOADBALANCER, self.Id)
return ElasticipManager.getEip(api.EIP_ASSOCIATE_TYPE_LOADBALANCER, self.Id, "")
}
func (self *SLoadbalancer) SyncLoadbalancerEip(ctx context.Context, userCred mcclient.TokenCredential, provider *SCloudprovider, extEip cloudprovider.ICloudEIP) compare.SyncResult {