# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1242937450 25200
# Node ID 5417439be71f3f502576ee4db92764708c370874
# Parent e5fd77170913c3819d667e240c9873efa3bf0d07
[TEST] (#2) Return SKIP if the provider version doesn't support template pool RASDs
Changes:
-Rebase on updated tree.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r e5fd77170913 -r 5417439be71f
suites/libvirt-cim/cimtest/RASD/06_parent_net_pool.py
--- a/suites/libvirt-cim/cimtest/RASD/06_parent_net_pool.py Thu May 21 04:21:15 2009
-0700
+++ b/suites/libvirt-cim/cimtest/RASD/06_parent_net_pool.py Thu May 21 13:24:10 2009
-0700
@@ -67,7 +67,11 @@
options = main.options
virt = options.virt
server = options.ip
- netpool_rasd = get_pool_rasds(server, virt, filter_default=False)
+
+ status, netpool_rasd = get_pool_rasds(server, virt, filter_default=False)
+ if status != PASS:
+ return status
+
inst_list = [ 'Default', 'Minimum', 'Maximum',
'Increment' ]
n_rec_val = { 'ResourceType' : 10,
'PoolID' : "NetworkPool/0",
diff -r e5fd77170913 -r 5417439be71f suites/libvirt-cim/lib/XenKvmLib/pool.py
--- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Thu May 21 04:21:15 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Thu May 21 13:24:10 2009 -0700
@@ -22,7 +22,7 @@
import sys
from CimTest.Globals import logger, CIM_NS
-from CimTest.ReturnCodes import PASS, FAIL
+from CimTest.ReturnCodes import PASS, FAIL, SKIP
from XenKvmLib.classes import get_typed_class, inst_to_mof
from XenKvmLib.const import get_provider_version, default_pool_name
from XenKvmLib.enumclass import EnumInstances, GetInstance
@@ -108,6 +108,22 @@
def get_pool_rasds(server, virt,
pool_type="NetworkPool", filter_default=True):
+
+ net_pool_rasd_rev = 867
+ disk_pool_rasd_rev = 863
+
+ try:
+ rev, changeset = get_provider_version(virt, server)
+ if pool_type == "NetworkPool" and rev < net_pool_rasd_rev:
+ raise Exception("Supported in version %d" % net_pool_rasd_rev)
+
+ if pool_type == "DiskPool" and rev < disk_pool_rasd_rev:
+ raise Exception("Supported in version %d" % disk_pool_rasd_rev)
+
+ except Exception, detail:
+ logger.error("%s template RASDs not supported. %s.", pool_type,
detail)
+ return SKIP, None
+
net_pool_rasds = []
ac_cn = get_typed_class(virt, "AllocationCapabilities")
@@ -119,16 +135,16 @@
rasd = Associators(server, an_cn, ac_cn, InstanceID=inst.InstanceID)
except Exception, detail:
logger.error("Exception: %s", detail)
- return None
+ return FAIL, None
if filter_default == True:
for item in rasd:
if item['InstanceID'] == "Default":
net_pool_rasds.append(item)
else:
- return rasd
+ return PASS, rasd
- return net_pool_rasds
+ return PASS, net_pool_rasds
def net_undefine(network, server, virt="Xen"):
"""Function undefine a given virtual network"""
@@ -177,8 +193,8 @@
logger.error("IP address is in use by a different network")
return FAIL
- net_pool_rasds = get_pool_rasds(server, virt)
- if len(net_pool_rasds) == 0:
+ status, net_pool_rasds = get_pool_rasds(server, virt)
+ if len(net_pool_rasds) == 0 or status != PASS:
logger.error("We can not get NetPoolRASDs")
return FAIL
else: