[PATCH] [TEST] #2 Check return code of run_remote() in create_netpool_conf()

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1222133121 25200 # Node ID 7551f7d43bd39917cd936788dcfd1e319bed234b # Parent c76b2779aca9810f4c3bdf8a0ca768dc3dc9315f [TEST] #2 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. Updates from 1 to 2: -Add -w flag to grep command Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r c76b2779aca9 -r 7551f7d43bd3 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 18:25:21 2008 -0700 @@ -428,10 +428,11 @@ test_network = vir_network[0] if test_network == None: - cmd = "virsh -c %s net-list --all | grep %s" % \ + cmd = "virsh -c %s net-list --all | grep -w %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 7551f7d43bd3 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 18:25:21 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"

+1 for me. Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1222133121 25200 # Node ID 7551f7d43bd39917cd936788dcfd1e319bed234b # Parent c76b2779aca9810f4c3bdf8a0ca768dc3dc9315f [TEST] #2 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.
Updates from 1 to 2: -Add -w flag to grep command
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r c76b2779aca9 -r 7551f7d43bd3 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 18:25:21 2008 -0700 @@ -428,10 +428,11 @@ test_network = vir_network[0]
if test_network == None: - cmd = "virsh -c %s net-list --all | grep %s" % \ + cmd = "virsh -c %s net-list --all | grep -w %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 7551f7d43bd3 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 18:25:21 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"
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (2)
-
Deepti B Kalakeri
-
Kaitlin Rupert