Xen Domain Management CIM-Provider
by Tej
I am trying to understand the provider implementation for Xen VM
lifecycle management.
Does the xen provider (libvirt/xen-cim) uses the xenstore to
access/change the configuration information regarding the domains.
e.g if Xen Client has to changes the memory allocation for any of the
domain (i assume discover of domain/UUID/domid is already done) then
can it uses xenstore to perform the operation in following way.
*xenstore-write /local/domain/domid/memory/target <value> (balloon watch node)*
Or Is there any other method to perform the same operations.
thanks in advance for any information or pointers
Tej
16 years, 5 months
[PATCH] [TEST] Convert NetworkPort.02_np_gi_errors.py for LXC support
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1216793420 25200
# Node ID 73fa12d7cfcbc69a683dde7e953996d447bceaab
# Parent 3703b7be5a107c67e901546978e974546b3d5562
[TEST] Convert NetworkPort.02_np_gi_errors.py for LXC support
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 3703b7be5a10 -r 73fa12d7cfcb suites/libvirt-cim/cimtest/NetworkPort/02_np_gi_errors.py
--- a/suites/libvirt-cim/cimtest/NetworkPort/02_np_gi_errors.py Wed Jul 16 07:23:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/NetworkPort/02_np_gi_errors.py Tue Jul 22 23:10:20 2008 -0700
@@ -31,11 +31,11 @@
from XenKvmLib import assoc
from XenKvmLib.common_util import try_getinstance
from XenKvmLib.classes import get_typed_class
-from XenKvmLib.vxml import XenXML, KVMXML, get_class
+from XenKvmLib.vxml import XenXML, KVMXML, LXCXML, get_class
from CimTest.ReturnCodes import PASS, SKIP
from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS, do_main
-sup_types = ['Xen', 'KVM', 'XenFV']
+sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
expr_values = {
@@ -242,8 +242,11 @@
test_dom = "nettest_domain"
test_mac = "00:11:22:33:44:55"
-
- vsxml = get_class(options.virt)(test_dom, mac=test_mac)
+
+ if options.virt == 'LXC':
+ vsxml = get_class(options.virt)(test_dom)
+ else:
+ vsxml = get_class(options.virt)(test_dom, mac=test_mac)
ret = vsxml.define(options.ip)
if ret != 1:
logger.error("Define domain failed!")
16 years, 5 months
[PATCH] Don't clobber KVM user-type network devices when we redefine a guest
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1216824788 25200
# Node ID caa024a3a0938bcb709df190a02fcce0d738c165
# Parent e8d39d291bb30a5337605c4ba97f20acb97ab859
Don't clobber KVM user-type network devices when we redefine a guest.
This also makes KVM_NetworkPort expose an instance for user-type interfaces,
and thus causes 03_user_netport to pass.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r e8d39d291bb3 -r caa024a3a093 libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Wed Jul 23 07:37:23 2008 -0700
+++ b/libxkutil/device_parsing.c Wed Jul 23 07:53:08 2008 -0700
@@ -310,6 +310,8 @@
ndev->source = strdup(DEFAULT_NETWORK);
CU_DEBUG("No network, taking default of `%s'\n",
ndev->source);
+ } else if (STREQC(ndev->type, "user")){
+ CU_DEBUG("Leaving source blank for user net type");
} else {
/* This likely indicates an unsupported
* network configuration
diff -r e8d39d291bb3 -r caa024a3a093 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Wed Jul 23 07:37:23 2008 -0700
+++ b/libxkutil/xmlgen.c Wed Jul 23 07:53:08 2008 -0700
@@ -244,12 +244,36 @@
return true;
}
+static bool user_net_to_xml(char **xml, struct virt_device *dev)
+{
+ int ret;
+ char *_xml;
+ struct net_device *net = &dev->dev.net;
+
+ ret = asprintf(&_xml,
+ "<interface type='%s'>\n"
+ " <mac address='%s'/>\n"
+ "</interface>\n",
+ net->type,
+ net->mac);
+ if (ret == -1)
+ return false;
+ else
+ astrcat(xml, _xml);
+
+ free(_xml);
+
+ return true;
+}
+
static bool net_to_xml(char **xml, struct virt_device *dev)
{
if (STREQ(dev->dev.net.type, "network"))
return network_net_to_xml(xml, dev);
else if (STREQ(dev->dev.net.type, "bridge"))
return bridge_net_to_xml(xml, dev);
+ else if (STREQ(dev->dev.net.type, "user"))
+ return user_net_to_xml(xml, dev);
else
return false;
}
16 years, 5 months
[PATCH] [TEST] #3 Fix potiential false positive in AC 01
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1216742122 25200
# Node ID 28e2e11309e79c9285a122ec1f387dc1f7511e7c
# Parent 3703b7be5a107c67e901546978e974546b3d5562
[TEST] #3 Fix potiential false positive in AC 01.
This test needs to verify enum of AC returns the same number of instances as the number of instances returned by enum of MemoryPool + ProcessorPool + DiskPool + NetworkPool.
Also, cleaned up the logic to verify that the ResourceType and the InstanceIDs of the AC instances match the Pool instances they're describing.
Updates from 1 to 2:
-Create a disk pool and network pool to ensure there is an instance for each pool type.
-Add comment explaining the purpose of the test.
Updates from 2 to 3:
-Change if len(pools) < 1 to if len(pools) < 4
-Add log message if this if statement fails.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 3703b7be5a10 -r 28e2e11309e7 suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py
--- a/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py Wed Jul 16 07:23:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/AllocationCapabilities/01_enum.py Tue Jul 22 08:55:22 2008 -0700
@@ -20,63 +20,98 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+# This test verifies the enum of AC returns the same number of instances as
+# the number of instances returned by enum of:
+# MemoryPool + ProcessorPool + DiskPool + NetworkPool.
+#
import sys
+from VirtLib.live import virsh_version
from XenKvmLib import enumclass
from CimTest.Globals import do_main
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, platform_sup
from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.common_util import cleanup_restore, create_diskpool_conf, \
+ create_netpool_conf, destroy_netpool
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
+
+def enum_pools_and_ac(ip, virt, cn):
+ pools = {}
+ ac = []
+
+ pt = ['MemoryPool', 'ProcessorPool', 'DiskPool', 'NetworkPool']
+
+ try:
+ key = ["InstanceID"]
+ ac = enumclass.enumerate(ip, cn, key, virt)
+
+ for p in pt:
+ enum_list = enumclass.enumerate(ip, p, key, virt)
+
+ if len(enum_list) < 1:
+ logger.error("%s did not return any instances" % p)
+ return pools, ac
+
+ for pool in enum_list:
+ pools[pool.InstanceID] = pool
+
+ except Exception, details:
+ logger.error(CIM_ERROR_ENUMERATE, cn)
+ logger.error(details)
+ return pools, ac
+
+ if len(ac) != len(pools):
+ logger.error("%s returned %s instances, expected %s" % (cn, len(ac),
+ len(pools)))
+ return pools, ac
+
+def compare_pool_to_ac(ac, pools, cn):
+ try:
+ for inst in ac:
+ id = inst.InstanceID
+ if pools[id].ResourceType != inst.ResourceType:
+ logger.error("%s ResourceType %s, Pool ResourceType %s" % (cn,
+ inst.ResourceType, pools[id].ResourceType))
+ return FAIL
+
+ except Exception, details:
+ logger.error("%s returned instance with unexpected InstanceID %s" % (cn,
+ details))
+ return FAIL
+
+ return PASS
+
@do_main(sup_types)
def main():
options = main.options
- pools = {}
- pt = ['MemoryPool', 'ProcessorPool', 'DiskPool', 'NetworkPool']
- try:
- key_list = ["InstanceID"]
- ac = enumclass.enumerate(options.ip,
- "AllocationCapabilities",
- key_list,
- options.virt)
- pools['MemoryPool'] = enumclass.enumerate(options.ip,
- "MemoryPool",
- key_list,
- options.virt)
- pools['ProcessorPool'] = enumclass.enumerate(options.ip,
- "ProcessorPool",
- key_list,
- options.virt)
- pools['DiskPool'] = enumclass.enumerate(options.ip,
- "DiskPool",
- key_list,
- options.virt)
- pools['NetworkPool'] = enumclass.enumerate(options.ip,
- "NetworkPool",
- key_list,
- options.virt)
- except Exception:
- logger.error(CIM_ERROR_ENUMERATE, '%s_AllocationCapabilities' % options.virt)
- return FAIL
-
- acset = set([(x.InstanceID, x.ResourceType) for x in ac])
- poolset = set()
- for pl in pools.values():
- for x in pl:
- poolset.add((x.InstanceID, x.ResourceType))
+ cn = 'AllocationCapabilities'
- if len(acset) != len(poolset):
- logger.error(
- 'AllocationCapabilities return %i instances, excepted %i'
- % (ac_size, pool_size))
- return FAIL
- zeroset = acset - poolset
- if len(zeroset) != 0:
- logger.error('AC is inconsistent with pools')
+ status, diskid = create_diskpool_conf(options.ip, options.virt)
+ if status != PASS:
+ cleanup_restore(options.ip, options.virt)
+ return FAIL
+
+ status, test_network = create_netpool_conf(options.ip, options.virt)
+ if status != PASS:
+ cleanup_restore(options.ip, options.virt)
+ destroy_netpool(options.ip, options.virt, test_network)
+ return FAIL
+
+ pools, ac = enum_pools_and_ac(options.ip, options.virt, cn)
+ if len(pools) < 4:
+ logger.error("Only %d pools returned, expected at least 4" % len(pools))
+ cleanup_restore(options.ip, options.virt)
+ destroy_netpool(options.ip, options.virt, test_network)
return FAIL
- return PASS
+ status = compare_pool_to_ac(ac, pools, cn)
+
+ cleanup_restore(options.ip, options.virt)
+ destroy_netpool(options.ip, options.virt, test_network)
+
+ return status
if __name__ == "__main__":
sys.exit(main())
16 years, 5 months
[PATCH] [TEST] #4 Fix CS 22 to use providers instead of virsh
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1216741569 25200
# Node ID 0b2f67eed74e01561029d4c46fc8d54716e9b462
# Parent 9fb3407dd5098ab438653d4854d77b44ff9888e1
[TEST] #4 Fix CS 22 to use providers instead of virsh.
This test was defining a guest with virsh and then suspending it with virsh, which doesn't touch the providers in anyway. Now the test calls DefineSystem() and RequestStateChange().
Updates from 1 to 2:
-Add check to verify guest is the expected state after the RequestStateChange() call.
-Create a network pool because the VSMS provider requires a network pool to exist in order to create a guest.
Updates from 2 to 3:
-Remove destroy_netpool() if create_netpool_conf() fails. This is not needed.
Updates from 3 to 4:
-Changed log message from "%s not in defined state as expected." to "%s should have been in defined state"
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 9fb3407dd509 -r 0b2f67eed74e suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py Mon Jul 21 09:51:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/22_define_suspend.py Tue Jul 22 08:46:09 2008 -0700
@@ -32,54 +32,71 @@
from XenKvmLib import computersystem
from VirtLib import utils
from XenKvmLib import vxml
-from XenKvmLib.test_doms import destroy_and_undefine_all
-from CimTest.Globals import do_main
-from CimTest import Globals
+from XenKvmLib.test_doms import destroy_and_undefine_domain
+from CimTest.Globals import do_main, logger
from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.common_util import create_using_definesystem, \
+ call_request_state_change, get_cs_instance, \
+ create_netpool_conf, destroy_netpool
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "domgst"
+DEFINE_STATE = 3
+SUSPND_STATE = 9
+TIME = "00000000000000.000000:000"
+
+def chk_state(domain_name, ip, en_state, virt):
+ rc, cs = get_cs_instance(domain_name, ip, virt)
+ if rc != 0:
+ return rc
+
+ if cs.EnabledState != en_state:
+ logger.error("EnabledState should be %d not %d",
+ en_state, cs.EnabledState)
+ return FAIL
+
+ return PASS
+
@do_main(sup_types)
def main():
options = main.options
- status = FAIL
-
- cxml = vxml.get_class(options.virt)(test_dom)
-#define VS
+ status, test_network = create_netpool_conf(options.ip, options.virt)
+ if status != PASS:
+ return FAIL
+
try:
- ret = cxml.define(options.ip)
- if not ret:
- Globals.logger.error(Globals.VIRSH_ERROR_DEFINE % test_dom)
- return status
-
- cs = computersystem.get_cs_class(options.virt)(options.ip, test_dom)
- if not (cs.Name == test_dom) :
- Globals.logger.error("Error: VS %s not found" % test_dom)
- cxml.undefine(options.ip)
+ # define the vs
+ status = create_using_definesystem(test_dom, options.ip,
+ virt=options.virt)
+ if status != PASS:
+ logger.error("Unable to define %s using DefineSystem()" % test_dom)
+ destroy_netpool(options.ip, options.virt, test_network)
return status
- except Exception, detail:
- Globals.logger.error("Errors: %s" % detail)
+ # suspend the vs
+ status = call_request_state_change(test_dom, options.ip, SUSPND_STATE,
+ TIME, virt=options.virt)
+ if status != PASS:
+ logger.info("Suspending defined %s failed, as expected" % test_dom)
+ status = PASS
-#Suspend the defined VS
-
- try:
- ret = cxml.run_virsh_cmd(options.ip, "suspend")
- if not ret :
- Globals.logger.info("Suspending defined VS %s failed, as expected" \
-% test_dom)
- status = PASS
+ status = chk_state(test_dom, options.ip, DEFINE_STATE, options.virt)
+ if status != PASS:
+ logger.error("%s should have been in defined state" % test_dom)
+ status = FAIL
+
else :
- Globals.logger.info("Error: Suspending defined VS %s should not \
-have been allowed" % test_dom)
+ logger.error("Suspending defined %s should have failed" % test_dom)
status = FAIL
except Exception, detail:
- Globals.logger.error("Error: %s" % detail)
+ logger.error("Error: %s" % detail)
+ status = FAIL
- ret = cxml.undefine(options.ip)
+ destroy_netpool(options.ip, options.virt, test_network)
+ destroy_and_undefine_domain(test_dom, options.ip, options.virt)
return status
if __name__ == "__main__":
16 years, 5 months
[PATCH] [TEST] #2 Convert VirtualSystemMigrationService.05 to support XenFV
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1216798356 25200
# Node ID 567173832c7fb213be726e0dff29cc1b559449f8
# Parent 3703b7be5a107c67e901546978e974546b3d5562
[TEST] #2 Convert VirtualSystemMigrationService.05 to support XenFV
Updates from 1 to 2:
Change the destroy_and_undefine_domain() calls to .destroy() and .undefine() calls
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 3703b7be5a10 -r 567173832c7f suites/libvirt-cim/cimtest/VirtualSystemMigrationService/05_migratable_host_errs.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/05_migratable_host_errs.py Wed Jul 16 07:23:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/05_migratable_host_errs.py Wed Jul 23 00:32:36 2008 -0700
@@ -24,14 +24,13 @@
import pywbem
from pywbem.cim_obj import CIMInstanceName
from VirtLib import utils
-from XenKvmLib.test_doms import define_test_domain, start_test_domain, destroy_and_undefine_domain
-from XenKvmLib.test_xml import *
+from XenKvmLib import vxml
from XenKvmLib import computersystem
from XenKvmLib import vsmigrations
from CimTest.Globals import logger, do_main
from CimTest.ReturnCodes import PASS, FAIL, XFAIL
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV']
test_dom = 'dom_migration'
exp_rc = 1 #CIM_ERR_FAILED
@@ -40,23 +39,17 @@
@do_main(sup_types)
def main():
options = main.options
- xmlfile = testxml(test_dom)
+
+ virt_xml = vxml.get_class(options.virt)
+ cxml = virt_xml(test_dom)
+ ret = cxml.create(options.ip)
+ if not ret:
+ logger.error("Error create domain %s" % test_dom )
+ return FAIL
status = FAIL
rc = -1
- try:
- define_test_domain(xmlfile, options.ip)
- except Exception:
- logger.error("Error define domain %s" % test_dom)
- return FAIL
-
- try:
- start_test_domain(test_dom, options.ip)
- except Exception:
- logger.error("Error start domain %s" % test_dom)
- return FAIL
-
try:
service = vsmigrations.Xen_VirtualSystemMigrationService(options.ip)
except Exception:
@@ -87,7 +80,9 @@
if rc == 0:
logger.error('Migrate to host method should NOT return OK with a wrong key input')
- destroy_and_undefine_domain(test_dom, options.ip)
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
+
return status
if __name__ == "__main__":
16 years, 6 months
[PATCH] [TEST] #2 Convert VirtualSystemMigrationService.02 for XenFV support
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1216798202 25200
# Node ID 5fd2b27efd0c0da47d15b9f365dba667293baca0
# Parent 3703b7be5a107c67e901546978e974546b3d5562
[TEST] #2 Convert VirtualSystemMigrationService.02 for XenFV support
Updates from 1 to 2:
1) Change the destroy_and_undefine_domain() calls to .destroy() and .undefine() calls
2) Remove time.sleep(10), call poll_for_state_change() to check to see if the guest is running before moving on
3) Cancle virt default setting in internal function
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 3703b7be5a10 -r 5fd2b27efd0c suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py Wed Jul 16 07:23:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py Wed Jul 23 00:30:02 2008 -0700
@@ -25,8 +25,8 @@
import pywbem
from pywbem.cim_obj import CIMInstanceName
from VirtLib import utils
-from XenKvmLib.test_doms import define_test_domain, start_test_domain, destroy_and_undefine_domain
-from XenKvmLib.test_xml import *
+from XenKvmLib import vxml
+from XenKvmLib.common_util import poll_for_state_change
from XenKvmLib import computersystem
from XenKvmLib import vsmigrations
from XenKvmLib.vsmigrations import check_possible_host_migration, migrate_guest_to_host, check_migration_job
@@ -34,17 +34,19 @@
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, do_main
from CimTest.ReturnCodes import PASS, FAIL, XFAIL
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV']
dom_name = 'dom_migrate'
+REQUESTED_STATE = 2
-def define_guest_get_ref(ip, guest_name):
+def define_guest_get_ref(ip, guest_name, virt):
try:
- xmlfile = testxml(guest_name)
- define_test_domain(xmlfile, ip)
+ virt_xml = vxml.get_class(virt)
+ cxml = virt_xml(guest_name)
+ cxml.define(ip)
except Exception:
logger.error("Error define domain %s" % guest_name)
- destroy_and_undefine_domain(guest_name, options.ip)
+ cxml.undefine(ip)
return FAIL, None
classname = 'Xen_ComputerSystem'
@@ -54,18 +56,18 @@
return PASS, cs_ref
-def setup_env(ip, migration_list, local_migrate):
+def setup_env(ip, migration_list, local_migrate, virt):
ref_list = []
if local_migrate == 1:
for i in range(0, len(migration_list)):
guest_name = "%s-%i" % (dom_name, i)
- status, ref = define_guest_get_ref(ip, guest_name)
+ status, ref = define_guest_get_ref(ip, guest_name, virt)
if status != PASS:
return FAIL, None
ref_list.append(ref)
else:
- status, ref = define_guest_get_ref(ip, dom_name)
+ status, ref = define_guest_get_ref(ip, dom_name, virt)
if status != PASS:
return FAIL, None
ref_list.append(ref)
@@ -90,16 +92,24 @@
return migration_list
-def start_guest(ip, guest_name, type):
+def start_guest(ip, guest_name, type, virt):
if type != "Offline":
try:
- start_test_domain(guest_name, ip)
- time.sleep(10)
+ virt_xml = vxml.get_class(virt)
+ cxml = virt_xml(guest_name)
+ cxml.start(ip)
+
+ status = poll_for_state_change(ip, virt, guest_name,
+ REQUESTED_STATE)
+ if status != PASS:
+ raise Exception("%s didn't change state as expected" % guest_name)
+ return FAIL, None
+
except Exception:
logger.error("Error start domain %s" % guest_name)
- return FAIL
+ return FAIL, None
- return PASS
+ return PASS, cxml
@do_main(sup_types)
def main():
@@ -126,7 +136,7 @@
ref_list = []
cs_ref = None
- status, ref_list = setup_env(options.ip, mlist, local_migrate)
+ status, ref_list = setup_env(options.ip, mlist, local_migrate, options.virt)
if status != PASS or len(ref_list) < 1:
return FAIL
@@ -135,7 +145,7 @@
for type, item in mlist.iteritems():
guest_name = cs_ref['Name']
- status = start_guest(options.ip, guest_name, type)
+ status, cxml = start_guest(options.ip, guest_name, type, options.virt)
if status != PASS:
break
@@ -149,7 +159,8 @@
if status == FAIL:
logger.error("MigrateVirtualSystemToHost: unexpected list length %s"
% len(ret))
- destroy_and_undefine_domain(dom_name, options.ip)
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
return status
elif len(ret) == 2:
id = ret[1]['Job'].keybindings['InstanceID']
@@ -161,13 +172,15 @@
#Get new ref
if local_migrate == 1:
- destroy_and_undefine_domain(guest_name, options.ip)
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
ref_list.remove(cs_ref)
if len(ref_list) > 0:
cs_ref = ref_list[0]
if local_migrate == 0:
- destroy_and_undefine_domain(dom_name, options.ip)
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
return status
16 years, 6 months
[PATCH] [TEST] #2 Convert VirtualSystemMigrationService.01 to support XenFV
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1216797825 25200
# Node ID 8fa80a82ac8cae0885c5d82cafde0b4e0d07a29e
# Parent 3703b7be5a107c67e901546978e974546b3d5562
[TEST] #2 Convert VirtualSystemMigrationService.01 to support XenFV
Updates from 1 to 2:
1) Change the destroy_and_undefine_domain() calls to .destroy() and .undefine() calls
2) Remove time.sleep(10), call poll_for_state_change() to check to see if the guest is running before moving on
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 3703b7be5a10 -r 8fa80a82ac8c suites/libvirt-cim/cimtest/VirtualSystemMigrationService/01_migratable_host.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/01_migratable_host.py Wed Jul 16 07:23:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/01_migratable_host.py Wed Jul 23 00:23:45 2008 -0700
@@ -27,8 +27,8 @@
import pywbem
from pywbem.cim_obj import CIMInstanceName
from VirtLib import utils
-from XenKvmLib.test_doms import define_test_domain, start_test_domain, destroy_and_undefine_domain
-from XenKvmLib.test_xml import *
+from XenKvmLib import vxml
+from XenKvmLib.common_util import poll_for_state_change
from XenKvmLib import computersystem
from XenKvmLib import vsmigrations
from XenKvmLib.vsmigrations import check_possible_host_migration, migrate_guest_to_host, check_migration_job
@@ -36,24 +36,24 @@
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, do_main
from CimTest.ReturnCodes import PASS, FAIL, XFAIL
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV']
dom_name = 'dom_migrate'
-def start_guest_get_ref(ip, guest_name):
- try:
- xmlfile = testxml(guest_name)
- ret = define_test_domain(xmlfile, ip)
- if not ret:
- return FAIL, None
+REQUESTED_STATE = 2
- ret = start_test_domain(guest_name, ip)
- if not ret:
- return FAIL, None
+def start_guest_get_ref(ip, guest_name, virt):
+ virt_xml = vxml.get_class(virt)
+ cxml = virt_xml(guest_name)
+ ret = cxml.create(ip)
+ if not ret:
+ logger.error("Error create domain %s" % guest_name)
+ return FAIL
- time.sleep(10)
- except Exception:
- logger.error("Error creating domain %s" % guest_name)
- return FAIL, None
+ status = poll_for_state_change(ip, virt, guest_name,
+ REQUESTED_STATE)
+ if status != PASS:
+ raise Exception("%s didn't change state as expected" % guest_name)
+ return FAIL
classname = 'Xen_ComputerSystem'
cs_ref = CIMInstanceName(classname, keybindings = {
@@ -61,9 +61,9 @@
'CreationClassName':classname})
if cs_ref is None:
- return FAIL, None
+ return FAIL, None, cxml
- return PASS, cs_ref
+ return PASS, cs_ref, cxml
@do_main(sup_types)
def main():
@@ -85,23 +85,26 @@
else:
local_migrate = 0
- status, cs_ref = start_guest_get_ref(options.ip, dom_name)
+ status, cs_ref, cxml = start_guest_get_ref(options.ip, dom_name, options.virt)
if status != PASS:
- destroy_and_undefine_domain(guest_name, options.ip)
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
return FAIL
guest_name = cs_ref['Name']
status = check_possible_host_migration(service, cs_ref, target_ip)
if status != PASS:
- destroy_and_undefine_domain(dom_name, options.ip)
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
return FAIL
status, ret = migrate_guest_to_host(service, cs_ref, target_ip)
if status == FAIL:
logger.error("MigrateVirtualSystemToHost: unexpected list length %s"
% len(ret))
- destroy_and_undefine_domain(dom_name, options.ip)
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
return status
elif len(ret) == 2:
id = ret[1]['Job'].keybindings['InstanceID']
@@ -109,8 +112,8 @@
status = check_migration_job(options.ip, id, target_ip,
guest_name, local_migrate)
-
- destroy_and_undefine_domain(dom_name, options.ip)
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
return status
16 years, 6 months
[TEST] Cimtest Report for LXC on F9 (2008/07/21)
by Guo Lian Yun
stro: Fedora 9 Beta
kernel-2.6.25-0.218.rc8.git7.fc9.x86_64
CIMOM: tog-pegasus-2.7.0-6.fc9.x86_64
cimtest: changeset-249
==================================================================
PASS : 90
XFAIL : 1
FAIL : 1
SKIP : 38
-----------------
Total : 130
======================CIMTEST 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: FAIL
ERROR - Error: property values are not set for VS domguest
ComputerSystem - 05_activate_defined_start.py: XFAIL Bug: 00002
ERROR - ERROR: VS DomST1 transition from Defined State to Activate state
was not Successful
Bug:<00002>
ComputerSystem - 06_paused_active_suspend.py: SKIP
ComputerSystem - 22_define_suspend.py: PASS
ComputerSystem - 23_suspend_suspend.py: SKIP
ComputerSystem - 27_define_suspend_errs.py: PASS
ComputerSystem - 32_start_reboot.py: SKIP
ComputerSystem - 33_suspend_reboot.py: SKIP
ComputerSystem - 35_start_reset.py: SKIP
ComputerSystem - 40_RSC_start.py: SKIP
ComputerSystem - 41_cs_to_settingdefinestate.py: SKIP
ComputerSystem - 42_cs_gi_errs.py: PASS
ComputerSystemIndication - 01_created_indication.py: SKIP
ElementAllocatedFromPool - 01_forward.py: PASS
ElementAllocatedFromPool - 02_reverse.py: SKIP
ElementAllocatedFromPool - 03_reverse_errs.py: SKIP
ElementAllocatedFromPool - 04_forward_errs.py: SKIP
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: SKIP
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: SKIP
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: SKIP
LogicalDisk - 02_nodevs.py: SKIP
ERROR - System has defined domains; unable to run
LogicalDisk - 03_ld_gi_errs.py: SKIP
Memory - 01_memory.py: PASS
Memory - 02_defgetmem.py: PASS
Memory - 03_mem_gi_errs.py: PASS
NetworkPort - 01_netport.py: SKIP
NetworkPort - 02_np_gi_errors.py: SKIP
NetworkPort - 03_user_netport.py: SKIP
Processor - 01_processor.py: SKIP
Processor - 02_definesys_get_procs.py: SKIP
Processor - 03_proc_gi_errs.py: SKIP
Profile - 01_enum.py: PASS
Profile - 02_profile_to_elec.py: SKIP
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
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: SKIP
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: SKIP
ResourcePoolConfigurationService - 04_CreateChildResourcePool.py: SKIP
ResourcePoolConfigurationService - 05_AddResourcesToResourcePool.py: SKIP
ResourcePoolConfigurationService - 06_RemoveResourcesFromResourcePool.py:
SKIP
ResourcePoolConfigurationService - 07_DeleteResourcePool.py: SKIP
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: SKIP
VirtualSystemManagementService - 07_addresource_neg.py: PASS
VirtualSystemManagementService - 08_modifyresource.py: SKIP
VirtualSystemManagementService - 09_procrasd_persist.py: SKIP
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: SKIP
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
Best,
Regards
Daisy (运国莲)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol(a)cn.ibm.com
TEL: (86)-21-60922403
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203
16 years, 6 months
[PATCH] [TEST] Update VSMigrationS.02 for XenFV support, also convert test_xml call to vxml
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1216721594 25200
# Node ID 4aecbb8cdaeef5b7c13517a08cd411c27bc429ca
# Parent 3703b7be5a107c67e901546978e974546b3d5562
[TEST] Update VSMigrationS.02 for XenFV support, also convert test_xml call to vxml
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 3703b7be5a10 -r 4aecbb8cdaee suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py Wed Jul 16 07:23:32 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemMigrationService/02_host_migrate_type.py Tue Jul 22 03:13:14 2008 -0700
@@ -25,8 +25,8 @@
import pywbem
from pywbem.cim_obj import CIMInstanceName
from VirtLib import utils
-from XenKvmLib.test_doms import define_test_domain, start_test_domain, destroy_and_undefine_domain
-from XenKvmLib.test_xml import *
+from XenKvmLib.test_doms import destroy_and_undefine_domain
+from XenKvmLib import vxml
from XenKvmLib import computersystem
from XenKvmLib import vsmigrations
from XenKvmLib.vsmigrations import check_possible_host_migration, migrate_guest_to_host, check_migration_job
@@ -34,14 +34,15 @@
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE, do_main
from CimTest.ReturnCodes import PASS, FAIL, XFAIL
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV']
dom_name = 'dom_migrate'
-def define_guest_get_ref(ip, guest_name):
+def define_guest_get_ref(ip, guest_name, virt='Xen'):
try:
- xmlfile = testxml(guest_name)
- define_test_domain(xmlfile, ip)
+ virt_xml = vxml.get_class(virt)
+ cxml = virt_xml(guest_name)
+ cxml.define(ip)
except Exception:
logger.error("Error define domain %s" % guest_name)
destroy_and_undefine_domain(guest_name, options.ip)
@@ -54,18 +55,18 @@
return PASS, cs_ref
-def setup_env(ip, migration_list, local_migrate):
+def setup_env(ip, migration_list, local_migrate, virt='Xen'):
ref_list = []
if local_migrate == 1:
for i in range(0, len(migration_list)):
guest_name = "%s-%i" % (dom_name, i)
- status, ref = define_guest_get_ref(ip, guest_name)
+ status, ref = define_guest_get_ref(ip, guest_name, virt)
if status != PASS:
return FAIL, None
ref_list.append(ref)
else:
- status, ref = define_guest_get_ref(ip, dom_name)
+ status, ref = define_guest_get_ref(ip, dom_name, virt)
if status != PASS:
return FAIL, None
ref_list.append(ref)
@@ -90,10 +91,13 @@
return migration_list
-def start_guest(ip, guest_name, type):
+def start_guest(ip, guest_name, type, virt='Xen'):
if type != "Offline":
try:
- start_test_domain(guest_name, ip)
+ virt_xml = vxml.get_class(virt)
+ cxml = virt_xml(guest_name)
+ cxml.start(ip)
+
time.sleep(10)
except Exception:
logger.error("Error start domain %s" % guest_name)
@@ -126,7 +130,7 @@
ref_list = []
cs_ref = None
- status, ref_list = setup_env(options.ip, mlist, local_migrate)
+ status, ref_list = setup_env(options.ip, mlist, local_migrate, options.virt)
if status != PASS or len(ref_list) < 1:
return FAIL
@@ -135,7 +139,7 @@
for type, item in mlist.iteritems():
guest_name = cs_ref['Name']
- status = start_guest(options.ip, guest_name, type)
+ status = start_guest(options.ip, guest_name, type, options.virt)
if status != PASS:
break
16 years, 6 months