From a85c17a64b83d99f03ca2d8e8bef3d623956ef9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Thu, 29 Dec 2022 23:19:14 +0800 Subject: [PATCH] fix(region): hostname sync (#15659) --- pkg/compute/models/guests.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/compute/models/guests.go b/pkg/compute/models/guests.go index 596b1679f9..82e569186f 100644 --- a/pkg/compute/models/guests.go +++ b/pkg/compute/models/guests.go @@ -2745,8 +2745,9 @@ func (self *SGuest) syncWithCloudVM(ctx context.Context, userCred mcclient.Token self.Name = newName } } - if extVM.GetName() != extVM.GetHostname() { - self.Hostname = pinyinutils.Text2Pinyin(extVM.GetHostname()) + hostname := pinyinutils.Text2Pinyin(extVM.GetHostname()) + if extVM.GetName() != hostname { + self.Hostname = hostname } if !self.IsFailureStatus() && syncStatus { self.Status = extVM.GetStatus()