[PATCH] [TEST] (#2) Improve enum volumes

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1240002683 25200 # Node ID eea660ff3ad6e589f76bf17b3697d30465e54398 # Parent ced161a8198115797a6036f3f22e02d234439a76 [TEST] (#2) 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 Updates: -Remove test code -Allow caller to specify pool name, or use default pool name if one isn't specified Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r ced161a81981 -r eea660ff3ad6 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 @@ -80,16 +80,20 @@ return pool_insts, PASS -def enum_volumes(virt, server): +def enum_volumes(virt, server, pooln=default_pool_name): 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 -c %s vol-info --pool %s %s" % (virt2uri(virt), pooln, vol) + ret, out = run_remote(server ,cmd) + if ret == 0: + volume = volume + 1 return volume

+1 from me. libvirt-cim-bounces@redhat.com wrote on 2009-04-21 02:19:13:
# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1240002683 25200 # Node ID eea660ff3ad6e589f76bf17b3697d30465e54398 # Parent ced161a8198115797a6036f3f22e02d234439a76 [TEST] (#2) 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
Updates: -Remove test code -Allow caller to specify pool name, or use default pool name if one isn't specified
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r ced161a81981 -r eea660ff3ad6 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 @@ -80,16 +80,20 @@
return pool_insts, PASS
-def enum_volumes(virt, server): +def enum_volumes(virt, server, pooln=default_pool_name): 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 -c %s vol-info --pool %s %s" % (virt2uri(virt), pooln, 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 eea660ff3ad6e589f76bf17b3697d30465e54398 # Parent ced161a8198115797a6036f3f22e02d234439a76 [TEST] (#2) 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.
The information that libvirt virsh pool-list is returning is not completely correct: For ex: virsh -c qemu:///system vol-list cimtest-diskpoolName Path ----------------------------------------- .X0-lock /tmp/.X0-lock cimtest.uuid /tmp/cimtest.uuid default-kvm-dimage /tmp/default-kvm-dimage tmpnsIv8q /tmp/tmpnsIv8q The last pool information tmpnsIv8q does not seem to exist on the machine, hence when I ran the HostSystem/03_hs_to_settdefcap.py it failed with the following error: ------------------------------------------------------------------------------------------------------------------------------- ERROR - 'KVM_SettingsDefineCapabilities' returned 0 RASD objects instead of 16 CIM_ERR_INVALID_CLASS: Linux_ComputerSystem CIM_ERR_FAILED: Unable to get volume information: cannot open volume '/tmp/tmpnsIv8q': No such file or directory ------------------------------------------------------------------------------------------------------------------------------- The test case passed after I created the file /tmp/tmpnsIv8q. I am not sure if this is the limitation from libvirt side or if its a feature with libvirt. Anyways +1 for these changes.
Also, don't use a hardcoded disk pool name - use the default value from const.py
Updates: -Remove test code -Allow caller to specify pool name, or use default pool name if one isn't specified
Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>
diff -r ced161a81981 -r eea660ff3ad6 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 @@ -80,16 +80,20 @@
return pool_insts, PASS
-def enum_volumes(virt, server): +def enum_volumes(virt, server, pooln=default_pool_name): 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 -c %s vol-info --pool %s %s" % (virt2uri(virt), pooln, 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

The information that libvirt virsh pool-list is returning is not completely correct: For ex:
virsh -c qemu:///system vol-list cimtest-diskpoolName Path ----------------------------------------- .X0-lock /tmp/.X0-lock cimtest.uuid /tmp/cimtest.uuid default-kvm-dimage /tmp/default-kvm-dimage tmpnsIv8q /tmp/tmpnsIv8q
The last pool information tmpnsIv8q does not seem to exist on the machine, hence when I ran the HostSystem/03_hs_to_settdefcap.py it failed with the following error:
-------------------------------------------------------------------------------------------------------------------------------
ERROR - 'KVM_SettingsDefineCapabilities' returned 0 RASD objects instead of 16 CIM_ERR_INVALID_CLASS: Linux_ComputerSystem CIM_ERR_FAILED: Unable to get volume information: cannot open volume '/tmp/tmpnsIv8q': No such file or directory -------------------------------------------------------------------------------------------------------------------------------
Are you running with recent sources? This issue should have been fixed with Richard's patch: "This patch removes the error throwed when volume info cannot be extracted in the disk template generation" rev: 842, changeset: 2f4943568299
The test case passed after I created the file /tmp/tmpnsIv8q.
Items written to /tmp aren't permanent. Programs often write temporary files here during execution, so we cannot count on all the files in /tmp to exist. Actually, we really shouldn't place our images in /tmp. We should place them in something like /var/spool/libvirt-cim? Some place more permanent, and a little more expected from a application. A good admin would make sure that a directory based pool (the kind of pool cimtest creates) would only be populated with images. So we should be doing the same with ours.
I am not sure if this is the limitation from libvirt side or if its a feature with libvirt. Anyways +1 for these changes.
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
The information that libvirt virsh pool-list is returning is not completely correct: For ex:
virsh -c qemu:///system vol-list cimtest-diskpoolName Path ----------------------------------------- .X0-lock /tmp/.X0-lock cimtest.uuid /tmp/cimtest.uuid default-kvm-dimage /tmp/default-kvm-dimage tmpnsIv8q /tmp/tmpnsIv8q
The last pool information tmpnsIv8q does not seem to exist on the machine, hence when I ran the HostSystem/03_hs_to_settdefcap.py it failed with the following error:
-------------------------------------------------------------------------------------------------------------------------------
ERROR - 'KVM_SettingsDefineCapabilities' returned 0 RASD objects instead of 16 CIM_ERR_INVALID_CLASS: Linux_ComputerSystem CIM_ERR_FAILED: Unable to get volume information: cannot open volume '/tmp/tmpnsIv8q': No such file or directory -------------------------------------------------------------------------------------------------------------------------------
Are you running with recent sources? This issue should have been fixed with Richard's patch:
"This patch removes the error throwed when volume info cannot be extracted in the disk template generation"
rev: 842, changeset: 2f4943568299 No I had not tested with the latest revision. Yes this passed with the latest changes.
The test case passed after I created the file /tmp/tmpnsIv8q.
Items written to /tmp aren't permanent. Programs often write temporary files here during execution, so we cannot count on all the files in /tmp to exist.
Actually, we really shouldn't place our images in /tmp. We should place them in something like /var/spool/libvirt-cim? Some place more permanent, and a little more expected from a application.
A good admin would make sure that a directory based pool (the kind of pool cimtest creates) would only be populated with images. So we should be doing the same with ours.
Yes its essential for us to keep the images in someother directory other than /tmp/ , how about /etc/libvirt-cim like the one we have for /etc/libvirt?
I am not sure if this is the limitation from libvirt side or if its a feature with libvirt. Anyways +1 for these changes.
-- 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