[PATCH 0 of 2] [TEST] Adding AllocationUnits field to MemRASD and updating the call to MemRASD in the libraries where it is accessed.

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1217512370 25200 # Node ID 6cc6d0b3dbbacba5eaa5faf9e7cbef1fb24f4f78 # Parent fc92abb3ae7cab32dec6718412be1c0d88874a4a [TEST] Adding AllocationUnits field to MemRASD and updating the call to MemRASD in the libraries where it is accessed. These changes are required to accomdate the recent RASD provider changes. The changes are tested with KVM, Xen , XenFV on the current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r fc92abb3ae7c -r 6cc6d0b3dbba suites/libvirt-cim/lib/XenKvmLib/const.py --- a/suites/libvirt-cim/lib/XenKvmLib/const.py Wed Jul 30 06:55:31 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Thu Jul 31 06:52:50 2008 -0700 @@ -49,6 +49,7 @@ default_domname = 'domU1' default_memory = 128 default_vcpus = 1 +default_mallocunits="MegaBytes" _image_dir = '/tmp' diff -r fc92abb3ae7c -r 6cc6d0b3dbba suites/libvirt-cim/lib/XenKvmLib/vsms.py --- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Wed Jul 30 06:55:31 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Thu Jul 31 06:52:50 2008 -0700 @@ -203,11 +203,14 @@ pass class CIM_MemResourceAllocationSettingData(CIMClassMOF): - def __init__(self, megabytes, name): + def __init__(self, megabytes, mallocunits, name): self.ResourceType = RASD_TYPE_MEM if megabytes != None: self.VirtualQuantity = megabytes + + if mallocunits != None: + self.AllocationUnits = mallocunits if name != None: self.InstanceID = '%s/mem' % name @@ -232,6 +235,7 @@ net_mac=const.Xen_default_mac, proc_vcpu=1, mem_mb=512, + malloc_units="MegaBytes", virt='Xen'): class_vssd = get_vssd_class(virt) vssd = class_vssd(name=dom_name, virt=virt) @@ -258,6 +262,7 @@ class_masd = get_masd_class(virt) m = class_masd( megabytes=mem_mb, + mallocunits=malloc_units, name=dom_name) if virt == 'LXC': return vssd.mof(), [d.mof(), m.mof()] diff -r fc92abb3ae7c -r 6cc6d0b3dbba suites/libvirt-cim/lib/XenKvmLib/vxml.py --- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Jul 30 06:55:31 2008 -0700 +++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Thu Jul 31 06:52:50 2008 -0700 @@ -498,7 +498,7 @@ class VirtCIM: def __init__(self, virt, dom_name, disk_dev, disk_source, - net_type, net_mac, vcpus, mem): + net_type, net_mac, vcpus, mem, mem_allocunits): self.virt = virt self.domain_name = dom_name self.vssd = vsms.get_vssd_class(virt)(name=dom_name, virt=virt) @@ -509,7 +509,9 @@ mac=net_mac, name=dom_name) self.pasd = vsms.get_pasd_class(virt)(vcpu=vcpus, name=dom_name) - self.masd = vsms.get_masd_class(virt)(megabytes=mem, name=dom_name) + self.masd = vsms.get_masd_class(virt)(megabytes=mem, + mallocunits=mem_allocunits, + name=dom_name) def cim_define(self, ip): service = vsms.get_vsms_class(self.virt)(ip) @@ -552,6 +554,7 @@ def __init__(self, test_dom=const.default_domname, mem=const.default_memory, + mem_allocunits=const.default_mallocunits, vcpus=const.default_vcpus, mac=const.Xen_default_mac, disk_file_path=const.Xen_disk_path, @@ -567,7 +570,7 @@ self._devices(disk_file_path, disk, ntype, mac) VirtCIM.__init__(self, 'Xen', test_dom, disk, disk_file_path, - ntype, mac, vcpus, mem) + ntype, mac, vcpus, mem, mem_allocunits) def _os(self, os_kernel, os_initrd): os = self.get_node('/domain/os')

DK> + def __init__(self, megabytes, mallocunits, name): DK> self.ResourceType = RASD_TYPE_MEM DK> if megabytes != None: DK> self.VirtualQuantity = megabytes DK> + DK> + if mallocunits != None: DK> + self.AllocationUnits = mallocunits These should be parameters with default values. The way you have it now, the caller must specify something for each, and if they don't, you create an invalid RASD. For example: class_masd(None, None, "foo") succeeds, but passes none of the required information in the RASD. A definition like this would be better: def __init__(self, name, megabytes=128, mallocunits="MegaBytes") So that someone can call it in any of the following ways: masd_class("foo") masd_class("foo", 256) masd_class("foo", 131076, "KiloBytes") Doing it this way will avoid the need to change every use of this function in places that don't need to know about whatever new parameter you add next time. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1217512627 25200 # Node ID 75b131d1d9bf499d5da56c8ff66327d32f026a7f # Parent 6cc6d0b3dbbacba5eaa5faf9e7cbef1fb24f4f78 [TEST] Fixing the tc 08_modifyresource.py and updating the others to accomdate the AllocationUnits field changes. The changes are tested with KVM, Xen , XenFV on the current sources. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r 6cc6d0b3dbba -r 75b131d1d9bf suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py --- a/suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py Thu Jul 31 06:52:50 2008 -0700 +++ b/suites/libvirt-cim/cimtest/RASD/04_disk_rasd_size.py Thu Jul 31 06:57:07 2008 -0700 @@ -78,7 +78,7 @@ drasd = drasd_class("hda", temp, default_dom) mrasd_class = vsms.get_masd_class(options.virt) - mrasd = mrasd_class(32, default_dom) + mrasd = mrasd_class(32, "MegaBytes", default_dom) params = { "vssd" : vssd.mof(), diff -r 6cc6d0b3dbba -r 75b131d1d9bf suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py Thu Jul 31 06:52:50 2008 -0700 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py Thu Jul 31 06:57:07 2008 -0700 @@ -41,6 +41,7 @@ cpu = 2 ncpu = 1 nmem = 256 +munits = "Megabytes" def cleanup_env(ip, virt, cxml, net_name): destroy_netpool(ip, virt, net_name) @@ -68,7 +69,9 @@ mac=cxml.xml_get_net_mac(), name=default_dom, virt_net=net_name) - masd = vsms.get_masd_class(options.virt)(megabytes=nmem, name=default_dom) + masd = vsms.get_masd_class(options.virt)(megabytes=nmem, + mallocunits=munits, + name=default_dom) pasd = vsms.get_pasd_class(options.virt)(vcpu=ncpu, name=default_dom) status = FAIL diff -r 6cc6d0b3dbba -r 75b131d1d9bf suites/libvirt-cim/cimtest/VirtualSystemManagementService/11_define_memrasdunits.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/11_define_memrasdunits.py Thu Jul 31 06:52:50 2008 -0700 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/11_define_memrasdunits.py Thu Jul 31 06:57:07 2008 -0700 @@ -47,9 +47,8 @@ def try_define(options, vssd, units, value): mrasd_class = vsms.get_masd_class(options.virt) - mrasd = mrasd_class(None, default_dom) + mrasd = mrasd_class(None, units, default_dom) - mrasd.AllocationUnits = units mrasd.VirtualQuantity = value params = {
participants (2)
-
Dan Smith
-
Deepti B. Kalakeri