This patch will change utils.system() to utils.system_output()
to get command output.
Also use error.context in create() function.

changes from v1:
Clean some internal comments.

Signed-off-by: Feng Yang <[email protected]>
---
 client/virt/kvm_storage.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/client/virt/kvm_storage.py b/client/virt/kvm_storage.py
index 918717d..a99a2b0 100644
--- a/client/virt/kvm_storage.py
+++ b/client/virt/kvm_storage.py
@@ -27,7 +27,7 @@ class QemuImg(virt_storage.QemuImg):
         self.image_cmd = virt_utils.get_path(root_dir,
                                  params.get("qemu_img_binary","qemu-img"))
 
-
+    @error.context_aware
     def create(self, params):
         """
         Create an image using qemu_img or dd.
@@ -91,7 +91,9 @@ class QemuImg(virt_storage.QemuImg):
 
         check_output = params.get("check_output") == "yes"
         try:
-            result = utils.system(qemu_img_cmd)
+            msg = "Create image by command: %s" % qemu_img_cmd
+            error.context(msg, logging.info)
+            result = utils.system_output(qemu_img_cmd, verbose=False)
         except error.CmdError, e:
             logging.error("Could not create image, failed with error message:"
                             "%s", str(e))
-- 
1.7.7.6

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to