Skip to content

Commit 8e43d25

Browse files
ustcweizhouyadvr
authored andcommitted
server: Fail to restart VPC with cleanup if there are multiple public IPs in different subnet" (apache#3342)
If there are multiple IPs in different subnet assigned to a VPC, after restarting VPC with cleanup, the VRs will be FAULT state. Step to reproduce: (1) create vpc, source nat IP is 10.11.118.X (2) assign two public IPs in other subnet to this VPC. 10.11.119.X and 10.11.119.Y (3) deploy two vms in the vpc, and enable static nat 10.11.119.X and 10.11.119.Y to these two vms (4) restart vpc with cleanup. There are more than 1 nic allocated for 10.11.119 to new VRs Logs as below: 2019-05-10 14:12:24,652 DEBUG [o.a.c.e.o.NetworkOrchestrator] (API-Job-Executor-36:ctx-839f6522 job-652 ctx-35fb4667) (logid:1ab7aa37) Allocating nic for vm VM[DomainRouter|r-85-VM] in network Ntwk[200|Public|1] with requested profile NicProfile[0-0-null-10.11.118.157-vlan://untagged 2019-05-10 14:12:24,676 DEBUG [o.a.c.e.o.NetworkOrchestrator] (API-Job-Executor-36:ctx-839f6522 job-652 ctx-35fb4667) (logid:1ab7aa37) Allocating nic for vm VM[DomainRouter|r-85-VM] in network Ntwk[200|Public|1] with requested profile NicProfile[0-0-null-10.11.119.110-vlan://119 2019-05-10 14:12:24,699 DEBUG [o.a.c.e.o.NetworkOrchestrator] (API-Job-Executor-36:ctx-839f6522 job-652 ctx-35fb4667) (logid:1ab7aa37) Allocating nic for vm VM[DomainRouter|r-85-VM] in network Ntwk[200|Public|1] with requested profile NicProfile[0-0-null-10.11.119.110-vlan://119 2019-05-10 14:12:24,723 DEBUG [o.a.c.e.o.NetworkOrchestrator] (API-Job-Executor-36:ctx-839f6522 job-652 ctx-35fb4667) (logid:1ab7aa37) Allocating nic for vm VM[DomainRouter|r-85-VM] in network Ntwk[200|Public|1] with requested profile NicProfile[0-0-null-10.11.119.110-vlan://119 This is a regression issue caused by commit 1d382e0
1 parent 910b08f commit 8e43d25

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

server/src/com/cloud/network/router/VpcNetworkHelperImpl.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,15 @@ public void reallocateRouterNetworks(final RouterDeploymentDefinition vpcRouterD
154154
publicVlans.add(publicIp.getVlanTag());
155155
}
156156
}
157-
if (publicNetwork != null) {
158-
if (networks.get(publicNetwork) != null) {
159-
@SuppressWarnings("unchecked") final List<NicProfile> publicNicProfiles = (List<NicProfile>)networks.get(publicNetwork);
160-
publicNicProfiles.addAll(publicNics);
161-
networks.put(publicNetwork, publicNicProfiles);
162-
} else {
163-
networks.put(publicNetwork, publicNics);
164-
}
157+
}
158+
if (publicNetwork != null) {
159+
if (networks.get(publicNetwork) != null) {
160+
@SuppressWarnings("unchecked")
161+
final List<NicProfile> publicNicProfiles = (List<NicProfile>)networks.get(publicNetwork);
162+
publicNicProfiles.addAll(publicNics);
163+
networks.put(publicNetwork, publicNicProfiles);
164+
} else {
165+
networks.put(publicNetwork, publicNics);
165166
}
166167
}
167168

@@ -187,4 +188,4 @@ public LinkedHashMap<Network, List<? extends NicProfile>> configureDefaultNics(f
187188

188189
return networks;
189190
}
190-
}
191+
}

0 commit comments

Comments
 (0)