If the action is status, the funtion is supposed to return True when 
libvirtd
    service is running,otherwise return False if its stopped.
    However in this case since the function calls utilis.run without
    ignore_status=True, if the libvirtd service is stopped, then a CmdError
    is raised and the utils.run function fails to return after raising the
    error, in which case service_libvirtd_control(status) will never return 
false
    when libvirtd service is stopped.

    The fix will be to use ignore_status=True while calling utils.run,
    so that it can return if there is a CmdError, in case libvirtd is
    stopped.

Signed-off-by: Prem Karat <[email protected]>
---
 client/virt/libvirt_vm.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 996a185..82a7801 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -76,7 +76,7 @@ def service_libvirtd_control(action):
             logging.error("Failed to %s libvirtd:\n%s", action, detail)
             return False
     elif action == "status":
-        cmd_result = utils.run("service libvirtd status")
+        cmd_result = utils.run("service libvirtd status", ignore_status=True)
         if re.search("pid", cmd_result.stdout.strip()):
             logging.info("Libvirtd service is running")
             return True
-- 
1.7.10.4

-- 
        -prem

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

Reply via email to