[PATCH] [TEST] #2 Update VSMS 14_define_sys_disk.py to use cim_define()
by Kaitlin Rupert
# 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
15 years, 10 months
[PATCH] (#2) Add a migration_tester.py tool
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1232519221 28800
# Node ID 61209742da1d511a4b453d38432c2eeb35639a83
# Parent 189cc68a2f5a3251be1204bdaddfd90bb8740789
(#2) Add a migration_tester.py tool.
This can be used to drive migration between two different hosts.
How to call the tester:
python tools/migration_tester.py -u root -p pass -s fqdn:port -t fqdn -v virt_type guest_name --migration-type type
Ex:
python tools/migration_tester.py -u root -p pass -s source.myhost.com:5988 -t target.myhost.com -v Xen my_guest --migration-type live
Updates:
-Added comment at the beginning of the tool that describes the usage
-Improved the descriptions for username and password for the OptionParser
-Fixed some errors in the usage description in the commit log
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 189cc68a2f5a -r 61209742da1d tools/migration_tester.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/migration_tester.py Tue Jan 20 22:27:01 2009 -0800
@@ -0,0 +1,310 @@
+#!/usr/bin/python
+#
+# Copyright IBM Corp. 2009
+#
+# Authors:
+# Kaitlin Rupert <karupert(a)us.ibm.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser 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
+#
+# Usage: python tools/migration_tester.py -u root -p pass
+# -s source.myhost.com:5988 -t target.myhost.com -v Xen guest
+# --migration-type live
+#
+# Note: Be sure you can authenticate via ssh into the target machine prior
+# to running the test.
+#
+# You can set up ssh keys, or you will be prompted for the password
+# of the target machine
+
+import sys
+import time
+from optparse import OptionParser
+from pywbem import WBEMConnection, CIMInstanceName, CIMInstance, CIMError
+
+CIM_MIGRATE_OTHER=1
+CIM_MIGRATE_LIVE=2
+CIM_MIGRATE_RESUME=3
+CIM_MIGRATE_RESTART=4
+
+CIM_MIGRATE_URI_OTHER=1
+CIM_MIGRATE_URI_SSH=2
+CIM_MIGRATE_URI_TLS=3
+CIM_MIGRATE_URI_TLS_STRICT=4
+CIM_MIGRATE_URI_TCP=5
+CIM_MIGRATE_URI_UNIX=6
+
+CIM_JOBSTATE_COMPLETE=7
+
+class CIMClassMOF:
+
+ __supported_types = [int, str, bool]
+
+ def __init__(self, attrs = None):
+ """attrs should be dict
+ """
+
+ if attrs != None:
+ self.__dict__.update(attrs)
+
+ def mof(self):
+ """mof()
+
+ Return value is a string, containing the mof representation of the
+ object.
+
+ Attribute types supported are : int, str, bool.
+
+ Attributes with unsupported types will be silently ignored when
+ converting to mof representation.
+ """
+
+ mof_str = "instance of " + self.__class__.__name__ + " {\n"
+ for key, value in self.__dict__.items():
+ value_type = type(value)
+ if value_type not in self.__supported_types:
+ continue
+
+ mof_str += "%s = " % key
+ if value_type == int:
+ mof_str += "%d" % value
+ elif value_type == bool:
+ mof_str += str(value).lower()
+ else:
+ mof_str += '"%s"' % value
+ mof_str += ";\n"
+
+ mof_str += "};"
+ return mof_str
+
+ def __str__(self):
+ return self.mof()
+
+class CIM_VirtualSystemMigrationSettingData(CIMClassMOF):
+ def __init__(self, type, priority):
+ self.InstanceID = 'MigrationSettingData'
+ self.CreationClassName = self.__class__.__name__
+ self.MigrationType = type
+ self.Priority = priority
+
+class Xen_VirtualSystemMigrationSettingData(CIM_VirtualSystemMigrationSettingData):
+ def __init__(self, type, priority):
+ CIM_VirtualSystemMigrationSettingData.__init__(self, type, priority)
+
+class KVM_VirtualSystemMigrationSettingData(CIM_VirtualSystemMigrationSettingData):
+ def __init__(self, type, priority):
+ CIM_VirtualSystemMigrationSettingData.__init__(self, type, priority)
+
+def get_guest_ref(guest, virt):
+ guest_cn = "%s_ComputerSystem" % virt
+
+ keys = { 'Name' : guest,
+ 'CreationClassName' : guest_cn
+ }
+
+ try:
+ cs_ref = CIMInstanceName(guest_cn, keybindings=keys)
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return None
+
+ return cs_ref
+
+def get_msd(mtype, virt):
+ if mtype == "live":
+ mtype = CIM_MIGRATE_LIVE
+ elif mtype == "resume":
+ mtype = CIM_MIGRATE_RESUME
+ elif mtype == "restart":
+ mtype = CIM_MIGRATE_RESTART
+ else:
+ mtype = CIM_MIGRATE_OTHER
+
+ try:
+ vsmsd_cn_base = "_VirtualSystemMigrationSettingData"
+ msd = eval(virt + vsmsd_cn_base)(type=mtype, priority=0)
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return None
+
+ return msd.mof()
+
+def check_migrate(s_conn, cs_ref, ip, msd, virt):
+ vsms_cn = "%s_VirtualSystemMigrationService" % virt
+ try:
+ if msd == None:
+ res = s_conn.InvokeMethod("CheckVirtualSystemIsMigratableToHost",
+ vsms_cn,
+ ComputerSystem=cs_ref,
+ DestinationHost=ip)
+ else:
+ res = s_conn.InvokeMethod("CheckVirtualSystemIsMigratableToHost",
+ vsms_cn,
+ ComputerSystem=cs_ref,
+ DestinationHost=ip,
+ MigrationSettingData=msd)
+
+ if res == None or res[1]['IsMigratable'] != True:
+ print "Migration check failed."
+ return 1
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return 1
+
+ return 0
+
+def get_job_inst(s_conn, job_ref):
+ try:
+ inst = s_conn.GetInstance(job_ref)
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return None
+
+ return inst
+
+def poll_for_job_status(s_conn, job_ref):
+
+ job_inst = get_job_inst(s_conn, job_ref)
+ if not job_inst:
+ print "Unable to get job instance"
+ return 1
+
+ try:
+ while job_inst['JobState'] != CIM_JOBSTATE_COMPLETE:
+ time.sleep(3)
+ job_inst = get_job_inst(s_conn, job_ref)
+ if not job_inst:
+ print "Unable to get job instance"
+ return 1
+
+ if job_inst['Status'] != "Completed":
+ print "Migrate job failed: %s" % job_inst['Status']
+ return 1
+ except KeyboardInterrupt:
+ print "Migrate job took too long"
+ return 1
+
+ print "Migrate job succeeded: %s" % job_inst['Status']
+ return 0
+
+def migrate_host(s_conn, cs_ref, dest, msd, virt):
+ vsms_cn = "%s_VirtualSystemMigrationService" % virt
+
+ try:
+ if msd == None:
+ job = s_conn.InvokeMethod("MigrateVirtualSystemToHost",
+ vsms_cn,
+ ComputerSystem=cs_ref,
+ DestinationHost=dest)
+ else:
+ job = s_conn.InvokeMethod("MigrateVirtualSystemToHost",
+ vsms_cn,
+ ComputerSystem=cs_ref,
+ DestinationHost=dest,
+ MigrationSettingData=msd)
+
+ if len(job) < 1:
+ print "No job returned from migrate call"
+ return 1
+
+ status = poll_for_job_status(s_conn, job[1]['Job'])
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return 1
+
+ return 0
+
+def main():
+ usage = "usage: %prog [options] <target system>\nex: %prog my.target.com"
+ parser = OptionParser(usage)
+
+ parser.add_option("-s", "--src-url", dest="s_url", default="localhost:5988",
+ help="URL of CIMOM to connect to (host:port)")
+ parser.add_option("-t", "--target-url", dest="t_url",
+ default="localhost:5988",
+ help="URL of CIMOM to connect to (host:port)")
+ parser.add_option("-N", "--ns", dest="ns", default="root/virt",
+ help="Namespace (default is root/virt)")
+ parser.add_option("-u", "--user", dest="username", default=None,
+ help="Auth username for CIMOM on source system")
+ parser.add_option("-p", "--pass", dest="password", default=None,
+ help="Auth password for CIMOM on source system")
+ parser.add_option("-v", "--virt-type", dest="virt", default=None,
+ help="Virtualization type [ Xen | KVM ]")
+ parser.add_option("--migration-type", dest="type", default=None,
+ help="Migration type: [ live | resume | restart ]")
+ parser.add_option("--disable-check", dest="disable_ck", action="store_true",
+ help="Disable migration pre-check")
+
+ (options, args) = parser.parse_args()
+
+ if len(args) == 0:
+ print "Fatal: no guest specified."
+ sys.exit(1)
+
+ guest_name = args[0]
+
+ if ":" in options.s_url:
+ (sysname, port) = options.s_url.split(":")
+ else:
+ sysname = options.s_url
+
+ if ":" in options.t_url:
+ (t_sysname, port) = options.t_url.split(":")
+ else:
+ t_sysname = options.t_url
+
+ src_conn = WBEMConnection('http://%s' % sysname,
+ (options.username, options.password), options.ns)
+
+ guest_ref = get_guest_ref(guest_name, options.virt)
+ if guest_ref == None:
+ return 1
+
+ if options.virt == None:
+ print "Must specify virtualization type"
+ return 1
+
+ if options.virt != "Xen":
+ print "Only Xen migration is currently supported"
+ return 1
+
+ if options.type != None:
+ msd = get_msd(options.type, options.virt)
+ if msd == None:
+ return 1
+ else:
+ print "Using default MigrationSettingData"
+ msd = None
+
+ if not options.disable_ck:
+ status = check_migrate(src_conn, guest_ref, t_sysname, msd,
+ options.virt)
+ if status == 1:
+ return 1
+
+ print "Migrating %s.. this will take some time." % guest_name
+ status = migrate_host(src_conn, guest_ref, t_sysname, msd, options.virt)
+ return status
+
+if __name__=="__main__":
+ sys.exit(main())
+
+
15 years, 10 months
[PATCH] [TEST] #2 Update VSMS 12_referenced_config.py to use cim_() function
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1233682625 28800
# Node ID b5e7e1cf87f88b2baa21645b5d2bed2286ffb0ca
# Parent fa1424f9b3f4ae005b4fcc34e18858035cc8f102
[TEST] #2 Update VSMS 12_referenced_config.py to use cim_() function.
Also re-wrote part of this test to fix the overall test flow.
Updates:
-Added comment
-Ensured cleanup only occurs when guest has been started / defined
-Use cs instance Name and CCN
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r fa1424f9b3f4 -r b5e7e1cf87f8 suites/libvirt-cim/cimtest/VirtualSystemManagementService/12_referenced_config.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/12_referenced_config.py Mon Feb 02 12:02:30 2009 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/12_referenced_config.py Tue Feb 03 09:37:05 2009 -0800
@@ -19,21 +19,27 @@
# 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 DefineSystem() properly uses the settings of the referenced passed in
+# for the ReferenceConfiguration parameter.
+#
+# Steps:
+# 1) Define and start a guest
+# 2) Get the reference of the guest
+# 3) Define a second guest using the reference of the first guest
+# 4) Verify the settings of the second guest
+
import sys
-import pywbem
-from XenKvmLib.common_util import create_using_definesystem, \
- call_request_state_change, \
- poll_for_state_change, get_cs_instance
-from XenKvmLib import vsms
-from VirtLib import utils
+from XenKvmLib.common_util import get_cs_instance
from CimTest.Globals import logger
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import FAIL, PASS
-from XenKvmLib.test_doms import destroy_and_undefine_domain
-from XenKvmLib.classes import get_typed_class
+from XenKvmLib.classes import get_typed_class, inst_to_mof
from XenKvmLib.assoc import AssociatorNames
from XenKvmLib.test_xml import dumpxml
+from XenKvmLib.vxml import get_class
+from XenKvmLib.rasd import get_default_rasds
sup_types = ['Xen', 'XenFV', 'KVM']
test_dom = 'rstest_domain'
@@ -41,36 +47,27 @@
mac = "aa:aa:aa:00:00:00"
-REQUESTED_STATE = 2
-TIME = "00000000000000.000000:000"
+def setup_first_guest(ip, virt, cxml):
+ ret = cxml.cim_define(ip)
+ if not ret:
+ logger.error("Unable to define %s using DefineSystem()" % test_dom)
+ return FAIL, None
-def setup_first_guest(ip, virt):
- status = create_using_definesystem(test_dom, ip, virt=virt)
- if status != PASS:
- logger.error("Unable to define %s using DefineSystem()" % test_dom)
- return FAIL
-
- rc = call_request_state_change(test_dom, ip, REQUESTED_STATE, TIME, virt)
- if rc != 0:
- logger.error("Unable to start %s" % test_dom)
- return FAIL
-
- status, cs = poll_for_state_change(ip, virt, test_dom, REQUESTED_STATE)
+ status = cxml.cim_start(ip)
if status != PASS:
logger.error("Unable to start %s" % test_dom)
- return FAIL
+ return FAIL, "define"
- return PASS
+ return PASS, "start"
def get_vssd_ref(ip, virt):
rc, cs = get_cs_instance(test_dom, ip, virt)
if rc != 0:
return None
- cn = "ComputerSystem"
- ccn = get_typed_class(virt, cn)
an = get_typed_class(virt, 'SettingsDefineState')
- vssd = AssociatorNames(ip, an, ccn, Name = test_dom, CreationClassName = ccn)
+ vssd = AssociatorNames(ip, an, cs.CreationClassName, Name=cs.Name,
+ CreationClassName=cs.CreationClassName)
if len(vssd) != 1:
logger.error("Returned %i vssd insts for '%s'", len(vssd), test_dom)
@@ -78,26 +75,33 @@
return vssd[0]
-def get_vssd_rasd(virt):
- vssd, def_rasd = vsms.default_vssd_rasd_str(dom_name=test_dom2,
- net_type='network',
- net_mac=mac, virt=virt)
+def setup_second_guest(ip, virt, cxml2, ref):
+ nrasd_cn = get_typed_class(virt, "NetResourceAllocationSettingData")
- rasd = []
- for inst in def_rasd:
- cn = get_typed_class(virt, "NetResourceAllocationSettingData")
- if cn in inst:
- rasd.append(inst)
+ rasds = get_default_rasds(ip, virt)
- params = {}
+ rasd_list = {}
- if len(rasd) != 1:
- return params
+ for rasd in rasds:
+ if rasd.classname == nrasd_cn:
+ rasd['Address'] = mac
+ rasd['NetworkType'] = "network"
+ rasd_list[nrasd_cn] = inst_to_mof(rasd)
+ else:
+ rasd_list[rasd.classname] = None
- params['vssd'] = vssd
- params['rasd'] = rasd
+ if rasd_list[nrasd_cn] is None:
+ logger.error("Unable to get template NetRASD")
+ return FAIL
- return params
+ cxml2.set_res_settings(rasd_list)
+
+ ret = cxml2.cim_define(ip, ref_conf=ref)
+ if not ret:
+ logger.error("Unable to define %s using DefineSystem()" % test_dom2)
+ return FAIL, None
+
+ return PASS, "define"
def get_dom_macs(server, dom, virt):
mac_list = []
@@ -117,33 +121,34 @@
@do_main(sup_types)
def main():
options = main.options
+ virt = options.virt
+ ip = options.ip
+
+ cxml = get_class(virt)(test_dom)
+ cxml2 = get_class(virt)(test_dom2)
+
+ guest1_setup = None
+ guest2_setup = None
try:
- status = setup_first_guest(options.ip, options.virt)
+ status, guest1_setup = setup_first_guest(ip, virt, cxml)
if status != PASS:
raise Exception("Unable to start %s" % test_dom)
- ref = get_vssd_ref(options.ip, options.virt)
+ ref = get_vssd_ref(ip, virt)
if ref is None:
raise Exception("Unable to get %s reference" % test_dom)
- define_params = get_vssd_rasd(options.virt)
- if len(define_params) != 2:
- raise Exception("Unable to build VSSD and RASD instances for %s" % \
- test_dom2)
-
- status = create_using_definesystem(test_dom2, options.ip,
- params=define_params, ref_config=ref,
- virt=options.virt)
+ status, guest2_setup = setup_second_guest(ip, virt, cxml2, ref)
if status != PASS:
raise Exception("Unable to define %s" % test_dom2)
- dom1_mac_list = get_dom_macs(options.ip, test_dom, options.virt)
+ dom1_mac_list = get_dom_macs(ip, test_dom, virt)
if len(dom1_mac_list) != 1:
raise Exception("%s has %d macs, expected 1" % (test_dom,
len(dom1_mac_list)))
- dom2_mac_list = get_dom_macs(options.ip, test_dom2, options.virt)
+ dom2_mac_list = get_dom_macs(ip, test_dom2, virt)
if len(dom2_mac_list) != 2:
raise Exception("%s has %d macs, expected 2" % (test_dom2,
len(dom2_mac_list)))
@@ -159,8 +164,14 @@
logger.error(details)
status = FAIL
- destroy_and_undefine_domain(test_dom, options.ip, options.virt)
- destroy_and_undefine_domain(test_dom2, options.ip, options.virt)
+ if guest1_setup == "start":
+ cxml.cim_destroy(ip)
+
+ if guest1_setup == "define":
+ cxml.undefine(ip)
+
+ if guest2_setup == "define":
+ cxml2.undefine(ip)
return status
15 years, 10 months
Test Run Summary (Jan 19 2009): KVM on Fedora release 9.90.1 (Rawhide) with sfcb
by Guo Lian Yun
=================================================
Test Run Summary (Jan 19 2009): KVM on Fedora release 9.90.1 (Rawhide)
with sfcb
=================================================
Distro: Fedora release 9.90.1 (Rawhide)
Kernel: 2.6.27-0.323.rc6.fc10.x86_64
libvirt: 0.4.5
Hypervisor: QEMU 0.9.1
CIMOM: sfcb sfcbd 1.3.3preview
Libvirt-cim revision: 800
Libvirt-cim changeset: 611757263edd
Cimtest revision: 598
Cimtest changeset: 32645e444b32
=================================================
FAIL : 1
XFAIL : 2
SKIP : 4
PASS : 134
-----------------
Total : 141
=================================================
FAIL Test Summary:
ElementConforms - 01_forward.py: FAIL
=================================================
XFAIL Test Summary:
ComputerSystem - 32_start_reboot.py: XFAIL
ComputerSystem - 33_suspend_reboot.py: XFAIL
=================================================
SKIP Test Summary:
VSSD - 02_bootldr.py: SKIP
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
=================================================
Full report:
--------------------------------------------------------------------
AllocationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
AllocationCapabilities - 02_alloccap_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 01_enum.py: PASS
--------------------------------------------------------------------
ComputerSystem - 02_nosystems.py: PASS
--------------------------------------------------------------------
ComputerSystem - 03_defineVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 04_defineStartVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 05_activate_defined_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 06_paused_active_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 22_define_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 23_pause_pause.py: PASS
--------------------------------------------------------------------
ComputerSystem - 27_define_pause_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 32_start_reboot.py: XFAIL
ERROR - In fn cim_state_change()
ERROR - Failed to change state of the domain 'cs_test_domain'
ERROR - Exception: (1, u'Unable to reboot domain: this function
is not supported by the hypervisor: virDomainReboot')
ERROR - Exception: Unable reboot dom 'cs_test_domain'
InvokeMethod(RequestStateChange): Unable to reboot domain: this function
is not supported by the hypervisor: virDomainReboot
Bug:<00005>
--------------------------------------------------------------------
ComputerSystem - 33_suspend_reboot.py: XFAIL
ERROR - In fn cim_state_change()
ERROR - Failed to change state of the domain 'test_domain'
ERROR - Exception: (7, u'State not supported')
ERROR - Exception: Unable Suspend dom 'test_domain'
InvokeMethod(RequestStateChange): State not supported
Bug:<00012>
--------------------------------------------------------------------
ComputerSystem - 35_start_reset.py: PASS
--------------------------------------------------------------------
ComputerSystem - 40_RSC_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 41_cs_to_settingdefinestate.py: PASS
--------------------------------------------------------------------
ComputerSystem - 42_cs_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystemIndication - 01_created_indication.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 03_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 04_forward_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 01_forward.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 03_forward_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 05_hostsystem_cap.py: PASS
--------------------------------------------------------------------
ElementConforms - 01_forward.py: FAIL
ERROR - verify_fields() exception:
u'KVM_AllocationCapabilities'
ERROR - Exception: Failed to verify instance
Class not found
--------------------------------------------------------------------
ElementConforms - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementConforms - 03_ectp_fwd_errs.py: PASS
--------------------------------------------------------------------
ElementConforms - 04_ectp_rev_errs.py: PASS
--------------------------------------------------------------------
ElementSettingData - 01_forward.py: PASS
--------------------------------------------------------------------
ElementSettingData - 03_esd_assoc_with_rasd_errs.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 02_elecap_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 01_enum.py: PASS
--------------------------------------------------------------------
HostSystem - 02_hostsystem_to_rasd.py: PASS
--------------------------------------------------------------------
HostSystem - 03_hs_to_settdefcap.py: PASS
--------------------------------------------------------------------
HostSystem - 04_hs_to_EAPF.py: PASS
--------------------------------------------------------------------
HostSystem - 05_hs_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 06_hs_to_vsms.py: PASS
--------------------------------------------------------------------
HostedDependency - 01_forward.py: PASS
--------------------------------------------------------------------
HostedDependency - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedDependency - 03_enabledstate.py: PASS
--------------------------------------------------------------------
HostedDependency - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 01_forward.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedService - 01_forward.py: PASS
--------------------------------------------------------------------
HostedService - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedService - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedService - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
LogicalDisk - 01_disk.py: PASS
--------------------------------------------------------------------
LogicalDisk - 02_nodevs.py: PASS
--------------------------------------------------------------------
LogicalDisk - 03_ld_gi_errs.py: PASS
--------------------------------------------------------------------
Memory - 01_memory.py: PASS
--------------------------------------------------------------------
Memory - 02_defgetmem.py: PASS
--------------------------------------------------------------------
Memory - 03_mem_gi_errs.py: PASS
--------------------------------------------------------------------
NetworkPort - 01_netport.py: PASS
--------------------------------------------------------------------
NetworkPort - 02_np_gi_errors.py: PASS
--------------------------------------------------------------------
NetworkPort - 03_user_netport.py: PASS
--------------------------------------------------------------------
Processor - 01_processor.py: PASS
--------------------------------------------------------------------
Processor - 02_definesys_get_procs.py: PASS
--------------------------------------------------------------------
Processor - 03_proc_gi_errs.py: PASS
--------------------------------------------------------------------
Profile - 01_enum.py: PASS
--------------------------------------------------------------------
Profile - 02_profile_to_elec.py: PASS
--------------------------------------------------------------------
Profile - 03_rprofile_gi_errs.py: PASS
--------------------------------------------------------------------
RASD - 01_verify_rasd_fields.py: PASS
--------------------------------------------------------------------
RASD - 02_enum.py: PASS
--------------------------------------------------------------------
RASD - 03_rasd_errs.py: PASS
--------------------------------------------------------------------
RASD - 04_disk_rasd_size.py: PASS
--------------------------------------------------------------------
RASD - 05_disk_rasd_emu_type.py: PASS
--------------------------------------------------------------------
RedirectionService - 01_enum_crs.py: PASS
--------------------------------------------------------------------
RedirectionService - 02_enum_crscap.py: PASS
--------------------------------------------------------------------
RedirectionService - 03_RedirectionSAP_errs.py: PASS
--------------------------------------------------------------------
ReferencedProfile - 01_verify_refprof.py: PASS
--------------------------------------------------------------------
ReferencedProfile - 02_refprofile_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 05_RAPF_err.py: PASS
--------------------------------------------------------------------
ResourcePool - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePool - 02_rp_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 02_rpcc_gi_errs.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 02_rcps_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 03_CreateResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 04_CreateChildResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 05_AddResourcesToResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 06_RemoveResourcesFromResourcePool.py:
PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 07_DeleteResourcePool.py: PASS
--------------------------------------------------------------------
SettingsDefine - 01_forward.py: PASS
--------------------------------------------------------------------
SettingsDefine - 02_reverse.py: PASS
--------------------------------------------------------------------
SettingsDefine - 03_sds_fwd_errs.py: PASS
--------------------------------------------------------------------
SettingsDefine - 04_sds_rev_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 01_forward.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 03_forward_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 04_forward_vsmsdata.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 05_reverse_vsmcap.py: PASS
--------------------------------------------------------------------
SystemDevice - 01_forward.py: PASS
--------------------------------------------------------------------
SystemDevice - 02_reverse.py: PASS
--------------------------------------------------------------------
SystemDevice - 03_fwderrs.py: PASS
--------------------------------------------------------------------
VSSD - 01_enum.py: PASS
--------------------------------------------------------------------
VSSD - 02_bootldr.py: SKIP
--------------------------------------------------------------------
VSSD - 03_vssd_gi_errs.py: PASS
--------------------------------------------------------------------
VSSD - 04_vssd_to_rasd.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 02_vsmcap_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 01_definesystem_name.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 02_destroysystem.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 03_definesystem_ess.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 04_definesystem_ers.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 05_destroysystem_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 06_addresource.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 07_addresource_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 08_modifyresource.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 09_procrasd_persist.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 10_hv_version.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 11_define_memrasdunits.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 12_referenced_config.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 13_refconfig_additional_devs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 14_define_sys_disk.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 15_mod_system_settings.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 02_vsmc_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 02_vsmsd_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 01_forward.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 02_reverse.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 03_vssdc_fwd_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 04_vssdc_rev_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 02_vs_sservice_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 02_vs_sservicecap_gi_errs.py:
PASS
--------------------------------------------------------------------
15 years, 10 months
[PATCH] [TEST] Update VSMS 14_define_sys_disk.py to use cim_define()
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1233605202 28800
# Node ID f9b044c4d5ddeed5b2383186ebfb9337b102ba5d
# Parent 4327fd7361d8107c8f7fc827d62162e9151ff6dd
[TEST] Update VSMS 14_define_sys_disk.py to use cim_define()
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 4327fd7361d8 -r f9b044c4d5dd suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py Mon Feb 02 12:04:30 2009 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py Mon Feb 02 12:06:42 2009 -0800
@@ -25,14 +25,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 +47,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 +77,24 @@
else:
disk_cap = ""
+ cxml = get_class(options.virt)(test_dom)
+
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
+
except Exception, details:
logger.error(details)
status = FAIL
@@ -106,7 +102,7 @@
if os.path.exists(addr):
os.remove(addr)
- destroy_and_undefine_domain(test_dom, options.ip, options.virt)
+ cxml.undefine(options.ip)
return status
15 years, 10 months
Test Run Summary (Feb 02 2009): KVM on Fedora release 9 (Sulphur) with Pegasus
by Deepti B Kalakeri
=================================================
Test Run Summary (Feb 02 2009): KVM on Fedora release 9 (Sulphur) with Pegasus
=================================================
Distro: Fedora release 9 (Sulphur)
Kernel: 2.6.25.14-108.fc9.x86_64
libvirt: 0.4.4
Hypervisor: QEMU 0.9.1
CIMOM: Pegasus 2.7.0
Libvirt-cim revision: 613
Libvirt-cim changeset: 1fcf330fadf8+
Cimtest revision: 606
Cimtest changeset: 2ef1704ac586
=================================================
FAIL : 0
XFAIL : 3
SKIP : 11
PASS : 126
-----------------
Total : 140
=================================================
XFAIL Test Summary:
ComputerSystem - 32_start_reboot.py: XFAIL
ComputerSystem - 33_suspend_reboot.py: XFAIL
VirtualSystemManagementService - 15_mod_system_settings.py: XFAIL
=================================================
SKIP Test Summary:
ComputerSystem - 02_nosystems.py: SKIP
KVMRedirectionSAP - 01_enum_KVMredSAP.py: SKIP
LogicalDisk - 02_nodevs.py: SKIP
RASD - 05_disk_rasd_emu_type.py: SKIP
RedirectionService - 01_enum_crs.py: SKIP
RedirectionService - 02_enum_crscap.py: SKIP
RedirectionService - 03_RedirectionSAP_errs.py: SKIP
VSSD - 02_bootldr.py: SKIP
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
=================================================
Full report:
--------------------------------------------------------------------
AllocationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
AllocationCapabilities - 02_alloccap_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 01_enum.py: PASS
--------------------------------------------------------------------
ComputerSystem - 02_nosystems.py: SKIP
ERROR - System has defined domains; unable to run
--------------------------------------------------------------------
ComputerSystem - 03_defineVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 04_defineStartVS.py: PASS
--------------------------------------------------------------------
ComputerSystem - 05_activate_defined_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 06_paused_active_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 22_define_suspend.py: PASS
--------------------------------------------------------------------
ComputerSystem - 23_pause_pause.py: PASS
--------------------------------------------------------------------
ComputerSystem - 27_define_pause_errs.py: PASS
--------------------------------------------------------------------
ComputerSystem - 32_start_reboot.py: XFAIL
ERROR - Got CIM error CIM_ERR_FAILED: Domain Operation Failed with return code 1
ERROR - Exception: Unable reboot dom 'cs_test_domain'
InvokeMethod(RequestStateChange): CIM_ERR_FAILED: Domain Operation Failed
Bug:<00005>
--------------------------------------------------------------------
ComputerSystem - 33_suspend_reboot.py: XFAIL
ERROR - Got CIM error CIM_ERR_NOT_SUPPORTED: State not supported with return code 7
ERROR - Exception: Unable Suspend dom 'test_domain'
InvokeMethod(RequestStateChange): CIM_ERR_NOT_SUPPORTED: State not supported
Bug:<00012>
--------------------------------------------------------------------
ComputerSystem - 35_start_reset.py: PASS
--------------------------------------------------------------------
ComputerSystem - 40_RSC_start.py: PASS
--------------------------------------------------------------------
ComputerSystem - 41_cs_to_settingdefinestate.py: PASS
--------------------------------------------------------------------
ComputerSystem - 42_cs_gi_errs.py: PASS
--------------------------------------------------------------------
ComputerSystemIndication - 01_created_indication.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 03_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementAllocatedFromPool - 04_forward_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 01_forward.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 03_forward_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ElementCapabilities - 05_hostsystem_cap.py: PASS
--------------------------------------------------------------------
ElementConforms - 01_forward.py: PASS
--------------------------------------------------------------------
ElementConforms - 02_reverse.py: PASS
--------------------------------------------------------------------
ElementConforms - 03_ectp_fwd_errs.py: PASS
--------------------------------------------------------------------
ElementConforms - 04_ectp_rev_errs.py: PASS
--------------------------------------------------------------------
ElementSettingData - 01_forward.py: PASS
--------------------------------------------------------------------
ElementSettingData - 03_esd_assoc_with_rasd_errs.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
EnabledLogicalElementCapabilities - 02_elecap_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 01_enum.py: PASS
--------------------------------------------------------------------
HostSystem - 02_hostsystem_to_rasd.py: PASS
--------------------------------------------------------------------
HostSystem - 03_hs_to_settdefcap.py: PASS
--------------------------------------------------------------------
HostSystem - 04_hs_to_EAPF.py: PASS
--------------------------------------------------------------------
HostSystem - 05_hs_gi_errs.py: PASS
--------------------------------------------------------------------
HostSystem - 06_hs_to_vsms.py: PASS
--------------------------------------------------------------------
HostedDependency - 01_forward.py: PASS
--------------------------------------------------------------------
HostedDependency - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedDependency - 03_enabledstate.py: PASS
--------------------------------------------------------------------
HostedDependency - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 01_forward.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedResourcePool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
HostedService - 01_forward.py: PASS
--------------------------------------------------------------------
HostedService - 02_reverse.py: PASS
--------------------------------------------------------------------
HostedService - 03_forward_errs.py: PASS
--------------------------------------------------------------------
HostedService - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
KVMRedirectionSAP - 01_enum_KVMredSAP.py: SKIP
--------------------------------------------------------------------
LogicalDisk - 01_disk.py: PASS
--------------------------------------------------------------------
LogicalDisk - 02_nodevs.py: SKIP
ERROR - System has defined domains; unable to run
--------------------------------------------------------------------
LogicalDisk - 03_ld_gi_errs.py: PASS
--------------------------------------------------------------------
Memory - 01_memory.py: PASS
--------------------------------------------------------------------
Memory - 02_defgetmem.py: PASS
--------------------------------------------------------------------
Memory - 03_mem_gi_errs.py: PASS
--------------------------------------------------------------------
NetworkPort - 01_netport.py: PASS
--------------------------------------------------------------------
NetworkPort - 02_np_gi_errors.py: PASS
--------------------------------------------------------------------
NetworkPort - 03_user_netport.py: PASS
--------------------------------------------------------------------
Processor - 01_processor.py: PASS
--------------------------------------------------------------------
Processor - 02_definesys_get_procs.py: PASS
--------------------------------------------------------------------
Processor - 03_proc_gi_errs.py: PASS
--------------------------------------------------------------------
Profile - 01_enum.py: PASS
--------------------------------------------------------------------
Profile - 02_profile_to_elec.py: PASS
--------------------------------------------------------------------
Profile - 03_rprofile_gi_errs.py: PASS
--------------------------------------------------------------------
RASD - 01_verify_rasd_fields.py: PASS
--------------------------------------------------------------------
RASD - 02_enum.py: PASS
--------------------------------------------------------------------
RASD - 03_rasd_errs.py: PASS
--------------------------------------------------------------------
RASD - 04_disk_rasd_size.py: PASS
--------------------------------------------------------------------
RASD - 05_disk_rasd_emu_type.py: SKIP
--------------------------------------------------------------------
RedirectionService - 01_enum_crs.py: SKIP
--------------------------------------------------------------------
RedirectionService - 02_enum_crscap.py: SKIP
--------------------------------------------------------------------
RedirectionService - 03_RedirectionSAP_errs.py: SKIP
--------------------------------------------------------------------
ReferencedProfile - 01_verify_refprof.py: PASS
--------------------------------------------------------------------
ReferencedProfile - 02_refprofile_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 01_forward.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 02_reverse.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 03_forward_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 04_reverse_errs.py: PASS
--------------------------------------------------------------------
ResourceAllocationFromPool - 05_RAPF_err.py: PASS
--------------------------------------------------------------------
ResourcePool - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePool - 02_rp_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationCapabilities - 02_rpcc_gi_errs.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 01_enum.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 02_rcps_gi_errors.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 03_CreateResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 04_CreateChildResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 05_AddResourcesToResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 06_RemoveResourcesFromResourcePool.py: PASS
--------------------------------------------------------------------
ResourcePoolConfigurationService - 07_DeleteResourcePool.py: PASS
--------------------------------------------------------------------
SettingsDefine - 01_forward.py: PASS
--------------------------------------------------------------------
SettingsDefine - 02_reverse.py: PASS
--------------------------------------------------------------------
SettingsDefine - 03_sds_fwd_errs.py: PASS
--------------------------------------------------------------------
SettingsDefine - 04_sds_rev_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 01_forward.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 03_forward_errs.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 04_forward_vsmsdata.py: PASS
--------------------------------------------------------------------
SettingsDefineCapabilities - 05_reverse_vsmcap.py: PASS
--------------------------------------------------------------------
SystemDevice - 01_forward.py: PASS
--------------------------------------------------------------------
SystemDevice - 02_reverse.py: PASS
--------------------------------------------------------------------
SystemDevice - 03_fwderrs.py: PASS
--------------------------------------------------------------------
VSSD - 01_enum.py: PASS
--------------------------------------------------------------------
VSSD - 02_bootldr.py: SKIP
--------------------------------------------------------------------
VSSD - 03_vssd_gi_errs.py: PASS
--------------------------------------------------------------------
VSSD - 04_vssd_to_rasd.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementCapabilities - 02_vsmcap_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 01_definesystem_name.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 02_destroysystem.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 03_definesystem_ess.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 04_definesystem_ers.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 05_destroysystem_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 06_addresource.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 07_addresource_neg.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 08_modifyresource.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 10_hv_version.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 11_define_memrasdunits.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 13_refconfig_additional_devs.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 14_define_sys_disk.py: PASS
--------------------------------------------------------------------
VirtualSystemManagementService - 15_mod_system_settings.py: XFAIL
ERROR - rstest_domain not updated properly.
ERROR - Exp AutomaticRecoveryAction=3, got 2
Bug:<00010>
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationCapabilities - 02_vsmc_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationService - 01_migratable_host.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 02_host_migrate_type.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationService - 05_migratable_host_errs.py: SKIP
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemMigrationSettingData - 02_vsmsd_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 01_forward.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 02_reverse.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 03_vssdc_fwd_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSettingDataComponent - 04_vssdc_rev_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotService - 02_vs_sservice_gi_errs.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 01_enum.py: PASS
--------------------------------------------------------------------
VirtualSystemSnapshotServiceCapabilities - 02_vs_sservicecap_gi_errs.py: PASS
--------------------------------------------------------------------
--
Thanks and Regards,
Deepti B. Kalakeri
IBM Linux Technology Center
deeptik(a)linux.vnet.ibm.com
15 years, 10 months
[PATCH] [TEST] Update VSMS 12_referenced_config.py to use cim_() function
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1233605070 28800
# Node ID 4327fd7361d8107c8f7fc827d62162e9151ff6dd
# Parent fa1424f9b3f4ae005b4fcc34e18858035cc8f102
[TEST] Update VSMS 12_referenced_config.py to use cim_() function.
Also re-wrote part of this test to fix the overall test flow.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r fa1424f9b3f4 -r 4327fd7361d8 suites/libvirt-cim/cimtest/VirtualSystemManagementService/12_referenced_config.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/12_referenced_config.py Mon Feb 02 12:02:30 2009 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/12_referenced_config.py Mon Feb 02 12:04:30 2009 -0800
@@ -21,19 +21,15 @@
#
import sys
-import pywbem
-from XenKvmLib.common_util import create_using_definesystem, \
- call_request_state_change, \
- poll_for_state_change, get_cs_instance
-from XenKvmLib import vsms
-from VirtLib import utils
+from XenKvmLib.common_util import get_cs_instance
from CimTest.Globals import logger
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import FAIL, PASS
-from XenKvmLib.test_doms import destroy_and_undefine_domain
-from XenKvmLib.classes import get_typed_class
+from XenKvmLib.classes import get_typed_class, inst_to_mof
from XenKvmLib.assoc import AssociatorNames
from XenKvmLib.test_xml import dumpxml
+from XenKvmLib.vxml import get_class
+from XenKvmLib.rasd import get_default_rasds
sup_types = ['Xen', 'XenFV', 'KVM']
test_dom = 'rstest_domain'
@@ -41,21 +37,13 @@
mac = "aa:aa:aa:00:00:00"
-REQUESTED_STATE = 2
-TIME = "00000000000000.000000:000"
-
-def setup_first_guest(ip, virt):
- status = create_using_definesystem(test_dom, ip, virt=virt)
- if status != PASS:
+def setup_first_guest(ip, virt, cxml):
+ ret = cxml.cim_define(ip)
+ if not ret:
logger.error("Unable to define %s using DefineSystem()" % test_dom)
return FAIL
- rc = call_request_state_change(test_dom, ip, REQUESTED_STATE, TIME, virt)
- if rc != 0:
- logger.error("Unable to start %s" % test_dom)
- return FAIL
-
- status, cs = poll_for_state_change(ip, virt, test_dom, REQUESTED_STATE)
+ status = cxml.cim_start(ip)
if status != PASS:
logger.error("Unable to start %s" % test_dom)
return FAIL
@@ -70,7 +58,7 @@
cn = "ComputerSystem"
ccn = get_typed_class(virt, cn)
an = get_typed_class(virt, 'SettingsDefineState')
- vssd = AssociatorNames(ip, an, ccn, Name = test_dom, CreationClassName = ccn)
+ vssd = AssociatorNames(ip, an, ccn, Name=test_dom, CreationClassName=ccn)
if len(vssd) != 1:
logger.error("Returned %i vssd insts for '%s'", len(vssd), test_dom)
@@ -78,26 +66,33 @@
return vssd[0]
-def get_vssd_rasd(virt):
- vssd, def_rasd = vsms.default_vssd_rasd_str(dom_name=test_dom2,
- net_type='network',
- net_mac=mac, virt=virt)
+def setup_second_guest(ip, virt, cxml2, ref):
+ nrasd_cn = get_typed_class(virt, "NetResourceAllocationSettingData")
- rasd = []
- for inst in def_rasd:
- cn = get_typed_class(virt, "NetResourceAllocationSettingData")
- if cn in inst:
- rasd.append(inst)
+ rasds = get_default_rasds(ip, virt)
- params = {}
+ rasd_list = {}
- if len(rasd) != 1:
- return params
+ for rasd in rasds:
+ if rasd.classname == nrasd_cn:
+ rasd['Address'] = mac
+ rasd['NetworkType'] = "network"
+ rasd_list[nrasd_cn] = inst_to_mof(rasd)
+ else:
+ rasd_list[rasd.classname] = None
- params['vssd'] = vssd
- params['rasd'] = rasd
+ if rasd_list[nrasd_cn] is None:
+ logger.error("Unable to get template NetRASD")
+ return FAIL
- return params
+ cxml2.set_res_settings(rasd_list)
+
+ ret = cxml2.cim_define(ip, ref_conf=ref)
+ if not ret:
+ logger.error("Unable to define %s using DefineSystem()" % test_dom2)
+ return FAIL
+
+ return PASS
def get_dom_macs(server, dom, virt):
mac_list = []
@@ -118,8 +113,10 @@
def main():
options = main.options
+ cxml = get_class(options.virt)(test_dom)
+ cxml2 = get_class(options.virt)(test_dom2)
try:
- status = setup_first_guest(options.ip, options.virt)
+ status = setup_first_guest(options.ip, options.virt, cxml)
if status != PASS:
raise Exception("Unable to start %s" % test_dom)
@@ -127,14 +124,7 @@
if ref is None:
raise Exception("Unable to get %s reference" % test_dom)
- define_params = get_vssd_rasd(options.virt)
- if len(define_params) != 2:
- raise Exception("Unable to build VSSD and RASD instances for %s" % \
- test_dom2)
-
- status = create_using_definesystem(test_dom2, options.ip,
- params=define_params, ref_config=ref,
- virt=options.virt)
+ status = setup_second_guest(options.ip, options.virt, cxml2, ref)
if status != PASS:
raise Exception("Unable to define %s" % test_dom2)
@@ -159,8 +149,9 @@
logger.error(details)
status = FAIL
- destroy_and_undefine_domain(test_dom, options.ip, options.virt)
- destroy_and_undefine_domain(test_dom2, options.ip, options.virt)
+ cxml.cim_destroy(options.ip)
+ cxml.undefine(options.ip)
+ cxml2.undefine(options.ip)
return status
15 years, 10 months
[PATCH] [TEST]Fixing VSMS/05_migratable_host_errs.py tc by modifying it to use cim_define() and cim_start()
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1233646768 28800
# Node ID 847fc58984293f69ef35a4c5294737cf1f8e7156
# Parent 912b7615d48c8303fd3daa6e55669c6d66af23e4
[TEST]Fixing VSMS/05_migratable_host_errs.py tc by modifying it to use cim_define() and cim_start().
Also,
1) removed unnecessary import statements, Exception block.
2) Used meaningful variable names
3) Indented the tc to fit in 80 columns.
4) Added the missing destroy and undefine() calls.
Tested for Xen with current sources.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 912b7615d48c -r 847fc5898429 suites/libvirt-cim/cimtest/VirtualSystemMigrationService/05_migratable_host_errs.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/05_migratable_host_errs.py Mon Feb 02 04:45:23 2009 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/05_migratable_host_errs.py Mon Feb 02 23:39:28 2009 -0800
@@ -21,14 +21,12 @@
#
import sys
-import pywbem
from pywbem.cim_obj import CIMInstanceName
-from VirtLib import utils
from XenKvmLib import vxml
from XenKvmLib import vsmigrations
from CimTest.Globals import logger
from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL
+from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'XenFV']
@@ -39,49 +37,57 @@ exp_desc = 'Missing key (Name) in Comput
@do_main(sup_types)
def main():
options = main.options
+ server = options.ip
virt_xml = vxml.get_class(options.virt)
cxml = virt_xml(test_dom)
- ret = cxml.create(options.ip)
+ ret = cxml.cim_define(server)
if not ret:
- logger.error("Error create domain %s" % test_dom )
+ logger.error("Error define domain %s" % test_dom )
return FAIL
+ status = cxml.cim_start(server)
+ if status != PASS:
+ cxml.undefine(server)
+ logger.error("Error start domain %s" % test_dom )
+ return status
+
status = FAIL
- rc = -1
+ mig_successful = False
try:
- service = vsmigrations.Xen_VirtualSystemMigrationService(options.ip)
+ service = vsmigrations.Xen_VirtualSystemMigrationService(server)
except Exception:
- logger.error("Error when go to the class of Xen_VirtualSystemMigrationService")
+ logger.error("Error using Xen_VirtualSystemMigrationService")
+ cxml.destroy(server)
+ cxml.undefine(server)
return FAIL
classname = 'Xen_ComputerSystem'
- cs_ref = CIMInstanceName(classname, keybindings = {
- 'Wrong':test_dom,
- 'CreationClassName':classname})
+ cs_ref = CIMInstanceName(classname,
+ keybindings = { 'Wrong':test_dom,
+ 'CreationClassName':classname})
try:
service.CheckVirtualSystemIsMigratableToHost(ComputerSystem=cs_ref,
- DestinationHost=options.ip)
+ DestinationHost=server)
service.MigrateVirtualSystemToHost(ComputerSystem=cs_ref,
- DestinationHost=options.ip)
- rc = 0
- except pywbem.CIMError, (rc, desc):
+ DestinationHost=server)
+ mig_successful = True
+ except Exception, (rc, desc):
if rc == exp_rc and desc.find(exp_desc) >= 0:
- logger.info('Got expected rc code and error string.')
+ logger.info('Got expected rc code :%s', rc)
+ logger.info('Got expected error string:%s', desc)
status = PASS
else:
- logger.error('Unexpected rc code %s and description:\n %s' % (rc, desc))
- except Exception, details:
- logger.error('Unknown exception happened')
- logger.error(details)
+ logger.error('Unexpected rc code %s and description: %s', rc, desc)
- if rc == 0:
- logger.error('Migrate to host method should NOT return OK with a wrong key input')
+ if mig_successful == True:
+ logger.error('Migrate to host method should NOT return OK '
+ 'since wrong key was supplied')
- cxml.destroy(options.ip)
- cxml.undefine(options.ip)
+ cxml.destroy(server)
+ cxml.undefine(server)
return status
15 years, 10 months
[PATCH] [TEST] Update VSMS 03_definesystem_ess.py to use cim_define()
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1233604950 28800
# Node ID fa1424f9b3f4ae005b4fcc34e18858035cc8f102
# Parent 912b7615d48c8303fd3daa6e55669c6d66af23e4
[TEST] Update VSMS 03_definesystem_ess.py to use cim_define()
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 912b7615d48c -r fa1424f9b3f4 suites/libvirt-cim/cimtest/VirtualSystemManagementService/03_definesystem_ess.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/03_definesystem_ess.py Mon Feb 02 04:45:23 2009 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/03_definesystem_ess.py Mon Feb 02 12:02:30 2009 -0800
@@ -23,17 +23,14 @@
#
import sys
-import pywbem
-from VirtLib import utils
-from XenKvmLib import vsms
-from XenKvmLib.test_doms import undefine_test_domain
-from XenKvmLib.common_util import create_using_definesystem
+from pywbem import CIM_ERR_FAILED
from CimTest.Globals import logger
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.vxml import get_class
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
-exp_rc = 1 #CMPI_RC_ERR_FAILED
+exp_rc = CIM_ERR_FAILED
exp_desc = 'Unable to parse embedded object'
@do_main(sup_types)
@@ -42,25 +39,31 @@
dname = 'test_domain'
- vssd, rasd = vsms.default_vssd_rasd_str(dom_name=dname, virt=options.virt)
+ cxml = get_class(options.virt)(dname)
+ cxml.set_sys_settings("wrong")
- params = {'vssd' : 'wrong',
- 'rasd' : rasd
- }
+ ret = cxml.cim_define(options.ip)
+ if ret:
+ logger.error('DefineSystem should NOT return OK with a wrong ss input')
+ status = FAIL
- exp_err = {'exp_rc' : exp_rc,
- 'exp_desc' : exp_desc
- }
+ try:
+ if int(cxml.err_rc) != exp_rc:
+ raise Exception("Got rc: %d, exp %d." % (int(cxml.err_rc), exp_rc))
- rc = create_using_definesystem(dname, options.ip, params, ref_config=' ',
- exp_err=exp_err, virt=options.virt)
+ if cxml.err_desc.find(exp_desc) < 0:
+ raise Exception("Got desc: '%s', exp '%s'" % (cxml.err_desc,
+ exp_desc))
- if rc != PASS:
- logger.error('DefineSystem should NOT return OK with a wrong ss input')
+ status = PASS
- undefine_test_domain(dname, options.ip, virt=options.virt)
+ except Exception, details:
+ logger.error(details)
+ status = FAIL
- return rc
+ cxml.undefine(options.ip)
+
+ return status
if __name__ == "__main__":
sys.exit(main())
15 years, 10 months
[PATCH] Add a migration_tester.py tool
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1232519221 28800
# Node ID 6fa1f52dc8298b4d643fc94bb3f91715cc40dd58
# Parent e4f4e7c64325395494355516d4c111977f5b451a
Add a migration_tester.py tool.
This can be used to drive migration between two different hosts.
How to call the tester:
python tools/migrate_tester.py -u user -p pass -s fqdn:port -t fqdn guest_name
Ex:
python tools/migrate_tester.py -u root -p mypass -s my_host.my_domain.com:5988 -t my_target.my_domain.com my_guest
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r e4f4e7c64325 -r 6fa1f52dc829 tools/migration_tester.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/migration_tester.py Tue Jan 20 22:27:01 2009 -0800
@@ -0,0 +1,301 @@
+#!/usr/bin/python
+#
+# Copyright IBM Corp. 2009
+#
+# Authors:
+# Kaitlin Rupert <karupert(a)us.ibm.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser 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
+#
+
+import sys
+import time
+from optparse import OptionParser
+from pywbem import WBEMConnection, CIMInstanceName, CIMInstance, CIMError
+
+CIM_MIGRATE_OTHER=1
+CIM_MIGRATE_LIVE=2
+CIM_MIGRATE_RESUME=3
+CIM_MIGRATE_RESTART=4
+
+CIM_MIGRATE_URI_OTHER=1
+CIM_MIGRATE_URI_SSH=2
+CIM_MIGRATE_URI_TLS=3
+CIM_MIGRATE_URI_TLS_STRICT=4
+CIM_MIGRATE_URI_TCP=5
+CIM_MIGRATE_URI_UNIX=6
+
+CIM_JOBSTATE_COMPLETE=7
+
+class CIMClassMOF:
+
+ __supported_types = [int, str, bool]
+
+ def __init__(self, attrs = None):
+ """attrs should be dict
+ """
+
+ if attrs != None:
+ self.__dict__.update(attrs)
+
+ def mof(self):
+ """mof()
+
+ Return value is a string, containing the mof representation of the
+ object.
+
+ Attribute types supported are : int, str, bool.
+
+ Attributes with unsupported types will be silently ignored when
+ converting to mof representation.
+ """
+
+ mof_str = "instance of " + self.__class__.__name__ + " {\n"
+ for key, value in self.__dict__.items():
+ value_type = type(value)
+ if value_type not in self.__supported_types:
+ continue
+
+ mof_str += "%s = " % key
+ if value_type == int:
+ mof_str += "%d" % value
+ elif value_type == bool:
+ mof_str += str(value).lower()
+ else:
+ mof_str += '"%s"' % value
+ mof_str += ";\n"
+
+ mof_str += "};"
+ return mof_str
+
+ def __str__(self):
+ return self.mof()
+
+class CIM_VirtualSystemMigrationSettingData(CIMClassMOF):
+ def __init__(self, type, priority):
+ self.InstanceID = 'MigrationSettingData'
+ self.CreationClassName = self.__class__.__name__
+ self.MigrationType = type
+ self.Priority = priority
+
+class Xen_VirtualSystemMigrationSettingData(CIM_VirtualSystemMigrationSettingData):
+ def __init__(self, type, priority):
+ CIM_VirtualSystemMigrationSettingData.__init__(self, type, priority)
+
+class KVM_VirtualSystemMigrationSettingData(CIM_VirtualSystemMigrationSettingData):
+ def __init__(self, type, priority):
+ CIM_VirtualSystemMigrationSettingData.__init__(self, type, priority)
+
+def get_guest_ref(guest, virt):
+ guest_cn = "%s_ComputerSystem" % virt
+
+ keys = { 'Name' : guest,
+ 'CreationClassName' : guest_cn
+ }
+
+ try:
+ cs_ref = CIMInstanceName(guest_cn, keybindings=keys)
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return None
+
+ return cs_ref
+
+def get_msd(mtype, virt):
+ if mtype == "live":
+ mtype = CIM_MIGRATE_LIVE
+ elif mtype == "resume":
+ mtype = CIM_MIGRATE_RESUME
+ elif mtype == "restart":
+ mtype = CIM_MIGRATE_RESTART
+ else:
+ mtype = CIM_MIGRATE_OTHER
+
+ try:
+ vsmsd_cn_base = "_VirtualSystemMigrationSettingData"
+ msd = eval(virt + vsmsd_cn_base)(type=mtype, priority=0)
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return None
+
+ return msd.mof()
+
+def check_migrate(s_conn, cs_ref, ip, msd, virt):
+ vsms_cn = "%s_VirtualSystemMigrationService" % virt
+ try:
+ if msd == None:
+ res = s_conn.InvokeMethod("CheckVirtualSystemIsMigratableToHost",
+ vsms_cn,
+ ComputerSystem=cs_ref,
+ DestinationHost=ip)
+ else:
+ res = s_conn.InvokeMethod("CheckVirtualSystemIsMigratableToHost",
+ vsms_cn,
+ ComputerSystem=cs_ref,
+ DestinationHost=ip,
+ MigrationSettingData=msd)
+
+ if res == None or res[1]['IsMigratable'] != True:
+ print "Migration check failed."
+ return 1
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return 1
+
+ return 0
+
+def get_job_inst(s_conn, job_ref):
+ try:
+ inst = s_conn.GetInstance(job_ref)
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return None
+
+ return inst
+
+def poll_for_job_status(s_conn, job_ref):
+
+ job_inst = get_job_inst(s_conn, job_ref)
+ if not job_inst:
+ print "Unable to get job instance"
+ return 1
+
+ try:
+ while job_inst['JobState'] != CIM_JOBSTATE_COMPLETE:
+ time.sleep(3)
+ job_inst = get_job_inst(s_conn, job_ref)
+ if not job_inst:
+ print "Unable to get job instance"
+ return 1
+
+ if job_inst['Status'] != "Completed":
+ print "Migrate job failed: %s" % job_inst['Status']
+ return 1
+ except KeyboardInterrupt:
+ print "Migrate job took too long"
+ return 1
+
+ print "Migrate job succeeded: %s" % job_inst['Status']
+ return 0
+
+def migrate_host(s_conn, cs_ref, dest, msd, virt):
+ vsms_cn = "%s_VirtualSystemMigrationService" % virt
+
+ try:
+ if msd == None:
+ job = s_conn.InvokeMethod("MigrateVirtualSystemToHost",
+ vsms_cn,
+ ComputerSystem=cs_ref,
+ DestinationHost=dest)
+ else:
+ job = s_conn.InvokeMethod("MigrateVirtualSystemToHost",
+ vsms_cn,
+ ComputerSystem=cs_ref,
+ DestinationHost=dest,
+ MigrationSettingData=msd)
+
+ if len(job) < 1:
+ print "No job returned from migrate call"
+ return 1
+
+ status = poll_for_job_status(s_conn, job[1]['Job'])
+
+ except CIMError, (err_no, desc):
+ print err_no, desc
+ return 1
+
+ return 0
+
+def main():
+ usage = "usage: %prog [options] <target system>\nex: %prog my.target.com"
+ parser = OptionParser(usage)
+
+ parser.add_option("-s", "--src-url", dest="s_url", default="localhost:5988",
+ help="URL of CIMOM to connect to (host:port)")
+ parser.add_option("-t", "--target-url", dest="t_url",
+ default="localhost:5988",
+ help="URL of CIMOM to connect to (host:port)")
+ parser.add_option("-N", "--ns", dest="ns", default="root/virt",
+ help="Namespace (default is root/virt)")
+ parser.add_option("-u", "--user", dest="username", default=None,
+ help="HTTP Auth username")
+ parser.add_option("-p", "--pass", dest="password", default=None,
+ help="HTTP Auth password")
+ parser.add_option("-v", "--virt-type", dest="virt", default=None,
+ help="Virtualization type [ Xen | KVM ]")
+ parser.add_option("--migration-type", dest="type", default=None,
+ help="Migration type: [ live | resume | restart ]")
+ parser.add_option("--disable-check", dest="disable_ck", action="store_true",
+ help="Disable migration pre-check")
+
+ (options, args) = parser.parse_args()
+
+ if len(args) == 0:
+ print "Fatal: no guest specified."
+ sys.exit(1)
+
+ guest_name = args[0]
+
+ if ":" in options.s_url:
+ (sysname, port) = options.s_url.split(":")
+ else:
+ sysname = options.s_url
+
+ if ":" in options.t_url:
+ (t_sysname, port) = options.t_url.split(":")
+ else:
+ t_sysname = options.t_url
+
+ src_conn = WBEMConnection('http://%s' % sysname,
+ (options.username, options.password), options.ns)
+
+ guest_ref = get_guest_ref(guest_name, options.virt)
+ if guest_ref == None:
+ return 1
+
+ if options.virt == None:
+ print "Must specify virtualization type"
+ return 1
+
+ if options.virt != "Xen":
+ print "Only Xen migration is currently supported"
+ return 1
+
+ if options.type != None:
+ msd = get_msd(options.type, options.virt)
+ if msd == None:
+ return 1
+ else:
+ print "Using default MigrationSettingData"
+ msd = None
+
+ if not options.disable_ck:
+ status = check_migrate(src_conn, guest_ref, t_sysname, msd,
+ options.virt)
+ if status == 1:
+ return 1
+
+ print "Migrating %s.. this will take some time." % guest_name
+ status = migrate_host(src_conn, guest_ref, t_sysname, msd, options.virt)
+ return status
+
+if __name__=="__main__":
+ sys.exit(main())
+
+
15 years, 10 months