[PATCH] [TEST] Add UUID workaround for python-2.4-based systems (i.e. RHEL5.x)
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1206986066 25200
# Node ID ace377826c9c8f3b034f5c696ffb71dfb163d77b
# Parent 5d47437104551b638aa75e2e525e49ec4b41e3ec
[TEST] Add UUID workaround for python-2.4-based systems (i.e. RHEL5.x)
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 5d4743710455 -r ace377826c9c suites/libvirt-cim/lib/XenKvmLib/test_doms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Mon Mar 31 07:54:19 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Mon Mar 31 10:54:26 2008 -0700
@@ -22,11 +22,23 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import tempfile
-import uuid
import os
from VirtLib import utils
from VirtLib import live
from CimTest.Globals import CIM_FUUID
+
+try:
+ import uuid as _uuid
+ def uuid():
+ return str(_uuid.uuid1())
+except ImportError:
+ def uuid():
+ from commands import getstatusoutput as run
+ s, o = run('uuidgen')
+ if s == 0:
+ return o
+ else:
+ raise ImportError("Missing uuid library (and can't fake it)")
def define_test_domain(xml, server, virt="Xen"):
name = tempfile.mktemp()
@@ -74,7 +86,7 @@ def set_uuid(myuuid=0):
"""Generate a random uuid and record it into CIM_FUUID"""
if myuuid == 0:
- myuuid = uuid.uuid1().urn[9:]
+ myuuid = uuid()
f = file(CIM_FUUID, 'a')
f.write('%s\n' % myuuid)
16 years, 8 months
[PATCH] [TEST] Run basicConfig() on logger to make python-2.4 happy
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1206986099 25200
# Node ID bde349d23ce5320d7c593e57df45335dcae62df8
# Parent ace377826c9c8f3b034f5c696ffb71dfb163d77b
[TEST] Run basicConfig() on logger to make python-2.4 happy
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r ace377826c9c -r bde349d23ce5 lib/CimTest/Globals.py
--- a/lib/CimTest/Globals.py Mon Mar 31 10:54:26 2008 -0700
+++ b/lib/CimTest/Globals.py Mon Mar 31 10:54:59 2008 -0700
@@ -50,6 +50,7 @@ CIM_PORT = "5988"
CIM_PORT = "5988"
NM = "TEST LOG"
platform_sup = ["Xen", "KVM", "XenFV"]
+logging.basicConfig()
logger = logging.getLogger(NM)
logging.PRINT = logging.DEBUG + 50
logging.addLevelName(logging.PRINT, "PRINT")
16 years, 8 months
[PATCH] Make DestroySystem actually undefine a domain as it should
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1206736474 25200
# Node ID 1e1c2cd2ef0bff684df37d5c94d7b66b6189295c
# Parent 2eaed9da089f7b49d85eadeb75334c11c869ffc8
Make DestroySystem actually undefine a domain as it should
Also clean up the error path and CMPIValue stuff in the method while
we're swizzling
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 2eaed9da089f -r 1e1c2cd2ef0b src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri Mar 28 07:20:02 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Fri Mar 28 13:34:34 2008 -0700
@@ -479,54 +479,56 @@ static CMPIStatus destroy_system(CMPIMet
CMPIArgs *argsout)
{
const char *dom_name = NULL;
- CMPIStatus status = {CMPI_RC_OK, NULL};
- CMPIValue rc;
+ CMPIStatus status;
+ uint32_t rc = IM_RC_FAILED;
CMPIObjectPath *sys;
-
- virConnectPtr conn;
+ virConnectPtr conn = NULL;
+ virDomainPtr dom = NULL;
conn = connect_by_classname(_BROKER,
CLASSNAME(reference),
&status);
- if (conn == NULL) {
- rc.uint32 = IM_RC_FAILED;
- goto error1;
- }
-
- if (cu_get_ref_arg(argsin, "AffectedSystem", &sys) != CMPI_RC_OK) {
- rc.uint32 = IM_RC_FAILED;
- goto error2;
- }
+ if (conn == NULL)
+ goto error;
+
+ if (cu_get_ref_arg(argsin, "AffectedSystem", &sys) != CMPI_RC_OK)
+ goto error;
dom_name = get_key_from_ref_arg(argsin, "AffectedSystem", "Name");
- if (dom_name == NULL) {
- rc.uint32 = IM_RC_FAILED;
- goto error2;
- }
+ if (dom_name == NULL)
+ goto error;
// Make sure system exists and destroy it.
- if (domain_exists(conn, dom_name)) {
- virDomainPtr dom = virDomainLookupByName(conn, dom_name);
- if (!virDomainDestroy(dom)) {
- rc.uint32 = IM_RC_OK;
- } else {
- rc.uint32 = IM_RC_FAILED;
- cu_statusf(_BROKER, &status,
- CMPI_RC_ERR_FAILED,
- "Domain already exists");
- }
- virDomainFree(dom);
+ if (!domain_exists(conn, dom_name))
+ goto error;
+
+ dom = virDomainLookupByName(conn, dom_name);
+ if (dom == NULL) {
+ CU_DEBUG("No such domain `%s', dom_name");
+ rc = IM_RC_SYS_NOT_FOUND;
+ goto error;
+ }
+
+ virDomainDestroy(dom); /* Okay for this to fail */
+ if (virDomainUndefine(dom) == 0) {
+ rc = IM_RC_OK;
trigger_indication(context,
"ComputerSystemDeletedIndication",
NAMESPACE(reference));
- } else {
- rc.uint32 = IM_RC_SYS_NOT_FOUND;
- }
-
- error2:
+ }
+
+error:
+ if (rc == IM_RC_SYS_NOT_FOUND)
+ cu_statusf(_BROKER, &status,
+ CMPI_RC_ERR_FAILED,
+ "Failed to find domain");
+ else if (rc == IM_RC_OK)
+ status = (CMPIStatus){CMPI_RC_OK, NULL};
+
+ virDomainFree(dom);
virConnectClose(conn);
- error1:
CMReturnData(results, &rc, CMPI_uint32);
+
return status;
}
16 years, 8 months
[PATCH] [TEST] update ElementConforms.03 for XenFV and KVM support
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1206952946 25200
# Node ID 9a6366dcdb01ebe19dceee945b9f59092e0f495d
# Parent 612ccb311e273b091659fe14f0471567abe61d08
[TEST] update ElementConforms.03 for XenFV and KVM support
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 612ccb311e27 -r 9a6366dcdb01 suites/libvirt-cim/cimtest/ElementConforms/03_ectp_fwd_errs.py
--- a/suites/libvirt-cim/cimtest/ElementConforms/03_ectp_fwd_errs.py Fri Mar 28 00:03:41 2008 -0700
+++ b/suites/libvirt-cim/cimtest/ElementConforms/03_ectp_fwd_errs.py Mon Mar 31 01:42:26 2008 -0700
@@ -3,6 +3,7 @@
# Copyright 2008 IBM Corp.
#
# Authors:
+# Guolian Yun <yunguol(a)cn.ibm.com>
# Anoop V Chakkalakkal<anoop.vijayan(a)in.ibm.com>
# Guolian Yun <yunguol(a)cn.ibm.com>
# This library is free software; you can redistribute it and/or
@@ -55,14 +56,13 @@ from VirtLib import utils
from VirtLib import utils
from XenKvmLib import assoc
from XenKvmLib.common_util import try_assoc
+from XenKvmLib.classes import get_typed_class
from CimTest.ReturnCodes import PASS, FAIL
from CimTest import Globals
from CimTest.Globals import log_param, logger, CIM_USER, CIM_PASS, do_main
-sup_types = ['Xen']
+sup_types = ['Xen', 'XenFV', 'KVM']
-classname = 'Xen_RegisteredProfile'
-ac_classname = 'Xen_ElementConformsToProfile'
bug = '92642'
expr_values = {
@@ -72,7 +72,9 @@ expr_values = {
'desc' : 'No such instance' }
}
-def try_invalid_assoc(name_val, i, field):
+def try_invalid_assoc(name_val, i, field, virt='Xen'):
+ classname = get_typed_class(virt, "RegisteredProfile")
+ ac_classname = get_typed_class(virt, "ElementConformsToProfile")
j = 0
keys = {}
temp = name_val[i]
@@ -106,7 +108,7 @@ def main():
tc_scen = ['INVALID_InstID_Keyname', 'INVALID_InstID_Keyvalue']
for i in range(len(tc_scen)):
- retval = try_invalid_assoc(sv_name_val, i, tc_scen[i])
+ retval = try_invalid_assoc(sv_name_val, i, tc_scen[i], options.virt)
if retval != PASS:
status = retval
16 years, 8 months
[PATCH] [TEST] Make 02_destroysystem actually test the right thing
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1206736402 25200
# Node ID fe283ed5273e0983adf6355c9d6d8e1e81dcdde2
# Parent 612ccb311e273b091659fe14f0471567abe61d08
[TEST] Make 02_destroysystem actually test the right thing
This test was passing incorrectly because it was only looking at the active
domain list instead of active+inactive. The DestroySystem method in the
provider was only doing a destroy, which means that it disappeared from the
active list and this test considered that a PASS.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 612ccb311e27 -r fe283ed5273e suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py Fri Mar 28 00:03:41 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/02_destroysystem.py Fri Mar 28 13:33:22 2008 -0700
@@ -25,7 +25,7 @@ import pywbem
import pywbem
from pywbem.cim_obj import CIMInstanceName
from VirtLib import utils
-from VirtLib.live import active_domain_list
+from VirtLib.live import domain_list
from XenKvmLib import vsms, vxml
from XenKvmLib.classes import get_typed_class
from CimTest.Globals import do_main
@@ -50,7 +50,7 @@ def main():
'Name':default_dom,
'CreationClassName':classname})
- list_before = active_domain_list(options.ip, options.virt)
+ list_before = domain_list(options.ip, options.virt)
status = PASS
rc = -1
@@ -62,7 +62,7 @@ def main():
logger.error(details)
status = FAIL
- list_after = active_domain_list(options.ip, options.virt)
+ list_after = domain_list(options.ip, options.virt)
status = PASS
if default_dom not in list_before:
16 years, 8 months
[PATCH] [TEST] .2# Add kernel params in VSSD construction in vsms
by lizg@cn.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1206712013 -28800
# Node ID c67d4960d4073c641beeb1fe5180862001c247ae
# Parent 877558f5cbe913300335b7069d8e21a6257638a4
[TEST] .2# Add kernel params in VSSD construction in vsms
Provider has added Kernel/Bootloader properties for para-virt. This is
the change to utilize those properties.
The non-default argument follows default argment error fixed in this
version.
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r 877558f5cbe9 -r c67d4960d407 suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Fri Mar 28 17:23:54 2008 +0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Fri Mar 28 21:46:53 2008 +0800
@@ -25,6 +25,7 @@ import pywbem
import pywbem
from CimTest.CimExt import CIMMethodClass, CIMClassMOF
from CimTest import Globals
+from VirtLib import live
from XenKvmLib import vxml
from XenKvmLib.classes import get_typed_class, get_class_type, virt_types
@@ -33,6 +34,10 @@ RASD_TYPE_NET_ETHER = 10
RASD_TYPE_NET_ETHER = 10
RASD_TYPE_NET_OTHER = 11
RASD_TYPE_DISK = 17
+
+VSSD_RECOVERY_NONE = 2
+VSSD_RECOVERY_RESTART = 3
+VSSD_RECOVERY_PRESERVE = 123
def eval_cls(basename):
def func(f):
@@ -81,17 +86,25 @@ def enumerate_instances(server, virt='Xe
# classes to define VSSD parameters
class CIM_VirtualSystemSettingData(CIMClassMOF):
- def __init__(self, name='test_domain', set_vs_id = True):
+ def __init__(self, name, virt):
type = get_class_type(self.__class__.__name__)
self.InstanceID = '%s:%s' % (type, name)
self.Caption = self.Description = 'Virtual System'
- self.ElementName = name
+ self.VirtualSystemIdentifier = self.ElementName = name
self.VirtualSystemType = type
self.CreationClassName = self.__class__.__name__
- self.isFullVirt = (type == 'KVM')
+ self.AutomaticShutdownAction = VSSD_RECOVERY_NONE
+ self.AutomaticRecoveryAction = VSSD_RECOVERY_NONE
+
+ self.isFullVirt = (type == 'KVM' or virt == 'XenFV')
+ if self.isFullVirt:
+ self.BootDevice = 'hd'
+ else:
+ self.Bootloader = live.bootloader(Globals.CIM_IP, 0)
+ self.BootloaderArgs = ''
+ self.Kernel = vxml.XenXML.kernel_path
+ self.Ramdisk = vxml.XenXML.init_path
- if set_vs_id == True:
- self.VirtualSystemIdentifier = name
class Xen_VirtualSystemSettingData(CIM_VirtualSystemSettingData):
pass
@@ -193,7 +206,7 @@ def default_vssd_rasd_str(dom_name='test
mem_mb=512,
virt='Xen'):
class_vssd = get_vssd_class(virt)
- vssd = class_vssd(name=dom_name)
+ vssd = class_vssd(name=dom_name, virt=virt)
class_dasd = get_dasd_class(virt)
if virt == 'KVM':
16 years, 8 months
[PATCH] [CU] add one class to keep a list of received indications
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1206942619 25200
# Node ID 66fc3211e0bf16d2be0d39e2f0a4d74b84fb15f9
# Parent e9037a5a7df99bb63ae5e90ade698592af7b7e92
[CU] add one class to keep a list of received indications
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r e9037a5a7df9 -r 66fc3211e0bf tools/indication_tester.py
--- a/tools/indication_tester.py Mon Mar 10 12:05:59 2008 -0700
+++ b/tools/indication_tester.py Sun Mar 30 22:50:19 2008 -0700
@@ -286,6 +286,11 @@ class CIMIndication:
def __str__(self):
return self.name
+class CIMIndicationServer(BaseHTTPServer.HTTPServer):
+ def __init__(self, *args):
+ BaseHTTPServer.HTTPServer.__init__(self, *args)
+ self.indications = []
+
class CIMSocketHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_POST(self):
length = self.headers.getheader('content-length')
@@ -295,6 +300,7 @@ class CIMSocketHandler(BaseHTTPServer.Ba
print "Got indication: %s" % indication
if self.server.print_ind:
print "%s\n\n" % data
+ self.server.indications.append(indication)
class CIMIndicationSubscription:
def __init__(self, name, typ, ns, print_ind, sysname):
@@ -305,6 +311,7 @@ class CIMIndicationSubscription:
self.server = BaseHTTPServer.HTTPServer(('', 8000), CIMSocketHandler)
self.server.print_ind = print_ind
+ self.server.indications = []
self.port = 8000
self.filter_xml = filter_xml(name, typ, ns, sysname)
16 years, 8 months