Skip to content

Commit 627070c

Browse files
ustcweizhouDaanHoogland
authored andcommitted
vpc vr: fix Conflicting device id on private gw nic
1 parent 7f5eb64 commit 627070c

6 files changed

Lines changed: 14 additions & 5 deletions

File tree

api/src/main/java/com/cloud/vm/NicProfile.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ public void setDeviceId(int deviceId) {
173173
this.deviceId = deviceId;
174174
}
175175

176+
public void setDeviceId(Integer deviceId) {
177+
this.deviceId = deviceId;
178+
}
179+
176180
public String getName() {
177181
return name;
178182
}

server/src/main/java/com/cloud/network/router/NicProfileHelperImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public NicProfile createPrivateNicProfileForGateway(final VpcGateway privateGate
8585
new NicProfile(privateNic, privateNetwork, privateNic.getBroadcastUri(), privateNic.getIsolationUri(), _networkModel.getNetworkRate(
8686
privateNetwork.getId(), router.getId()), _networkModel.isSecurityGroupSupportedInNetwork(privateNetwork), _networkModel.getNetworkTag(
8787
router.getHypervisorType(), privateNetwork));
88+
privateNicProfile.setDeviceId(null);
8889

8990
if (router.getIsRedundantRouter()) {
9091
String newMacAddress = NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ipVO.getMacAddress(), NetworkModel.MACIdentifier.value()));
@@ -137,4 +138,4 @@ public String acquireGuestIpAddressForVrouterRedundant(Network network) {
137138
return _ipAddrMgr.acquireGuestIpAddressByPlacement(network, null);
138139
}
139140

140-
}
141+
}

test/integration/component/test_multiple_subnets_in_isolated_network.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,8 @@ def test_01_acquire_public_ips_in_isolated_network_with_single_vr(self):
753753
# 20. reboot router
754754
# verify the available nics in VR should be "eth0,eth1,eth2,eth3,"
755755
# verify the IPs in VR. eth0 -> guest nic, eth2 -> source nat IP, eth3 -> new ip 6
756-
for router in routers:
756+
if len(routers) > 0:
757+
router = routers[0]
757758
cmd = rebootRouter.rebootRouterCmd()
758759
cmd.id = router.id
759760
self.apiclient.rebootRouter(cmd)

test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,8 @@ def test_02_acquire_public_ips_in_isolated_network_with_redundant_vrs(self):
753753
# 20. reboot router
754754
# verify the available nics in VR should be "eth0,eth1,eth2,eth3,"
755755
# verify the IPs in VR. eth0 -> guest nic, eth2 -> source nat IP, eth3 -> new ip 6
756-
for router in routers:
756+
if len(routers) > 0:
757+
router = routers[0]
757758
cmd = rebootRouter.rebootRouterCmd()
758759
cmd.id = router.id
759760
self.apiclient.rebootRouter(cmd)

test/integration/component/test_multiple_subnets_in_vpc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,8 @@ def test_03_acquire_public_ips_in_vpc_with_single_vr(self):
902902
# verify the available nics in VR should be "eth0,eth1,eth2,eth3,eth4,eth5,"
903903
# verify the IPs in VR. eth1 -> source nat IP, eth2 -> new ip 6, eth3 -> tier 1, eth4 -> private gateway, eth5 -> tier 2
904904
routers = self.get_vpc_routers(self.vpc1.id)
905-
for router in routers:
905+
if len(routers) > 0:
906+
router = routers[0]
906907
cmd = rebootRouter.rebootRouterCmd()
907908
cmd.id = router.id
908909
self.apiclient.rebootRouter(cmd)

test/integration/component/test_multiple_subnets_in_vpc_rvr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,8 @@ def test_04_acquire_public_ips_in_vpc_with_redundant_vrs(self):
902902
# verify the available nics in VR should be "eth0,eth1,eth2,eth3,eth4,eth5,"
903903
# verify the IPs in VR. eth1 -> source nat IP, eth2 -> new ip 6, eth3 -> tier 1, eth4 -> private gateway, eth5 -> tier 2
904904
routers = self.get_vpc_routers(self.vpc1.id)
905-
for router in routers:
905+
if len(routers) > 0:
906+
router = routers[0]
906907
cmd = rebootRouter.rebootRouterCmd()
907908
cmd.id = router.id
908909
self.apiclient.rebootRouter(cmd)

0 commit comments

Comments
 (0)