From c119af4b813601959cd9ecba56528b21a343a2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Fri, 17 Apr 2026 10:10:29 +0800 Subject: [PATCH] fix(region): show associate info (#24688) --- pkg/compute/models/elasticips.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/compute/models/elasticips.go b/pkg/compute/models/elasticips.go index b8189286d3..50d3a9eeb0 100644 --- a/pkg/compute/models/elasticips.go +++ b/pkg/compute/models/elasticips.go @@ -932,8 +932,8 @@ func (self *SElasticip) AssociateLoadbalancer(ctx context.Context, userCred mccl if self.AssociateType == api.EIP_ASSOCIATE_TYPE_LOADBALANCER && self.AssociateId == lb.Id { return nil } - if self.GetAssociateResource() != nil { - return fmt.Errorf("eip has been associated!!") + if res := self.GetAssociateResource(); res != nil { + return fmt.Errorf("eip has been associated %s %s %s !!", res.Keyword(), res.GetName(), res.GetId()) } } _, err := db.Update(self, func() error { @@ -964,8 +964,8 @@ func (self *SElasticip) AssociateInstance(ctx context.Context, userCred mcclient if self.AssociateType == insType && self.AssociateId == ins.GetId() { return nil } - if self.GetAssociateResource() != nil { - return fmt.Errorf("eip has been associated!!") + if res := self.GetAssociateResource(); res != nil { + return fmt.Errorf("eip has been associated %s %s %s !!", res.Keyword(), res.GetName(), res.GetId()) } } _, err := db.Update(self, func() error { @@ -996,8 +996,8 @@ func (self *SElasticip) AssociateInstanceGroup(ctx context.Context, userCred mcc if self.AssociateType == insType && self.AssociateId == ins.GetId() { return nil } - if self.GetAssociateResource() != nil { - return fmt.Errorf("eip has been associated!!") + if res := self.GetAssociateResource(); res != nil { + return fmt.Errorf("eip has been associated %s %s %s !!", res.Keyword(), res.GetName(), res.GetId()) } } _, err := db.Update(self, func() error {