vpcagent: models: annotate guest with guestnetworks

This commit is contained in:
Yousong Zhou
2021-03-24 20:16:19 +08:00
parent 3b8e4811bc
commit 1b2878d699
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -107,6 +107,7 @@ type Guest struct {
Host *Host `json:"-"`
AdminSecurityGroup *SecurityGroup `json:"-"`
SecurityGroups SecurityGroups `json:"-"`
Guestnetworks Guestnetworks `json:"-"`
}
func (el *Guest) Copy() *Guest {
+5
View File
@@ -401,6 +401,11 @@ func (set Guestnetworks) joinGuests(subEntries Guests) bool {
continue
}
gn.Guest = g
if g.Guestnetworks == nil {
g.Guestnetworks = Guestnetworks{}
}
rowIdStr := fmt.Sprintf("%d", gn.RowId)
g.Guestnetworks[rowIdStr] = gn
}
return true
}