[Libvirt-cim] [PATCH 1 of 2] [TEST] Adding AllocationUnits field to MemRASD and updating the call to MemRASD in the libraries where it is accessed

Deepti B. Kalakeri deeptik at linux.vnet.ibm.com
Thu Jul 31 13:57:19 UTC 2008


# HG changeset patch
# User Deepti B. Kalakeri <deeptik at 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 at 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')




More information about the Libvirt-cim mailing list