This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch 4.14
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 627070c5f853c6d6fabede0e12efc557472ef3d3
Author: Wei Zhou <[email protected]>
AuthorDate: Tue Nov 24 22:12:25 2020 +0000

    vpc vr: fix Conflicting device id on private gw nic
---
 api/src/main/java/com/cloud/vm/NicProfile.java                        | 4 ++++
 .../src/main/java/com/cloud/network/router/NicProfileHelperImpl.java  | 3 ++-
 .../component/test_multiple_subnets_in_isolated_network.py            | 3 ++-
 .../component/test_multiple_subnets_in_isolated_network_rvr.py        | 3 ++-
 test/integration/component/test_multiple_subnets_in_vpc.py            | 3 ++-
 test/integration/component/test_multiple_subnets_in_vpc_rvr.py        | 3 ++-
 6 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/api/src/main/java/com/cloud/vm/NicProfile.java 
b/api/src/main/java/com/cloud/vm/NicProfile.java
index 47021c8..10d126d 100644
--- a/api/src/main/java/com/cloud/vm/NicProfile.java
+++ b/api/src/main/java/com/cloud/vm/NicProfile.java
@@ -173,6 +173,10 @@ public class NicProfile implements InternalIdentity, 
Serializable {
         this.deviceId = deviceId;
     }
 
+    public void setDeviceId(Integer deviceId) {
+        this.deviceId = deviceId;
+    }
+
     public String getName() {
         return name;
     }
diff --git 
a/server/src/main/java/com/cloud/network/router/NicProfileHelperImpl.java 
b/server/src/main/java/com/cloud/network/router/NicProfileHelperImpl.java
index 588e832..6b4b4a8 100644
--- a/server/src/main/java/com/cloud/network/router/NicProfileHelperImpl.java
+++ b/server/src/main/java/com/cloud/network/router/NicProfileHelperImpl.java
@@ -85,6 +85,7 @@ public class NicProfileHelperImpl implements NicProfileHelper 
{
                     new NicProfile(privateNic, privateNetwork, 
privateNic.getBroadcastUri(), privateNic.getIsolationUri(), 
_networkModel.getNetworkRate(
                             privateNetwork.getId(), router.getId()), 
_networkModel.isSecurityGroupSupportedInNetwork(privateNetwork), 
_networkModel.getNetworkTag(
                                     router.getHypervisorType(), 
privateNetwork));
+            privateNicProfile.setDeviceId(null);
 
             if (router.getIsRedundantRouter()) {
               String newMacAddress = 
NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ipVO.getMacAddress(), 
NetworkModel.MACIdentifier.value()));
@@ -137,4 +138,4 @@ public class NicProfileHelperImpl implements 
NicProfileHelper {
         return _ipAddrMgr.acquireGuestIpAddressByPlacement(network, null);
     }
 
-}
\ No newline at end of file
+}
diff --git 
a/test/integration/component/test_multiple_subnets_in_isolated_network.py 
b/test/integration/component/test_multiple_subnets_in_isolated_network.py
index 9cbd3bb..046e062 100644
--- a/test/integration/component/test_multiple_subnets_in_isolated_network.py
+++ b/test/integration/component/test_multiple_subnets_in_isolated_network.py
@@ -753,7 +753,8 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
         # 20. reboot router
         #   verify the available nics in VR should be "eth0,eth1,eth2,eth3,"
         #   verify the IPs in VR. eth0 -> guest nic, eth2 -> source nat IP, 
eth3 -> new ip 6
-        for router in routers:
+        if len(routers) > 0:
+            router = routers[0]
             cmd = rebootRouter.rebootRouterCmd()
             cmd.id = router.id
             self.apiclient.rebootRouter(cmd)
diff --git 
a/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py 
b/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py
index 7b58e00..30a701d 100644
--- 
a/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py
+++ 
b/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py
@@ -753,7 +753,8 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
         # 20. reboot router
         #   verify the available nics in VR should be "eth0,eth1,eth2,eth3,"
         #   verify the IPs in VR. eth0 -> guest nic, eth2 -> source nat IP, 
eth3 -> new ip 6
-        for router in routers:
+        if len(routers) > 0:
+            router = routers[0]
             cmd = rebootRouter.rebootRouterCmd()
             cmd.id = router.id
             self.apiclient.rebootRouter(cmd)
diff --git a/test/integration/component/test_multiple_subnets_in_vpc.py 
b/test/integration/component/test_multiple_subnets_in_vpc.py
index eaa4216..0235e4c 100644
--- a/test/integration/component/test_multiple_subnets_in_vpc.py
+++ b/test/integration/component/test_multiple_subnets_in_vpc.py
@@ -902,7 +902,8 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
         #   verify the available nics in VR should be 
"eth0,eth1,eth2,eth3,eth4,eth5,"
         #   verify the IPs in VR. eth1 -> source nat IP, eth2 -> new ip 6, 
eth3 -> tier 1, eth4 -> private gateway, eth5 -> tier 2
         routers = self.get_vpc_routers(self.vpc1.id)
-        for router in routers:
+        if len(routers) > 0:
+            router = routers[0]
             cmd = rebootRouter.rebootRouterCmd()
             cmd.id = router.id
             self.apiclient.rebootRouter(cmd)
diff --git a/test/integration/component/test_multiple_subnets_in_vpc_rvr.py 
b/test/integration/component/test_multiple_subnets_in_vpc_rvr.py
index f6c0f52..1ebed1d 100644
--- a/test/integration/component/test_multiple_subnets_in_vpc_rvr.py
+++ b/test/integration/component/test_multiple_subnets_in_vpc_rvr.py
@@ -902,7 +902,8 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
         #   verify the available nics in VR should be 
"eth0,eth1,eth2,eth3,eth4,eth5,"
         #   verify the IPs in VR. eth1 -> source nat IP, eth2 -> new ip 6, 
eth3 -> tier 1, eth4 -> private gateway, eth5 -> tier 2
         routers = self.get_vpc_routers(self.vpc1.id)
-        for router in routers:
+        if len(routers) > 0:
+            router = routers[0]
             cmd = rebootRouter.rebootRouterCmd()
             cmd.id = router.id
             self.apiclient.rebootRouter(cmd)

Reply via email to