[PATCH] Fixing NullPointerException
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1293660976 28800
# Node ID a4f6fba67e8e85aaec6969c39cfaa016b60779d3
# Parent 35396e5b805193c024b6d4f065136d7b57a0b03d
Fixing NullPointerException
CMPIInstance 'inst' is used before it is set.
With this patch sending a one line change to
set previous instance correctly.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 35396e5b8051 -r a4f6fba67e8e src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Tue Dec 14 13:59:51 2010 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Wed Dec 29 14:16:16 2010 -0800
@@ -1378,16 +1378,6 @@
goto out;
}
- if (cu_get_str_prop(inst, "autoStart", &autoStartFlag) != CMPI_RC_OK)
- autoStartFlag = strdup("disable");
-
- if (STREQ(autoStartFlag, "enable"))
- autoflag = 1;
- else
- autoflag = 0;
- if((virDomainSetAutostart(dom, autoflag)) == -1)
- CU_DEBUG("Failed to set autostart flag.");
-
name = virDomainGetName(dom);
*s = get_domain_by_name(_BROKER, ref, name, &inst);
@@ -1396,6 +1386,20 @@
cu_statusf(_BROKER, s,
CMPI_RC_ERR_FAILED,
"Failed to lookup resulting system");
+ goto out;
+ }
+
+ if (inst != NULL) {
+ if (cu_get_str_prop(inst, "autoStart",
+ &autoStartFlag) != CMPI_RC_OK)
+ autoStartFlag = strdup("disable");
+
+ if (STREQ(autoStartFlag, "enable"))
+ autoflag = 1;
+ else
+ autoflag = 0;
+ if((virDomainSetAutostart(dom, autoflag)) == -1)
+ CU_DEBUG("Failed to set autostart flag.");
}
out:
@@ -2424,12 +2428,12 @@
goto out;
}
+ prev_inst = orig_inst;
s = cu_merge_instances(rasd, orig_inst);
if (s.rc != CMPI_RC_OK) {
CU_DEBUG("Failed to merge Instances");
goto out;
}
- prev_inst = orig_inst;
rasd = orig_inst;
}
13 years, 9 months
[PATCH] Patch to fix missing DiskPool type
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1293496322 28800
# Node ID 28f3d6f46a06aa5be6aba8bcfeda55bd0ddc5468
# Parent 35396e5b805193c024b6d4f065136d7b57a0b03d
Patch to fix missing DiskPool type.
DiskPool type was not being populated.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 35396e5b8051 -r 28f3d6f46a06 libxkutil/pool_parsing.c
--- a/libxkutil/pool_parsing.c Tue Dec 14 13:59:51 2010 -0800
+++ b/libxkutil/pool_parsing.c Mon Dec 27 16:32:02 2010 -0800
@@ -166,6 +166,30 @@
return 1;
}
+char *get_disk_pool_type(uint16_t type)
+{
+
+ switch (type) {
+ case DISK_POOL_DIR:
+ return "dir";
+ case DISK_POOL_FS:
+ return "fs";
+ case DISK_POOL_NETFS:
+ return "netfs";
+ case DISK_POOL_DISK:
+ return "disk";
+ case DISK_POOL_ISCSI:
+ return "iscsi";
+ case DISK_POOL_LOGICAL:
+ return "logical";
+ case DISK_POOL_SCSI:
+ return "scsi";
+ default:
+ return NULL;
+ }
+
+}
+
static const char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool)
{
xmlNode **nodes = nsv->nodeTab;
diff -r 35396e5b8051 -r 28f3d6f46a06 libxkutil/pool_parsing.h
--- a/libxkutil/pool_parsing.h Tue Dec 14 13:59:51 2010 -0800
+++ b/libxkutil/pool_parsing.h Mon Dec 27 16:32:02 2010 -0800
@@ -86,6 +86,7 @@
void cleanup_virt_pool_res(struct virt_pool_res **res);
int get_pool_from_xml(const char *xml, struct virt_pool *pool, int type);
+char *get_disk_pool_type(uint16_t type);
int define_pool(virConnectPtr conn, const char *xml, int res_type);
int destroy_pool(virConnectPtr conn, const char *name, int res_type);
diff -r 35396e5b8051 -r 28f3d6f46a06 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c Tue Dec 14 13:59:51 2010 -0800
+++ b/src/Virt_DevicePool.c Mon Dec 27 16:32:02 2010 -0800
@@ -172,6 +172,7 @@
virStoragePoolInfo info;
uint64_t cap;
uint64_t res;
+ uint16_t type;
struct virt_pool *pool_vals = NULL;
const char *pool_str = NULL;
@@ -204,6 +205,10 @@
CMSetProperty(inst, "Path",
(CMPIValue *)pool_str, CMPI_chars);
}
+ type = pool_vals->pool_info.disk.pool_type;
+ CMSetProperty(inst, "OtherResourceType",
+ (CMPIValue *)get_disk_pool_type(type),
+ CMPI_chars);
}
result = true;
@@ -957,11 +962,19 @@
const char *refcn,
const CMPIBroker *broker)
{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *inst;
char *poolid = NULL;
inst = get_typed_instance(broker, refcn, "DiskPool", ns);
+ if (inst == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to init DiskPool instance");
+ goto out;
+ }
+
if (asprintf(&poolid, "DiskPool/%s", pool->tag) == -1)
return NULL;
@@ -976,6 +989,7 @@
CU_DEBUG("Failed to set capacity for disk pool: %s",
pool->tag);
+out:
free(poolid);
return inst;
13 years, 9 months
[PATCH] Added support for qcow2 format type
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1293079091 28800
# Node ID 353104beb7b459f715f64bd88feb899bfce4458f
# Parent 35396e5b805193c024b6d4f065136d7b57a0b03d
Added support for qcow2 format type.
Only 'raw' storage volume was supported by libvirt-cim.
This patch adds support for qcow2.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 35396e5b8051 -r 353104beb7b4 libxkutil/pool_parsing.h
--- a/libxkutil/pool_parsing.h Tue Dec 14 13:59:51 2010 -0800
+++ b/libxkutil/pool_parsing.h Wed Dec 22 20:38:11 2010 -0800
@@ -66,7 +66,8 @@
struct storage_vol {
enum {VOL_FORMAT_UNKNOWN,
- VOL_FORMAT_RAW} format_type;
+ VOL_FORMAT_RAW,
+ VOL_FORMAT_QCOW2} format_type;
char *vol_name;
char *path;
uint16_t alloc;
diff -r 35396e5b8051 -r 353104beb7b4 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Tue Dec 14 13:59:51 2010 -0800
+++ b/libxkutil/xmlgen.c Wed Dec 22 20:38:11 2010 -0800
@@ -1134,6 +1134,8 @@
switch (type) {
case VOL_FORMAT_RAW:
return "raw";
+ case VOL_FORMAT_QCOW2:
+ return "qcow2";
default:
CU_DEBUG("Unsupported storage volume type");
}
13 years, 9 months
[PATCH] [TEST] Verify that disk can be dynamically modified
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1293659957 28800
# Node ID 52487783c9e1ae0967aa6f2c72269a85290c3f22
# Parent c08c7fb1eb78c209fd6af1fc40b9858b0027061b
[TEST] Verify that disk can be dynamically modified.
This test case will create a new VM (define and start)
and add a virtio disk and then modify it.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r c08c7fb1eb78 -r 52487783c9e1 suites/libvirt-cim/cimtest/VirtualSystemManagementService/30_dynamic_disk_mod.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/30_dynamic_disk_mod.py Wed Dec 29 13:59:17 2010 -0800
@@ -0,0 +1,88 @@
+#!/usr/bin/python
+#
+# Copyright 2008 IBM Corp.
+#
+# Authors:
+# Sharad Mishra <snmishra(a)us.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
+#
+
+import sys
+import pywbem
+from pywbem.cim_obj import CIMInstanceName
+from XenKvmLib import vsms
+from XenKvmLib import vxml
+from XenKvmLib.classes import get_typed_class
+from CimTest.Globals import logger
+from XenKvmLib.const import do_main
+from CimTest.ReturnCodes import FAIL, PASS
+from XenKvmLib import vsms_util
+
+sup_types = ['Xen', 'KVM', 'XenFV']
+default_dom = 'rstest_domain'
+
+@do_main(sup_types)
+def main():
+ options = main.options
+
+ if options.virt == 'KVM':
+ nddev = 'vda'
+ else:
+ nddev = 'xvdb'
+
+ service = vsms.get_vsms_class(options.virt)(options.ip)
+ cxml = vxml.get_class(options.virt)(default_dom)
+ classname = get_typed_class(options.virt, 'VirtualSystemSettingData')
+ inst_id = '%s:%s' % (options.virt, default_dom)
+ vssd_ref = CIMInstanceName(classname, keybindings = {
+ 'InstanceID' : inst_id,
+ 'CreationClassName' : classname})
+ dasd = vsms.get_dasd_class(options.virt)(dev=nddev,
+ source=cxml.secondary_disk_path,
+ name=default_dom)
+ disk_attr = { 'nddev' : nddev,
+ 'src_path' : cxml.secondary_disk_path
+ }
+
+ cxml.undefine(options.ip)
+ cxml = vxml.get_class(options.virt)(default_dom)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ logger.error("Failed to define the dom: %s", default_dom)
+ return FAIL
+
+ ret = cxml.start(options.ip)
+ if not ret:
+ logger.error("Failed to start the dom: %s", default_dom)
+ return FAIL
+
+ status = vsms_util.add_disk_res(options.ip, service, cxml, vssd_ref,
+ dasd, disk_attr)
+ if status != PASS:
+ return FAIL
+ dasd = vsms.get_dasd_class(options.virt)(dev='vdc',
+ instanceid='rstest_domain/vda',
+ source='/home/rss.iso',
+ name=default_dom)
+
+ service = vsms.get_vsms_class(options.virt)(options.ip)
+ output = service.ModifyResourceSettings(ResourceSettings = [str(dasd)])
+
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
+
13 years, 9 months
[PATCH] [TEST] Updated the test to create qcow2 storage volumes
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1293219718 28800
# Node ID c08c7fb1eb78c209fd6af1fc40b9858b0027061b
# Parent d88da81a62f6c4cd6bfc0310f360e4d77863d9f4
[TEST] Updated the test to create qcow2 storage volumes.
This test has been updated to create not just raw storage volumes, but also qcow2.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r d88da81a62f6 -r c08c7fb1eb78 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py
--- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Wed Dec 22 18:37:01 2010 -0800
+++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Fri Dec 24 11:41:58 2010 -0800
@@ -42,6 +42,7 @@
from XenKvmLib.classes import get_typed_class, inst_to_mof
from XenKvmLib.common_util import destroy_diskpool
from XenKvmLib.pool import create_pool, undefine_diskpool, DIR_POOL
+from pywbem.cim_types import Uint64
pool_attr = { 'Path' : _image_dir }
vol_name = "cimtest-vol.img"
@@ -62,7 +63,7 @@
return PASS, rasd
-def get_stovol_settings(server, virt, dp_id, pool_name):
+def get_stovol_settings(server, virt, dp_id, pool_name, format):
status, dp_rasds = get_template_rasd_from_sdc(virt, server, dp_id)
if status != PASS:
logger.error("Failed to get the StorageVol RASD's")
@@ -79,7 +80,8 @@
if not pool_name in dpool_rasd['PoolID']:
return None
-
+ dpool_rasd['FormatType'] = Uint64(format)
+
stovol_settings = inst_to_mof(dpool_rasd)
return stovol_settings
@@ -197,67 +199,71 @@
# vol creation, we can extend dp_types to include netfs etc
dp_types = { "DISK_POOL_DIR" : DIR_POOL }
- for pool_name, pool_type in dp_types.iteritems():
- status = FAIL
- res = [FAIL]
- found = 0
- clean_pool=True
- try:
- if pool_type == DIR_POOL:
- pool_name = default_pool_name
- clean_pool=False
- else:
- status = create_pool(server, virt, pool_name, pool_attr,
- mode_type=pool_type, pool_type="DiskPool")
+ format_types = [1, 2]
- if status != PASS:
- logger.error("Failed to create pool '%s'", pool_name)
- return status
+ for fs in format_types:
+ for pool_name, pool_type in dp_types.iteritems():
+ status = FAIL
+ res = [FAIL]
+ found = 0
+ clean_pool=True
+ try:
+ if pool_type == DIR_POOL:
+ pool_name = default_pool_name
+ clean_pool=False
+ else:
+ status = create_pool(server, virt, pool_name, pool_attr,
+ mode_type=pool_type, pool_type="DiskPool")
- dp_inst_id = "%s/%s" % (dp_cn, pool_name)
- stovol_settings = get_stovol_settings(server, virt,
- dp_inst_id, pool_name)
- if stovol_settings == None:
- raise Exception("Failed to get the defualt StorageVolRASD info")
+ if status != PASS:
+ logger.error("Failed to create pool '%s'", pool_name)
+ return status
- disk_pool_inst = get_diskpool(server, virt, dp_cn, dp_inst_id)
- if disk_pool_inst == None:
- raise Exception("DiskPool instance for '%s' not found!" \
- % pool_name)
+ dp_inst_id = "%s/%s" % (dp_cn, pool_name)
+ stovol_settings = get_stovol_settings(server, virt,
+ dp_inst_id, pool_name, fs)
+ if stovol_settings == None:
+ raise Exception("Failed to get the defualt StorageVolRASD info")
+
+ disk_pool_inst = get_diskpool(server, virt, dp_cn, dp_inst_id)
+ if disk_pool_inst == None:
+ raise Exception("DiskPool instance for '%s' not found!" \
+ % pool_name)
- rpcs = get_typed_class(virt, "ResourcePoolConfigurationService")
- rpcs_conn = eval("rpcs_service." + rpcs)(server)
- res = rpcs_conn.CreateResourceInPool(Settings=stovol_settings,
- Pool=disk_pool_inst)
- if res[0] != PASS:
- raise Exception("Failed to create the Vol %s" % vol_name)
+ rpcs = get_typed_class(virt, "ResourcePoolConfigurationService")
+ rpcs_conn = eval("rpcs_service." + rpcs)(server)
+ res = rpcs_conn.CreateResourceInPool(Settings=stovol_settings,
+ Pool=disk_pool_inst)
+ if res[0] != PASS:
+ raise Exception("Failed to create the Vol %s" % vol_name)
- if res[1]['Resource']['InstanceID'] != exp_vol_path and \
- cim_rev >= libvirt_stovol_instance_id:
- raise Exception("Incorrect InstanceID")
- else:
- status = PASS
+ if res[1]['Resource']['InstanceID'] != exp_vol_path and \
+ cim_rev >= libvirt_stovol_instance_id:
+ raise Exception("Incorrect InstanceID")
+ else:
+ status = PASS
- found = verify_vol(server, virt, pool_name, exp_vol_path, found)
- stovol_status = verify_template_rasd_exists(virt, server,
- dp_inst_id,
- exp_vol_path)
+ found = verify_vol(server, virt, pool_name, exp_vol_path, found)
+ stovol_status = verify_template_rasd_exists(virt, server,
+ dp_inst_id,
+ exp_vol_path)
- ret = cleanup_pool_vol(server, virt, pool_name,
- clean_pool, exp_vol_path)
- if res[0] == PASS and found == 1 and \
- ret == PASS and stovol_status == PASS and \
- status == PASS:
- status = PASS
- else:
- return FAIL
+ ret = cleanup_pool_vol(server, virt, pool_name,
+ clean_pool, exp_vol_path)
+ if res[0] == PASS and found == 1 and \
+ ret == PASS and stovol_status == PASS and \
+ status == PASS:
+ status = PASS
+ else:
+ return FAIL
- except Exception, details:
- logger.error("Exception details: %s", details)
- cleanup_pool_vol(server, virt, pool_name,
- clean_pool, exp_vol_path)
- status = FAIL
+ except Exception, details:
+ logger.error("Exception details: %s", details)
+ cleanup_pool_vol(server, virt, pool_name,
+ clean_pool, exp_vol_path)
+ status = FAIL
return status
+
if __name__ == "__main__":
sys.exit(main())
13 years, 9 months
[PATCH] [TEST] New test to verify cdrom media change
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1293071821 28800
# Node ID d88da81a62f6c4cd6bfc0310f360e4d77863d9f4
# Parent dac5cb514b9a7668b7717ac07bf02b9fcdf3a78d
[TEST] New test to verify cdrom media change.
Libvirt-cim now allows live cdrom media change.
This test checks that functionality.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r dac5cb514b9a -r d88da81a62f6 suites/libvirt-cim/cimtest/VirtualSystemManagementService/29_cdrom_media_change.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/29_cdrom_media_change.py Wed Dec 22 18:37:01 2010 -0800
@@ -0,0 +1,178 @@
+#!/usr/bin/python
+#
+# Copyright 2010 IBM Corp.
+#
+# Authors:
+# Sharad Mishra <snmishra(a)us.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
+#
+# Purpose:
+# Verify providers support disk images with long paths / names
+#
+# Steps:
+# 1) Define and start a guest with cdrom drive.
+# 2) Modify cdrom drive to point to another source.
+# 3) Verify guest is now pointing to new locations.
+#
+
+import sys
+import os
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import FAIL, PASS, SKIP
+from XenKvmLib.classes import get_typed_class, inst_to_mof
+from XenKvmLib.rasd import get_rasd_templates
+from XenKvmLib.const import do_main, get_provider_version, \
+ KVM_disk_path, KVM_secondary_disk_path, \
+ default_pool_name
+from XenKvmLib.vxml import get_class
+from XenKvmLib import vxml
+from XenKvmLib.common_util import parse_instance_id
+from XenKvmLib.enumclass import EnumInstances
+from XenKvmLib import vsms
+from XenKvmLib import vsms_util
+from XenKvmLib.vsms import VIRT_DISK_TYPE_CDROM
+
+sup_types = ['KVM']
+test_dom = 'cddom'
+cdrom_rev = 1056
+
+def get_rasd_list(ip, virt, addr):
+ drasd_cn = get_typed_class(virt, "DiskResourceAllocationSettingData")
+ instanceid = "DiskPool/%s" % default_pool_name
+
+ rasds = get_rasd_templates(ip, virt, instanceid)
+ if len(rasds) < 1:
+ logger.info("No RASD templates returned for %s", pool_id)
+ return []
+
+ for rasd in rasds:
+ if rasd.classname != drasd_cn:
+ continue
+ if rasd['EmulatedType'] == VIRT_DISK_TYPE_CDROM and \
+ "Default" in rasd['InstanceID']:
+ rasd['source'] = addr
+ rasd['Address'] = addr
+ break
+ return rasd
+
+def change_cdrom_media(ip, virt, rasd, addr):
+ status = FAIL
+ service = vsms.get_vsms_class(virt)(ip)
+ cxml = vxml.get_class(virt)(test_dom)
+ dasd = vsms.get_dasd_class(virt)(dev=rasd['VirtualDevice'],
+ source=addr,
+ instanceid="cddom/hdc",
+ name=test_dom)
+
+ status = vsms_util.mod_disk_res(ip, service, cxml, dasd, addr)
+ return status
+
+def verify_cdrom_update(ip, virt, addr, guest_name):
+ inst = None
+
+ try:
+ drasd_cn = get_typed_class(virt, 'DiskResourceAllocationSettingData')
+ enum_list = EnumInstances(ip, drasd_cn)
+
+ if enum_list < 1:
+ raise Exception("No %s instances returned" % drasd_cn)
+
+ for rasd in enum_list:
+ guest, dev, status = parse_instance_id(rasd.InstanceID)
+ if status != PASS:
+ raise Exception("Unable to parse InstanceID: %s" % \
+ rasd.InstanceID)
+
+ if guest == guest_name:
+ inst = rasd
+ break
+
+ if inst is None or inst.Address != addr:
+ raise Exception("Expected Address to be of %s" % \
+ KVM_secondary_disk_path)
+
+ if inst.EmulatedType != VIRT_DISK_TYPE_CDROM:
+ raise Exception("Expected device to be of %d type" % \
+ VIRT_DISK_TYPE_FLOPPY)
+
+ except Exception, details:
+ logger.error(details)
+ return FAIL
+
+ return PASS
+
+@do_main(sup_types)
+def main():
+ options = main.options
+
+ status = FAIL
+
+ curr_cim_rev, changeset = get_provider_version(options.virt, options.ip)
+ if curr_cim_rev < cdrom_rev:
+ logger.error("cdrom media change support is available in rev >= %s", cdrom_rev)
+ return SKIP
+
+ cxml = get_class(options.virt)(test_dom)
+
+ addr = KVM_disk_path
+
+ guest_defined = False
+ guest_running = False
+
+ try:
+ rasd = get_rasd_list(options.ip, options.virt, addr)
+ rasd_list = {}
+ rasd_list[rasd.classname] = inst_to_mof(rasd)
+ if len(rasd_list) < 1:
+ raise Exception("Unable to get template RASDs for %s" % test_dom)
+
+ cxml.set_res_settings(rasd_list)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ raise Exception("Unable to define %s" % test_dom)
+
+ guest_defined = True
+
+ ret = cxml.cim_start(options.ip)
+ if ret:
+ raise Exception("Unable to start %s" % test_dom)
+
+ guest_running = True
+
+ status = change_cdrom_media(options.ip, options.virt, rasd, KVM_secondary_disk_path)
+ if status != PASS:
+ raise Exception("Failed cdrom media change for %s" % test_dom)
+
+ status = verify_cdrom_update(options.ip, options.virt, KVM_secondary_disk_path, test_dom)
+ if status != PASS:
+ raise Exception("Failed to verify cdrom media change for %s" % test_dom)
+
+ except Exception, details:
+ logger.error(details)
+ status = FAIL
+
+ if guest_running == True:
+ cxml.destroy(options.ip)
+
+ if guest_defined == True:
+ cxml.undefine(options.ip)
+
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
+
+
diff -r dac5cb514b9a -r d88da81a62f6 suites/libvirt-cim/lib/XenKvmLib/vsms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vsms.py Thu Oct 07 01:06:53 2010 -0400
+++ b/suites/libvirt-cim/lib/XenKvmLib/vsms.py Wed Dec 22 18:37:01 2010 -0800
@@ -146,13 +146,15 @@
# classes to define RASD parameters
class CIM_DiskResourceAllocationSettingData(CIMClassMOF):
- def __init__(self, dev, source, name, emu_type=None):
+ def __init__(self, dev, source, name, instanceid=None, emu_type=None):
self.ResourceType = RASD_TYPE_DISK
if emu_type != None:
self.EmulatedType = emu_type
if dev != None:
self.VirtualDevice = dev
self.InstanceID = '%s/%s' % (name, dev)
+ if instanceid != None:
+ self.InstanceID = instanceid
if source != None:
self.Address = source
13 years, 9 months
[PATCH] (#2) Update indication providers to the std_indication interface change introduced in libcmpiutil f967d9432f31
by Chip Vincent
# HG changeset patch
# User Chip Vincent <cvincent(a)us.ibm.com>
# Date 1293663180 18000
# Node ID 7b2e9efc2778533b14fd7a4ac82b840a3baec275
# Parent 35396e5b805193c024b6d4f065136d7b57a0b03d
Update indication providers to the std_indication interface change
introduced in libcmpiutil f967d9432f31.
This fix is needed to build libvirt-cim with the latest
libcmpiutil-devel headers. There will be a small patch
coming for std_indication.h shortly to ensure 0 warnings.
Signed-off-by: Chip Vincent <cvincent(a)us.ibm.com>
diff -r 35396e5b8051 -r 7b2e9efc2778 libvirt-cim.spec.in
--- a/libvirt-cim.spec.in Tue Dec 14 13:59:51 2010 -0800
+++ b/libvirt-cim.spec.in Wed Dec 29 17:53:00 2010 -0500
@@ -10,10 +10,10 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
URL: http://libvirt.org/CIM/
Requires: libxml2 >= 2.6.0
-Requires: libvirt >= 0.3.2
+Requires: libvirt >= 0.6.3
Requires: unzip
BuildRequires: tog-pegasus-devel
-BuildRequires: libvirt-devel >= 0.3.2
+BuildRequires: libvirt-devel >= 0.5.3
BuildRequires: e2fsprogs-devel
BuildRequires: libxml2-devel
BuildRequires: libcmpiutil-devel
diff -r 35396e5b8051 -r 7b2e9efc2778 src/Virt_ComputerSystemIndication.c
--- a/src/Virt_ComputerSystemIndication.c Tue Dec 14 13:59:51 2010
-0800
+++ b/src/Virt_ComputerSystemIndication.c Wed Dec 29 17:53:00 2010
-0500
@@ -787,12 +787,13 @@
static CMPIStatus raise_indication(const CMPIBroker *broker,
const CMPIContext *ctx,
+ const CMPIObjectPath *ref,
const CMPIInstance *ind)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *prev_inst;
CMPIInstance *src_inst;
- CMPIObjectPath *ref = NULL;
+ CMPIObjectPath *_ref = NULL;
struct std_indication_ctx *_ctx = NULL;
struct ind_args *args = NULL;
char *prefix = NULL;
@@ -809,7 +810,7 @@
if (s.rc != CMPI_RC_OK || CMIsNullObject(prev_inst))
goto out;
- ref = CMGetObjectPath(prev_inst, &s);
+ _ref = CMGetObjectPath(prev_inst, &s);
if (s.rc != CMPI_RC_OK) {
cu_statusf(broker, &s,
CMPI_RC_ERR_FAILED,
@@ -819,10 +820,10 @@
/* FIXME: This is a Pegasus work around. Pegsus loses the
namespace
when an ObjectPath is pulled from an instance */
- if (STREQ(NAMESPACE(ref), ""))
- CMSetNameSpace(ref, "root/virt");
+ if (STREQ(NAMESPACE(_ref), ""))
+ CMSetNameSpace(_ref, "root/virt");
- s = get_domain_by_ref(broker, ref, &src_inst);
+ s = get_domain_by_ref(broker, _ref, &src_inst);
if (s.rc != CMPI_RC_OK || CMIsNullObject(src_inst))
goto out;
@@ -847,8 +848,8 @@
goto out;
}
- args->ns = strdup(NAMESPACE(ref));
- args->classname = strdup(CLASSNAME(ref));
+ args->ns = strdup(NAMESPACE(_ref));
+ args->classname = strdup(CLASSNAME(_ref));
args->_ctx = _ctx;
prefix = class_prefix_name(args->classname);
diff -r 35396e5b8051 -r 7b2e9efc2778
src/Virt_ResourceAllocationSettingDataIndication.c
--- a/src/Virt_ResourceAllocationSettingDataIndication.c Tue Dec
14 13:59:51 2010 -0800
+++ b/src/Virt_ResourceAllocationSettingDataIndication.c Wed Dec
29 17:53:00 2010 -0500
@@ -68,12 +68,13 @@
static CMPIStatus raise_indication(const CMPIBroker *broker,
const CMPIContext *ctx,
+ const CMPIObjectPath *ref,
const CMPIInstance *ind)
{
struct std_indication_ctx *_ctx = NULL;
CMPIStatus s = {CMPI_RC_OK, NULL};
struct ind_args *args = NULL;
- CMPIObjectPath *ref = NULL;
+ CMPIObjectPath *_ref = NULL;
_ctx = malloc(sizeof(struct std_indication_ctx));
if (_ctx == NULL) {
@@ -96,8 +97,8 @@
goto out;
}
- ref = CMGetObjectPath(ind, &s);
- if (ref == NULL) {
+ _ref = CMGetObjectPath(ind, &s);
+ if (_ref == NULL) {
cu_statusf(broker, &s,
CMPI_RC_ERR_FAILED,
"Got a null object path");
@@ -108,14 +109,14 @@
when an ObjectPath is pulled from an instance */
- CMSetNameSpace(ref, "root/virt");
- args->ns = strdup(NAMESPACE(ref));
- args->classname = strdup(CLASSNAME(ref));
+ CMSetNameSpace(_ref, "root/virt");
+ args->ns = strdup(NAMESPACE(_ref));
+ args->classname = strdup(CLASSNAME(_ref));
args->_ctx = _ctx;
/* This is a workaround for Pegasus, it loses its objectpath by
CMGetObjectPath. So set it back. */
- ind->ft->setObjectPath((CMPIInstance *)ind, ref);
+ ind->ft->setObjectPath((CMPIInstance *)ind, _ref);
s = stdi_deliver(broker, ctx, args, (CMPIInstance *)ind);
if (s.rc == CMPI_RC_OK) {
--
Chip Vincent
Open Virtualization, Linux Technology Center
IBM Systems & Technology Group
phone: 919-254-4482, T/L 444-4482
email: cvincent(a)us.ibm.com
13 years, 9 months
[PATCH] (#2) Restore const to interface to avoid warnings
by Chip Vincent
# HG changeset patch
# User Chip Vincent <cvincent(a)us.ibm.com>
# Date 1293659369 18000
# Node ID 4339c67a849ce34af7d7df62860431be4a879f31
# Parent b2f96d5cfbe7e4c8608fcee30b6007457677adbd
Restore const to interface to avoid warnings.
This change simply tweaks the interface to avoid build warnings (sadly
buried in macros).
Signed-off-by: Chip Vincent <cvincent(a)us.ibm.com>
diff -r b2f96d5cfbe7 -r 4339c67a849c std_indication.c
--- a/std_indication.c Wed Dec 29 16:42:31 2010 -0500
+++ b/std_indication.c Wed Dec 29 16:49:29 2010 -0500
@@ -98,7 +98,7 @@
static CMPIStatus default_raise(const CMPIBroker *broker,
const CMPIContext *context,
- CMPIObjectPath *ref,
+ const CMPIObjectPath *ref,
CMPIInstance *ind)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
@@ -117,7 +117,7 @@
static CMPIStatus raise(struct std_indication_ctx *ctx,
const CMPIContext *context,
const CMPIArgs *argsin,
- CMPIObjectPath *ref)
+ const CMPIObjectPath *ref)
{
bool enabled;
CMPIInstance *inst;
@@ -301,7 +301,7 @@
CMPIStatus stdi_handler(CMPIMethodMI *self,
const CMPIContext *context,
const CMPIResult *results,
- CMPIObjectPath *reference,
+ const CMPIObjectPath *reference,
const char *methodname,
const CMPIArgs *argsin,
CMPIArgs *argsout)
diff -r b2f96d5cfbe7 -r 4339c67a849c std_indication.h
--- a/std_indication.h Wed Dec 29 16:42:31 2010 -0500
+++ b/std_indication.h Wed Dec 29 16:49:29 2010 -0500
@@ -41,7 +41,7 @@
typedef CMPIStatus (*raise_indication_t)(const CMPIBroker *broker,
const CMPIContext *ctx,
- CMPIObjectPath *ref,
+ const CMPIObjectPath *ref,
const CMPIInstance *ind);
typedef CMPIStatus (*trigger_indication_t)(const CMPIContext *ctx);
--
Chip Vincent
Open Virtualization, Linux Technology Center
IBM Systems & Technology Group
phone: 919-254-4482, T/L 444-4482
email: cvincent(a)us.ibm.com
13 years, 9 months
[PATCH] Restore const to interface to avoid warnings
by Chip Vincent
# HG changeset patch
# User Chip Vincent <cvincent(a)us.ibm.com>
# Date 1292947743 18000
# Node ID 13fbf3dc3923457a894a063b20077e3fb586e7d3
# Parent 531f151df659f030fe4fab1f6663572af356935f
Restore const to interface to avoid warnings.
This change simply tweaks the interface to avoid build warnings (sadly
buried in macros).
Signed-off-by: Chip Vincent <cvincent(a)us.ibm.com>
diff -r 531f151df659 -r 13fbf3dc3923 std_indication.h
--- a/std_indication.h Wed Dec 08 12:44:27 2010 -0800
+++ b/std_indication.h Tue Dec 21 11:09:03 2010 -0500
@@ -135,7 +135,7 @@
CMPIStatus stdi_handler(CMPIMethodMI *self,
const CMPIContext *context,
const CMPIResult *results,
- CMPIObjectPath *reference,
+ const CMPIObjectPath *reference,
const char *methodname,
const CMPIArgs *argsin,
CMPIArgs *argsout);
--
Chip Vincent
Open Virtualization, Linux Technology Center
IBM Systems & Technology Group
phone: 919-254-4482, T/L 444-4482
email: cvincent(a)us.ibm.com
13 years, 9 months
[PATCH] Update indication providers to the std_indication interface change introduced in libcmpiutil f967d9432f31
by Chip Vincent
# HG changeset patch
# User Chip Vincent <cvincent(a)us.ibm.com>
# Date 1292947301 18000
# Node ID 92459d48d4128e0b569eb1c0d489bc41485545c8
# Parent d7237a0fcc8a765d8a9a92bb64792837c9f33325
Update indication providers to the std_indication interface change
introduced in libcmpiutil f967d9432f31.
This fix is needed to build libvirt-cim with the latest
libcmpiutil-devel headers. There will be a small patch
coming for std_indication.h shortly to ensure 0 warnings.
Signed-off-by: Chip Vincent <cvincent(a)us.ibm.com>
diff -r d7237a0fcc8a -r 92459d48d412 src/Virt_ComputerSystemIndication.c
--- a/src/Virt_ComputerSystemIndication.c Tue Dec 21 11:00:57 2010
-0500
+++ b/src/Virt_ComputerSystemIndication.c Tue Dec 21 11:01:41 2010
-0500
@@ -787,12 +787,13 @@
static CMPIStatus raise_indication(const CMPIBroker *broker,
const CMPIContext *ctx,
+ CMPIObjectPath *ref,
const CMPIInstance *ind)
{
CMPIStatus s = {CMPI_RC_OK, NULL};
CMPIInstance *prev_inst;
CMPIInstance *src_inst;
- CMPIObjectPath *ref = NULL;
+ CMPIObjectPath *_ref = NULL;
struct std_indication_ctx *_ctx = NULL;
struct ind_args *args = NULL;
char *prefix = NULL;
@@ -809,7 +810,7 @@
if (s.rc != CMPI_RC_OK || CMIsNullObject(prev_inst))
goto out;
- ref = CMGetObjectPath(prev_inst, &s);
+ _ref = CMGetObjectPath(prev_inst, &s);
if (s.rc != CMPI_RC_OK) {
cu_statusf(broker, &s,
CMPI_RC_ERR_FAILED,
@@ -819,10 +820,10 @@
/* FIXME: This is a Pegasus work around. Pegsus loses the
namespace
when an ObjectPath is pulled from an instance */
- if (STREQ(NAMESPACE(ref), ""))
- CMSetNameSpace(ref, "root/virt");
+ if (STREQ(NAMESPACE(_ref), ""))
+ CMSetNameSpace(_ref, "root/virt");
- s = get_domain_by_ref(broker, ref, &src_inst);
+ s = get_domain_by_ref(broker, _ref, &src_inst);
if (s.rc != CMPI_RC_OK || CMIsNullObject(src_inst))
goto out;
@@ -847,8 +848,8 @@
goto out;
}
- args->ns = strdup(NAMESPACE(ref));
- args->classname = strdup(CLASSNAME(ref));
+ args->ns = strdup(NAMESPACE(_ref));
+ args->classname = strdup(CLASSNAME(_ref));
args->_ctx = _ctx;
prefix = class_prefix_name(args->classname);
diff -r d7237a0fcc8a -r 92459d48d412
src/Virt_ResourceAllocationSettingDataIndication.c
--- a/src/Virt_ResourceAllocationSettingDataIndication.c Tue Dec
21 11:00:57 2010 -0500
+++ b/src/Virt_ResourceAllocationSettingDataIndication.c Tue Dec
21 11:01:41 2010 -0500
@@ -68,12 +68,13 @@
static CMPIStatus raise_indication(const CMPIBroker *broker,
const CMPIContext *ctx,
+ CMPIObjectPath *ref,
const CMPIInstance *ind)
{
struct std_indication_ctx *_ctx = NULL;
CMPIStatus s = {CMPI_RC_OK, NULL};
struct ind_args *args = NULL;
- CMPIObjectPath *ref = NULL;
+ CMPIObjectPath *_ref = NULL;
_ctx = malloc(sizeof(struct std_indication_ctx));
if (_ctx == NULL) {
@@ -96,8 +97,8 @@
goto out;
}
- ref = CMGetObjectPath(ind, &s);
- if (ref == NULL) {
+ _ref = CMGetObjectPath(ind, &s);
+ if (_ref == NULL) {
cu_statusf(broker, &s,
CMPI_RC_ERR_FAILED,
"Got a null object path");
@@ -108,14 +109,14 @@
when an ObjectPath is pulled from an instance */
- CMSetNameSpace(ref, "root/virt");
- args->ns = strdup(NAMESPACE(ref));
- args->classname = strdup(CLASSNAME(ref));
+ CMSetNameSpace(_ref, "root/virt");
+ args->ns = strdup(NAMESPACE(_ref));
+ args->classname = strdup(CLASSNAME(_ref));
args->_ctx = _ctx;
/* This is a workaround for Pegasus, it loses its objectpath by
CMGetObjectPath. So set it back. */
- ind->ft->setObjectPath((CMPIInstance *)ind, ref);
+ ind->ft->setObjectPath((CMPIInstance *)ind, _ref);
s = stdi_deliver(broker, ctx, args, (CMPIInstance *)ind);
if (s.rc == CMPI_RC_OK) {
--
Chip Vincent
Open Virtualization, Linux Technology Center
IBM Systems & Technology Group
phone: 919-254-4482, T/L 444-4482
email: cvincent(a)us.ibm.com
13 years, 9 months