# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1219718483 25200
# Node ID 187c2bd619db911505c1e5460050e6dc47dab180
# Parent a9978826a31d881a7fcaa2ca277a44322511a624
[TEST] Move libvirt-cim specific bits from lib/CimTest/Globals.py to XenKvmLib.
The main libraries for cimtest should be libvirt-cim independent.
Once all tests are converted, follow up with a patch to remove the libvirt-cim specific
pieces from Globals.py
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r a9978826a31d -r 187c2bd619db suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py Wed Aug 27 01:04:31 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Mon Aug 25 19:41:23 2008 -0700
@@ -20,10 +20,16 @@
import os
import platform
+import traceback
+from optparse import OptionParser
from VirtLib.live import fv_cap
from CimTest.Globals import CIM_IP
from pywbem import WBEMConnection
from XenKvmLib.classes import get_typed_class
+
+platform_sup = ["Xen", "KVM", "XenFV"]
+
+VIRSH_ERROR_DEFINE = "Failed to define a domain with the name %s from virsh"
# vxml.NetXML
default_bridge_name = 'testbridge'
@@ -80,6 +86,42 @@
LXC_default_source = '/tmp/lxc_files'
LXC_default_mac = '11:22:33:aa:bb:cc'
+parser = OptionParser()
+parser.add_option("-i", "--ip", dest="ip",
default="localhost",
+ help="IP address of machine to test, default: localhost")
+parser.add_option("-v", "--virt", dest="virt",
type="choice",
+ choices=['Xen', 'KVM', 'XenFV', 'LXC'],
default="Xen",
+ help="Virt type, select from: 'Xen' & 'KVM'
& 'XenFV' & 'LXC', default: Xen")
+parser.add_option("-d", "--debug-output",
action="store_true", dest="debug",
+ help="Duplicate the output to stderr")
+
+
+def do_main(types=['Xen'], p=parser):
+ def do_type(f):
+ import sys
+ from ReturnCodes import SKIP, FAIL
+ (options, args) = p.parse_args()
+ if options.virt not in types:
+ return lambda:SKIP
+ else:
+ def do_try():
+ try:
+ log_param()
+ from VirtLib.utils import setup_ssh_key
+ from XenKvmLib.test_doms import destroy_and_undefine_all
+ setup_ssh_key()
+ destroy_and_undefine_all(options.ip, options.virt)
+ rc = f()
+ except Exception, e:
+ logger.error('%s : %s' % (e.__class__.__name__, e))
+ logger.error("%s" % traceback.print_exc())
+ rc = FAIL
+ return rc
+ setattr(do_try, 'options', options)
+ return do_try
+ return do_type
+
+
def get_provider_version(virt, ip):
conn = WBEMConnection('http://%s' % ip,
(os.getenv('CIM_USER'),
os.getenv('CIM_PASS')),