[PATCH] [TEST] Add test for DiskRASD size parameter

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1217005489 25200 # Node ID 3c80ea156a3c45bc321f9c465ba7692c011ab2e0 # Parent 2972728363defd7c9a7683ebfa85a4dfc8225e32 [TEST] Add test for DiskRASD size parameter Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 2972728363de -r 3c80ea156a3c suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py Fri Jul 25 10:04:49 2008 -0700 @@ -0,0 +1,127 @@ +#!/usr/bin/python +# +# Copyright 2008 IBM Corp. +# +# Authors: +# Dan Smith <danms@us.ibm.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +sup_types = ['Xen', 'XenFV', 'KVM'] +default_dom = "diskrasd_test" + +import sys + +from CimTest.ReturnCodes import FAIL, PASS +from CimTest.Globals import do_main +from CimTest.Globals import logger +from VirtLib import utils +from XenKvmLib.test_doms import undefine_test_domain +from XenKvmLib.common_util import create_using_definesystem +from XenKvmLib import vsms +from XenKvmLib import enumclass + +def make_image(ip, size): + s, fn = utils.run_remote(ip, "mktemp") + if s != 0: + return None + + s, _ = utils.run_remote(ip, + "dd if=/dev/zero of=%s bs=1 count=%i" % (fn, size)) + if s != 0: + return None + + return fn + +def kill_image(ip, name): + s, _ = utils.run_remote(ip, "rm -f %s" % name) + + return s == 0 + +def check_rasd_size(rasd, size): + if rasd["AllocationUnits"] != "Bytes": + logger.error("AllocationUnits != Bytes?") + return FAIL + + try: + cim_size = int(rasd["VirtualQuantity"]) + except Exception, e: + logger.error("Failed to get DiskRASD size: %s" % e) + return FAIL + + if cim_size != size: + logger.error("CIM reports %i bytes, but should be %i bytes" % (cim_size, + size)) + return FAIL + else: + logger.info("Verified %i bytes" % cim_size) + return PASS + +def test_rasd(options, temp, test_size): + vssd_class = vsms.get_vssd_class(options.virt) + vssd = vssd_class(name=default_dom, virt=options.virt) + + drasd_class = vsms.get_dasd_class(options.virt) + drasd = drasd_class("hda", temp, default_dom) + + mrasd_class = vsms.get_masd_class(options.virt) + mrasd = mrasd_class(32, default_dom) + + params = { + "vssd" : vssd.mof(), + "rasd" : [drasd.mof(), mrasd.mof()] + } + + create_using_definesystem(default_dom, + options.ip, + params=params, + virt=options.virt) + + rasds = enumclass.enumerate_inst(options.ip, drasd_class, options.virt) + + status = FAIL + for rasd in rasds: + if rasd["Address"] == temp: + status = check_rasd_size(rasd, test_size) + break + + return status + +@do_main(sup_types) +def main(): + options = main.options + + test_size = 123 << 10 + + temp = make_image(options.ip, test_size) + if not temp: + logger.error("Unable to create a temporary disk image") + return FAIL + + logger.info("Created temp disk %s of size %i bytes" % (temp, test_size)) + + try: + status = test_rasd(options, temp, test_size) + except Exception, e: + logger.error("Failed to test RASD: %s" % e) + + undefine_test_domain(default_dom, options.ip, options.virt) + kill_image(options.ip, temp) + + return status + +if __name__ == "__main__": + sys.exit(main())

Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1217005489 25200 # Node ID 3c80ea156a3c45bc321f9c465ba7692c011ab2e0 # Parent 2972728363defd7c9a7683ebfa85a4dfc8225e32 [TEST] Add test for DiskRASD size parameter
Signed-off-by: Dan Smith <danms@us.ibm.com>
diff -r 2972728363de -r 3c80ea156a3c suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py
You'll need to create a diskpool using the diskpool functions in common_util. Otherwise, the test fails if a corresponding storage pool isn't present. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

KR> You'll need to create a diskpool using the diskpool functions in KR> common_util. Otherwise, the test fails if a corresponding storage KR> pool isn't present. Why? I just ran it on my system with all the storage pools destroyed and it worked. The info log shows it retrieved the proper size for the image as well. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
KR> You'll need to create a diskpool using the diskpool functions in KR> common_util. Otherwise, the test fails if a corresponding storage KR> pool isn't present.
Why? I just ran it on my system with all the storage pools destroyed and it worked. The info log shows it retrieved the proper size for the image as well.
I was confusing myself yesterday. There's no need to worry about pools at all for this patch. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1217005489 25200 # Node ID 3c80ea156a3c45bc321f9c465ba7692c011ab2e0 # Parent 2972728363defd7c9a7683ebfa85a4dfc8225e32 [TEST] Add test for DiskRASD size parameter
Signed-off-by: Dan Smith <danms@us.ibm.com>
diff -r 2972728363de -r 3c80ea156a3c suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py Fri Jul 25 10:04:49 2008 -0700 @@ -0,0 +1,127 @@ +#!/usr/bin/python +# +# Copyright 2008 IBM Corp. +# +# Authors: +# Dan Smith <danms@us.ibm.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +sup_types = ['Xen', 'XenFV', 'KVM'] +default_dom = "diskrasd_test" + +import sys + +from CimTest.ReturnCodes import FAIL, PASS +from CimTest.Globals import do_main +from CimTest.Globals import logger +from VirtLib import utils +from XenKvmLib.test_doms import undefine_test_domain +from XenKvmLib.common_util import create_using_definesystem +from XenKvmLib import vsms +from XenKvmLib import enumclass + +def make_image(ip, size): + s, fn = utils.run_remote(ip, "mktemp") + if s != 0: + return None + + s, _ = utils.run_remote(ip, + "dd if=/dev/zero of=%s bs=1 count=%i" % (fn, size)) + if s != 0: + return None + + return fn + +def kill_image(ip, name): + s, _ = utils.run_remote(ip, "rm -f %s" % name) + + return s == 0 + +def check_rasd_size(rasd, size): + if rasd["AllocationUnits"] != "Bytes": + logger.error("AllocationUnits != Bytes?") + return FAIL This test case fails with the current source on KVM. KVM_DiskRASD is not able to fetch the *AllocationUnits and VirtualQuantity *on F9 for KVM. Here is the xml file that I used to define the guest :
<domain type='kvm'> <uuid>f07987b1-6a8b-4b65-bff3-41dc54c011df</uuid> <name>diskrasd_test</name> <on_poweroff>destroy</on_poweroff> <on_crash>destroy</on_crash> <os> <type>hvm</type> <boot dev='hd'/> </os> <currentMemory>32768</currentMemory> <memory>32768</memory> <devices> <disk type='file' device='disk'> <source file='/tmp/tmp.RAKm7sLnUF'/> <target dev='hda'/> </disk> <graphics type='vnc' port='-1'/> </devices> </domain> Here is the KVM_DiskRASD value for the above guest. wbemcli gi http://root:p@localhost:5988/root/virt:KVM_DiskResourceAllocationSettingData.InstanceID="diskrasd_test/hda" -nl localhost:5988/root/virt:KVM_DiskResourceAllocationSettingData.InstanceID="diskrasd_test/hda" -Caption -Description -InstanceID="diskrasd_test/hda" -ElementName -ConfigurationName -ChangeableType -ResourceType=17 -OtherResourceType -ResourceSubType -PoolID -ConsumerVisibility -HostResource *-AllocationUnits -VirtualQuantity *-Reservation -Limit -Weight -AutomaticAllocation -AutomaticDeallocation -Parent -Connection -Address="/tmp/tmp.RAKm7sLnUF" -MappingBehavior -VirtualDevice="hda" The details of the disk image used to define the guest is as below: *ll /tmp/tmp.RAKm7sLnUF -rw------- 1 root root 125952 2008-07-31 22:34 /tmp/tmp.RAKm7sLnUF *I suppose the value of *125952 *should be filled in *VirtualQuantity *field ?? While *AllocationUnits and VirtualQuantity* value is being set properly for Xen/XenFV. Since the test case has been accepted I am not sure if this is problem only on my machine. Thanks and Regards, Deepti.

The revision of the libvirt-cim on my machines is 651. Thanks and Regards, Deepti. Deepti B Kalakeri wrote:
Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1217005489 25200 # Node ID 3c80ea156a3c45bc321f9c465ba7692c011ab2e0 # Parent 2972728363defd7c9a7683ebfa85a4dfc8225e32 [TEST] Add test for DiskRASD size parameter
Signed-off-by: Dan Smith <danms@us.ibm.com>
diff -r 2972728363de -r 3c80ea156a3c suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py Fri Jul 25 10:04:49 2008 -0700 @@ -0,0 +1,127 @@ +#!/usr/bin/python +# +# Copyright 2008 IBM Corp. +# +# Authors: +# Dan Smith <danms@us.ibm.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +sup_types = ['Xen', 'XenFV', 'KVM'] +default_dom = "diskrasd_test" + +import sys + +from CimTest.ReturnCodes import FAIL, PASS +from CimTest.Globals import do_main +from CimTest.Globals import logger +from VirtLib import utils +from XenKvmLib.test_doms import undefine_test_domain +from XenKvmLib.common_util import create_using_definesystem +from XenKvmLib import vsms +from XenKvmLib import enumclass + +def make_image(ip, size): + s, fn = utils.run_remote(ip, "mktemp") + if s != 0: + return None + + s, _ = utils.run_remote(ip, + "dd if=/dev/zero of=%s bs=1 count=%i" % (fn, size)) + if s != 0: + return None + + return fn + +def kill_image(ip, name): + s, _ = utils.run_remote(ip, "rm -f %s" % name) + + return s == 0 + +def check_rasd_size(rasd, size): + if rasd["AllocationUnits"] != "Bytes": + logger.error("AllocationUnits != Bytes?") + return FAIL This test case fails with the current source on KVM. KVM_DiskRASD is not able to fetch the *AllocationUnits and VirtualQuantity *on F9 for KVM. Here is the xml file that I used to define the guest :
<domain type='kvm'> <uuid>f07987b1-6a8b-4b65-bff3-41dc54c011df</uuid> <name>diskrasd_test</name> <on_poweroff>destroy</on_poweroff> <on_crash>destroy</on_crash> <os> <type>hvm</type> <boot dev='hd'/> </os> <currentMemory>32768</currentMemory> <memory>32768</memory> <devices> <disk type='file' device='disk'> <source file='/tmp/tmp.RAKm7sLnUF'/> <target dev='hda'/> </disk> <graphics type='vnc' port='-1'/> </devices> </domain>
Here is the KVM_DiskRASD value for the above guest.
wbemcli gi http://root:p@localhost:5988/root/virt:KVM_DiskResourceAllocationSettingData.InstanceID="diskrasd_test/hda" -nl localhost:5988/root/virt:KVM_DiskResourceAllocationSettingData.InstanceID="diskrasd_test/hda"
-Caption -Description -InstanceID="diskrasd_test/hda" -ElementName -ConfigurationName -ChangeableType -ResourceType=17 -OtherResourceType -ResourceSubType -PoolID -ConsumerVisibility -HostResource *-AllocationUnits -VirtualQuantity *-Reservation -Limit -Weight -AutomaticAllocation -AutomaticDeallocation -Parent -Connection -Address="/tmp/tmp.RAKm7sLnUF" -MappingBehavior -VirtualDevice="hda"
The details of the disk image used to define the guest is as below: *ll /tmp/tmp.RAKm7sLnUF -rw------- 1 root root 125952 2008-07-31 22:34 /tmp/tmp.RAKm7sLnUF
*I suppose the value of *125952 *should be filled in *VirtualQuantity *field ?? While *AllocationUnits and VirtualQuantity* value is being set properly for Xen/XenFV.
Since the test case has been accepted I am not sure if this is problem only on my machine.
Thanks and Regards, Deepti.

DK> The revision of the libvirt-cim on my machines is 651. The changeset that added this functionality is 652, so please upgrade... :) -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
DK> The revision of the libvirt-cim on my machines is 651.
The changeset that added this functionality is 652, so please upgrade... :)
:) I should have done this before sending the mail. Yes this problem is not seen in the latest 654 libvirt-cim provider. Thanks and Regards, Deepti.
------------------------------------------------------------------------
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (3)
-
Dan Smith
-
Deepti B Kalakeri
-
Kaitlin Rupert