Change in vdsm[master]: tc_wrapper: Fix errno parsing for multiline error text

asegurap at redhat.com asegurap at redhat.com
Wed Aug 13 13:22:25 UTC 2014


Antoni Segura Puimedon has uploaded a new change for review.

Change subject: tc_wrapper: Fix errno parsing for multiline error text
......................................................................

tc_wrapper: Fix errno parsing for multiline error text

Sometimes tc appends an extra text after the parseable error. E.g.:

    RTNETLINK answers: Invalid argument\nWe have an error talking to the kernel\n

This patch makes it possible to handle such cases

Change-Id: Ica50f0be8ff842421933ec8bb441ddc6e5cc19bb
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M vdsm/network/tc/_wrapper.py
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/31457/1

diff --git a/vdsm/network/tc/_wrapper.py b/vdsm/network/tc/_wrapper.py
index c384356..313e518 100644
--- a/vdsm/network/tc/_wrapper.py
+++ b/vdsm/network/tc/_wrapper.py
@@ -31,7 +31,9 @@
     retcode, out, err = execCmd(command, raw=True)
     if retcode != 0:
         if retcode == 2:
-            retcode = _errno_trans.get(err[len(_TC_ERR_PREFIX):].strip())
+            if err:
+                err = err.splitlines()[0]  # There may be extra lines
+                retcode = _errno_trans.get(err[len(_TC_ERR_PREFIX):].strip())
         raise TrafficControlException(retcode, err, command)
     return out
 


-- 
To view, visit http://gerrit.ovirt.org/31457
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica50f0be8ff842421933ec8bb441ddc6e5cc19bb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>


More information about the vdsm-patches mailing list