Kaitlin Rupert wrote:
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1243630742 25200
# Node ID 10746e30b8d0532ee7eda8d0689a085d1b695ee2
# Parent 64548d3a357980326b64cebc8d2388f8b631049a
[TEST] #2 Add support for DiskPoolRASD / NetPoolRASD to get_exp_template_rasd_len()
Also update HostSystem 03 to support DiskPoolRASD / NetPoolRASD
Updates from 1 to 2:
-Add instance id to log message HostSystem/03_hs_to_settdefcap.py: 223
-Rework the DiskRASD portion of get_exp_disk_rasd_len() - only check for
volumed if the libvirt version is greater than 0.4.1.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 64548d3a3579 -r 10746e30b8d0
suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py
--- a/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py Tue Jun 02 10:37:42
2009 -0700
+++ b/suites/libvirt-cim/cimtest/HostSystem/03_hs_to_settdefcap.py Fri May 29 13:59:02
2009 -0700
@@ -204,8 +204,10 @@
else:
rtype = {
"%s_DiskResourceAllocationSettingData" % virt : 17, \
+ "%s_DiskPoolResourceAllocationSettingData" % virt : 17, \
"%s_MemResourceAllocationSettingData" % virt : 4, \
"%s_NetResourceAllocationSettingData" % virt : 10, \
+ "%s_NetPoolResourceAllocationSettingData" % virt : 10, \
"%s_ProcResourceAllocationSettingData" % virt : 3
}
try:
@@ -218,8 +220,8 @@
exp_len = get_exp_template_rasd_len(virt, server, ap['InstanceID'])
if len(assoc_info) != exp_len:
- logger.error("'%s' returned %i RASD objects instead of
%i",
- an, len(assoc_info), exp_len)
+ logger.error("%s returned %i RASD objects instead of %i for
%s",
+ an, len(assoc_info), exp_len, ap['InstanceID'])
return FAIL
for inst in assoc_info:
diff -r 64548d3a3579 -r 10746e30b8d0 suites/libvirt-cim/lib/XenKvmLib/rasd.py
--- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py Tue Jun 02 10:37:42 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py Fri May 29 13:59:02 2009 -0700
@@ -31,6 +31,7 @@
from XenKvmLib.const import default_pool_name, default_network_name, \
get_provider_version
from XenKvmLib.pool import enum_volumes
+from XenKvmLib.xm_virt_util import virsh_version
pasd_cn = 'ProcResourceAllocationSettingData'
nasd_cn = 'NetResourceAllocationSettingData'
@@ -304,45 +305,76 @@
return rasd_insts, PASS
-def get_exp_template_rasd_len(virt, ip, id):
+def get_exp_disk_rasd_len(virt, ip, rev, 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)
+ libvirt_ver = virsh_version(ip, virt)
# 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
+ 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 id == "DiskPool/0":
+ pool_types = 3
+ return exp_base_num * pool_types
The test fails here with current sources and KVM for DiskPool/0 with the
following error:
--------------------------------------------------------------------
HostSystem - 03_hs_to_settdefcap.py: FAIL
ERROR - KVM_SettingsDefineCapabilities returned 20 RASD objects instead
of 12 for DiskPool/0
CIM_ERR_INVALID_CLASS: Linux_ComputerSystem
--------------------------------------------------------------------
The above pool_types should be 5.
+
+ 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
+ if rev >= libvirt_rasd_template_changes and \
+ 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 rev >= libvirt_rasd_dpool_changes and libvirt_ver >=
'0.4.1':
+ volumes = enum_volumes(virt, ip)
+ exp_len = ((volumes * 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
+ exp_len = (exp_base_num + exp_cdrom) * xen_multi
This line 338 [ exp_len = (exp_base_num + exp_cdrom) * xen_multi ] after
attaching the patch is resetting the the calculation
exp_len = ((volumes * exp_base_num) + exp_cdrom) * xen_multi and hence we are getting the
error on Xen with current source
--------------------------------------------------------------------
HostSystem - 03_hs_to_settdefcap.py: FAIL
ERROR - Xen_SettingsDefineCapabilities returned 88 RASD objects
instead of 16 for DiskPool/cimtest-diskpool
CIM_ERR_INVALID_CLASS: Linux_ComputerSystem
--------------------------------------------------------------------
- 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 virt == 'KVM':
+ if rev >= libvirt_rasd_new_changes and \
+ 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
+ elif rev >= libvirt_rasd_dpool_changes:
+ volumes = enum_volumes(virt, ip)
+ exp_len = (volumes * exp_base_num) + exp_cdrom
return exp_len
+def get_exp_net_rasd_len(virt, rev, id):
+ net_rasd_template_changes = 861
+
+ exp_base_num = 4
+
+ if id == "NetworkPool/0":
+ pool_types = 3
+ forward_modes = 2
+
+ return (exp_base_num * pool_types) + (exp_base_num * forward_modes)
+
+ if rev >= net_rasd_template_changes:
+ dev_types = 2
+
+ return exp_base_num * dev_types
+
+def get_exp_template_rasd_len(virt, ip, id):
+ curr_cim_rev, changeset = get_provider_version(virt, ip)
+
+ exp_len = 4
+
+ if 'DiskPool' in id:
+ exp_len = get_exp_disk_rasd_len(virt, ip, curr_cim_rev, id)
+
+ elif 'NetworkPool' in id:
+ exp_len = get_exp_net_rasd_len(virt, curr_cim_rev, id)
+
+ return exp_len
+
+
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Thanks and Regards,
Deepti B. Kalakeri
IBM Linux Technology Center
deeptik(a)linux.vnet.ibm.com