[Libvirt-cim] [PATCH] [TEST] Check return code of run_remote() in create_netpool_conf()

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Sep 22 16:47:21 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1222101955 25200
# Node ID 16fd8f75598442d71eeb0199fb680ca6564656bc
# Parent  c76b2779aca9810f4c3bdf8a0ca768dc3dc9315f
[TEST] Check return code of run_remote() in create_netpool_conf()

Instead of checking the output. Also, add log_param to main.py debug messages for errors encountered by main.py will be printed to stderr/stdout.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r c76b2779aca9 -r 16fd8f755984 suites/libvirt-cim/lib/XenKvmLib/common_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Mon Sep 22 07:50:25 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py	Mon Sep 22 09:45:55 2008 -0700
@@ -431,7 +431,8 @@
             cmd = "virsh -c %s net-list --all | grep %s" % \
                   (utils.virt2uri(virt), net_name)
             ret, out = utils.run_remote(server, cmd)
-            if out != "":
+            # If success, network pool with name net_name already exists
+            if ret == 0:
                 logger.error("Network pool with name '%s' already exists",
                               net_name)
                 return FAIL, "Unknown" 
diff -r c76b2779aca9 -r 16fd8f755984 suites/libvirt-cim/main.py
--- a/suites/libvirt-cim/main.py	Mon Sep 22 07:50:25 2008 -0700
+++ b/suites/libvirt-cim/main.py	Mon Sep 22 09:45:55 2008 -0700
@@ -27,6 +27,7 @@
 import sys
 sys.path.append('../../lib')
 import TestSuite
+from CimTest.Globals import logger, log_param
 import commands
 from VirtLib import groups
 import ConfigParser
@@ -184,6 +185,7 @@
             return 1
          
     testsuite = TestSuite.TestSuite(log=True)
+    log_param(file_name=testsuite.log_file)
    
     set_python_path()
 
@@ -209,6 +211,7 @@
     status = setup_env(options.ip, options.virt)
     if status != PASS:
         print "Please check your environment.\n"
+        testsuite.finish()
         return 1
 
     print "\nTesting " + options.virt + " hypervisor"




More information about the Libvirt-cim mailing list