# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1242936560 25200
# Node ID 4467ea28368f7343c89990e7179170be34c08c6f
# Parent 835ba5d083c620046dc16c29e1bf44932af759a7
[TEST] Return SKIP if the provider version doesn't support template pool RASDs
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 835ba5d083c6 -r 4467ea28368f
suites/libvirt-cim/cimtest/RASD/06_parent_net_pool.py
--- a/suites/libvirt-cim/cimtest/RASD/06_parent_net_pool.py Wed May 20 03:27:45 2009
-0700
+++ b/suites/libvirt-cim/cimtest/RASD/06_parent_net_pool.py Thu May 21 13:09:20 2009
-0700
@@ -68,7 +68,10 @@
virt = options.virt
server = options.ip
status = FAIL
- 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 835ba5d083c6 -r 4467ea28368f suites/libvirt-cim/lib/XenKvmLib/pool.py
--- a/suites/libvirt-cim/lib/XenKvmLib/pool.py Wed May 20 03:27:45 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py Thu May 21 13:09:20 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: