From b66dcda49f370e6fc91ebff889a694f17826ca44 Mon Sep 17 00:00:00 2001 From: Bharat Kumar Date: Thu, 10 Sep 2015 04:14:30 -0700 Subject: [PATCH] CLOUDSTACK-8799 fixed for vpc networks. --- .../debian/config/opt/cloud/bin/cs/CsAddress.py | 14 +++++++++++++- .../debian/config/opt/cloud/bin/cs/CsRedundant.py | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) 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 a855f8337e0..e97abacb912 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py @@ -95,6 +95,14 @@ class CsAddress(CsDataBag): return ip return None + def check_if_link_exists(self,dev): + cmd="ip link show dev %s"%dev + result=CsHelper.execute(cmd) + if(len(result)!=0): + return True + else: + return False + def check_if_link_up(self,dev): cmd="ip link show dev %s | tr '\n' ' ' | cut -d ' ' -f 9"%dev result=CsHelper.execute(cmd) @@ -117,6 +125,9 @@ class CsAddress(CsDataBag): continue #check if link is up + if (not self.check_if_link_exists(dev)): + logging.info("link %s does not exist, so not processing"%dev) + continue if not self.check_if_link_up(dev): cmd="ip link set %s up"%dev CsHelper.execute(cmd) @@ -142,7 +153,8 @@ class CsAddress(CsDataBag): # is a default route and add if needed if not route.defaultroute_exists(): cmdline=self.config.get_cmdline_instance() - route.add_defaultroute(cmdline.get_gateway()) + if(cmdline.get_gateway()): + route.add_defaultroute(cmdline.get_gateway()) diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py index 3f1cbe03c47..5d728244c5b 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsRedundant.py @@ -262,7 +262,7 @@ class CsRedundant(object): self.set_lock() logging.debug("Setting router to master") self.address.process() - logging.info("added default rotue") + logging.info("added default routes") # ip route add default via $gw table Table_$dev proto static cmd = "%s -C %s" % (self.CONNTRACKD_BIN, self.CONNTRACKD_CONF)