fix(region): sync empty security groups (#19516)

This commit is contained in:
屈轩
2024-02-21 16:27:03 +08:00
committed by GitHub
parent e2149d01b6
commit 1c94dac7b6
+1 -1
View File
@@ -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 = ""