From 1c94dac7b6c00f0c8c03d0bc77c124d3efeb0231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Wed, 21 Feb 2024 16:27:03 +0800 Subject: [PATCH] fix(region): sync empty security groups (#19516) --- pkg/compute/models/guests.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/compute/models/guests.go b/pkg/compute/models/guests.go index 6f0319f49a..b989b28ead 100644 --- a/pkg/compute/models/guests.go +++ b/pkg/compute/models/guests.go @@ -5904,7 +5904,7 @@ func (self *SGuest) getSecgroupsBySecgroupExternalIds(externalIds []string) ([]S func (self *SGuest) SyncVMSecgroups(ctx context.Context, userCred mcclient.TokenCredential, externalIds []string) error { // clear secgroup if vm not support security group - if self.GetDriver().GetMaxSecurityGroupCount() == 0 { + if self.GetDriver().GetMaxSecurityGroupCount() == 0 || len(externalIds) == 0 { _, err := db.Update(self, func() error { self.SecgrpId = "" self.AdminSecgrpId = ""