From 3be7a103c33795a4a280fbf4af96f26045faec88 Mon Sep 17 00:00:00 2001 From: tangbin Date: Tue, 6 Apr 2021 17:23:45 +0800 Subject: [PATCH] fix(region): guest sync eip fix --- pkg/compute/models/guests.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/compute/models/guests.go b/pkg/compute/models/guests.go index 813fa82521..71f14c672f 100644 --- a/pkg/compute/models/guests.go +++ b/pkg/compute/models/guests.go @@ -4919,10 +4919,16 @@ func (self *SGuest) GetPublicIp() (*SElasticip, error) { func (self *SGuest) SyncVMEip(ctx context.Context, userCred mcclient.TokenCredential, provider *SCloudprovider, extEip cloudprovider.ICloudEIP, syncOwnerId mcclient.IIdentityProvider) compare.SyncResult { result := compare.SyncResult{} - eip, err := self.GetEipOrPublicIp() + eip, err := self.GetPublicIp() if err != nil { - result.Error(fmt.Errorf("getEip error %s", err)) + result.Error(fmt.Errorf("getPublicIp error %s", err)) return result + } else if eip == nil { + eip, err = self.GetElasticIp() + if err != nil { + result.Error(fmt.Errorf("getEip error %s", err)) + return result + } } if eip == nil && extEip == nil {