# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1233685686 28800
# Node ID b1a757aa7efce7839998c49412f45d8c7f1596fa
# Parent b5e7e1cf87f88b2baa21645b5d2bed2286ffb0ca
[TEST] #2 Update VSMS 14_define_sys_disk.py to use cim_define()
Updates:
-Added comment to describe test
-Added flag to indicate whether guest should be undefined
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r b5e7e1cf87f8 -r b1a757aa7efc
suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py Tue
Feb 03 09:37:05 2009 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py Tue
Feb 03 10:28:06 2009 -0800
@@ -18,6 +18,14 @@
# You should have received a copy of the GNU General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Purpose:
+# Verify providers support disk images with long paths / names
+#
+# Steps:
+# 1) Create a disk image with a long path
+# 2) Build RASD parameters, making sure to specify disk image created in step 1
+# 3) Verify guest is defined properly
#
import sys
@@ -25,14 +33,11 @@
from VirtLib.utils import run_remote
from CimTest.Globals import logger
from CimTest.ReturnCodes import FAIL, PASS
-from XenKvmLib.common_util import create_using_definesystem
-from XenKvmLib.test_doms import destroy_and_undefine_domain
from XenKvmLib.classes import get_typed_class, inst_to_mof
from XenKvmLib.rasd import get_default_rasds
-from XenKvmLib.vsms import get_vssd_mof
-from XenKvmLib.const import get_provider_version
from XenKvmLib.const import do_main, _image_dir, f9_changeset, \
- KVM_default_disk_dev
+ KVM_default_disk_dev, get_provider_version
+from XenKvmLib.vxml import get_class
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
test_dom = 'rstest_disk_domain'
@@ -50,28 +55,24 @@
return path
-def get_vssd_rasd(ip, virt, addr, disk_type):
- vssd = get_vssd_mof(virt, test_dom)
+def get_rasd_list(ip, virt, addr, disk_type):
+ drasd_cn = get_typed_class(virt, "DiskResourceAllocationSettingData")
rasds = get_default_rasds(ip, virt)
- rasd_list = []
+ rasd_list = {}
for rasd in rasds:
- if 'DiskPool' in rasd['PoolID']:
+ if rasd.classname == drasd_cn:
if disk_type != "" and rasd['Caption'] != disk_type:
continue
rasd['Address'] = addr
curr_cim_rev, changeset = get_provider_version(virt, ip)
if changeset == f9_changeset and virt == 'KVM':
rasd['VirtualDevice'] = KVM_default_disk_dev
- rasd_list.append(inst_to_mof(rasd))
+ rasd_list[rasd.classname] = inst_to_mof(rasd)
- params = { 'vssd' : vssd,
- 'rasd' : rasd_list
- }
-
- return params
+ return rasd_list
@do_main(sup_types)
def main():
@@ -84,21 +85,27 @@
else:
disk_cap = ""
+ cxml = get_class(options.virt)(test_dom)
+
+ guest_defined = False
+
try:
addr = make_long_disk_path(options.ip)
if addr is None:
raise Exception("Unable to create large disk image")
- define_params = get_vssd_rasd(options.ip, options.virt, addr, disk_cap)
- if len(define_params) != 2:
- raise Exception("Unable to get VSSD and RASDs for %s" % test_dom)
+ rasd_list = get_rasd_list(options.ip, options.virt, addr, disk_cap)
+ if len(rasd_list) < 1:
+ raise Exception("Unable to get template RASDs for %s" % test_dom)
- status = create_using_definesystem(test_dom, options.ip,
- params=define_params,
ref_config="",
- virt=options.virt)
- if status != PASS:
+ cxml.set_res_settings(rasd_list)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
raise Exception("Unable to define %s" % test_dom)
+ status = PASS
+ guest_defined = True
+
except Exception, details:
logger.error(details)
status = FAIL
@@ -106,7 +113,8 @@
if os.path.exists(addr):
os.remove(addr)
- destroy_and_undefine_domain(test_dom, options.ip, options.virt)
+ if guest_defined == True:
+ cxml.undefine(options.ip)
return status