From f5a6dee8dd6b89ef954d39b4ade91f8f898cc026 Mon Sep 17 00:00:00 2001 From: Wilder Rodrigues Date: Fri, 18 Dec 2015 20:18:24 +0100 Subject: [PATCH] CLOUDSTACK-9187 - Makes code ready for more something like ethXXXX, if we ever get that far - Adds log info to NetworkOrchestrator in order to make the work of the Net-Scavenger more visible. --- .../engine/orchestration/NetworkOrchestrator.java | 6 +++++- .../debian/config/opt/cloud/bin/cs/CsAddress.py | 10 ++++++---- test/integration/smoke/test_vpc_redundant.py | 13 +++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java index ca465efa797..5f442b3a1cc 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -586,6 +586,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra @Override public boolean start() { final int netGcInterval = NumbersUtil.parseInt(_configDao.getValue(NetworkGcInterval.key()), 60); + s_logger.info("Network Manager will run the NetworkGarbageCollector every '" + netGcInterval + "' seconds."); + _executor.scheduleWithFixedDelay(new NetworkGarbageCollector(), netGcInterval, netGcInterval, TimeUnit.SECONDS); return true; } @@ -2445,7 +2447,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra final HashMap stillFree = new HashMap(); final List networkIds = _networksDao.findNetworksToGarbageCollect(); - final int netGcWait = NumbersUtil.parseInt(_configDao.getValue(NetworkGcWait.key()), 1); + final int netGcWait = NumbersUtil.parseInt(_configDao.getValue(NetworkGcWait.key()), 60); + s_logger.info("NetworkGarbageCollector uses '" + netGcWait + "' seconds for GC interval."); + for (final Long networkId : networkIds) { if (!_networkModel.isNetworkReadyForGc(networkId)) { diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py index 3eb944705ad..1b39b385d4d 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py @@ -51,13 +51,15 @@ class CsAddress(CsDataBag): Return CsInterface object for the lowest in use guest interface """ guest_interface = None - lowest_device = 99 + lowest_device = 1000 for ip in self.get_ips(): if ip.is_guest() and ip.is_added(): - devive_sufix = int(ip.get_device()[-1:]) - if devive_sufix < lowest_device: - lowest_device = devive_sufix + device = ip.get_device() + device_suffix = int(''.join([digit for digit in device if digit.isdigit()])) + if device_suffix < lowest_device: + lowest_device = device_suffix guest_interface = ip + logging.debug("Guest interface will be set on device '%s' and IP '%s'" % (guest_interface.get_device(), guest_interface.get_ip())) return guest_interface def get_guest_ip(self): diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py index 2ffc938db78..65797e87ddc 100644 --- a/test/integration/smoke/test_vpc_redundant.py +++ b/test/integration/smoke/test_vpc_redundant.py @@ -523,8 +523,7 @@ class TestVPCRedundancy(cloudstackTestCase): self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress)) @attr(tags=["advanced", "intervlan"], required_hardware="true") - def test_04_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL(self): - self.skipTest("Skipping for now...") + def test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL(self): """ Create a redundant VPC with two networks with two VMs in each network """ self.logger.debug("Starting test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL") self.query_routers() @@ -549,8 +548,7 @@ class TestVPCRedundancy(cloudstackTestCase): self.do_vpc_test(False) @attr(tags=["advanced", "intervlan"], required_hardware="true") - def test_05_redundant_VPC_default_routes(self): - self.skipTest("Skipping for now...") + def test_02_redundant_VPC_default_routes(self): """ Create a redundant VPC with two networks with two VMs in each network and check default routes""" self.logger.debug("Starting test_02_redundant_VPC_default_routes") self.query_routers() @@ -562,7 +560,6 @@ class TestVPCRedundancy(cloudstackTestCase): @attr(tags=["advanced", "intervlan"], required_hardware="true") def test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers(self): - self.skipTest("Skipping for now...") """ Create a redundant VPC with two networks with two VMs in each network """ self.logger.debug("Starting test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL") self.query_routers() @@ -580,7 +577,7 @@ class TestVPCRedundancy(cloudstackTestCase): self.do_vpc_test(False) @attr(tags=["advanced", "intervlan"], required_hardware="true") - def test_01_rvpc_network_garbage_collector_nics(self): + def test_04_rvpc_network_garbage_collector_nics(self): """ Create a redundant VPC with 1 Tier, 1 VM, 1 ACL, 1 PF and test Network GC Nics""" self.logger.debug("Starting test_04_rvpc_network_garbage_collector_nics") self.query_routers() @@ -597,7 +594,7 @@ class TestVPCRedundancy(cloudstackTestCase): self.logger.debug("network.gc.wait is ==> %s" % gc_wait) self.logger.debug("network.gc.interval is ==> %s" % gc_wait) - total_sleep = 90 + total_sleep = 120 if gc_wait and gc_interval: total_sleep = int(gc_wait[0].value) + int(gc_interval[0].value) else: @@ -611,7 +608,7 @@ class TestVPCRedundancy(cloudstackTestCase): self.do_vpc_test(False) @attr(tags=["advanced", "intervlan"], required_hardware="true") - def test_02_rvpc_multi_tiers(self): + def test_05_rvpc_multi_tiers(self): """ Create a redundant VPC with 1 Tier, 1 VM, 1 ACL, 1 PF and test Network GC Nics""" self.logger.debug("Starting test_04_rvpc_network_garbage_collector_nics") self.query_routers()