[PATCH] KVM-test: Log the output of failed executed command 'pre/post-command'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sometimes we need the output of failed command 'pre/post-command'
when raising error.TestError. Take an example that using post-command
to check images of qcow2 format, it will simply tell command failed
rather than show '%d errors were found on the image'.

Signed-off-by: Yolkfull Chow <yzhou@xxxxxxxxxx>
---
 client/tests/kvm/kvm_preprocessing.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py
index 4e45c76..53fa2cb 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -148,9 +148,11 @@ def process_command(test, params, env, command, command_timeout,
                                              logging.debug, "(command) ",
                                              timeout=command_timeout)
     if status != 0:
-        logging.warn("Custom processing command failed: '%s'" % command)
+        logging.warn("Custom processing command failed: '%s'; Output is: %s" %
+                                                            (command, output))
         if not command_noncritical:
-            raise error.TestError("Custom processing command failed")
+            raise error.TestError("Custom processing command failed: %s" %
+                                                                   output)
 
 
 def process(test, params, env, image_func, vm_func):
-- 
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux