fix(region): support managed ipv6 (#19394)

This commit is contained in:
屈轩
2024-01-31 17:29:51 +08:00
committed by GitHub
parent a24d76232d
commit 5a18e691ba
36 changed files with 144 additions and 27 deletions
+3
View File
@@ -3657,6 +3657,7 @@ func (self *SGuest) SyncVMNics(
_, err = db.Update(&commondb[i], func() error {
network := commondb[i].GetNetwork()
ip := commonext[i].GetIP()
ip6 := commonext[i].GetIP6()
if len(ip) > 0 {
if !network.Contains(ip) {
localNet, err := getCloudNicNetwork(ctx, commonext[i], host, ipList, i)
@@ -3667,6 +3668,7 @@ func (self *SGuest) SyncVMNics(
commondb[i].IpAddr = ip
} else {
commondb[i].IpAddr = ip
commondb[1].Ip6Addr = ip6
}
}
commondb[i].Driver = commonext[i].GetDriver()
@@ -3707,6 +3709,7 @@ func (self *SGuest) SyncVMNics(
guestnetworks, err := self.Attach2Network(ctx, userCred, Attach2NetworkArgs{
Network: localNet,
IpAddr: ip,
Ip6Addr: added[i].GetIP6(),
NicDriver: added[i].GetDriver(),
TryReserved: true,
AllocDir: api.IPAllocationDefault,
+5
View File
@@ -738,6 +738,11 @@ func (snet *SNetwork) SyncWithCloudNetwork(ctx context.Context, userCred mcclien
snet.GuestGateway = extNet.GetGateway()
snet.ServerType = extNet.GetServerType()
snet.GuestIp6Start = extNet.GetIp6Start()
snet.GuestIp6End = extNet.GetIp6End()
snet.GuestIp6Mask = extNet.GetIp6Mask()
snet.GuestGateway6 = extNet.GetGateway6()
snet.AllocTimoutSeconds = extNet.GetAllocTimeoutSeconds()
if createdAt := extNet.GetCreatedAt(); !createdAt.IsZero() {
+1
View File
@@ -647,6 +647,7 @@ func (svpc *SVpc) SyncWithCloudVpc(ctx context.Context, userCred mcclient.TokenC
}
svpc.Status = extVPC.GetStatus()
svpc.CidrBlock = extVPC.GetCidrBlock()
svpc.CidrBlock6 = extVPC.GetCidrBlock6()
svpc.IsDefault = extVPC.GetIsDefault()
svpc.ExternalId = extVPC.GetGlobalId()