[PATCH]
by Richard Maciel
# HG changeset patch
# User Richard Maciel <richardm(a)br.ibm.com>
# Date 1229729923 7200
# Node ID ebb3a754af1f3eed21b8daf65c0b72ad9d7e65e3
# Parent c4b178c78475fe8ad11328d80f38bcdcf0d50e70
#2 Added 2 end points for the ServiceAffectsElement association, both related to the LogicalDevice class.
- ConsoleRedirectionService <-> DisplayController
- ConsoleRedirectionService <-> PointingDevice
Signed-off-by: Richard Maciel <richardm(a)br.ibm.com>
diff -r c4b178c78475 -r ebb3a754af1f src/Makefile.am
--- a/src/Makefile.am Fri Dec 19 21:10:32 2008 -0200
+++ b/src/Makefile.am Fri Dec 19 21:38:43 2008 -0200
@@ -213,9 +213,9 @@
libVirt_ConsoleRedirectionServiceCapabilities_la_SOURCES = Virt_ConsoleRedirectionServiceCapabilities.c
-libVirt_ServiceAffectsElement_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_ConsoleRedirectionService.la
+libVirt_ServiceAffectsElement_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_Device.la libVirt_ConsoleRedirectionService.la
libVirt_ServiceAffectsElement_la_SOURCES = Virt_ServiceAffectsElement.c
-libVirt_ServiceAffectsElement_la_LIBADD = -lVirt_ComputerSystem -lVirt_ConsoleRedirectionService
+libVirt_ServiceAffectsElement_la_LIBADD = -lVirt_ComputerSystem -lVirt_Device -lVirt_ConsoleRedirectionService
libVirt_KVMRedirectionSAP_la_SOURCES = Virt_KVMRedirectionSAP.c
diff -r c4b178c78475 -r ebb3a754af1f src/Virt_ServiceAffectsElement.c
--- a/src/Virt_ServiceAffectsElement.c Fri Dec 19 21:10:32 2008 -0200
+++ b/src/Virt_ServiceAffectsElement.c Fri Dec 19 21:38:43 2008 -0200
@@ -29,9 +29,11 @@
#include <libcmpiutil/libcmpiutil.h>
#include <libcmpiutil/std_association.h>
#include "misc_util.h"
+#include "svpc_types.h"
#include "Virt_ComputerSystem.h"
#include "Virt_ConsoleRedirectionService.h"
+#include "Virt_Device.h"
const static CMPIBroker *_BROKER;
@@ -41,15 +43,70 @@
{
CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *instance = NULL;
-
+ const char *host = NULL;
+ int i;
+ int num_of_domains;
+
if (!match_hypervisor_prefix(ref, info))
- return s;
+ goto out;
s = get_console_rs(ref, &instance, _BROKER, info->context, true);
if (s.rc != CMPI_RC_OK)
- return s;
+ goto out;
s = enum_domains(_BROKER, ref, list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ num_of_domains = list->cur;
+
+ /*
+ * For each domain, insert its video and pointer devices into
+ * the list
+ */
+ for (i = 0; i < num_of_domains; i++) {
+ s.rc = cu_get_str_prop(list->list[i], "Name", &host);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ s = enum_devices(_BROKER,
+ ref,
+ host,
+ CIM_RES_TYPE_INPUT,
+ list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ s = enum_devices(_BROKER,
+ ref,
+ host,
+ CIM_RES_TYPE_GRAPHICS,
+ list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+ }
+
+ out:
+ return s;
+}
+
+static CMPIStatus validate_cs_or_dev_ref(const CMPIContext *context,
+ const CMPIObjectPath *ref)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ char* classname;
+
+ classname = class_base_name(CLASSNAME(ref));
+
+ if (STREQC(classname, "ComputerSystem")) {
+ s = get_domain_by_ref(_BROKER, ref, &inst);
+ } else if ((STREQC(classname, "PointingDevice")) ||
+ (STREQC(classname, "DisplayController"))) {
+ s = get_device_by_ref(_BROKER, ref, &inst);
+ }
+
+ free(classname);
return s;
}
@@ -63,8 +120,8 @@
if (!match_hypervisor_prefix(ref, info))
return s;
-
- s = get_domain_by_ref(_BROKER, ref, &inst);
+
+ s = validate_cs_or_dev_ref(info->context, ref);
if (s.rc != CMPI_RC_OK)
return s;
@@ -83,6 +140,12 @@
"Xen_ComputerSystem",
"KVM_ComputerSystem",
"LXC_ComputerSystem",
+ "Xen_PointingDevice",
+ "KVM_PointingDevice",
+ "LXC_PointingDevice",
+ "Xen_DisplayController",
+ "KVM_DisplayController",
+ "LXC_DisplayController",
NULL
};
15 years, 11 months
[PATCH] Add EmulatedType to DiskRASDs
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1230156310 28800
# Node ID a7f77c32ddddb804e556fa19ceed0ebf625c9c2a
# Parent 3557859610b4eaf8a2bdcb28d7002121e3e776b1
Add EmulatedType to DiskRASDs.
This sets EmulatedType to 0. Should an additional template RASD be returned
for EmulatedType 1?
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 3557859610b4 -r a7f77c32dddd src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Wed Dec 10 12:42:02 2008 -0800
+++ b/src/Virt_SettingsDefineCapabilities.c Wed Dec 24 14:05:10 2008 -0800
@@ -617,6 +617,7 @@
const char *dev;
CMPIInstance *inst;
CMPIStatus s = {CMPI_RC_OK, NULL};
+ uint16_t emu_type = 0;
if (type == DOMAIN_LXC) {
addr = "/tmp";
@@ -652,6 +653,8 @@
CMSetProperty(inst, "VirtualDevice",
(CMPIValue *)dev, CMPI_chars);
+ CMSetProperty(inst, "EmulatedType",
+ (CMPIValue *)&emu_type, CMPI_uint16);
}
inst_list_add(list, inst);
15 years, 11 months
[PATCH] Added 2 end points for the ServiceAffectsElement association, both related to the LogicalDevice class
by Richard Maciel
# HG changeset patch
# User Richard Maciel <richardm(a)br.ibm.com>
# Date 1229729923 7200
# Node ID 0a617ecc1b6f49a1391afa5566f3f7ca710ec5cb
# Parent 27c75ec951e790bfec72273828154eec647e4caf
Added 2 end points for the ServiceAffectsElement association, both related to the LogicalDevice class.
- ConsoleRedirectionService <-> DisplayController
- ConsoleRedirectionService <-> PointingDevice
Signed-off-by: Richard Maciel <richardm(a)br.ibm.com>
diff -r 27c75ec951e7 -r 0a617ecc1b6f src/Makefile.am
--- a/src/Makefile.am Fri Dec 19 21:10:32 2008 -0200
+++ b/src/Makefile.am Fri Dec 19 21:38:43 2008 -0200
@@ -213,9 +213,9 @@
libVirt_ConsoleRedirectionServiceCapabilities_la_SOURCES = Virt_ConsoleRedirectionServiceCapabilities.c
-libVirt_ServiceAffectsElement_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_ConsoleRedirectionService.la
+libVirt_ServiceAffectsElement_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_Device.la libVirt_ConsoleRedirectionService.la
libVirt_ServiceAffectsElement_la_SOURCES = Virt_ServiceAffectsElement.c
-libVirt_ServiceAffectsElement_la_LIBADD = -lVirt_ComputerSystem -lVirt_ConsoleRedirectionService
+libVirt_ServiceAffectsElement_la_LIBADD = -lVirt_ComputerSystem -lVirt_Device -lVirt_ConsoleRedirectionService
libVirt_KVMRedirectionSAP_la_SOURCES = Virt_KVMRedirectionSAP.c
diff -r 27c75ec951e7 -r 0a617ecc1b6f src/Virt_ServiceAffectsElement.c
--- a/src/Virt_ServiceAffectsElement.c Fri Dec 19 21:10:32 2008 -0200
+++ b/src/Virt_ServiceAffectsElement.c Fri Dec 19 21:38:43 2008 -0200
@@ -29,11 +29,29 @@
#include <libcmpiutil/libcmpiutil.h>
#include <libcmpiutil/std_association.h>
#include "misc_util.h"
+#include "svpc_types.h"
#include "Virt_ComputerSystem.h"
#include "Virt_ConsoleRedirectionService.h"
+#include "Virt_Device.h"
const static CMPIBroker *_BROKER;
+
+static CMPIStatus add_devices_to_list(const CMPIObjectPath *ref,
+ const char *host,
+ int type,
+ struct inst_list *list)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+
+ s = enum_devices(_BROKER, ref, host, type, list);
+
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ out:
+ return s;
+}
static CMPIStatus service_to_cs(const CMPIObjectPath *ref,
struct std_assoc_info *info,
@@ -41,15 +59,60 @@
{
CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *instance = NULL;
-
+ const char *host = NULL;
+ int i;
+ int num_of_domains;
+
if (!match_hypervisor_prefix(ref, info))
- return s;
+ goto out;
s = get_console_rs(ref, &instance, _BROKER, info->context, true);
if (s.rc != CMPI_RC_OK)
- return s;
+ goto out;
s = enum_domains(_BROKER, ref, list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ num_of_domains = list->cur;
+
+ // For each domain, insert its video and pointer devices into
+ // the list
+ for (i = 0; i < num_of_domains; i++) {
+ s.rc = cu_get_str_prop(list->list[i], "Name", &host);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ s = add_devices_to_list(ref, host, CIM_RES_TYPE_INPUT, list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
+ s = add_devices_to_list(ref, host, CIM_RES_TYPE_GRAPHICS, list);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+ }
+
+ out:
+ return s;
+}
+
+static CMPIStatus validate_cs_or_dev_ref(const CMPIContext *context,
+ const CMPIObjectPath *ref)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ CMPIInstance *inst = NULL;
+ char* classname;
+
+ classname = class_base_name(CLASSNAME(ref));
+
+ if (STREQC(classname, "ComputerSystem")) {
+ s = get_domain_by_ref(_BROKER, ref, &inst);
+ } else if ((STREQC(classname, "PointingDevice")) ||
+ (STREQC(classname, "DisplayController"))) {
+ s = get_device_by_ref(_BROKER, ref, &inst);
+ }
+
+ free(classname);
return s;
}
@@ -63,8 +126,8 @@
if (!match_hypervisor_prefix(ref, info))
return s;
-
- s = get_domain_by_ref(_BROKER, ref, &inst);
+
+ s = validate_cs_or_dev_ref(info->context, ref);
if (s.rc != CMPI_RC_OK)
return s;
@@ -83,6 +146,12 @@
"Xen_ComputerSystem",
"KVM_ComputerSystem",
"LXC_ComputerSystem",
+ "Xen_PointingDevice",
+ "KVM_PointingDevice",
+ "LXC_PointingDevice",
+ "Xen_DisplayController",
+ "KVM_DisplayController",
+ "LXC_DisplayController",
NULL
};
15 years, 11 months
[PATCH] [TEST] Update Memory - 02_defgetmem.py to use cim_define()
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1231198069 28800
# Node ID e285d6399feada658bb9a360aab15f1ff5d76e1f
# Parent 87b41555ea6e8a363cc966b599e0cf28af4fd318
[TEST] Update Memory - 02_defgetmem.py to use cim_define()
Also, modify the test to use PASS/FAIL values.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 87b41555ea6e -r e285d6399fea suites/libvirt-cim/cimtest/Memory/02_defgetmem.py
--- a/suites/libvirt-cim/cimtest/Memory/02_defgetmem.py Mon Jan 05 15:02:59 2009 -0800
+++ b/suites/libvirt-cim/cimtest/Memory/02_defgetmem.py Mon Jan 05 15:27:49 2009 -0800
@@ -29,64 +29,57 @@
# 4. Verify the DeviceId and domName with the instance info.
import sys
-from XenKvmLib.test_doms import undefine_test_domain
-from XenKvmLib.common_util import create_using_definesystem
+from CimTest.ReturnCodes import PASS, FAIL
from XenKvmLib.devices import get_dom_mem_inst
from CimTest.Globals import logger
from XenKvmLib.const import do_main
+from XenKvmLib.vxml import get_class
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
default_dom = "domu"
def check_mem(memInst):
- status = 0
for mem in memInst:
if mem['SystemName'] != default_dom:
logger.error("Inst returned is for guesst %s, expected guest %s.",
mem['SystemName'], default_dom)
- return 1
+ return FAIL
devid = "%s/%s" % (default_dom, "mem" )
if mem['DeviceID'] != devid:
logger.error("DeviceID %s does not match expected %s.",
mem['DeviceID'], devid)
- status = 1
- else:
- logger.info("Memory : Verified domain %s having DeviceID %s" % \
- (default_dom, devid))
+ return FAIL
- return status
+ logger.info("Verified domain %s having DeviceID %s", default_dom, devid)
+
+ return PASS
@do_main(sup_types)
def main():
options = main.options
- status = 0
+ status = FAIL
- undefine_test_domain(default_dom, options.ip)
-
-
+ cxml = get_class(options.virt)(default_dom)
try:
- rc = create_using_definesystem(default_dom, options.ip, params=None,
- ref_config='', exp_err=None,
- virt=options.virt)
- if rc != 0:
- raise Exception("Unable to create domain %s using DefineSys()" % default_dom)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ raise Exception("Failed to define the guest: %s" % default_dom)
memInst = get_dom_mem_inst(options.virt, options.ip, default_dom)
+ if len(memInst) == 0:
+ raise Exception("Failied to get mem instances for %s" % default_dom)
- if len(memInst) == 0:
- raise Exception("Failied to retrieve mem instances for %s" % default_dom)
-
- rc = check_mem(memInst)
- if rc != 0:
- raise Exception("Memory instance for %s is not as expected." % default_dom)
+ status = check_mem(memInst)
+ if status != PASS:
+ raise Exception("Memory inst for %s not as expected." % default_dom)
except Exception, detail:
logger.error("Exception: %s" % detail)
- status = 1
+ status = FAIL
- undefine_test_domain(default_dom, options.ip)
+ cxml.undefine(options.ip)
return status
15 years, 11 months
[PATCH] [TEST] Update Processor -t 02_definesys_get_procs.py to use cim_define()
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1231196579 28800
# Node ID 87b41555ea6e8a363cc966b599e0cf28af4fd318
# Parent 5650fd38e40aca51f20037f9df695930ddff7cdf
[TEST] Update Processor -t 02_definesys_get_procs.py to use cim_define()
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 5650fd38e40a -r 87b41555ea6e suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py
--- a/suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py Mon Jan 05 14:45:41 2009 -0800
+++ b/suites/libvirt-cim/cimtest/Processor/02_definesys_get_procs.py Mon Jan 05 15:02:59 2009 -0800
@@ -32,11 +32,7 @@
#
import sys
-import pywbem
-from XenKvmLib.classes import get_typed_class
-from XenKvmLib.vxml import XenXML, KVMXML, get_class
-from XenKvmLib.test_doms import undefine_test_domain
-from XenKvmLib.common_util import create_using_definesystem
+from XenKvmLib.vxml import get_class
from XenKvmLib.devices import get_dom_proc_insts
from CimTest.Globals import logger
from XenKvmLib.const import do_main
@@ -71,33 +67,29 @@
@do_main(sup_types)
def main():
options = main.options
- status = PASS
-
- undefine_test_domain(default_dom, options.ip)
+ status = FAIL
try:
- rc = create_using_definesystem(default_dom, options.ip, params=None,
- ref_config=' ', exp_err=None,
- virt=options.virt)
- if rc != 0:
- raise Exception("Unable create domain %s using DefineSystem()" \
- % default_dom)
+ cxml = get_class(options.virt)(default_dom)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ raise Exception("Failed to define the guest: %s" % default_dom)
proc_list = get_dom_proc_insts(options.virt, options.ip, default_dom)
if len(proc_list) == 0:
raise Exception("Failied to retrieve vcpu instances for %s" \
% default_dom)
- rc = check_processors(proc_list)
- if rc != 0:
+ status = check_processors(proc_list)
+ if status != PASS:
raise Exception("Processor instances for %s are not as expected." \
% default_dom)
-
+
except Exception, detail:
logger.error("Exception: %s" % detail)
status = FAIL
- undefine_test_domain(default_dom, options.ip)
+ cxml.undefine(options.ip)
return status
15 years, 11 months
[PATCH] [TEST] Update 40_RSC_start.py to use cim_start()
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1231195541 28800
# Node ID 5650fd38e40aca51f20037f9df695930ddff7cdf
# Parent e476bb52a679fd519086a5fbb8310568cb192ddc
[TEST] Update 40_RSC_start.py to use cim_start()
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r e476bb52a679 -r 5650fd38e40a suites/libvirt-cim/cimtest/ComputerSystem/40_RSC_start.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/40_RSC_start.py Mon Jan 05 14:43:06 2009 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/40_RSC_start.py Mon Jan 05 14:45:41 2009 -0800
@@ -34,19 +34,14 @@
#
import sys
-import pywbem
-from VirtLib import utils
-from XenKvmLib.test_doms import destroy_and_undefine_domain
-from XenKvmLib.common_util import *
from CimTest.Globals import logger
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.vxml import get_class
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
default_dom = 'cs_test_domain'
-REQUESTED_STATE = 2
-TIME = "00000000000000.000000:000"
@do_main(sup_types)
def main():
@@ -56,34 +51,23 @@
status = FAIL
try:
- rc = create_using_definesystem(default_dom, server,
- virt=virt)
- if rc != 0:
- status = FAIL
- raise Exception("DefineSystem() failed to create domain: '%s'" %
- default_dom)
+ cxml = get_class(virt)(default_dom)
+ ret = cxml.cim_define(server)
+ if not ret:
+ raise Exception("Failed to define the guest: %s" % default_dom)
- rc = call_request_state_change(default_dom, server,
- REQUESTED_STATE, TIME, virt)
- if rc != 0:
- status = FAIL
- raise Exception("RequestedStateChange() could not be used to start"
- " domain: '%s'" % default_dom)
-
- status, dom_cs = poll_for_state_change(server, virt, default_dom,
- REQUESTED_STATE, timeout=10)
-
- if status != PASS or dom_cs.RequestedState != REQUESTED_STATE:
- status = FAIL
- raise Exception("Attributes were not set as expected for "
- "domain: '%s'" % default_dom)
- else:
- status = PASS
+ status = cxml.cim_start(server)
+ if status != PASS:
+ action_failed = True
+ raise Exception("Unable start dom '%s'" % default_dom)
except Exception, detail:
logger.error("Exception: %s", detail)
+ status = FAIL
- destroy_and_undefine_domain(default_dom, server, virt)
+ cxml.cim_destroy(server)
+ cxml.undefine(server)
+
return status
if __name__ == "__main__":
15 years, 11 months
[PATCH] [TEST] Update 35_start_reset.py to work with cim_() functions
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1231195386 28800
# Node ID e476bb52a679fd519086a5fbb8310568cb192ddc
# Parent f317d11f46a29a8141563498076d716153dfc5f2
[TEST] Update 35_start_reset.py to work with cim_() functions
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r f317d11f46a2 -r e476bb52a679 suites/libvirt-cim/cimtest/ComputerSystem/35_start_reset.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/35_start_reset.py Mon Jan 05 14:33:07 2009 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/35_start_reset.py Mon Jan 05 14:43:06 2009 -0800
@@ -29,80 +29,48 @@
# has a value of 2 when the VS is moved from defined to active state and
# and has a value of 11 when reset
#
-# List of Valid state values (Refer to VSP spec doc Table 2 for more)
-# ---------------------------------
-# State | Values
-# ---------------------------------
-# Defined | 3
-# Active | 2
-# Reset | 11
-#
# Date: 06-03-2008
import sys
-from VirtLib import utils
from CimTest.Globals import logger
from XenKvmLib.const import do_main
from CimTest.ReturnCodes import PASS, FAIL
-from XenKvmLib.test_doms import destroy_and_undefine_domain
-from XenKvmLib.common_util import get_cs_instance, create_using_definesystem, \
- call_request_state_change, \
- poll_for_state_change
+from XenKvmLib.vxml import get_class
sup_types = ['Xen', 'XenFV', 'KVM', 'LXC']
-ACTIVE_STATE = 2
-RESET_STATE = 11
-
default_dom = 'cs_test_domain'
-TIME = "00000000000000.000000:000"
@do_main(sup_types)
def main():
options = main.options
status = FAIL
server = options.ip
- virt = options.virt
-
- tc_scen = [('Start', [ACTIVE_STATE, ACTIVE_STATE]),
- ('Reset', [ACTIVE_STATE, RESET_STATE])]
+ virt = options.virt
try:
# define the vs
- status = create_using_definesystem(default_dom, server,
- virt=virt)
- if status != PASS:
- logger.error("Unable to define domain '%s' using DefineSystem()",
- default_dom)
- return status
+ cxml = get_class(virt)(default_dom)
+ ret = cxml.cim_define(server)
+ if not ret:
+ raise Exception("Failed to define the guest: %s" % default_dom)
# start and reset
- for action, state in tc_scen:
- en_state = state[0]
- rq_state = state[1]
- status = call_request_state_change(default_dom, server,
- rq_state, TIME,
- virt=virt)
- if status != PASS:
- logger.error("Unable to '%s' dom '%s' using RequestedStateChange()",
- action, default_dom)
- break
+ status = cxml.cim_start(server)
+ if status != PASS:
+ raise Exception("Unable start dom '%s'" % default_dom)
- status, dom_cs = poll_for_state_change(server, virt, default_dom, en_state,
- timeout=30)
-
- if status != PASS or dom_cs.RequestedState != rq_state:
- status = FAIL
- logger.error("Attributes for dom '%s' is not set as expected.",
- default_dom)
- break
-
+ status = cxml.cim_reset(server)
+ if status != PASS:
+ raise Exception("Unable reset dom '%s'" % default_dom)
except Exception, detail:
logger.error("Exception: %s", detail)
status = FAIL
- destroy_and_undefine_domain(default_dom, server, virt)
+ cxml.cim_destroy(server)
+ cxml.undefine(server)
+
return status
if __name__ == "__main__":
diff -r f317d11f46a2 -r e476bb52a679 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Jan 05 14:33:07 2009 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Jan 05 14:43:06 2009 -0800
@@ -614,7 +614,7 @@
def cim_reset(self, server, req_time=const.TIME, poll_time=30):
return self.cim_state_change(server, const.CIM_RESET,
- req_time, poll_time)
+ req_time, poll_time, const.CIM_ENABLE)
class XenXML(VirtXML, VirtCIM):
15 years, 11 months
[PATCH] [TEST] Rename 27_define_suspend_errs.py to 27_define_pause_errs.py
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1231193318 28800
# Node ID ae40dfa1b8f6e134d200233d2e5b3395855cafa2
# Parent 5ca146678acf60551b90b1e07a94633f0668b8c3
[TEST] Rename 27_define_suspend_errs.py to 27_define_pause_errs.py
CIM requested state 9 is pause, not suspend. So this test is being renamed.
It was also updated to use cim_() functions.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 5ca146678acf -r ae40dfa1b8f6 suites/libvirt-cim/cimtest/ComputerSystem/27_define_pause_errs.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/27_define_pause_errs.py Mon Jan 05 14:08:38 2009 -0800
@@ -0,0 +1,75 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Anoop V Chakkalakkal<anoop.vijayan(a)in.ibm.com>
+#
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# Test Case Info:
+# --------------
+# This test case is used to verify the Virtual System State Transition
+# The test is considered to be successful if the request for the invalid
+# state change from defined to suspend fails
+#
+# Date: 05-03-2008
+#
+
+import sys
+from CimTest.Globals import logger
+from XenKvmLib.const import do_main
+from CimTest.ReturnCodes import PASS, FAIL
+from XenKvmLib.vxml import get_class
+
+sup_types = ['Xen', 'XenFV', 'LXC', 'KVM']
+
+default_dom = 'test_domain'
+
+@do_main(sup_types)
+def main():
+ options = main.options
+ server = options.ip
+ virt = options.virt
+ status = FAIL
+
+ try:
+ # define the vs
+ cxml = get_class(options.virt)(default_dom)
+ ret = cxml.cim_define(server)
+ if not ret:
+ raise Exception("Failed to define the guest: %s" % default_dom)
+
+ status = cxml.cim_pause(server)
+ if status != PASS:
+ raise Exception("Unable pause dom '%s'" % default_dom)
+
+ except Exception, details:
+ logger.error("Exception: %s", details)
+ status = FAIL
+
+ if status != FAIL:
+ logger.error("Expected Defined -> Suspended state transition to fail")
+ status = FAIL
+ else:
+ status = PASS
+
+ cxml.undefine(server)
+
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
diff -r 5ca146678acf -r ae40dfa1b8f6 suites/libvirt-cim/cimtest/ComputerSystem/27_define_suspend_errs.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/27_define_suspend_errs.py Mon Jan 05 13:41:14 2009 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2008 IBM Corp.
-#
-# Authors:
-# Anoop V Chakkalakkal<anoop.vijayan(a)in.ibm.com>
-#
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Test Case Info:
-# --------------
-# This test case is used to verify the Virtual System State Transition
-# The test is considered to be successful if the request for the invalid
-# state change from defined to suspend fails
-#
-# List of Valid state values (Refer to VSP spec doc Table 2 for more)
-# ---------------------------------
-# State | Values
-# ---------------------------------
-# Defined | 3
-# Suspend | 9
-#
-# Date: 05-03-2008
-#
-
-import sys
-import pywbem
-from VirtLib import utils
-from CimTest.Globals import logger
-from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL
-from XenKvmLib.test_doms import destroy_and_undefine_domain
-from XenKvmLib.common_util import try_request_state_change, \
- create_using_definesystem
-
-sup_types = ['Xen', 'XenFV', 'LXC', 'KVM']
-
-SUSPEND_STATE = 9
-default_dom = 'test_domain'
-TIME = "00000000000000.000000:000"
-exp_rc = pywbem.CIM_ERR_FAILED
-exp_desc = 'Domain not running'
-
-
-@do_main(sup_types)
-def main():
- options = main.options
- server = options.ip
- virt = options.virt
- status = FAIL
-
- try:
- # define the vs
- status = create_using_definesystem(default_dom, server, virt=virt)
- if status != PASS:
- logger.error("Unable to define domain '%s' using DefineSystem()",
- default_dom)
- return status
-
- except Exception, details:
- logger.error("Exception: %s", details)
- destroy_and_undefine_domain(default_dom, server, virt)
- return FAIL
-
- status = try_request_state_change(default_dom, server,
- SUSPEND_STATE, TIME, exp_rc,
- exp_desc, virt)
-
- if status != PASS:
- logger.error("Expected Defined -> Suspended state transition to fail")
-
- destroy_and_undefine_domain(default_dom, server, virt)
- return status
-
-if __name__ == "__main__":
- sys.exit(main())
15 years, 11 months
[PATCH] [TEST] #2 Update CS 06_paused_active_suspend.py to use cim_() functions
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1231183018 28800
# Node ID 0e6f4b82fce48e3ed1eeb46f3b8f318ebc9f5ffb
# Parent 1745043d345ceb2ee24462bee31c8c5e640e6bad
[TEST] #2 Update CS 06_paused_active_suspend.py to use cim_() functions.
This test has been re-written so it is now easier to read and flows better.
Updates:
-Use check_guest_state()
-Use CIM state values defined in const.py
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 1745043d345c -r 0e6f4b82fce4 suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py Mon Jan 05 11:16:46 2009 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/06_paused_active_suspend.py Mon Jan 05 11:16:58 2009 -0800
@@ -26,36 +26,20 @@
# information related to this is captured in the RequestedState Property
# of the VS.
# The test is considered to be successful if RequestedState Property
-# has a value of "9" when the VS is moved from active to suspend state.
+# has a value of "9" when the VS is moved from active to paused state.
#
-# List of Valid state values (Refer to VSP spec doc Table 2 for more)
-# ---------------------------------
-# State | Values
-# ---------------------------------
-# Defined | 3
-# Active | 2
-# Paused | 9
-# Suspended | 6
-#
-#
# Date :18-10-2007
import sys
-from XenKvmLib import vxml
-from VirtLib import utils
-from XenKvmLib.test_doms import destroy_and_undefine_all
+from XenKvmLib.vxml import get_class
from CimTest.Globals import logger
-from XenKvmLib.const import do_main
-from XenKvmLib.common_util import call_request_state_change, \
-poll_for_state_change
+from XenKvmLib.const import do_main, CIM_ENABLE, CIM_PAUSE
from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from XenKvmLib.classes import get_typed_class
+from XenKvmLib.enumclass import GetInstance
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "DomST1"
-mem = 128 # MB
-START_STATE = 2
-FINAL_STATE = 9
-TIME = "00000000000000.000000:000"
bug_libvirt = "00011"
@do_main(sup_types)
@@ -65,69 +49,42 @@
server = options.ip
virt = options.virt
- destroy_and_undefine_all(server)
-
- cxml = vxml.get_class(virt)(test_dom, mem)
+ cxml = get_class(virt)(test_dom)
#Create VS
+ pause_failed = False
try:
- ret = cxml.create(server)
+ ret = cxml.cim_define(server)
if not ret:
- logger.error("VS '%s' was not created" % test_dom)
- return status
+ raise Exception("VS '%s' was not defined" % test_dom)
+
+ status = cxml.cim_start(server)
+ if status != PASS:
+ raise Exception("Unable start dom '%s'" % test_dom)
+
+ status = cxml.check_guest_state(options.ip, CIM_ENABLE)
+ if status != PASS:
+ raise Exception("%s not in expected state" % test_dom)
+
+ #Pause the VS
+ status = cxml.cim_pause(server)
+ if status != PASS:
+ pause_failed = True
+ raise Exception("Unable pause dom '%s'" % test_dom)
+
+ status = cxml.check_guest_state(options.ip, CIM_PAUSE)
+ if status != PASS:
+ raise Exception("%s not in expected state" % test_dom)
+
except Exception, detail:
logger.error("Exception variable: %s" % detail)
- return status
-
- status, dom_cs = poll_for_state_change(server, virt, test_dom,
- START_STATE)
-
- if status != PASS:
- cxml.destroy(server)
- return status
-
- from_State = dom_cs.EnabledState
-
- #Suspend the VS
- status = call_request_state_change(test_dom, server, FINAL_STATE,
- TIME, virt)
- if status != PASS:
- logger.error("Unable to suspend dom '%s' using RequestedStateChange()",
- test_dom)
- cxml.destroy(server)
- if virt == 'LXC':
- return XFAIL_RC(bug_libvirt)
- return status
-
- #Polling for the value of EnabledState to be set to 9.
- #We need to wait for the EnabledState to be set appropriately since
- #it does not get set immediatley to value of 9 when suspended.
- status, dom_cs = poll_for_state_change(server, virt, test_dom,
- FINAL_STATE, timeout=40)
-
- if status != PASS:
- cxml.destroy(server)
- return status
-
- enabledState = dom_cs.EnabledState
- to_RequestedState = dom_cs.RequestedState
-
- # Success:
- # if
- # From state == 2
- # To state == 9
- # Enabled_state == RequestedState
-
- if from_State == START_STATE and \
- to_RequestedState == FINAL_STATE and \
- to_RequestedState == enabledState:
- status = PASS
- else:
- logger.error("VS '%s' transition from Activate State to Suspend State"
- " was not Successful" % test_dom)
status = FAIL
cxml.destroy(server)
+ cxml.undefine(options.ip)
+
+ if pause_failed and virt == 'LXC':
+ return XFAIL_RC(bug_libvirt)
return status
if __name__ == "__main__":
15 years, 11 months
[PATCH] [TEST] #2 Update CS 05_activate_defined_start.py
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1231183006 28800
# Node ID 1745043d345ceb2ee24462bee31c8c5e640e6bad
# Parent 6f478a44ce06ad28bd0c5f019eeb0fff13c6e274
[TEST] #2 Update CS 05_activate_defined_start.py
Re-wrote this test to fix readibilty and layout.
Updates:
-Use check_guest_state()
-Use CIM state values defined in const.py
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 6f478a44ce06 -r 1745043d345c suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py
--- a/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Mon Jan 05 10:11:32 2009 -0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystem/05_activate_defined_start.py Mon Jan 05 11:16:46 2009 -0800
@@ -29,96 +29,49 @@
# The test is considered to be successful if RequestedState Property
# has a value of "2" when the VS is moved from defined to activate state.
#
-# List of Valid state values (Refer to VSP spec doc Table 2 for more)
-# ---------------------------------
-# State | Values
-# ---------------------------------
-# Defined | 3
-# Active | 2
-# Paused | 9
-# Suspended | 6
-#
-#
# Date : 17-10-2007
import sys
-from XenKvmLib import enumclass
-from XenKvmLib import vxml
-from VirtLib import utils
+from XenKvmLib.enumclass import GetInstance
+from XenKvmLib.vxml import get_class
from CimTest.Globals import logger
-from XenKvmLib.const import do_main
+from XenKvmLib.const import do_main, CIM_ENABLE, CIM_DISABLE
from XenKvmLib.classes import get_typed_class
-from CimTest.ReturnCodes import PASS, FAIL, XFAIL_RC
+from CimTest.ReturnCodes import PASS, FAIL
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
test_dom = "DomST1"
-mem = 128 # MB
-bug_no = "00002"
-START_STATE = 3
-FINAL_STATE = 2
@do_main(sup_types)
def main():
options = main.options
status = FAIL
- cxml = vxml.get_class(options.virt)(test_dom, mem)
+ cxml = get_class(options.virt)(test_dom)
ret = cxml.cim_define(options.ip)
#Define a VS
if not ret :
logger.error("ERROR: VS '%s' was not defined", test_dom)
return status
- cs_class = get_typed_class(options.virt, 'ComputerSystem')
- keys = { 'Name' : test_dom, 'CreationClassName' : cs_class }
+ try:
+ status = cxml.check_guest_state(options.ip, CIM_DISABLE, 0)
+ if status != PASS:
+ raise Exception("%s not in expected state" % test_dom)
- try:
- cs = enumclass.GetInstance(options.ip, cs_class, keys)
- if cs.Name == test_dom:
- from_State = cs.EnabledState
- else:
- logger.error("VS '%s' is not available", test_dom)
- return status
+ #Change the state of the VS to Start
+ status = cxml.cim_start(options.ip)
+ if status != PASS:
+ raise Exception("Unable start dom '%s'" % test_dom)
+
+ #Get the value of the EnabledState property and RequestedState property.
+ status = cxml.check_guest_state(options.ip, CIM_ENABLE)
+ if status != PASS:
+ raise Exception("%s not in expected state" % test_dom)
except Exception, detail:
logger.error("Exception: %s" % detail)
- cxml.undefine(options.ip)
- return status
-
- try:
- #Change the state of the VS to Start
- status = cxml.cim_start(options.ip)
- if status != PASS:
- logger.error("Unable start dom '%s' using "
- "RequestedStateChange()", test_dom)
- cxml.undefine(options.ip)
- return status
-
- #Get the value of the EnabledState property and RequestedState property.
- cs= enumclass.GetInstance(options.ip, cs_class, keys)
- if cs.Name == test_dom:
- to_RequestedState = cs.RequestedState
- enabledState = cs.EnabledState
- else:
- logger.error("VS '%s' is not found", test_dom)
- return status
-
- # Success:
- # if
- # From state == defined
- # To state == running
- # Enabled_state == RequestedState
-
- if from_State == START_STATE and \
- to_RequestedState == FINAL_STATE and \
- enabledState == to_RequestedState:
- status = PASS
- else:
- logger.error("VS '%s' transition from Defined State to "
- "Activate state was not Successful", test_dom)
- status = XFAIL_RC(bug_no)
- except Exception, detail:
- logger.error("Exception: %s" % detail)
+ status = FAIL
cxml.cim_destroy(options.ip)
cxml.undefine(options.ip)
15 years, 11 months