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

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Mon Apr 20 18:35:58 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1240252500 25200
# Node ID 100c1a61b0b48a5afdfed3758bc01e0ea8d29b08
# Parent  90251a5a9af463cbfbbeb74ed819e0df4faf0f4f
[TEST] #2 Add get_exp_template_rasd_len() - returns the expected # of template RASD

Updates:
  -Remove hardcoded 2 value - use xen_multi instead

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

diff -r 90251a5a9af4 -r 100c1a61b0b4 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	Mon Apr 20 11:35:00 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) + exp_cdrom) * xen_multi
+
+        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