Change in vdsm[master]: sourceroute: move exception handling to the respective confi...

osvoboda at redhat.com osvoboda at redhat.com
Thu May 28 19:24:14 UTC 2015


Ondřej Svoboda has uploaded a new change for review.

Change subject: sourceroute: move exception handling to the respective configurator
......................................................................

sourceroute: move exception handling to the respective configurator

Change-Id: I579b1789522eaed025d1c059bcf7a900e499ef32
Signed-off-by: Ondřej Svoboda <osvoboda at redhat.com>
---
M vdsm/network/configurators/iproute2.py
M vdsm/network/sourceroute.py
2 files changed, 16 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/41594/1

diff --git a/vdsm/network/configurators/iproute2.py b/vdsm/network/configurators/iproute2.py
index c260bfe..bec32f7 100644
--- a/vdsm/network/configurators/iproute2.py
+++ b/vdsm/network/configurators/iproute2.py
@@ -201,17 +201,22 @@
 
     @staticmethod
     def configureSourceRoute(routes, rules, device):
-        for route in routes:
-            routeAdd(route)
-
-        for rule in rules:
-            ruleAdd(rule)
+        try:
+            for route in routes:
+                routeAdd(route)
+            for rule in rules:
+                ruleAdd(rule)
+        except IPRoute2Error as e:
+            logging.error('Source route configuration failed: %s', e.message)
 
     @staticmethod
     def removeSourceRoute(routes, rules, device):
         # Routes are removed automatically when the link goes down.
-        for rule in rules:
-            ruleDel(rule)
+        try:
+            for rule in rules:
+                ruleDel(rule)
+        except IPRoute2Error as e:
+            logging.error('Source route removal failed: %s' % e.message)
 
 
 class ConfigApplier(object):
diff --git a/vdsm/network/sourceroute.py b/vdsm/network/sourceroute.py
index d7916ed..1fb9626 100644
--- a/vdsm/network/sourceroute.py
+++ b/vdsm/network/sourceroute.py
@@ -74,12 +74,8 @@
 
     def configure(self):
         self._prepare_configuration()
-        try:
-            self._configurator.configureSourceRoute(self.routes, self.rules,
-                                                    self.device)
-        except IPRoute2Error as e:
-            logging.error('ip binary failed during source route configuration'
-                          ': %s', e.message)
+        self._configurator.configureSourceRoute(self.routes, self.rules,
+                                                self.device)
 
     def _prepare_removal(self):
         self.routes = None
@@ -173,12 +169,8 @@
         logging.info("Removing gateway - device: %s", self.device)
         self._prepare_removal()
         if self.rules and self.table:
-            try:
-                self._configurator.removeSourceRoute(
-                    self.routes, self.rules, self.device)
-            except IPRoute2Error as e:
-                logging.error('ip binary failed during source route '
-                              'removal: %s' % e.message)
+            self._configurator.removeSourceRoute(self.routes, self.rules,
+                                                 self.device)
 
     @staticmethod
     def _isLibvirtInterfaceFallback(device):


-- 
To view, visit https://gerrit.ovirt.org/41594
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I579b1789522eaed025d1c059bcf7a900e499ef32
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda at redhat.com>


More information about the vdsm-patches mailing list