# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1217937480 25200
# Node ID e58d58ab857cac9cad118eb517294ee1f4ece949
# Parent 60a06040f18db61947039512028c75faf450ceb5
[TEST] #2 Adding AllocationUnits field to MemRASD and updating the call to MemRASD in the
libraries where it is accessed.
Changes
--------
Patch 2:
--------
1) Added default values to MemRASD properties.
Patch 1:
--------
1) Initalised the MemRASD AllocationUnits.
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(a)linux.vnet.ibm.com>
diff -r 60a06040f18d -r e58d58ab857c suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py Thu Jul 31 22:37:11 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Tue Aug 05 04:58:00 2008 -0700
@@ -49,6 +49,7 @@ default_domname = 'domU1'
default_domname = 'domU1'
default_memory = 128
default_vcpus = 1
+default_mallocunits="MegaBytes"
_image_dir = '/tmp'
diff -r 60a06040f18d -r e58d58ab857c suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Thu Jul 31 22:37:11 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Tue Aug 05 04:58:00 2008 -0700
@@ -203,11 +203,14 @@ def get_pasd_class(virt):
pass
class CIM_MemResourceAllocationSettingData(CIMClassMOF):
- def __init__(self, megabytes, name):
+ def __init__(self, name, megabytes=512, mallocunits="MegaBytes"):
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 @@ def default_vssd_rasd_str(dom_name='test
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 @@ def default_vssd_rasd_str(dom_name='test
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 60a06040f18d -r e58d58ab857c suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Thu Jul 31 22:37:11 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Aug 05 04:58:00 2008 -0700
@@ -498,7 +498,7 @@ class VirtXML(Virsh, XMLClass):
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 @@ class VirtCIM:
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 @@ class XenXML(VirtXML, VirtCIM):
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 @@ class XenXML(VirtXML, VirtCIM):
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')