[PATCH] [TEST] Adding verification for DestroySystem() of the domain

# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1252590021 14400 # Node ID 53b05fc42fbc04ce45eea4a09ad84881fbcf6d3e # Parent 30196cc506c07d81642c94a01fc65b34421c0714 [TEST] Adding verification for DestroySystem() of the domain. Tested with KVM and current sources on SLES11. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> diff -r 30196cc506c0 -r 53b05fc42fbc suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py Wed Sep 02 05:11:16 2009 -0700 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py Thu Sep 10 09:40:21 2009 -0400 @@ -27,8 +27,9 @@ from VirtLib import utils from XenKvmLib.xm_virt_util import domain_list, active_domain_list from XenKvmLib import vsms, vxml +from XenKvmLib.common_util import poll_for_state_change from XenKvmLib.classes import get_typed_class -from XenKvmLib.const import do_main +from XenKvmLib.const import do_main, CIM_DISABLE from CimTest.Globals import logger from CimTest.ReturnCodes import PASS, FAIL @@ -45,44 +46,49 @@ service = vsms.get_vsms_class(options.virt)(options.ip) cxml = vxml.get_class(options.virt)(default_dom) - ret = cxml.cim_define(options.ip) - if not ret: - logger.error("Failed to define the dom: %s", default_dom) - return FAIL - ret = cxml.start(options.ip) - if not ret: - logger.error("Failed to start the dom: %s", default_dom) - cleanup_env(options.ip, cxml) - return FAIL - classname = get_typed_class(options.virt, 'ComputerSystem') - cs_ref = CIMInstanceName(classname, keybindings = { - 'Name':default_dom, - 'CreationClassName':classname}) - list_before = domain_list(options.ip, options.virt) - if default_dom not in list_before: - logger.error("Domain not in domain list") - cleanup_env(options.ip, cxml) - return FAIL + try: + ret = cxml.cim_define(options.ip) + if not ret: + logger.error("Failed to define the dom: %s", default_dom) + return FAIL + + ret = cxml.cim_start(options.ip) + if ret: + logger.error("Failed to start the dom: %s", default_dom) + cxml.undefine(options.ip) + return FAIL + + list_before = domain_list(options.ip, options.virt) + if default_dom not in list_before: + raise Exception("Domain not in domain list") - try: - service.DestroySystem(AffectedSystem=cs_ref) + ret = cxml.cim_destroy(options.ip) + if not ret: + raise Exception("Failed to destroy dom '%s'" % default_dom) + + list_after = domain_list(options.ip, options.virt) + + if default_dom in list_after: + raise Exception("Domain '%s' not destroyed: provider didn't " \ + "return error" % default_dom) + + status, dom_cs = poll_for_state_change(options.ip, options.virt, + default_dom, CIM_DISABLE) + if status != PASS: + raise Exception("RequestedState for dom '%s' is not '%s'"\ + % (default_dom, CIM_DISABLE)) + + ret = cxml.undefine(options.ip) + if not ret: + logger.error("Failed to undefine domain '%s'", default_dom) + return FAIL + except Exception, details: - logger.error('Unknow exception happened') logger.error(details) cleanup_env(options.ip, cxml) return FAIL - list_after = domain_list(options.ip, options.virt) - - if default_dom in list_after: - logger.error("Domain %s not destroyed: provider didn't return error", - default_dom) - cleanup_env(options.ip, cxml) - status = FAIL - else: - status = PASS - return status

Deepti B. Kalakeri wrote:
# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1252590021 14400 # Node ID 53b05fc42fbc04ce45eea4a09ad84881fbcf6d3e # Parent 30196cc506c07d81642c94a01fc65b34421c0714 [TEST] Adding verification for DestroySystem() of the domain.
Tested with KVM and current sources on SLES11. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com>
diff -r 30196cc506c0 -r 53b05fc42fbc suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py
I get the following failure: Starting test suite: libvirt-cim Cleaned log files. Testing KVM hypervisor -------------------------------------------------------------------- VirtualSystemManagementService - 02_destroysystem.py: FAIL ERROR - CS instance not returned for test_domain. ERROR - RequestedState for dom 'test_domain' is not '3' Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found -------------------------------------------------------------------- However, the test passes for me if the patch isn't applied. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
Deepti B. Kalakeri wrote:
# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1252590021 14400 # Node ID 53b05fc42fbc04ce45eea4a09ad84881fbcf6d3e # Parent 30196cc506c07d81642c94a01fc65b34421c0714 [TEST] Adding verification for DestroySystem() of the domain.
Tested with KVM and current sources on SLES11. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com>
diff -r 30196cc506c0 -r 53b05fc42fbc suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py
I get the following failure:
Starting test suite: libvirt-cim Cleaned log files.
Testing KVM hypervisor -------------------------------------------------------------------- VirtualSystemManagementService - 02_destroysystem.py: FAIL ERROR - CS instance not returned for test_domain. ERROR - RequestedState for dom 'test_domain' is not '3' Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found --------------------------------------------------------------------
However, the test passes for me if the patch isn't applied. Yes! This test fails with the changes, this is because the DestroySystem() is not just destroying the domain but also undefining it. The VSMS/15*py tc with the new changes also fails for the same reason. I am not sure if you got chance to look at the comments to "#2 Add try / except to VSMS 15" patch. Should I make a note of this in the libvirt.org and XFAIL this test ?
-- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com

Deepti B Kalakeri wrote:
Kaitlin Rupert wrote:
Deepti B. Kalakeri wrote:
# HG changeset patch # User Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com> # Date 1252590021 14400 # Node ID 53b05fc42fbc04ce45eea4a09ad84881fbcf6d3e # Parent 30196cc506c07d81642c94a01fc65b34421c0714 [TEST] Adding verification for DestroySystem() of the domain.
Tested with KVM and current sources on SLES11. Signed-off-by: Deepti B. Kalakeri <deeptik@linux.vnet.ibm.com>
diff -r 30196cc506c0 -r 53b05fc42fbc suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py
I get the following failure:
Starting test suite: libvirt-cim Cleaned log files.
Testing KVM hypervisor -------------------------------------------------------------------- VirtualSystemManagementService - 02_destroysystem.py: FAIL ERROR - CS instance not returned for test_domain. ERROR - RequestedState for dom 'test_domain' is not '3' Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found Referenced domain `test_domain' does not exist: Domain not found --------------------------------------------------------------------
However, the test passes for me if the patch isn't applied. Yes! This test fails with the changes, this is because the DestroySystem() is not just destroying the domain but also undefining it. The VSMS/15*py tc with the new changes also fails for the same reason. I am not sure if you got chance to look at the comments to "#2 Add try / except to VSMS 15" patch. Should I make a note of this in the libvirt.org and XFAIL this test ?
Any further comments on this ? -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com

Testing KVM hypervisor -------------------------------------------------------------------- VirtualSystemManagementService - 02_destroysystem.py: FAIL ERROR - CS instance not returned for test_domain. ERROR - RequestedState for dom 'test_domain' is not '3' Referenced domain `test_domain' does not exist: Domain not found
However, the test passes for me if the patch isn't applied.
Yes! This test fails with the changes, this is because the DestroySystem() is not just destroying the domain but also undefining it. The VSMS/15*py tc with the new changes also fails for the same reason. I am not sure if you got chance to look at the comments to "#2 Add try / except to VSMS 15" patch. Should I make a note of this in the libvirt.org and XFAIL this test ?
Any further comments on this ?
I didn't see your previous email - sorry for the delay here. My original mail was in hopes that you knew why your changes caused the test to fail. Last time I tested VSMS 15 with the changes I submitted, I didn't see it fail. I haven't had a chance to revist that patch. I took a look at this test, and you're right - the reason it's failing is because DestroySystem() is also undefined the guest. So the answer here is to modify the test so that it doesn't call undefine(). Also, make sure the guest isn't in the inactive domain list either. Not sure why you want to XFAIL the test, as DestroySystem() is doing what is expected. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
Testing KVM hypervisor -------------------------------------------------------------------- VirtualSystemManagementService - 02_destroysystem.py: FAIL ERROR - CS instance not returned for test_domain. ERROR - RequestedState for dom 'test_domain' is not '3' Referenced domain `test_domain' does not exist: Domain not found
However, the test passes for me if the patch isn't applied.
Yes! This test fails with the changes, this is because the DestroySystem() is not just destroying the domain but also undefining it. The VSMS/15*py tc with the new changes also fails for the same reason. I am not sure if you got chance to look at the comments to "#2 Add try / except to VSMS 15" patch. Should I make a note of this in the libvirt.org and XFAIL this test ?
Any further comments on this ?
I didn't see your previous email - sorry for the delay here. My original mail was in hopes that you knew why your changes caused the test to fail. No problem, I was wondering if I had to change the test case.
Last time I tested VSMS 15 with the changes I submitted, I didn't see it fail. I haven't had a chance to revist that patch.
I took a look at this test, and you're right - the reason it's failing is because DestroySystem() is also undefined the guest. So the answer here is to modify the test so that it doesn't call undefine(). Also, make sure the guest isn't in the inactive domain list either.
Not sure why you want to XFAIL the test, as DestroySystem() is doing what is expected.
I thought DestroySystem() is equivalent to "virsh destroy" command which would just destroy a running domain which was defined and started. -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com

I took a look at this test, and you're right - the reason it's failing is because DestroySystem() is also undefined the guest. So the answer here is to modify the test so that it doesn't call undefine(). Also, make sure the guest isn't in the inactive domain list either.
Not sure why you want to XFAIL the test, as DestroySystem() is doing what is expected.
I thought DestroySystem() is equivalent to "virsh destroy" command which would just destroy a running domain which was defined and started.
Nope, DestroySystem() does a "virsh destroy" and "virsh undefine". If you look at the System Virtualization Profile (DSP1042) under the heading " 8.2.2 CIM_VirtualSystemManagementService.DestroySystem( ) Method (Conditional)", DestroySystem() is defined as: "The execution of the DestroySystem( ) method shall effect the destruction of the referenced virtual system and all related virtual system configurations, including snapshots." -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
I took a look at this test, and you're right - the reason it's failing is because DestroySystem() is also undefined the guest. So the answer here is to modify the test so that it doesn't call undefine(). Also, make sure the guest isn't in the inactive domain list either.
Not sure why you want to XFAIL the test, as DestroySystem() is doing what is expected.
I thought DestroySystem() is equivalent to "virsh destroy" command which would just destroy a running domain which was defined and started.
Nope, DestroySystem() does a "virsh destroy" and "virsh undefine". If you look at the System Virtualization Profile (DSP1042) under the heading " 8.2.2 CIM_VirtualSystemManagementService.DestroySystem( ) Method (Conditional)", DestroySystem() is defined as:
"The execution of the DestroySystem( ) method shall effect the destruction of the referenced virtual system and all related virtual system configurations, including snapshots." Oh! yeah I read this today. Its been long time I read the DSP1042. Thanks for the clarifications. Updated patch on its way.
-- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com

Deepti B Kalakeri wrote:
Kaitlin Rupert wrote:
I took a look at this test, and you're right - the reason it's failing is because DestroySystem() is also undefined the guest. So the answer here is to modify the test so that it doesn't call undefine(). Also, make sure the guest isn't in the inactive domain list either.
Not sure why you want to XFAIL the test, as DestroySystem() is doing what is expected.
I thought DestroySystem() is equivalent to "virsh destroy" command which would just destroy a running domain which was defined and started.
Nope, DestroySystem() does a "virsh destroy" and "virsh undefine". If you look at the System Virtualization Profile (DSP1042) under the heading " 8.2.2 CIM_VirtualSystemManagementService.DestroySystem( ) Method (Conditional)", DestroySystem() is defined as:
"The execution of the DestroySystem( ) method shall effect the destruction of the referenced virtual system and all related virtual system configurations, including snapshots." Oh! yeah I read this today. Its been long time I read the DSP1042. Thanks for the clarifications. Updated patch on its way.
No problem =) Thanks for updating the patch! -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (3)
-
Deepti B Kalakeri
-
Deepti B. Kalakeri
-
Kaitlin Rupert