Change in vdsm[master]: lib: cmdutils: add command to cmdutils.Error

fromani at redhat.com fromani at redhat.com
Mon Nov 16 16:23:43 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: lib: cmdutils: add command to cmdutils.Error
......................................................................

lib: cmdutils: add command to cmdutils.Error

We add the command we attempted to run
in cmdutils.Error, to make the troubleshooting
a lot easier.

Change-Id: I5272202875436b9b8023358fa9f587f47b459997
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M lib/vdsm/cmdutils.py
M lib/vdsm/taskset.py
M lib/vdsm/udevadm.py
M lib/vdsm/virtsparsify.py
4 files changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/48628/1

diff --git a/lib/vdsm/cmdutils.py b/lib/vdsm/cmdutils.py
index 1531b5d..8629e1c 100644
--- a/lib/vdsm/cmdutils.py
+++ b/lib/vdsm/cmdutils.py
@@ -30,14 +30,15 @@
 
 class Error(Exception):
 
-    def __init__(self, rc, out, err):
+    def __init__(self, cmd, rc, out, err):
+        self.cmd = cmd
         self.rc = rc
         self.out = out
         self.err = err
 
     def __str__(self):
-        return "Process failed with rc=%d out=%r err=%r" % (
-            self.rc, self.out, self.err)
+        return "Command %s failed with rc=%d out=%r err=%r" % (
+            self.cmd, self.rc, self.out, self.err)
 
 
 def nice(cmd, nice):
diff --git a/lib/vdsm/taskset.py b/lib/vdsm/taskset.py
index a8cf792..cfca966 100644
--- a/lib/vdsm/taskset.py
+++ b/lib/vdsm/taskset.py
@@ -40,7 +40,7 @@
     rc, out, err = utils.execCmd(command, resetCpuAffinity=False)
 
     if rc != 0:
-        raise cmdutils.Error(rc, out, err)
+        raise cmdutils.Error(command, rc, out, err)
 
     return _cpu_set_from_output(out[-1])
 
@@ -68,7 +68,7 @@
     rc, out, err = utils.execCmd(command, resetCpuAffinity=False)
 
     if rc != 0:
-        raise cmdutils.Error(rc, out, err)
+        raise cmdutils.Error(command, rc, out, err)
 
 
 def _cpu_set_from_output(line):
diff --git a/lib/vdsm/udevadm.py b/lib/vdsm/udevadm.py
index 7ef72bf..bd257f3 100644
--- a/lib/vdsm/udevadm.py
+++ b/lib/vdsm/udevadm.py
@@ -102,4 +102,4 @@
     cmd.extend(args)
     rc, out, err = utils.execCmd(cmd, raw=True)
     if rc != 0:
-        raise cmdutils.Error(rc, out, err)
+        raise cmdutils.Error(cmd, rc, out, err)
diff --git a/lib/vdsm/virtsparsify.py b/lib/vdsm/virtsparsify.py
index 50fc16d..37801ad 100644
--- a/lib/vdsm/virtsparsify.py
+++ b/lib/vdsm/virtsparsify.py
@@ -53,4 +53,4 @@
     rc, out, err = utils.execCmd(cmd, deathSignal=signal.SIGKILL)
 
     if rc != 0:
-        raise cmdutils.Error(rc, out, err)
+        raise cmdutils.Error(cmd, rc, out, err)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5272202875436b9b8023358fa9f587f47b459997
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list