[PATCH] [TEST] Improve enum volumes

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1240002683 25200 # Node ID 5706fea95239f1633296e2fbce13ada882848e13 # Parent ced161a8198115797a6036f3f22e02d234439a76 [TEST] Improve enum volumes The providers don't return a template RASD for volumes that libvirt is unable to get volume info for. So the testsuite needs to do the same. Also, don't use a hardcoded disk pool name - use the default value from const.py Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r ced161a81981 -r 5706fea95239 suites/libvirt-cim/lib/XenKvmLib/pool.py --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Wed Apr 15 20:19:31 2009 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Fri Apr 17 14:11:23 2009 -0700 @@ -24,7 +24,7 @@ from CimTest.Globals import logger from CimTest.ReturnCodes import PASS, FAIL from XenKvmLib.classes import get_typed_class -from XenKvmLib.const import get_provider_version +from XenKvmLib.const import get_provider_version, default_pool_name from XenKvmLib.enumclass import EnumInstances from VirtLib.utils import run_remote from XenKvmLib.xm_virt_util import virt2uri @@ -83,13 +83,19 @@ def enum_volumes(virt, server): volume = 0 cmd = "virsh -c %s vol-list %s | sed -e '1,2 d' -e '$ d'" % \ - (virt2uri(virt), 'cimtest-diskpool') + (virt2uri(virt), default_pool_name) ret, out = run_remote(server ,cmd) if ret != 0: return None lines = out.split("\n") for line in lines: - volume = volume + 1 + vol = line.split()[0] + cmd = "virsh vol-info --pool cimtest-diskpool meep" + cmd = "virsh -c %s vol-info --pool %s %s" % (virt2uri(virt), + default_pool_name, vol) + ret, out = run_remote(server ,cmd) + if ret == 0: + volume = volume + 1 return volume

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1240002683 25200 # Node ID 5706fea95239f1633296e2fbce13ada882848e13 # Parent ced161a8198115797a6036f3f22e02d234439a76 [TEST] Improve enum volumes
The providers don't return a template RASD for volumes that libvirt is unable to get volume info for. So the testsuite needs to do the same.
Also, don't use a hardcoded disk pool name - use the default value from const.py
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r ced161a81981 -r 5706fea95239 suites/libvirt-cim/lib/XenKvmLib/pool.py --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Wed Apr 15 20:19:312009 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Fri Apr 17 14:11:232009 -0700 @@ -24,7 +24,7 @@ from CimTest.Globals import logger from CimTest.ReturnCodes import PASS, FAIL from XenKvmLib.classes import get_typed_class -from XenKvmLib.const import get_provider_version +from XenKvmLib.const import get_provider_version, default_pool_name from XenKvmLib.enumclass import EnumInstances from VirtLib.utils import run_remote from XenKvmLib.xm_virt_util import virt2uri @@ -83,13 +83,19 @@ def enum_volumes(virt, server): volume = 0 cmd = "virsh -c %s vol-list %s | sed -e '1,2 d' -e '$ d'" % \ - (virt2uri(virt), 'cimtest-diskpool') + (virt2uri(virt), default_pool_name) ret, out = run_remote(server ,cmd) if ret != 0: return None lines = out.split("\n") for line in lines: - volume = volume + 1 + vol = line.split()[0] + cmd = "virsh vol-info --pool cimtest-diskpool meep" I think above command line is your test code when you cook up this
libvirt-cim-bounces@redhat.com wrote on 2009-04-20 07:14:46: patch, right? If yes, please remove it. Thanks!
+ cmd = "virsh -c %s vol-info --pool %s %s" % (virt2uri(virt), + default_pool_name, vol) + ret, out = run_remote(server ,cmd) + if ret == 0: + volume = volume + 1
return volume
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

Kaitlin Rupert wrote:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1240002683 25200 # Node ID 5706fea95239f1633296e2fbce13ada882848e13 # Parent ced161a8198115797a6036f3f22e02d234439a76 [TEST] Improve enum volumes
The providers don't return a template RASD for volumes that libvirt is unable to get volume info for. So the testsuite needs to do the same.
Also, don't use a hardcoded disk pool name - use the default value from const.py
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r ced161a81981 -r 5706fea95239 suites/libvirt-cim/lib/XenKvmLib/pool.py --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Wed Apr 15 20:19:31 2009 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Fri Apr 17 14:11:23 2009 -0700 @@ -24,7 +24,7 @@ from CimTest.Globals import logger from CimTest.ReturnCodes import PASS, FAIL from XenKvmLib.classes import get_typed_class -from XenKvmLib.const import get_provider_version +from XenKvmLib.const import get_provider_version, default_pool_name from XenKvmLib.enumclass import EnumInstances from VirtLib.utils import run_remote from XenKvmLib.xm_virt_util import virt2uri @@ -83,13 +83,19 @@ def enum_volumes(virt, server):
It would be better to pass the networkpool name as a param. We can use default_pool_name as a default value for it though.
volume = 0 cmd = "virsh -c %s vol-list %s | sed -e '1,2 d' -e '$ d'" % \ - (virt2uri(virt), 'cimtest-diskpool') + (virt2uri(virt), default_pool_name) ret, out = run_remote(server ,cmd) if ret != 0: return None lines = out.split("\n") for line in lines: - volume = volume + 1 + vol = line.split()[0] + cmd = "virsh vol-info --pool cimtest-diskpool meep" + cmd = "virsh -c %s vol-info --pool %s %s" % (virt2uri(virt), + default_pool_name, vol) + ret, out = run_remote(server ,cmd) + if ret == 0: + volume = volume + 1
return volume
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
-- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com
participants (3)
-
Deepti B Kalakeri
-
Guo Lian Yun
-
Kaitlin Rupert