# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1231441895 28800
# Node ID 38811eb854a1c52be94d7e8440c2272b94b70708
# Parent 840f4651f746882475188adba781fafbf583c07b
[TEST] #3 Update VSMS 01_definesystem_name.py to use cim_() functions
Updates from 2 to 3:
-In case of an error, use logger.error not logger.info
Updates from 1 to 2:
-Added cim_destroy() to destroy the guest at the end of the test
-Reworded log message for clarity
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 840f4651f746 -r 38811eb854a1
suites/libvirt-cim/cimtest/VirtualSystemManagementService/01_definesystem_name.py
---
a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/01_definesystem_name.py Tue
Jan 06 11:56:13 2009 -0800
+++
b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/01_definesystem_name.py Thu
Jan 08 11:11:35 2009 -0800
@@ -23,12 +23,10 @@
#
import sys
-import pywbem
-from VirtLib import utils
-from XenKvmLib.test_doms import undefine_test_domain
-from XenKvmLib.common_util import create_using_definesystem
from XenKvmLib.const import do_main
from CimTest.Globals import logger
+from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.vxml import get_class
SUPPORTED_TYPES = ['Xen', 'KVM', 'XenFV', 'LXC']
default_dom = 'test_domain'
@@ -37,10 +35,19 @@
def main():
options = main.options
- status = create_using_definesystem(default_dom, options.ip,
- virt=options.virt)
- undefine_test_domain(default_dom, options.ip,
- virt=options.virt)
+ cxml = get_class(options.virt)(default_dom)
+
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ logger.error("Unable to define %s" % default_dom)
+ return FAIL
+
+ status = cxml.cim_start(options.ip)
+ if status != PASS:
+ logger.error("Failed to start the defined domain: %s" % default_dom)
+
+ cxml.cim_destroy(options.ip)
+ cxml.undefine(options.ip)
return status