[PATCH] [RFC] ProcessorRASD, the class that won't go away
by Jay Gagnon
# HG changeset patch
# User Jay Gagnon <grendel(a)linux.vnet.ibm.com>
# Date 1208983463 14400
# Node ID 741b757ad68c5c4b35c5c697acbc121ac88d1ecf
# Parent 2806f8744946757036f9639d8c8fe9a95f689233
[RFC] ProcessorRASD, the class that won't go away
Around and round we go on the merry-go-round of indecision, hopefully for our last ride. The definitely probably absolutely tentative final plan is that the default representation of processors as virt_device structs will be one per domain, with a quantity. Virt_Devices will just need to be told how to handle that, and all the RASD stuff will be much happier for it. And then we will never speak of this again.
Signed-off-by: Jay Gagnon <grendel(a)linux.vnet.ibm.com>
diff -r 2806f8744946 -r 741b757ad68c libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Wed Apr 16 17:50:49 2008 -0700
+++ b/libxkutil/device_parsing.c Wed Apr 23 16:44:23 2008 -0400
@@ -337,7 +337,6 @@ static int parse_vcpu_device(xmlNode *no
struct virt_device *list = NULL;
char *count_str;
int count;
- int i;
count_str = get_node_content(node);
if (count_str == NULL)
@@ -347,24 +346,15 @@ static int parse_vcpu_device(xmlNode *no
free(count_str);
- list = calloc(count, sizeof(*list));
+ list = calloc(1, sizeof(*list));
if (list == NULL)
goto err;
-
- for (i = 0; i < count; i++) {
- struct virt_device *vdev = &list[i];
- struct vcpu_device *cdev = &vdev->dev.vcpu;
-
- cdev->number = i;
-
- vdev->type = CIM_RES_TYPE_PROC;
- if (asprintf(&vdev->id, "%i", i) == -1)
- vdev->id = NULL;
- }
+
+ list->dev.vcpu.quantity = count;
*vdevs = list;
- return count;
+ return 1;
err:
free(list);
@@ -620,7 +610,7 @@ struct virt_device *virt_device_dup(stru
dev->dev.mem.size = _dev->dev.mem.size;
dev->dev.mem.maxsize = _dev->dev.mem.maxsize;
} else if (dev->type == CIM_RES_TYPE_PROC) {
- dev->dev.vcpu.number = _dev->dev.vcpu.number;
+ dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity;
} else if (dev->type == CIM_RES_TYPE_EMU) {
DUP_FIELD(dev, _dev, dev.emu.path);
} else if (dev->type == CIM_RES_TYPE_GRAPHICS) {
@@ -672,6 +662,32 @@ static int _get_mem_device(const char *x
return 1;
}
+static int _get_proc_device(const char *xml, struct virt_device **list)
+{
+ struct virt_device *proc_devs = NULL;
+ struct virt_device *proc_dev = NULL;
+ int ret;
+
+ ret = parse_devices(xml, &proc_devs, CIM_RES_TYPE_PROC);
+ if (ret <= 0)
+ return ret;
+
+ proc_dev = malloc(sizeof(*proc_dev));
+ if (proc_dev == NULL)
+ return 0;
+
+ memset(proc_dev, 0, sizeof(*proc_dev));
+
+ proc_dev->type = CIM_RES_TYPE_PROC;
+ proc_dev->id = strdup("proc");
+ proc_dev->dev.vcpu.quantity = proc_devs[0].dev.vcpu.quantity;
+ *list = proc_dev;
+
+ cleanup_virt_devices(&proc_devs, ret);
+
+ return 1;
+};
+
int get_devices(virDomainPtr dom, struct virt_device **list, int type)
{
char *xml;
@@ -683,6 +699,8 @@ int get_devices(virDomainPtr dom, struct
if (type == CIM_RES_TYPE_MEM)
ret = _get_mem_device(xml, list);
+ else if (type == CIM_RES_TYPE_PROC)
+ ret = _get_proc_device(xml, list);
else
ret = parse_devices(xml, list, type);
diff -r 2806f8744946 -r 741b757ad68c libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Wed Apr 16 17:50:49 2008 -0700
+++ b/libxkutil/device_parsing.h Wed Apr 23 16:44:23 2008 -0400
@@ -50,7 +50,7 @@ struct mem_device {
};
struct vcpu_device {
- uint64_t number;
+ uint64_t quantity;
};
struct emu_device {
diff -r 2806f8744946 -r 741b757ad68c src/Virt_Device.c
--- a/src/Virt_Device.c Wed Apr 16 17:50:49 2008 -0700
+++ b/src/Virt_Device.c Wed Apr 23 16:44:23 2008 -0400
@@ -174,23 +174,6 @@ static CMPIInstance *mem_instance(const
return inst;
}
-static CMPIInstance *vcpu_instance(const CMPIBroker *broker,
- struct vcpu_device *dev,
- const virDomainPtr dom,
- const char *ns)
-{
- CMPIInstance *inst;
- virConnectPtr conn;
-
- conn = virDomainGetConnect(dom);
- inst = get_typed_instance(broker,
- pfx_from_conn(conn),
- "Processor",
- ns);
-
- return inst;
-}
-
static int device_set_devid(CMPIInstance *instance,
struct virt_device *dev,
const virDomainPtr dom)
@@ -229,43 +212,114 @@ static int device_set_systemname(CMPIIns
return 1;
}
-static CMPIInstance *device_instance(const CMPIBroker *broker,
- struct virt_device *dev,
- const virDomainPtr dom,
- const char *ns)
-{
- CMPIInstance *instance;
-
- if (dev->type == CIM_RES_TYPE_NET)
- instance = net_instance(broker,
- &dev->dev.net,
- dom,
- ns);
- else if (dev->type == CIM_RES_TYPE_DISK)
- instance = disk_instance(broker,
- &dev->dev.disk,
- dom,
- ns);
- else if (dev->type == CIM_RES_TYPE_MEM)
- instance = mem_instance(broker,
- &dev->dev.mem,
- dom,
- ns);
- else if (dev->type == CIM_RES_TYPE_PROC)
- instance = vcpu_instance(broker,
- &dev->dev.vcpu,
- dom,
- ns);
- else
- return NULL;
-
- if (!instance)
- return NULL;
-
- device_set_devid(instance, dev, dom);
- device_set_systemname(instance, dom);
-
- return instance;
+static char *get_vcpu_inst_id(const virDomainPtr dom,
+ int proc_num)
+{
+ int rc;
+ char *id_num = NULL;
+ char *dev_id = NULL;
+
+ rc = asprintf(&id_num, "%d", proc_num);
+ if (rc == -1) {
+ free(dev_id);
+ dev_id = NULL;
+ goto out;
+ }
+
+ dev_id = get_fq_devid((char *)virDomainGetName(dom), id_num);
+ free(id_num);
+
+ out:
+ return dev_id;
+}
+
+static bool vcpu_instances(const CMPIBroker *broker,
+ const virDomainPtr dom,
+ const char *ns,
+ uint64_t proc_count,
+ struct inst_list *list)
+{
+ int i;
+ char *dev_id;
+ CMPIInstance *inst;
+ virConnectPtr conn;
+
+ for (i = 0; i < proc_count; i++) {
+ conn = virDomainGetConnect(dom);
+ inst = get_typed_instance(broker,
+ pfx_from_conn(conn),
+ "Processor",
+ ns);
+ if (inst == NULL)
+ return false;
+
+ dev_id = get_vcpu_inst_id(dom, i);
+ CMSetProperty(inst, "DeviceID",
+ (CMPIValue *)dev_id, CMPI_chars);
+ free(dev_id);
+
+ device_set_systemname(inst, dom);
+ inst_list_add(list, inst);
+ }
+
+ return true;
+}
+
+static bool device_instances(const CMPIBroker *broker,
+ struct virt_device *devs,
+ int count,
+ const virDomainPtr dom,
+ const char *ns,
+ struct inst_list *list)
+{
+ int i;
+ bool ret;
+ uint64_t proc_count = 0;
+ bool proc_found = false;
+ CMPIInstance *instance = NULL;
+
+ for (i = 0; i < count; i++) {
+ struct virt_device *dev = &devs[i];
+
+ if (dev->type == CIM_RES_TYPE_NET)
+ instance = net_instance(broker,
+ &dev->dev.net,
+ dom,
+ ns);
+ else if (dev->type == CIM_RES_TYPE_DISK)
+ instance = disk_instance(broker,
+ &dev->dev.disk,
+ dom,
+ ns);
+ else if (dev->type == CIM_RES_TYPE_MEM)
+ instance = mem_instance(broker,
+ &dev->dev.mem,
+ dom,
+ ns);
+ else if (dev->type == CIM_RES_TYPE_PROC) {
+ proc_found = true;
+ proc_count = dev->dev.vcpu.quantity;
+ continue;
+ } else
+ return false;
+
+ if (!instance)
+ return false;
+
+ device_set_devid(instance, dev, dom);
+ device_set_systemname(instance, dom);
+ inst_list_add(list, instance);
+ }
+
+ if (proc_count) {
+ ret = vcpu_instances(broker,
+ dom,
+ ns,
+ proc_count,
+ list);
+ }
+
+ return true;
}
uint16_t res_type_from_device_classname(const char *classname)
@@ -290,25 +344,24 @@ static CMPIStatus _get_devices(const CMP
{
CMPIStatus s = {CMPI_RC_OK, NULL};
int count;
- int i;
+ bool rc;
struct virt_device *devs = NULL;
count = get_devices(dom, &devs, type);
if (count <= 0)
goto out;
- for (i = 0; i < count; i++) {
- CMPIInstance *dev = NULL;
-
- dev = device_instance(broker,
- &devs[i],
- dom,
- NAMESPACE(reference));
- if (dev)
- inst_list_add(list, dev);
-
- cleanup_virt_device(&devs[i]);
- }
+ rc = device_instances(broker,
+ devs,
+ count,
+ dom,
+ NAMESPACE(reference),
+ list);
+
+ if (!rc)
+ CU_DEBUG("Problem");
+
+ cleanup_virt_devices(&devs, count);
out:
free(devs);
@@ -501,10 +554,13 @@ CMPIStatus get_device_by_name(const CMPI
goto err;
}
+#if 0
+ /* TODO: Handle this one. */
instance = device_instance(broker,
dev,
dom,
NAMESPACE(reference));
+#endif
cleanup_virt_device(dev);
*_inst = instance;
diff -r 2806f8744946 -r 741b757ad68c src/Virt_RASD.c
--- a/src/Virt_RASD.c Wed Apr 16 17:50:49 2008 -0700
+++ b/src/Virt_RASD.c Wed Apr 23 16:44:23 2008 -0400
@@ -173,10 +173,8 @@ static CMPIInstance *rasd_from_vdev(cons
CMSetProperty(inst, "Limit",
(CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64);
} else if (dev->type == CIM_RES_TYPE_PROC) {
- /* This would be the place to set the virtualquantity. */
- uint64_t quantity = dev->dev.vcpu.number + 1;
CMSetProperty(inst, "VirtualQuantity",
- (CMPIValue *)&quantity, CMPI_uint64);
+ (CMPIValue *)&dev->dev.vcpu.quantity, CMPI_uint64);
}
/* FIXME: Put the HostResource in place */
16 years, 8 months
[PATCH] [TEST] add branch of proc InstanceID and MB versus KB for memory in VSSD.04
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1209349323 25200
# Node ID 72f712cd3ceed863ebfcf9da734128b2553ac553
# Parent 22ed2c7c77e8ff3d96b40f1e0db2a931b5a7c37e
[TEST] add branch of proc InstanceID and MB versus KB for memory in VSSD.04
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 22ed2c7c77e8 -r 72f712cd3cee suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py
--- a/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py Fri Apr 25 03:20:54 2008 -0700
+++ b/suites/libvirt-cim/cimtest/VSSD/04_vssd_to_rasd.py Sun Apr 27 19:22:03 2008 -0700
@@ -53,6 +53,7 @@ from XenKvmLib.classes import get_typed_
from XenKvmLib.classes import get_typed_class
from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
verify_diskrasd_values, verify_memrasd_values
+from XenKvmLib.const import CIM_REV
sup_types = ['Xen', 'KVM', 'XenFV']
@@ -60,6 +61,8 @@ test_vcpus = 1
test_vcpus = 1
test_mem = 128
test_mac = "00:11:22:33:44:aa"
+proc_rev = 531
+mem_rev = 529
def setup_env():
vsxml_info = None
@@ -86,6 +89,8 @@ def init_list(virt):
"ResourceType" : 3,
"CreationClassName": get_typed_class(virt, 'ProcResourceAllocationSettingData')
}
+ if CIM_REV < proc_rev:
+ procrasd['InstanceID'] = '%s/%s' %(test_dom, "0")
netrasd = {
"InstanceID" : '%s/%s' %(test_dom,test_mac),
@@ -109,6 +114,8 @@ def init_list(virt):
"VirtualQuantity" : (test_mem * 1024),
"CreationClassName": get_typed_class(virt, 'MemResourceAllocationSettingData')
}
+ if CIM_REV < mem_rev:
+ memrasd['AllocationUnits'] = "MegaBytes"
return procrasd, netrasd, diskrasd, memrasd
def get_inst_from_list(classname, vssd_list, filter_name, exp_val):
16 years, 8 months
[PATCH] [TEST] Add branch of MB versus KB for memory in HostSystme.02
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1209348083 25200
# Node ID ee201ab9f32a63a7f4ebbce48ff52d60465c3d13
# Parent 22ed2c7c77e8ff3d96b40f1e0db2a931b5a7c37e
[TEST] Add branch of MB versus KB for memory in HostSystme.02
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 22ed2c7c77e8 -r ee201ab9f32a suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py
--- a/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py Fri Apr 25 03:20:54 2008 -0700
+++ b/suites/libvirt-cim/cimtest/HostSystem/02_hostsystem_to_rasd.py Sun Apr 27 19:01:23 2008 -0700
@@ -58,6 +58,7 @@ from CimTest.ReturnCodes import PASS, FA
from CimTest.ReturnCodes import PASS, FAIL
from XenKvmLib.rasd import verify_procrasd_values, verify_netrasd_values, \
verify_diskrasd_values, verify_memrasd_values
+from XenKvmLib.const import CIM_REV
sup_types = ['Xen', 'KVM', 'XenFV']
@@ -66,6 +67,7 @@ test_vcpus = 1
test_vcpus = 1
test_mem = 128
test_mac = "00:11:22:33:44:aa"
+rev = 529
def init_list(vsxml, virt="Xen"):
"""
@@ -100,6 +102,8 @@ def init_list(vsxml, virt="Xen"):
"VirtualQuantity" : (test_mem * 1024),
}
}
+ if CIM_REV < rev:
+ rasd_values[mem_cn]['AllocationUnits'] = "MegaBytes"
return rasd_values
16 years, 8 months
[PATCH 0 of 2] Beginnings of LXC DefineSystem() support
by Dan Smith
This patch adds some device type filtering framework to prevent a user from
specifying an invalid device in a domain configuration (like a disk device
to a container). It also adds early VSSD parsing support to VSMS.
16 years, 8 months
[PATCH] LXC osinfo xml generation bits
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1209142937 25200
# Node ID e1ce6d481719f6d884bcd662294b18136371c300
# Parent b425f4f1a59fac3b594b7536f00f18f20a4709c2
LXC osinfo xml generation bits
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r b425f4f1a59f -r e1ce6d481719 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Fri Apr 25 09:11:59 2008 -0700
+++ b/libxkutil/xmlgen.c Fri Apr 25 10:02:17 2008 -0700
@@ -533,6 +533,23 @@ static char *_kvm_os_xml(struct domain *
return xml;
}
+static char *_lxc_os_xml(struct domain *domain)
+{
+ struct lxc_os_info *os = &domain->os_info.lxc;
+ int ret;
+ char *xml = NULL;
+
+ ret = asprintf(&xml,
+ "<os>\n"
+ " <init>%s</init>\n"
+ "</os>\n",
+ os->init);
+ if (ret == -1)
+ xml = NULL;
+
+ return xml;
+}
+
static char *os_xml(struct domain *domain)
{
if (domain->type == DOMAIN_XENPV)
@@ -541,6 +558,8 @@ static char *os_xml(struct domain *domai
return _xenfv_os_xml(domain);
else if (domain->type == DOMAIN_KVM)
return _kvm_os_xml(domain);
+ else if (domain->type == DOMAIN_LXC)
+ return _lxc_os_xml(domain);
else
return strdup("<!-- unsupported domain type -->\n");
}
@@ -561,6 +580,8 @@ char *system_to_xml(struct domain *domin
domtype = "xen";
else if (dominfo->type == DOMAIN_KVM)
domtype = "kvm";
+ else if (dominfo->type == DOMAIN_LXC)
+ domtype = "lxc";
else
domtype = "unknown";
16 years, 8 months
[PATCH] Fill in the previously-unimplemented AC-to-Pool association with EC
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1209146661 25200
# Node ID 2f9459623e83b5f787e4aa86c9074af394030c30
# Parent b425f4f1a59fac3b594b7536f00f18f20a4709c2
Fill in the previously-unimplemented AC-to-Pool association with EC
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r b425f4f1a59f -r 2f9459623e83 src/Makefile.am
--- a/src/Makefile.am Fri Apr 25 09:11:59 2008 -0700
+++ b/src/Makefile.am Fri Apr 25 11:04:21 2008 -0700
@@ -112,7 +112,7 @@ libVirt_AllocationCapabilities_la_SOURCE
libVirt_AllocationCapabilities_la_SOURCES = Virt_AllocationCapabilities.c
libVirt_AllocationCapabilities_la_LIBADD = -lVirt_DevicePool
-libVirt_ElementCapabilities_la_DEPENDENCIES = libVirt_VirtualSystemManagementCapabilities.la libVirt_EnabledLogicalElementCapabilities.la libVirt_ComputerSystem.la libVirt_HostSystem.la libVirt_VSMigrationCapabilities.la libVirt_VirtualSystemManagementService.la libVirt_VSMigrationService.la
+libVirt_ElementCapabilities_la_DEPENDENCIES = libVirt_VirtualSystemManagementCapabilities.la libVirt_EnabledLogicalElementCapabilities.la libVirt_ComputerSystem.la libVirt_HostSystem.la libVirt_VSMigrationCapabilities.la libVirt_VirtualSystemManagementService.la libVirt_VSMigrationService.la libVirt_DevicePool.la
libVirt_ElementCapabilities_la_SOURCES = Virt_ElementCapabilities.c
libVirt_ElementCapabilities_la_LIBADD = -lVirt_VirtualSystemManagementCapabilities \
-lVirt_EnabledLogicalElementCapabilities \
@@ -121,7 +121,8 @@ libVirt_ElementCapabilities_la_LIBADD =
-lVirt_VSMigrationCapabilities \
-lVirt_AllocationCapabilities \
-lVirt_VirtualSystemManagementService \
- -lVirt_VSMigrationService
+ -lVirt_VSMigrationService \
+ -lVirt_DevicePool
libVirt_SettingsDefineCapabilities_la_DEPENDENCIES = libVirt_RASD.la libVirt_DevicePool.la libVirt_VSMigrationCapabilities.la libVirt_VSMigrationSettingData.la
libVirt_SettingsDefineCapabilities_la_SOURCES = Virt_SettingsDefineCapabilities.c
diff -r b425f4f1a59f -r 2f9459623e83 src/Virt_ElementCapabilities.c
--- a/src/Virt_ElementCapabilities.c Fri Apr 25 09:11:59 2008 -0700
+++ b/src/Virt_ElementCapabilities.c Fri Apr 25 11:04:21 2008 -0700
@@ -40,6 +40,7 @@
#include "Virt_HostSystem.h"
#include "Virt_VSMigrationCapabilities.h"
#include "Virt_AllocationCapabilities.h"
+#include "Virt_DevicePool.h"
#include "svpc_types.h"
@@ -270,6 +271,7 @@ static CMPIStatus alloc_to_pool_and_sys(
CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *host;
CMPIInstance *ac;
+ CMPIInstance *pool;
const char *poolid;
if (!match_hypervisor_prefix(ref, info))
@@ -282,7 +284,9 @@ static CMPIStatus alloc_to_pool_and_sys(
goto out;
}
- /* Pool part not yet implemented */
+ s = get_pool_by_name(_BROKER, ref, poolid, &pool);
+ if ((pool == NULL) || (s.rc != CMPI_RC_OK))
+ goto out;
s = get_alloc_cap_by_id(_BROKER, ref, poolid, &ac);
if ((ac == NULL) || (s.rc != CMPI_RC_OK))
@@ -293,6 +297,7 @@ static CMPIStatus alloc_to_pool_and_sys(
goto out;
inst_list_add(list, host);
+ inst_list_add(list, pool);
out:
return s;
}
16 years, 8 months
[PATCH] [TEST] Update ComputerSystemIndication.01 for all three of lifecycle indications support
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1208767952 -28800
# Node ID 36ef9e7fdfc53a20e5a248257b57723ab8ae85dc
# Parent 0d31dff13ae341fd6515dc844ee98c7b5300b71d
[TEST] Update ComputerSystemIndication.01 for all three of lifecycle indications support
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 0d31dff13ae3 -r 36ef9e7fdfc5 suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py
--- a/suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py Fri Apr 18 17:00:16 2008 +0800
+++ b/suites/libvirt-cim/cimtest/ComputerSystemIndication/01_created_indication.py Mon Apr 21 16:52:32 2008 +0800
@@ -28,14 +28,16 @@
from CimTest.Globals import do_main
from CimTest.ReturnCodes import PASS, FAIL
from XenKvmLib.common_util import create_using_definesystem
-from XenKvmLib.test_doms import undefine_test_domain
from XenKvmLib.classes import get_typed_class
+from XenKvmLib import vsms
+from XenKvmLib import vxml
from XenKvmLib.indication_tester import CIMIndicationSubscription
from XenKvmLib.vxml import set_default
SUPPORTED_TYPES = ['Xen', 'XenFV', 'KVM']
test_dom = "domU"
+nmem = 64
@do_main(SUPPORTED_TYPES)
def main():
@@ -44,8 +46,13 @@
status = FAIL
dict = set_default(options.ip)
- indication_name = get_typed_class(options.virt, 'ComputerSystemCreatedIndication')
-
+
+ created_indication = get_typed_class(options.virt, 'ComputerSystemCreatedIndication')
+ modified_indication = get_typed_class(options.virt, 'ComputerSystemModifiedIndication')
+ deleted_indication = get_typed_class(options.virt, 'ComputerSystemDeletedIndication')
+ indication_list = [created_indication, modified_indication, deleted_indication]
+
+ indication_name = "CIM_Indication"
sub = CIMIndicationSubscription(dict['default_name'], indication_name, dict['default_ns'],
dict['default_print_ind'], dict['default_sysname'])
sub.subscribe(dict['default_url'], dict['default_auth'])
@@ -55,16 +62,36 @@
pid = os.fork()
if pid == 0:
sub.server.handle_request()
- if len(sub.server.indications) == 0:
+ if len(sub.server.indications) != 3:
logger.error("No valid indications received")
sys.exit(1)
- elif str(sub.server.indications[0]) != indication_name:
- logger.error("Received indication %s instead of %s" % (indication_name, str(sub.server.indications[0])))
- sys.exit(2)
+ elif len(sub.server.indications) == 3:
+ for i in range(0, 3):
+ if str(sub.server.indications[i]) not in indication_list:
+ logger.error("Received indication %s instead of %s" % (indication_name, str(sub.server.indications[i])))
+ sys.exit(2)
else:
sys.exit(0)
else:
+ # Create domain
create_using_definesystem(test_dom, options.ip, None, None, options.virt)
+ time.sleep(10)
+
+ # Modify mem settings
+ service = vsms.get_vsms_class(options.virt)(options.ip)
+ cxml = vxml.get_class(options.virt)(test_dom)
+ masd = vsms.get_masd_class(options.virt)(megabytes=nmem, name=test_dom)
+ service.ModifyResourceSettings(ResourceSettings=[str(masd)])
+ cxml.dumpxml(options.ip)
+ mem = cxml.xml_get_mem()
+ if mem != '%i' % (nmem * 1024):
+ logger.error('Error changing rs for mem')
+ time.sleep(10)
+
+ # Delete domain
+ cxml.destroy(options.ip)
+ cxml.undefine(options.ip)
+
for i in range(0,100):
pw = os.waitpid(pid, os.WNOHANG)[1]
if pw == 0:
@@ -84,7 +111,6 @@
sub.unsubscribe(dict['default_auth'])
logger.info("Cancelling subscription for %s" % indication_name)
os.kill(pid, signal.SIGKILL)
- undefine_test_domain(test_dom, options.ip, options.virt)
return status
16 years, 8 months
[PATCH] [TEST]Fix indication_tester to send proper Content-Type based on Kaitlin's patch
by Guo Lian Yun
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1209086856 25200
# Node ID 37950e39b4173f3c3daa2c936de1a63708abd09d
# Parent 0b8c0247e9b8f8e7c26f25795a580284218c56e8
[TEST]Fix indication_tester to send proper Content-Type based on Kaitlin's patch
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 0b8c0247e9b8 -r 37950e39b417 suites/libvirt-cim/lib/XenKvmLib/indication_tester.py
--- a/suites/libvirt-cim/lib/XenKvmLib/indication_tester.py Wed Apr 23 19:56:59 2008 +0530
+++ b/suites/libvirt-cim/lib/XenKvmLib/indication_tester.py Thu Apr 24 18:27:36 2008 -0700
@@ -317,7 +317,7 @@ class CIMIndicationSubscription:
headers = {"CIMOperation" : "MethodCall",
"CIMMethod" : method,
"CIMObject" : "root/PG_Interop",
- "Content-Type" : "text/cimxml"}
+ "Content-Type" : 'application/xml; charset="utf-8"'}
if auth_hdr:
headers["Authorization"] = "Basic %s" % auth_hdr
@@ -325,7 +325,8 @@ class CIMIndicationSubscription:
conn.request("POST", "/cimom", body, headers)
resp = conn.getresponse()
if not resp.getheader("content-length"):
- raise Exception("Authentication (or request) Failed!")
+ raise Exception("Request Failed: %d %s" %
+ (resp.status, resp.reason))
resp.read()
16 years, 8 months
[PATCH] [TEST] #2 Rebased and updated 02_alloccap_gi_errs.py to use of the lib fn conf_file(), cleanup_restore() and create_diskpool_file()
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1209118854 25200
# Node ID d07d4f6c52f12135da8716294a28fc44135049d1
# Parent 0b8c0247e9b8f8e7c26f25795a580284218c56e8
[TEST] #2 Rebased and updated 02_alloccap_gi_errs.py to use of the lib fn conf_file(), cleanup_restore() and create_diskpool_file()
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r 0b8c0247e9b8 -r d07d4f6c52f1 suites/libvirt-cim/cimtest/AllocationCapabilities/02_alloccap_gi_errs.py
--- a/suites/libvirt-cim/cimtest/AllocationCapabilities/02_alloccap_gi_errs.py Wed Apr 23 19:56:59 2008 +0530
+++ b/suites/libvirt-cim/cimtest/AllocationCapabilities/02_alloccap_gi_errs.py Fri Apr 25 03:20:54 2008 -0700
@@ -63,55 +63,25 @@ from CimTest.Globals import do_main, pla
from CimTest.Globals import do_main, platform_sup
from XenKvmLib.classes import get_typed_class
from XenKvmLib.const import CIM_REV
+from XenKvmLib.common_util import cleanup_restore, test_dpath, \
+create_diskpool_file
-test_dpath = "foo"
-disk_file = '/tmp/diskpool.conf'
-back_disk_file = disk_file + "." + "alloccap_err"
diskid = "%s/%s" % ("DiskPool", test_dpath)
memid = "%s/%s" % ("MemoryPool", 0)
procid = "%s/%s" % ("ProcessorPool", 0)
rev = 463
-def conf_file():
- """
- Creating diskpool.conf file.
- """
- try:
- f = open(disk_file, 'w')
- f.write('%s %s' % (test_dpath, '/'))
- f.close()
- except Exception,detail:
- logger.error("Exception: %s", detail)
- status = SKIP
- sys.exit(status)
-
-def clean_up_restore():
- """
- Restoring back the original diskpool.conf
- file.
- """
- try:
- if os.path.exists(back_disk_file):
- os.remove(disk_file)
- move_file(back_disk_file, disk_file)
- except Exception, detail:
- logger.error("Exception: %s", detail)
- status = SKIP
- sys.exit(status)
-
@do_main(platform_sup)
def main():
options = main.options
- status = PASS
server = options.ip
- os.system("rm -f %s" % back_disk_file )
- if not (os.path.exists(disk_file)):
- conf_file()
- else:
- move_file(disk_file, back_disk_file)
- conf_file()
+ # Verify DiskPool on machine
+ status = create_diskpool_file()
+ if status != PASS:
+ return status
+ #Verify the virtual Network on the machine
vir_network = net_list(server)
if len(vir_network) > 0:
test_network = vir_network[0]
@@ -124,6 +94,7 @@ def main():
logger.error("Failed to create the Virtual Network '%s'",
test_network)
return SKIP
+
net_instid = 'NetworkPool/%s' %test_network
instid_list = ['ProcessorPool/0', 'MemoryPool/0',
'DiskPool/foo', net_instid]
@@ -159,7 +130,7 @@ def main():
status = ret_value
if status != PASS:
break
- clean_up_restore()
+ cleanup_restore()
return status
if __name__ == "__main__":
sys.exit(main())
16 years, 8 months