[Libvirt-cim] [PATCH 1 of 2] [TEST] Add get_exp_template_rasd_len() - returns the expected # of template RASD

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Sun Apr 19 23:32:53 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1240183799 25200
# Node ID 7ce2862e03dc20cd1e6d3ec9845912285d64eef1
# Parent  5706fea95239f1633296e2fbce13ada882848e13
[TEST] Add get_exp_template_rasd_len() - returns the expected # of template RASD

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 5706fea95239 -r 7ce2862e03dc suites/libvirt-cim/lib/XenKvmLib/rasd.py
--- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py	Fri Apr 17 14:11:23 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py	Sun Apr 19 16:29:59 2009 -0700
@@ -28,7 +28,9 @@
 from XenKvmLib.classes import get_typed_class, get_class_type
 from XenKvmLib.enumclass import GetInstance, EnumInstances
 from XenKvmLib.assoc import Associators 
-from XenKvmLib.const import default_pool_name, default_network_name 
+from XenKvmLib.const import default_pool_name, default_network_name, \
+                            get_provider_version
+from XenKvmLib.pool import enum_volumes
 
 pasd_cn = 'ProcResourceAllocationSettingData'
 nasd_cn = 'NetResourceAllocationSettingData'
@@ -302,3 +304,45 @@
 
     return rasd_insts, PASS
 
+def get_exp_template_rasd_len(virt, ip, id):
+    libvirt_rasd_template_changes = 707
+    libvirt_rasd_new_changes = 805
+    libvirt_rasd_dpool_changes = 839
+
+    curr_cim_rev, changeset = get_provider_version(virt, ip)
+
+    # For Diskpool, we have info 1 for each of Min, Max, Default, and Incr
+    exp_base_num = 4
+    exp_cdrom = 4
+
+    exp_len = exp_base_num
+
+    if 'DiskPool' in id:
+        if virt == 'Xen' or virt == 'XenFV':
+            # For Xen and XenFV, there is a template for PV and FV, so you 
+            # end up with double the number of templates
+            xen_multi = 2
+
+            if curr_cim_rev >= libvirt_rasd_template_changes and \
+               curr_cim_rev < libvirt_rasd_new_changes:
+                exp_len = exp_base_num + exp_cdrom
+
+            elif curr_cim_rev >= libvirt_rasd_new_changes and \
+                 curr_cim_rev < libvirt_rasd_dpool_changes:
+                exp_len = (exp_base_num + exp_cdrom) * xen_multi 
+
+            elif curr_cim_rev >= libvirt_rasd_dpool_changes:
+                volumes = enum_volumes(virt, ip)
+                exp_len = (volumes * exp_base_num) * xen_multi + (exp_cdrom * 2)
+
+        elif virt == 'KVM':
+            if curr_cim_rev >= libvirt_rasd_new_changes and \
+               curr_cim_rev < libvirt_rasd_dpool_changes:
+                exp_len = exp_base_num + exp_cdrom
+
+            elif curr_cim_rev >= libvirt_rasd_dpool_changes:
+                volumes = enum_volumes(virt, ip)
+                exp_len = (volumes * exp_base_num) + exp_cdrom
+
+    return exp_len
+




More information about the Libvirt-cim mailing list