mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #7361 from ioito/automated-cherry-pick-of-#7359-upstream-release-3.2
Automated cherry pick of #7359: fix: 修复vm绑定重复安全组
This commit is contained in:
@@ -1671,11 +1671,13 @@ func (guest *SGuest) PostCreate(ctx context.Context, userCred mcclient.TokenCred
|
||||
guest.setUserData(ctx, userCred, userData)
|
||||
}
|
||||
secgroups, _ := jsonutils.GetStringArray(data, "secgroups")
|
||||
for _, secgroup := range secgroups {
|
||||
gs := SGuestsecgroup{}
|
||||
gs.SecgroupId = secgroup
|
||||
gs.GuestId = guest.Id
|
||||
GuestsecgroupManager.TableSpec().Insert(&gs)
|
||||
for _, secgroupId := range secgroups {
|
||||
if secgroupId != guest.SecgrpId {
|
||||
gs := SGuestsecgroup{}
|
||||
gs.SecgroupId = secgroupId
|
||||
gs.GuestId = guest.Id
|
||||
GuestsecgroupManager.TableSpec().Insert(&gs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user