[PATCH] Expose HealthState of LogicalDisk
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1251150322 25200
# Node ID 5a1871168fd4d9b906646bc4b036a950bcc339df
# Parent 0243aa0574431112f0946354d4bbad62bb2c2f7b
Expose HealthState of LogicalDisk
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 0243aa057443 -r 5a1871168fd4 src/Virt_Device.c
--- a/src/Virt_Device.c Thu Aug 20 17:16:24 2009 -0700
+++ b/src/Virt_Device.c Mon Aug 24 14:45:22 2009 -0700
@@ -127,6 +127,7 @@
{
CMPIInstance *inst;
virConnectPtr conn;
+ uint16_t state;
conn = virDomainGetConnect(dom);
inst = get_typed_instance(broker,
@@ -137,6 +138,10 @@
if (!disk_set_name(inst, dev))
return NULL;
+ //Set HealthState to "OK"
+ state = 5;
+ CMSetProperty(inst, "HealthState", (CMPIValue *)&state, CMPI_uint16);
+
return inst;
}
15 years, 2 months
[PATCH] [Test](#4)Testcase to check for duplicate UUID
by Yogananth Subramanian
# HG changeset patch
# User anantyog(a)linux.vnet.ibm.com
# Date 1251280598 25200
# Node ID 311bad73905dfdb1299bb0eab902a54b332fc094
# Parent 3c09a49a30f4bc1e6544736612508d3f99308083
[Test](#4)Testcase to check for duplicate UUID
Hello everyone,
I have rewirtten the testcase to handle provider version less then 915.
For provider version less then 915, the testcase just exits and rewrote the
exception handling to handle exceptions of variable length.
Thx
Yogi
diff -r 3c09a49a30f4 -r 311bad73905d suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VSSD/06_duplicate_uuid.py Wed Aug 26 02:56:38 2009 -0700
@@ -0,0 +1,127 @@
+#!/usr/bin/python
+#
+# Copyright 2009 IBM Corp.
+#
+# Authors:
+# Yogananth Subramanian <anantyog(a)linux.vnet.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
+#
+#Steps:
+#1) Define 2 domains,'default' and 'test', both with random UUID
+#2) Reset the uuid of the second domain, 'test', to the uuid of the
+# first domain, using ModifySystemSettings
+#
+
+import sys
+import time
+from XenKvmLib import vsms
+from XenKvmLib import vxml
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from XenKvmLib.const import do_main
+from XenKvmLib.classes import get_typed_class, inst_to_mof
+from XenKvmLib.enumclass import GetInstance
+from XenKvmLib.const import get_provider_version
+
+sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
+default_dom = 'uuid_domain'
+test_dom = 'test_domain'
+nmac = '99:aa:bb:cc:ee:ff'
+duplicate_uuid_support = 915
+err_desc = "'uuid_domain' is already defined"
+
+def get_vssd(ip, virt, dom):
+ cn = get_typed_class(virt, "VirtualSystemSettingData")
+ inst = None
+
+ try:
+ if virt == "XenFV":
+ virt = "Xen"
+
+ key_list = {"InstanceID" : "%s:%s" % (virt, default_dom) }
+
+ inst = GetInstance(ip, cn, key_list, True)
+
+ except Exception, details:
+ logger.error(details)
+ return FAIL, inst
+
+ if inst is None:
+ return FAIL, inst
+
+ return PASS, inst
+
+@do_main(sup_types)
+def main():
+ options = main.options
+ virt = options.virt
+ server = options.ip
+
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev < duplicate_uuid_support:
+ logger.info("Need provider version 915 or greater to run testcase")
+ return SKIP
+
+ service = vsms.get_vsms_class(options.virt)(options.ip)
+
+ sxml = None
+ 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
+
+ try:
+ status, inst = get_vssd(options.ip, options.virt, default_dom)
+ if status != PASS:
+ raise Exception("Failed to get the VSSD instance for %s" %
+ default_dom)
+
+ uuid_defaultdom = inst['UUID']
+
+ sxml = vxml.get_class(options.virt)(test_dom, mac=nmac)
+ ret = sxml.cim_define(options.ip)
+ if not ret:
+ raise Exception("Failed to define the dom: %s" % test_dom)
+
+ status, inst = get_vssd(options.ip, options.virt, test_dom)
+ if status != PASS:
+ raise Exception("Failed to get the VSSD instance for %s" %
+ test_dom)
+
+ inst['UUID'] = uuid_defaultdom
+ vssd = inst_to_mof(inst)
+ ret = service.ModifySystemSettings(SystemSettings=vssd)
+ if ret[0] == 0:
+ raise Exception("Was able to assign duplicate UUID to domain %s"
+ % test_dom)
+
+ except Exception, details:
+ if details[-1].find(err_desc) >= 0:
+ logger.info('Got expected error desc %s', details[-1])
+ status = PASS
+ else:
+ logger.error(details)
+ status = FAIL
+
+ if sxml != None:
+ sxml.undefine(options.ip)
+ cxml.undefine(options.ip)
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
+
15 years, 2 months
[PATCH] [TEST] #2 Fix LXC connection uri
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1251145693 25200
# Node ID 57536e0647e4aa08a824e34aeddfb204c6d84f4b
# Parent c338efef06278a9a40a90f07a34750ec50c49939
[TEST] #2 Fix LXC connection uri...
And be sure not to pass a graphics device when creating a Containers guest.
These changes are dependent on libvirt-cim patch "Fix LXC connection uri,
remove default graphics device"
Updates:
-Remove commented out lines of old code
diff -r c338efef0627 -r 57536e0647e4 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Aug 19 09:03:40 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Aug 24 13:28:13 2009 -0700
@@ -151,7 +151,7 @@
elif vir_type == 'kvm':
self.vuri = 'qemu:///system'
elif vir_type == 'lxc':
- self.vuri = 'lxc:///system'
+ self.vuri = 'lxc:///'
def run(self, ip, vcmd, param):
file_arg_cmds = ['define', 'create', 'net-create', 'pool-create']
@@ -572,17 +572,18 @@
self.pasd = vsms.get_pasd_class(virt)(name=dom_name)
self.dasd = vsms.get_dasd_class(virt)(disk_dev, disk_source,
dom_name)
+ self.gasd = None
else:
self.pasd = vsms.get_pasd_class(virt)(vcpu=vcpus, name=dom_name)
self.dasd = vsms.get_dasd_class(virt)(disk_dev, disk_source,
dom_name, emu_type)
+ self.gasd = vsms.get_gasd_class(virt)(name=dom_name,
+ res_sub_type=grstype, ip=ip,
+ lport=port_num, keymap=kmap,
+ vnc_passwd=vnc_passwd)
self.masd = vsms.get_masd_class(virt)(megabytes=mem,
mallocunits=mem_allocunits,
name=dom_name)
- self.gasd = vsms.get_gasd_class(virt)(name=dom_name,
- res_sub_type=grstype, ip=ip,
- lport=port_num, keymap=kmap,
- vnc_passwd=vnc_passwd)
self.iasd = vsms.get_iasd_class(virt)(name=dom_name,
res_sub_type=irstype,
bus_type=btype)
diff -r c338efef0627 -r 57536e0647e4 suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Wed Aug 19 09:03:40 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Mon Aug 24 13:28:13 2009 -0700
@@ -313,7 +313,7 @@
if virt == "KVM":
return "qemu:///system"
if virt == "LXC":
- return "lxc:///system"
+ return "lxc:///"
return ""
def run_remote_guest(ip, domain, command):
15 years, 2 months
[PATCH] Be sure to check to see if the UUID is in use in both the DefineSystem()
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1250813784 25200
# Node ID 0243aa0574431112f0946354d4bbad62bb2c2f7b
# Parent 7efea1d379a1b4de6c4d7583b456a0a00f80ad3b
Be sure to check to see if the UUID is in use in both the DefineSystem()...
and ModifySystemSettings() calls.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 7efea1d379a1 -r 0243aa057443 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Aug 19 22:47:17 2009 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Thu Aug 20 17:16:24 2009 -0700
@@ -71,6 +71,37 @@
RESOURCE_MOD,
};
+static CMPIStatus check_uuid_in_use(const CMPIObjectPath *ref,
+ struct domain *domain)
+{
+ CMPIStatus s = {CMPI_RC_OK, NULL};
+ virConnectPtr conn = NULL;
+ virDomainPtr dom = NULL;
+
+ conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
+ if (conn == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Error connecting to libvirt");
+ goto out;
+ }
+
+ dom = virDomainLookupByUUIDString(conn, domain->uuid);
+ if (dom != NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Guest '%s' is already defined with UUID %s",
+ virDomainGetName(dom),
+ domain->uuid);
+ }
+
+ out:
+ virDomainFree(dom);
+ virConnectClose(conn);
+
+ return s;
+}
+
static CMPIStatus define_system_parse_args(const CMPIArgs *argsin,
CMPIInstance **sys,
const char *ns,
@@ -1402,26 +1433,10 @@
goto out;
}
- if (domain->uuid != NULL) {
- conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
- if (conn == NULL) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Error connecting to libvirt");
- goto out;
- }
-
- dom = virDomainLookupByUUIDString(conn, domain->uuid);
- if (dom != NULL) {
- cu_statusf(_BROKER, s,
- CMPI_RC_ERR_FAILED,
- "Guest '%s' is already defined with UUID %s",
- virDomainGetName(dom),
- domain->uuid);
- goto out;
- }
- }
-
+ *s = check_uuid_in_use(ref, domain);
+ if (s->rc != CMPI_RC_OK)
+ goto out;
+
msg = classify_resources(resources, NAMESPACE(ref), domain);
if (msg != NULL) {
CU_DEBUG("Failed to classify resources: %s", msg);
@@ -1644,6 +1659,10 @@
goto out;
}
+ s = check_uuid_in_use(ref, dominfo);
+ if (s.rc != CMPI_RC_OK)
+ goto out;
+
xml = system_to_xml(dominfo);
if (xml != NULL) {
CU_DEBUG("New XML is:\n%s", xml);
15 years, 2 months
[PATCH] [TEST] Fix LXC connection uri
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1250619664 25200
# Node ID 5d129fff36960c419dda641692c9f5b8682c5a3c
# Parent 5c08aeea7fa147dea06d6b1f0c75c2de70b4b0ae
[TEST] Fix LXC connection uri...
And be sure not to pass a graphics device when creating a Containers guest.
These changes are dependent on libvirt-cim patch "Fix LXC connection uri,
remove default graphics device"
diff -r 5c08aeea7fa1 -r 5d129fff3696 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Mon Aug 17 04:16:50 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Tue Aug 18 11:21:04 2009 -0700
@@ -151,7 +151,8 @@
elif vir_type == 'kvm':
self.vuri = 'qemu:///system'
elif vir_type == 'lxc':
- self.vuri = 'lxc:///system'
+ #self.vuri = 'lxc:///system'
+ self.vuri = 'lxc:///'
def run(self, ip, vcmd, param):
file_arg_cmds = ['define', 'create', 'net-create', 'pool-create']
@@ -572,17 +573,18 @@
self.pasd = vsms.get_pasd_class(virt)(name=dom_name)
self.dasd = vsms.get_dasd_class(virt)(disk_dev, disk_source,
dom_name)
+ self.gasd = None
else:
self.pasd = vsms.get_pasd_class(virt)(vcpu=vcpus, name=dom_name)
self.dasd = vsms.get_dasd_class(virt)(disk_dev, disk_source,
dom_name, emu_type)
+ self.gasd = vsms.get_gasd_class(virt)(name=dom_name,
+ res_sub_type=grstype, ip=ip,
+ lport=port_num, keymap=kmap,
+ vnc_passwd=vnc_passwd)
self.masd = vsms.get_masd_class(virt)(megabytes=mem,
mallocunits=mem_allocunits,
name=dom_name)
- self.gasd = vsms.get_gasd_class(virt)(name=dom_name,
- res_sub_type=grstype, ip=ip,
- lport=port_num, keymap=kmap,
- vnc_passwd=vnc_passwd)
self.iasd = vsms.get_iasd_class(virt)(name=dom_name,
res_sub_type=irstype,
bus_type=btype)
diff -r 5c08aeea7fa1 -r 5d129fff3696 suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Mon Aug 17 04:16:50 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Tue Aug 18 11:21:04 2009 -0700
@@ -313,7 +313,8 @@
if virt == "KVM":
return "qemu:///system"
if virt == "LXC":
- return "lxc:///system"
+ #return "lxc:///system"
+ return "lxc:///"
return ""
def run_remote_guest(ip, domain, command):
15 years, 2 months
[PATCH] Pass a CMPIStatus parameter in connect_by_classname() in create_system()
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1250747237 25200
# Node ID 7efea1d379a1b4de6c4d7583b456a0a00f80ad3b
# Parent 6fc5000bc5c33ffed10f71bf87a136da3fe2e036
Pass a CMPIStatus parameter in connect_by_classname() in create_system().
connect_by_classname() excepts a valid CMPIStatus argument since it calls
CMSetStatus(), otherwise, this can lead to a seg fault.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 6fc5000bc5c3 -r 7efea1d379a1 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Aug 19 18:56:56 2009 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Wed Aug 19 22:47:17 2009 -0700
@@ -1403,7 +1403,7 @@
}
if (domain->uuid != NULL) {
- conn = connect_by_classname(_BROKER, CLASSNAME(ref), NULL);
+ conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
if (conn == NULL) {
cu_statusf(_BROKER, s,
CMPI_RC_ERR_FAILED,
15 years, 2 months
[PATCH] Remove call to virConnectClose() in set_infstore_migration_flag()
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1250733416 25200
# Node ID 6fc5000bc5c33ffed10f71bf87a136da3fe2e036
# Parent 279db79737df790e7d10668e155bb7bcaf80254c
Remove call to virConnectClose() in set_infstore_migration_flag()
We don't want to close the connection here since it is used later on in
migrate_do(). This can lead to a seg fault or a invalid free. Also, it means
our connection object is invalid, so any queries we do to libvirt will fail.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 279db79737df -r 6fc5000bc5c3 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Tue Aug 18 11:18:19 2009 -0700
+++ b/src/Virt_VSMigrationService.c Wed Aug 19 18:56:56 2009 -0700
@@ -1298,7 +1298,6 @@
out:
virDomainFree(dom);
- virConnectClose(conn);
return ret;
}
15 years, 2 months