From snmishra at us.ibm.com Wed Feb 16 14:58:15 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 16 Feb 2011 06:58:15 -0800 Subject: [Libvirt-cim] [PATCH] Add readonly property to disk Message-ID: <5217c96d817d3d330898.1297868295@elm3a148.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1297867691 28800 # Node ID 5217c96d817d3d330898df26dd4262b9c26abc21 # Parent 432922275bea75a769cf058209bdb81198f3b360 Add readonly property to disk. This patch adds readonly property to disks. Signed-off-by: Sharad Mishra diff -r 432922275bea -r 5217c96d817d schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Fri Jan 21 15:59:27 2011 -0500 +++ b/schema/ResourceAllocationSettingData.mof Wed Feb 16 06:48:11 2011 -0800 @@ -17,6 +17,9 @@ [Description ("Bus type of the device")] string BusType; + [Description ("readonly mode for disk")] + boolean readonly; + }; [Description ("KVM virtual disk configuration"), @@ -35,6 +38,9 @@ [Description ("Bus type of the device")] string BusType; + + [Description ("readonly mode for disk")] + boolean readonly; }; [Description ("LXC virtual disk configuration"), diff -r 432922275bea -r 5217c96d817d src/Virt_RASD.c --- a/src/Virt_RASD.c Fri Jan 21 15:59:27 2011 -0500 +++ b/src/Virt_RASD.c Wed Feb 16 06:48:11 2011 -0800 @@ -275,6 +275,12 @@ (CMPIValue *)&type, CMPI_uint16); + if(dev->dev.disk.readonly) + CMSetProperty(inst, + "readonly", + (CMPIValue *)&(dev->dev.disk.readonly), + CMPI_boolean); + return s; } diff -r 432922275bea -r 5217c96d817d src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Fri Jan 21 15:59:27 2011 -0500 +++ b/src/Virt_SettingsDefineCapabilities.c Wed Feb 16 06:48:11 2011 -0800 @@ -852,6 +852,7 @@ const char *disk_path, uint64_t disk_size, uint16_t emu_type, + bool readonly, struct inst_list *list) { const char *dev; @@ -895,6 +896,9 @@ (CMPIValue *)dev, CMPI_chars); CMSetProperty(inst, "EmulatedType", (CMPIValue *)&emu_type, CMPI_uint16); + if(readonly) + CMSetProperty(inst, "readonly", + (CMPIValue *)&readonly, CMPI_boolean); } inst_list_add(list, inst); @@ -915,6 +919,7 @@ CMPIStatus s = {CMPI_RC_OK, NULL}; const char *dev_str = NULL; char *id_str = NULL; + bool readonly = true; if (emu_type == VIRT_DISK_TYPE_CDROM) dev_str = "CDROM"; @@ -960,6 +965,7 @@ vol_path, vol_size, emu_type, + readonly, list); } } else if (STREQ(pfx, "KVM")) { @@ -969,6 +975,7 @@ vol_path, vol_size, emu_type, + readonly, list); } else if (!STREQ(pfx, "LXC")){ @@ -1042,6 +1049,7 @@ const char *id; int type = 0; bool ret; + bool readonly = true; CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -1092,6 +1100,7 @@ disk_path, disk_size, emu_type, + readonly, list); if (s.rc != CMPI_RC_OK) goto out; @@ -1111,6 +1120,7 @@ disk_path, disk_size, emu_type, + readonly, list); } @@ -1236,6 +1246,7 @@ CMPIStatus s = {CMPI_RC_OK, NULL}; int ret; uint16_t emu_type = 0; + bool readonly = false; ret = virStorageVolGetInfo(volume_ptr, &vol_info); if (ret == -1) { @@ -1292,6 +1303,7 @@ vol_path, vol_size, emu_type, + readonly, list); } } else if (STREQ(pfx, "KVM")) { @@ -1301,6 +1313,7 @@ vol_path, vol_size, emu_type, + readonly, list); } else { cu_statusf(_BROKER, &s, @@ -1457,7 +1470,7 @@ if (STREQ(pfx, "LXC")) goto out; - s = cdrom_or_floppy_template(ref, + s = odrom_or_floppy_template(ref, template_type, VIRT_DISK_TYPE_CDROM, list); diff -r 432922275bea -r 5217c96d817d src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Fri Jan 21 15:59:27 2011 -0500 +++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 16 06:48:11 2011 -0800 @@ -835,6 +835,7 @@ { const char *val = NULL; uint16_t type; + bool read = false; CU_DEBUG("Enter disk_rasd_to_vdev"); if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK) @@ -867,6 +868,11 @@ CU_DEBUG("device type is %s", dev->dev.disk.device); + if (cu_get_bool_prop(inst, "readonly", &read) != CMPI_RC_OK) + dev->dev.disk.readonly = false; + else + dev->dev.disk.readonly = read; + free(dev->dev.disk.bus_type); if (cu_get_str_prop(inst, "BusType", &val) != CMPI_RC_OK) dev->dev.disk.bus_type = NULL; From snmishra at us.ibm.com Wed Feb 16 17:53:58 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 16 Feb 2011 09:53:58 -0800 Subject: [Libvirt-cim] [PATCH] Add support for deactivation of disk caching Message-ID: # HG changeset patch # User Sharad Mishra # Date 1297878704 28800 # Node ID a1bb536dcf5ca836a2b09d7682134c88a4fbeb6e # Parent 5217c96d817d3d330898df26dd4262b9c26abc21 Add support for deactivation of disk caching. This patch adds support to deactivate caching of disk devices. Signed-off-by: Sharad Mishra diff -r 5217c96d817d -r a1bb536dcf5c libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Wed Feb 16 06:48:11 2011 -0800 +++ b/libxkutil/device_parsing.c Wed Feb 16 09:51:44 2011 -0800 @@ -53,6 +53,7 @@ free(dev->type); free(dev->device); free(dev->driver); + free(dev->cache); free(dev->source); free(dev->virtual_dev); free(dev->bus_type); @@ -241,6 +242,7 @@ ddev->driver = get_attr_value(child, "name"); if (ddev->driver == NULL) goto err; + ddev->cache = get_attr_value(child, "cache"); } else if (XSTREQ(child->name, "source")) { ddev->source = get_attr_value(child, "file"); if (ddev->source) { @@ -739,6 +741,7 @@ DUP_FIELD(dev, _dev, dev.disk.type); DUP_FIELD(dev, _dev, dev.disk.device); DUP_FIELD(dev, _dev, dev.disk.driver); + DUP_FIELD(dev, _dev, dev.disk.cache); DUP_FIELD(dev, _dev, dev.disk.source); DUP_FIELD(dev, _dev, dev.disk.virtual_dev); DUP_FIELD(dev, _dev, dev.disk.bus_type); diff -r 5217c96d817d -r a1bb536dcf5c libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Wed Feb 16 06:48:11 2011 -0800 +++ b/libxkutil/device_parsing.h Wed Feb 16 09:51:44 2011 -0800 @@ -53,6 +53,7 @@ bool readonly; bool shareable; char *bus_type; + char *cache; }; struct net_device { diff -r 5217c96d817d -r a1bb536dcf5c libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Wed Feb 16 06:48:11 2011 -0800 +++ b/libxkutil/xmlgen.c Wed Feb 16 09:51:44 2011 -0800 @@ -84,6 +84,15 @@ xmlNewProp(disk, BAD_CAST "type", BAD_CAST "file"); xmlNewProp(disk, BAD_CAST "device", BAD_CAST dev->device); + tmp = xmlNewChild(disk, NULL, BAD_CAST "driver", NULL); + if (tmp == NULL) + return XML_ERROR; + if(dev->driver != NULL) { + xmlNewProp(tmp, BAD_CAST "name", BAD_CAST dev->driver); + if(dev->cache != NULL) + xmlNewProp(tmp, BAD_CAST "cache", BAD_CAST dev->cache); + } + tmp = xmlNewChild(disk, NULL, BAD_CAST "source", NULL); if (tmp == NULL) return XML_ERROR; diff -r 5217c96d817d -r a1bb536dcf5c schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Wed Feb 16 06:48:11 2011 -0800 +++ b/schema/ResourceAllocationSettingData.mof Wed Feb 16 09:51:44 2011 -0800 @@ -20,6 +20,9 @@ [Description ("readonly mode for disk")] boolean readonly; + [Description ("cache setting for device")] + string cache; + }; [Description ("KVM virtual disk configuration"), @@ -41,6 +44,9 @@ [Description ("readonly mode for disk")] boolean readonly; + + [Description ("cache setting for device")] + string cache; }; [Description ("LXC virtual disk configuration"), diff -r 5217c96d817d -r a1bb536dcf5c src/Virt_RASD.c --- a/src/Virt_RASD.c Wed Feb 16 06:48:11 2011 -0800 +++ b/src/Virt_RASD.c Wed Feb 16 09:51:44 2011 -0800 @@ -281,6 +281,12 @@ (CMPIValue *)&(dev->dev.disk.readonly), CMPI_boolean); + if(dev->dev.disk.cache) + CMSetProperty(inst, + "cache", + (CMPIValue *)dev->dev.disk.cache, + CMPI_chars); + return s; } diff -r 5217c96d817d -r a1bb536dcf5c src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Wed Feb 16 06:48:11 2011 -0800 +++ b/src/Virt_SettingsDefineCapabilities.c Wed Feb 16 09:51:44 2011 -0800 @@ -853,6 +853,7 @@ uint64_t disk_size, uint16_t emu_type, bool readonly, + const char *cache, struct inst_list *list) { const char *dev; @@ -899,6 +900,10 @@ if(readonly) CMSetProperty(inst, "readonly", (CMPIValue *)&readonly, CMPI_boolean); + + if(cache != NULL) + CMSetProperty(inst, "cache", + (CMPIValue *)cache, CMPI_chars); } inst_list_add(list, inst); @@ -920,6 +925,7 @@ const char *dev_str = NULL; char *id_str = NULL; bool readonly = true; + const char *cache = "none"; if (emu_type == VIRT_DISK_TYPE_CDROM) dev_str = "CDROM"; @@ -966,6 +972,7 @@ vol_size, emu_type, readonly, + cache, list); } } else if (STREQ(pfx, "KVM")) { @@ -976,6 +983,7 @@ vol_size, emu_type, readonly, + cache, list); } else if (!STREQ(pfx, "LXC")){ @@ -1050,6 +1058,7 @@ int type = 0; bool ret; bool readonly = true; + const char *cache = "none"; CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -1101,6 +1110,7 @@ disk_size, emu_type, readonly, + cache, list); if (s.rc != CMPI_RC_OK) goto out; @@ -1121,6 +1131,7 @@ disk_size, emu_type, readonly, + cache, list); } @@ -1247,6 +1258,7 @@ int ret; uint16_t emu_type = 0; bool readonly = false; + const char *cache = "none"; ret = virStorageVolGetInfo(volume_ptr, &vol_info); if (ret == -1) { @@ -1304,6 +1316,7 @@ vol_size, emu_type, readonly, + cache, list); } } else if (STREQ(pfx, "KVM")) { @@ -1314,6 +1327,7 @@ vol_size, emu_type, readonly, + cache, list); } else { cu_statusf(_BROKER, &s, diff -r 5217c96d817d -r a1bb536dcf5c src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Wed Feb 16 06:48:11 2011 -0800 +++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 16 09:51:44 2011 -0800 @@ -878,6 +878,12 @@ dev->dev.disk.bus_type = NULL; else dev->dev.disk.bus_type = strdup(val); + + free(dev->dev.disk.cache); + if (cu_get_str_prop(inst, "cache", &val) != CMPI_RC_OK) + dev->dev.disk.cache = NULL; + else + dev->dev.disk.cache = strdup(val); free(dev->id); dev->id = strdup(dev->dev.disk.virtual_dev); From snmishra at us.ibm.com Thu Feb 17 20:02:40 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Thu, 17 Feb 2011 12:02:40 -0800 Subject: [Libvirt-cim] [PATCH] Remove test for duplicate mac address Message-ID: # HG changeset patch # User Sharad Mishra # Date 1297972851 28800 # Node ID f3d3d546da029d62d3e5bceec52152a010e2e4b2 # Parent a1bb536dcf5ca836a2b09d7682134c88a4fbeb6e Remove test for duplicate mac address. This test has been removed since it was interfering with modifying network resources. This is an extra piece of check that was added in libvirt-cim, libvirt already does this check. Removing it should not cause any problem. When a user modified an existing active net RASD, libvirt-cim clones the RASD and changes the properties to the new values. But if mac was not one of the changing property, then this extra check, took it to be a duplicate mac and gave error. Signed-off-by: Sharad Mishra diff -r a1bb536dcf5c -r f3d3d546da02 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Wed Feb 16 09:51:44 2011 -0800 +++ b/src/Virt_VirtualSystemManagementService.c Thu Feb 17 12:00:51 2011 -0800 @@ -623,6 +623,7 @@ return _mac; } +/* static const char *filter_by_address(struct inst_list *src, const char *address) { @@ -665,8 +666,8 @@ goto out; } - /* FIXME: This is a Pegasus work around. Pegsus loses the namespace - when an ObjectPath is pulled from an instance */ + FIXME: This is a Pegasus work around. Pegsus loses the namespace + when an ObjectPath is pulled from an instance if (STREQ(NAMESPACE(op), "")) CMSetNameSpace(op, ns); @@ -684,7 +685,7 @@ inst_list_free(&in_list); return msg; } - +*/ static const char *net_rasd_to_vdev(CMPIInstance *inst, struct virt_device *dev, @@ -709,10 +710,12 @@ } } +/* msg = check_duplicate_mac(inst, val, ns); if (msg != NULL) { goto out; } +*/ free(dev->dev.net.mac); dev->dev.net.mac = strdup(val); From cvincent at linux.vnet.ibm.com Fri Feb 18 01:35:34 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 17 Feb 2011 20:35:34 -0500 Subject: [Libvirt-cim] [PATCH] [TEST] Updated test case for VSI In-Reply-To: References: Message-ID: <4D5DCCE6.8010003@linux.vnet.ibm.com> +1. We have some clean-up to do so it's not an urgent matter, but it we need to improve the code documentation so that future developers can make sense of vsi -> exp_base_num = 4. I don't have access to VSI HW so I'm not sure I can validate that assumption. Otherwise, the code change look fine. On 01/14/2011 10:51 AM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1295017601 28800 > # Node ID a226c6d2bccad847da03d29746b8f2c821957517 > # Parent bb3fbbcdfd16998662bc8187dcdac95f959473d0 > [TEST] Updated test case for VSI. > > libvirt-cim netpool template was changed to support VSI > and this test has been updated to reflect the new template > count. > > Signed-off-by: Sharad Mishra > > diff -r bb3fbbcdfd16 -r a226c6d2bcca suites/libvirt-cim/lib/XenKvmLib/rasd.py > --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py Fri Jan 14 06:56:10 2011 -0800 > +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py Fri Jan 14 07:06:41 2011 -0800 > @@ -395,11 +395,14 @@ > def get_exp_net_rasd_len(virt, rev, id): > net_rasd_template_changes = 861 > net_rasd_direct_nettype_changes = 1029 > + net_rasd_vsi_nettype_changes = 1043 > > # NetRASD record for Direct NetType 1 for each min, max, incr, default > exp_direct = 4 > > exp_base_num = 4 > + dev_types = 2 > + net_types = 3 > > if id == "NetworkPool/0": > pool_types = 3 > @@ -408,14 +411,13 @@ > return (exp_base_num * pool_types) + (exp_base_num * forward_modes) > > if rev>= net_rasd_template_changes: > - dev_types = 2 > - net_types = 3 > exp_base_num = exp_base_num * dev_types * net_types > > - if rev>= net_rasd_direct_nettype_changes: > - exp_base_num += exp_direct > + if rev>= net_rasd_direct_nettype_changes: > + exp_base_num += exp_direct > > - return exp_base_num > + if rev>= net_rasd_vsi_nettype_changes: > + exp_base_num = 4 * (dev_types * net_types + exp_direct) > > return exp_base_num > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From cvincent at linux.vnet.ibm.com Fri Feb 18 01:38:09 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 17 Feb 2011 20:38:09 -0500 Subject: [Libvirt-cim] [PATCH] [TEST] Updated test to only verify disk RASD In-Reply-To: <8866ff769a7637cbee7c.1295020326@elm3b197.beaverton.ibm.com> References: <8866ff769a7637cbee7c.1295020326@elm3b197.beaverton.ibm.com> Message-ID: <4D5DCD81.60401@linux.vnet.ibm.com> +1. Should we consider changing the default VM for this test? On 01/14/2011 10:52 AM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1295018716 28800 > # Node ID 8866ff769a7637cbee7c793827152649856815f2 > # Parent 2c9689c31d42c2320ecca7a4283bd564c5a27737 > [TEST] Updated test to only verify disk RASD. > > This test was written to look for disk and cdrom. > But default VM created by this test case only uses > disk and no cdrom. This test has been updated to > test for disk only. > > Signed-off-by: Sharad Mishra > > diff -r 2c9689c31d42 -r 8866ff769a76 suites/libvirt-cim/cimtest/RASD/05_disk_rasd_emu_type.py > --- a/suites/libvirt-cim/cimtest/RASD/05_disk_rasd_emu_type.py Fri Jan 14 07:06:49 2011 -0800 > +++ b/suites/libvirt-cim/cimtest/RASD/05_disk_rasd_emu_type.py Fri Jan 14 07:25:16 2011 -0800 > @@ -42,47 +42,43 @@ > if curr_cim_rev< libvirt_em_type_changeset: > return SKIP > > - if options.virt == 'Xen': > - emu_types = [0] > - else: > - emu_types = [0, 1] > + exp_emu_type = 0 > try: > - for exp_emu_type in emu_types: > - virt_xml = get_class(options.virt) > - cxml = virt_xml(default_dom, emu_type=exp_emu_type) > - ret = cxml.cim_define(options.ip) > - if not ret: > - logger.error("Failed to call DefineSystem()") > - return FAIL > + virt_xml = get_class(options.virt) > + cxml = virt_xml(default_dom, emu_type=exp_emu_type) > + ret = cxml.cim_define(options.ip) > + if not ret: > + logger.error("Failed to call DefineSystem()") > + return FAIL > > - drasd= get_typed_class(options.virt, > - 'DiskResourceAllocationSettingData') > + drasd= get_typed_class(options.virt, > + 'DiskResourceAllocationSettingData') > > - drasd_list = EnumInstances(options.ip, drasd, ret_cim_inst=True) > - if len(drasd_list)< 1: > - raise Exception("%s returned %i instances, expected at least 1"\ > - %(drasd, len(drasd_list))) > + drasd_list = EnumInstances(options.ip, drasd, ret_cim_inst=True) > + if len(drasd_list)< 1: > + raise Exception("%s returned %i instances, expected at least 1"\ > + %(drasd, len(drasd_list))) > > - found_rasd = None > - for rasd in drasd_list: > - guest, dev, status = parse_instance_id(rasd['InstanceID']) > - if status != PASS: > - raise Exception("Unable to parse InstanceID: %s" \ > - % rasd['InstanceID']) > - if guest == default_dom: > - if rasd['EmulatedType'] == exp_emu_type: > - found_rasd = rasd > - status = PASS > - break > - else: > - raise Exception("EmulatedType Mismatch: got %d," > - "expected %d" %(rasd['EmulatedType'], > - exp_emu_type)) > + found_rasd = None > + for rasd in drasd_list: > + guest, dev, status = parse_instance_id(rasd['InstanceID']) > + if status != PASS: > + raise Exception("Unable to parse InstanceID: %s" \ > + % rasd['InstanceID']) > + if guest == default_dom: > + if rasd['EmulatedType'] == exp_emu_type: > + found_rasd = rasd > + status = PASS > + break > + else: > + raise Exception("EmulatedType Mismatch: got %d," > + "expected %d" %(rasd['EmulatedType'], > + exp_emu_type)) > > - if found_rasd is None: > - raise Exception("DiskRASD for defined dom was not found") > + if found_rasd is None: > + raise Exception("DiskRASD for defined dom was not found") > > - cxml.undefine(options.ip) > + cxml.undefine(options.ip) > > except Exception, detail: > logger.error("Exception: %s", detail) > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From cvincent at linux.vnet.ibm.com Fri Feb 18 01:51:09 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 17 Feb 2011 20:51:09 -0500 Subject: [Libvirt-cim] [PATCH] [TEST] Memory is calculated in block sizes In-Reply-To: <0d0d87b8a5b44ed0af9c.1295022004@elm3b197.beaverton.ibm.com> References: <0d0d87b8a5b44ed0af9c.1295022004@elm3b197.beaverton.ibm.com> Message-ID: <4D5DD08D.7060204@linux.vnet.ibm.com> +1 On 01/14/2011 11:20 AM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1295021879 28800 > # Node ID 0d0d87b8a5b44ed0af9c32490db7d7fcc586cf21 > # Parent a0f35dd8ba2843bd548a3c3d0186e0fc48a9113d > [TEST] Memory is calculated in block sizes. > > This test was modifying the VM memory and then > verify that the new memory size matches the expected > memory. The test was failing because memory was not > getting multiplied by the block size (512). Updated this > test to account for memory size in blocks. > > Signed-off-by: Sharad Mishra > > diff -r a0f35dd8ba28 -r 0d0d87b8a5b4 suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py > --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py Fri Jan 14 08:16:16 2011 -0800 > +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py Fri Jan 14 08:17:59 2011 -0800 > @@ -41,7 +41,7 @@ > ntype = 'network' > cpu = 2 > ncpu = 1 > -nmem = 256 > +nmem = 131072 > new_int = randint(10, 99) > new_mac1 = "11:%s:22:%s:33:%s" % (new_int, new_int, new_int) > new_int += 1 > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From cvincent at linux.vnet.ibm.com Fri Feb 18 01:51:18 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 17 Feb 2011 20:51:18 -0500 Subject: [Libvirt-cim] [PATCH] [TEST] Removing graphics device from this test In-Reply-To: References: Message-ID: <4D5DD096.40701@linux.vnet.ibm.com> +1 On 01/14/2011 11:34 AM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1295022559 28800 > # Node ID f98167abd981e7e9551c26ab8367c8b2b71829dd > # Parent d54a6a278fa33413148d9a2ca63257284e5f7a1c > [TEST] Removing graphics device from this test. > > The VM does not have a graphics device. It is > being removed. > > Signed-off-by: Sharad Mishra > > diff -r d54a6a278fa3 -r f98167abd981 suites/libvirt-cim/cimtest/VirtualSystemManagementService/16_removeresource.py > --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/16_removeresource.py Fri Jan 14 08:20:38 2011 -0800 > +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/16_removeresource.py Fri Jan 14 08:29:19 2011 -0800 > @@ -66,7 +66,8 @@ > sds_classname = get_typed_class(options.virt, 'SettingsDefineState') > mem = get_typed_class(options.virt, 'Memory') > proc = get_typed_class(options.virt, 'Processor') > - dev_not_rem = [mem, proc] > + input = get_typed_class(options.virt, 'PointingDevice') > + dev_not_rem = [mem, proc, input] > > service = get_vsms_class(options.virt)(options.ip) > for dev in devs: > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From cvincent at linux.vnet.ibm.com Fri Feb 18 01:35:21 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 17 Feb 2011 20:35:21 -0500 Subject: [Libvirt-cim] [PATCH] [TEST] Updated this testcase to focus on pause/resume In-Reply-To: <2c9689c31d42c2320ecc.1295020310@elm3b197.beaverton.ibm.com> References: <2c9689c31d42c2320ecc.1295020310@elm3b197.beaverton.ibm.com> Message-ID: <4D5DCCD9.8010102@linux.vnet.ibm.com> +1 On 01/14/2011 10:51 AM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1295017609 28800 > # Node ID 2c9689c31d42c2320ecca7a4283bd564c5a27737 > # Parent a226c6d2bccad847da03d29746b8f2c821957517 > [TEST] Updated this testcase to focus on pause/resume. > > This test was running suspend and reboot which is not > supported on all hypervisor types. So changed this test > case to focus on pause and resume. > > Signed-off-by: Sharad Mishra > > diff -r a226c6d2bcca -r 2c9689c31d42 suites/libvirt-cim/cimtest/ComputerSystem/33_suspend_reboot.py > --- a/suites/libvirt-cim/cimtest/ComputerSystem/33_suspend_reboot.py Fri Jan 14 07:06:41 2011 -0800 > +++ b/suites/libvirt-cim/cimtest/ComputerSystem/33_suspend_reboot.py Fri Jan 14 07:06:49 2011 -0800 > @@ -59,7 +59,7 @@ > server = options.ip > virt = options.virt > > - tc_scen = ['Start', 'Suspend', 'Reboot'] > + tc_scen = ['Start', 'Paused', 'Resume'] > > action_passed = PASS > try: > @@ -73,10 +73,10 @@ > for action in tc_scen: > if action == "Start": > status = cxml.cim_start(server) > - elif action == "Suspend": > - status = cxml.cim_suspend(server) > - elif action == "Reboot": > - status = cxml.cim_reboot(server) > + elif action == "Paused": > + status = cxml.cim_pause(server) > + elif action == "Resume": > + status = cxml.cim_reset(server) > else: > raise Exception("Unexpected state change: %s" % action) > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From cvincent at linux.vnet.ibm.com Fri Feb 18 01:44:24 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 17 Feb 2011 20:44:24 -0500 Subject: [Libvirt-cim] [PATCH] [TEST] Memory is calculated in block sizes In-Reply-To: References: Message-ID: <4D5DCEF8.6030405@linux.vnet.ibm.com> +1. In the future, let's use either dyanmic block size (since it may vary) or code it such that "nmen = 256 * 512" so the code is somewhat "self documenting" :) On 01/14/2011 10:52 AM, Sharad Mishra wote: > # HG changeset patch > # User Sharad Mishra > # Date 1295019233 28800 > # Node ID a99191b4a4f499c452cb50558b87f9c03925f1f2 > # Parent 8866ff769a7637cbee7c793827152649856815f2 > [TEST] Memory is calculated in block sizes. > > This test was modifying the VM memory and then > verify that the new memory size matches the expected > memory. The test was failing because memory was not > getting multiplied by the block size (512). Updated this > test to account for memory size in blocks. > > Signed-off-by: Sharad Mishra > > diff -r 8866ff769a76 -r a99191b4a4f4 suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py > --- a/suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py Fri Jan 14 07:25:16 2011 -0800 > +++ b/suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py Fri Jan 14 07:33:53 2011 -0800 > @@ -45,7 +45,7 @@ > sup_types = ['KVM', 'Xen', 'XenFV'] > libvirt_guest_rasd_indication_rev = 980 > > -nmem = 256 > +nmem = 131072 > nmac = '00:11:22:33:44:55' > > def create_guest(test_dom, ip, virt, cxml): > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From snmishra at us.ibm.com Wed Feb 23 14:52:19 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 23 Feb 2011 06:52:19 -0800 Subject: [Libvirt-cim] [PATCH] Set/Reset VM autostart Message-ID: <219b9e147e611772e9f5.1298472739@elm3a148.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1298472523 28800 # Node ID 219b9e147e611772e9f540800943653ce73acdfd # Parent f3d3d546da029d62d3e5bceec52152a010e2e4b2 Set/Reset VM autostart. Support for VM autostart was added few months back, but a defect was opened against libvirt-cim that autostart can only be set during VM creation and cannot be changed later. This patch fixes that issue. Signed-off-by: Sharad Mishra diff -r f3d3d546da02 -r 219b9e147e61 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Thu Feb 17 12:00:51 2011 -0800 +++ b/libxkutil/device_parsing.c Wed Feb 23 06:48:43 2011 -0800 @@ -1086,12 +1086,17 @@ { char *xml; int ret; + int start; xml = virDomainGetXMLDesc(dom, 0); if (xml == NULL) return 0; ret = get_dominfo_from_xml(xml, dominfo); + if (virDomainGetAutostart(dom, &start) != 0) + return 0; + + (*dominfo)->autostrt = start; free(xml); diff -r f3d3d546da02 -r 219b9e147e61 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Thu Feb 17 12:00:51 2011 -0800 +++ b/libxkutil/device_parsing.h Wed Feb 23 06:48:43 2011 -0800 @@ -136,13 +136,13 @@ char *name; char *typestr; /*xen, kvm, etc */ char *uuid; - int autostart; char *bootloader; char *bootloader_args; char *clock; bool acpi; bool apic; bool pae; + int autostrt; union { struct pv_os_info pv; diff -r f3d3d546da02 -r 219b9e147e61 schema/ComputerSystem.mof --- a/schema/ComputerSystem.mof Thu Feb 17 12:00:51 2011 -0800 +++ b/schema/ComputerSystem.mof Wed Feb 23 06:48:43 2011 -0800 @@ -10,9 +10,6 @@ [Description("UUID assigned to this DomU.")] string UUID; - [Description("Flag to set VM autostart.")] - string autoStart; - }; [Description ( @@ -26,9 +23,6 @@ [Description("UUID assigned to this virtual machine.")] string UUID; - [Description("Flag to set VM autostart.")] - string autoStart; - }; [Description ( @@ -42,8 +36,5 @@ [Description("UUID assigned to this virtual machine.")] string UUID; - [Description("Flag to set VM autostart.")] - string autoStart; - }; diff -r f3d3d546da02 -r 219b9e147e61 schema/Virt_VSSD.mof --- a/schema/Virt_VSSD.mof Thu Feb 17 12:00:51 2011 -0800 +++ b/schema/Virt_VSSD.mof Wed Feb 23 06:48:43 2011 -0800 @@ -24,4 +24,7 @@ [Description ("Flag to determine whether this guest has pae enabled")] boolean EnablePAE; + [Description ("Flag to determine whether this guest has to be autostarted on reboot")] + uint16 AutoStart; + }; diff -r f3d3d546da02 -r 219b9e147e61 src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Thu Feb 17 12:00:51 2011 -0800 +++ b/src/Virt_ComputerSystem.c Wed Feb 23 06:48:43 2011 -0800 @@ -65,33 +65,6 @@ return 1; } -/* Set the "autoStart" property of an instance from a domain */ -static int set_autostart_from_dom(virDomainPtr dom, - CMPIInstance *instance, - struct domain *dominfo) -{ - int autoFlag = 0; - char autovalue[16]; - - if((virDomainGetAutostart(dom, &autoFlag)) == -1) { - CU_DEBUG("Could not read autostart value from xml"); - } else { - CU_DEBUG("Autostart for current domain is set to %d", - autoFlag); - dominfo->autostart = autoFlag; - } - - if(autoFlag) - strcpy(autovalue, "enable"); - else - strcpy(autovalue, "disable"); - - CMSetProperty(instance, "autoStart", - (CMPIValue *)autovalue, CMPI_chars); - - return 1; -} - /* Set the "UUID" property of an instance from a domain */ static int set_uuid_from_dom(virDomainPtr dom, CMPIInstance *instance, @@ -526,15 +499,6 @@ goto out; } - if (!set_autostart_from_dom(dom, instance, domain)) { - virt_set_status(broker, &s, - CMPI_RC_ERR_FAILED, - virDomainGetConnect(dom), - "Unable to get domain autostart flag"); - - goto out; - } - if (!set_uuid_from_dom(dom, instance, &uuid)) { virt_set_status(broker, &s, CMPI_RC_ERR_FAILED, diff -r f3d3d546da02 -r 219b9e147e61 src/Virt_VSSD.c --- a/src/Virt_VSSD.c Thu Feb 17 12:00:51 2011 -0800 +++ b/src/Virt_VSSD.c Wed Feb 23 06:48:43 2011 -0800 @@ -220,6 +220,9 @@ CMSetProperty(inst, "EnablePAE", (CMPIValue *)&dominfo->pae, CMPI_boolean); + CMSetProperty(inst, "AutoStart", + (CMPIValue *)&dominfo->autostrt, CMPI_uint16); + if (dominfo->clock != NULL) { uint16_t clock = VSSD_CLOCK_UTC; diff -r f3d3d546da02 -r 219b9e147e61 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Thu Feb 17 12:00:51 2011 -0800 +++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 23 06:48:43 2011 -0800 @@ -1374,8 +1374,6 @@ virDomainPtr dom; const char *name; CMPIInstance *inst = NULL; - const char *autoStartFlag = NULL; - int autoflag; conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); if (conn == NULL) { @@ -1404,19 +1402,6 @@ 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: virDomainFree(dom); virConnectClose(conn); @@ -1663,6 +1648,74 @@ } +static CMPIStatus set_autostart(CMPIInstance *vssd, + const CMPIObjectPath *ref, + virDomainPtr dom) +{ + CMPIStatus s; + const char *name = NULL; + CMPIrc ret; + virConnectPtr conn = NULL; + virDomainPtr inst_dom = NULL; + uint16_t val = 0; + int i = 0; + + CU_DEBUG("Enter set_autostart"); + ret = cu_get_str_prop(vssd, "VirtualSystemIdentifier", &name); + if (ret != CMPI_RC_OK) { + CU_DEBUG("Missing VirtualSystemIdentifier"); + cu_statusf(_BROKER, &s, + ret, + "Missing VirtualSystemIdentifier"); + goto out; + } + + conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); + if (conn == NULL) { + CU_DEBUG("Failed to connect"); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to connect"); + goto out; + } + + inst_dom = virDomainLookupByName(conn, name); + if (inst_dom == NULL) { + CU_DEBUG("reference domain '%s' does not exist", name); + virt_set_status(_BROKER, &s, + CMPI_RC_ERR_NOT_FOUND, + conn, + "Referenced domain `%s' does not exist", name); + goto out; + } + + if (cu_get_u16_prop(vssd, "AutoStart", &val) != CMPI_RC_OK) { + if (dom != NULL) { + /* Read the current domain's autostart setting. + Since the user did not specify any new + autostart, the updated VM will use the same + autostart setting as used before this + update. */ + if (virDomainGetAutostart(dom, &i) != 0) + i = 0; + } + } + else + i = val; + CU_DEBUG("setting VM's autostart to %d", i); + if (virDomainSetAutostart(inst_dom, i) == -1) { + CU_DEBUG("Failed to set autostart"); + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Failed to set autostart"); + } + + out: + virDomainFree(inst_dom); + virConnectClose(conn); + return s; +} + static CMPIInstance *create_system(const CMPIContext *context, CMPIInstance *vssd, CMPIArray *resources, @@ -1673,15 +1726,13 @@ CMPIInstance *inst = NULL; char *xml = NULL; const char *msg = NULL; - virConnectPtr conn = NULL; - virDomainPtr dom = NULL; struct inst_list list; const char *props[] = {NULL}; - struct domain *domain = NULL; inst_list_init(&list); + CU_DEBUG("Enter create_system"); if (refconf != NULL) { *s = get_reference_domain(&domain, ref, refconf); if (s->rc != CMPI_RC_OK) @@ -1731,6 +1782,7 @@ inst = connect_and_create(xml, ref, s); if (inst != NULL) { update_dominfo(domain, CLASSNAME(ref)); + set_autostart(vssd, ref, NULL); *s = enum_rasds(_BROKER, ref, @@ -1755,8 +1807,6 @@ out: cleanup_dominfo(&domain); free(xml); - virDomainFree(dom); - virConnectClose(conn); inst_list_free(&list); return inst; @@ -1943,6 +1993,7 @@ char *xml = NULL; const char *uuid = NULL; + CU_DEBUG("Enter update_system_settings"); ret = cu_get_str_prop(vssd, "VirtualSystemIdentifier", &name); if (ret != CMPI_RC_OK) { cu_statusf(_BROKER, &s, @@ -2002,6 +2053,7 @@ } if (s.rc == CMPI_RC_OK) { + set_autostart(vssd, ref, dom); trigger_indication(context, "ComputerSystemModifiedIndication", ref); From snmishra at us.ibm.com Wed Feb 23 15:02:01 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 23 Feb 2011 07:02:01 -0800 Subject: [Libvirt-cim] [PATCH] [TEST] Test VM's AutoStart feature Message-ID: <53f2cfb2a6ea2940b4de.1298473321@elm3a148.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1298473315 28800 # Node ID 53f2cfb2a6ea2940b4de62fff16e3413419cb511 # Parent 4f2bf0006818d2ca4903a0b550dde65e4d581d7c [TEST] Test VM's AutoStart feature. This testcase will create VM, get its AutoStart setting and compare against expected value. Then it changes AutoStart, modifies the VM and reads the AutoStart back to verify that it was changed. Signed-off-by: Sharad Mishra diff -r 4f2bf0006818 -r 53f2cfb2a6ea suites/libvirt-cim/cimtest/VSSD/07_autostart.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/VSSD/07_autostart.py Wed Feb 23 07:01:55 2011 -0800 @@ -0,0 +1,118 @@ +#!/usr/bin/python +# +# Copyright 2009 IBM Corp. +# +# Authors: +# Sharad Mishra +# +# 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 +# +# This test will create a VM, get its autostart setting and compare against +# the expected value. Then it sets the autostart to '1', and Modifies the VM. +# Updated VM's autostart is read and compared. Then once more autostart is reset +# and VM updated. Updated VM's autostart is again compared. +# + +import sys +import time +import pywbem +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 +from pywbem.cim_types import Uint16 + +sup_types = ['Xen', 'KVM', 'XenFV', 'LXC'] +default_dom = 'uuid_domain' +autostart_support = 1076 + +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, 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 + + at 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 < autostart_support: + logger.info("Need provider version %d or greater to run testcase", + autostart_support) + 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 + + 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) + inst['AutoStart'] = Uint16(1) + vssd = inst_to_mof(inst) + service.ModifySystemSettings(SystemSettings=vssd) + + 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) + if inst['AutoStart'] != Uint16(1): + raise Exception("Test failed, Autostart settings mismatch") + + inst['AutoStart'] = Uint16(0) + vssd = inst_to_mof(inst) + service.ModifySystemSettings(SystemSettings=vssd) + + 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) + if inst['AutoStart'] != Uint16(0): + raise Exception("Test failed, Autostart settings mismatch") + + cxml.undefine(options.ip) + return status + +if __name__ == "__main__": + sys.exit(main()) + From cvincent at linux.vnet.ibm.com Tue Feb 22 02:54:56 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Mon, 21 Feb 2011 21:54:56 -0500 Subject: [Libvirt-cim] [PATCH] Remove test for duplicate mac address In-Reply-To: References: Message-ID: <4D632580.1020903@linux.vnet.ibm.com> +1. Very good catch, Sharad. Pushed. On 02/17/2011 03:02 PM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1297972851 28800 > # Node ID f3d3d546da029d62d3e5bceec52152a010e2e4b2 > # Parent a1bb536dcf5ca836a2b09d7682134c88a4fbeb6e > Remove test for duplicate mac address. > > This test has been removed since it was interfering with modifying network resources. This is an extra piece of check that was added in libvirt-cim, libvirt already does this check. Removing it should not cause any problem. > When a user modified an existing active net RASD, libvirt-cim clones the RASD and changes the properties to the new values. But if mac was not one of the changing property, then this extra check, took it to be a duplicate mac and gave error. > > Signed-off-by: Sharad Mishra > > diff -r a1bb536dcf5c -r f3d3d546da02 src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Wed Feb 16 09:51:44 2011 -0800 > +++ b/src/Virt_VirtualSystemManagementService.c Thu Feb 17 12:00:51 2011 -0800 > @@ -623,6 +623,7 @@ > return _mac; > } > > +/* > static const char *filter_by_address(struct inst_list *src, > const char *address) > { > @@ -665,8 +666,8 @@ > goto out; > } > > - /* FIXME: This is a Pegasus work around. Pegsus loses the namespace > - when an ObjectPath is pulled from an instance */ > + FIXME: This is a Pegasus work around. Pegsus loses the namespace > + when an ObjectPath is pulled from an instance > > if (STREQ(NAMESPACE(op), "")) > CMSetNameSpace(op, ns); > @@ -684,7 +685,7 @@ > inst_list_free(&in_list); > return msg; > } > - > +*/ > > static const char *net_rasd_to_vdev(CMPIInstance *inst, > struct virt_device *dev, > @@ -709,10 +710,12 @@ > } > } > > +/* > msg = check_duplicate_mac(inst, val, ns); > if (msg != NULL) { > goto out; > } > +*/ > > free(dev->dev.net.mac); > dev->dev.net.mac = strdup(val); > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Tue Feb 22 02:43:33 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Mon, 21 Feb 2011 21:43:33 -0500 Subject: [Libvirt-cim] [PATCH] Add readonly property to disk In-Reply-To: <5217c96d817d3d330898.1297868295@elm3a148.beaverton.ibm.com> References: <5217c96d817d3d330898.1297868295@elm3a148.beaverton.ibm.com> Message-ID: <4D6322D5.6020504@linux.vnet.ibm.com> +1. Pushed. A nit: The CIM property "readonly" should be "ReadOnly". Not a big deal since we have other nits like this now in the code. Plan to address when we update the schema. On 02/16/2011 09:58 AM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1297867691 28800 > # Node ID 5217c96d817d3d330898df26dd4262b9c26abc21 > # Parent 432922275bea75a769cf058209bdb81198f3b360 > Add readonly property to disk. > > This patch adds readonly property to disks. > > Signed-off-by: Sharad Mishra > > diff -r 432922275bea -r 5217c96d817d schema/ResourceAllocationSettingData.mof > --- a/schema/ResourceAllocationSettingData.mof Fri Jan 21 15:59:27 2011 -0500 > +++ b/schema/ResourceAllocationSettingData.mof Wed Feb 16 06:48:11 2011 -0800 > @@ -17,6 +17,9 @@ > [Description ("Bus type of the device")] > string BusType; > > + [Description ("readonly mode for disk")] > + boolean readonly; > + > }; > > [Description ("KVM virtual disk configuration"), > @@ -35,6 +38,9 @@ > > [Description ("Bus type of the device")] > string BusType; > + > + [Description ("readonly mode for disk")] > + boolean readonly; > }; > > [Description ("LXC virtual disk configuration"), > diff -r 432922275bea -r 5217c96d817d src/Virt_RASD.c > --- a/src/Virt_RASD.c Fri Jan 21 15:59:27 2011 -0500 > +++ b/src/Virt_RASD.c Wed Feb 16 06:48:11 2011 -0800 > @@ -275,6 +275,12 @@ > (CMPIValue *)&type, > CMPI_uint16); > > + if(dev->dev.disk.readonly) > + CMSetProperty(inst, > + "readonly", > + (CMPIValue *)&(dev->dev.disk.readonly), > + CMPI_boolean); > + > return s; > } > > diff -r 432922275bea -r 5217c96d817d src/Virt_SettingsDefineCapabilities.c > --- a/src/Virt_SettingsDefineCapabilities.c Fri Jan 21 15:59:27 2011 -0500 > +++ b/src/Virt_SettingsDefineCapabilities.c Wed Feb 16 06:48:11 2011 -0800 > @@ -852,6 +852,7 @@ > const char *disk_path, > uint64_t disk_size, > uint16_t emu_type, > + bool readonly, > struct inst_list *list) > { > const char *dev; > @@ -895,6 +896,9 @@ > (CMPIValue *)dev, CMPI_chars); > CMSetProperty(inst, "EmulatedType", > (CMPIValue *)&emu_type, CMPI_uint16); > + if(readonly) > + CMSetProperty(inst, "readonly", > + (CMPIValue *)&readonly, CMPI_boolean); > } > > inst_list_add(list, inst); > @@ -915,6 +919,7 @@ > CMPIStatus s = {CMPI_RC_OK, NULL}; > const char *dev_str = NULL; > char *id_str = NULL; > + bool readonly = true; > > if (emu_type == VIRT_DISK_TYPE_CDROM) > dev_str = "CDROM"; > @@ -960,6 +965,7 @@ > vol_path, > vol_size, > emu_type, > + readonly, > list); > } > } else if (STREQ(pfx, "KVM")) { > @@ -969,6 +975,7 @@ > vol_path, > vol_size, > emu_type, > + readonly, > list); > > } else if (!STREQ(pfx, "LXC")){ > @@ -1042,6 +1049,7 @@ > const char *id; > int type = 0; > bool ret; > + bool readonly = true; > > CMPIStatus s = {CMPI_RC_OK, NULL}; > > @@ -1092,6 +1100,7 @@ > disk_path, > disk_size, > emu_type, > + readonly, > list); > if (s.rc != CMPI_RC_OK) > goto out; > @@ -1111,6 +1120,7 @@ > disk_path, > disk_size, > emu_type, > + readonly, > list); > } > > @@ -1236,6 +1246,7 @@ > CMPIStatus s = {CMPI_RC_OK, NULL}; > int ret; > uint16_t emu_type = 0; > + bool readonly = false; > > ret = virStorageVolGetInfo(volume_ptr,&vol_info); > if (ret == -1) { > @@ -1292,6 +1303,7 @@ > vol_path, > vol_size, > emu_type, > + readonly, > list); > } > } else if (STREQ(pfx, "KVM")) { > @@ -1301,6 +1313,7 @@ > vol_path, > vol_size, > emu_type, > + readonly, > list); > } else { > cu_statusf(_BROKER,&s, > @@ -1457,7 +1470,7 @@ > if (STREQ(pfx, "LXC")) > goto out; > > - s = cdrom_or_floppy_template(ref, > + s = odrom_or_floppy_template(ref, > template_type, > VIRT_DISK_TYPE_CDROM, > list); > diff -r 432922275bea -r 5217c96d817d src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Fri Jan 21 15:59:27 2011 -0500 > +++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 16 06:48:11 2011 -0800 > @@ -835,6 +835,7 @@ > { > const char *val = NULL; > uint16_t type; > + bool read = false; > > CU_DEBUG("Enter disk_rasd_to_vdev"); > if (cu_get_str_prop(inst, "VirtualDevice",&val) != CMPI_RC_OK) > @@ -867,6 +868,11 @@ > > CU_DEBUG("device type is %s", dev->dev.disk.device); > > + if (cu_get_bool_prop(inst, "readonly",&read) != CMPI_RC_OK) > + dev->dev.disk.readonly = false; > + else > + dev->dev.disk.readonly = read; > + > free(dev->dev.disk.bus_type); > if (cu_get_str_prop(inst, "BusType",&val) != CMPI_RC_OK) > dev->dev.disk.bus_type = NULL; > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Tue Feb 22 02:54:05 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Mon, 21 Feb 2011 21:54:05 -0500 Subject: [Libvirt-cim] [PATCH] Add support for deactivation of disk caching In-Reply-To: References: Message-ID: <4D63254D.3040605@linux.vnet.ibm.com> +1. Nit = "cache" should be "Cache" in CIM, but okay to deal with during future cleanup. Pushed. On 02/16/2011 12:53 PM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1297878704 28800 > # Node ID a1bb536dcf5ca836a2b09d7682134c88a4fbeb6e > # Parent 5217c96d817d3d330898df26dd4262b9c26abc21 > Add support for deactivation of disk caching. > > This patch adds support to deactivate caching of disk devices. > > Signed-off-by: Sharad Mishra > > diff -r 5217c96d817d -r a1bb536dcf5c libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Wed Feb 16 06:48:11 2011 -0800 > +++ b/libxkutil/device_parsing.c Wed Feb 16 09:51:44 2011 -0800 > @@ -53,6 +53,7 @@ > free(dev->type); > free(dev->device); > free(dev->driver); > + free(dev->cache); > free(dev->source); > free(dev->virtual_dev); > free(dev->bus_type); > @@ -241,6 +242,7 @@ > ddev->driver = get_attr_value(child, "name"); > if (ddev->driver == NULL) > goto err; > + ddev->cache = get_attr_value(child, "cache"); > } else if (XSTREQ(child->name, "source")) { > ddev->source = get_attr_value(child, "file"); > if (ddev->source) { > @@ -739,6 +741,7 @@ > DUP_FIELD(dev, _dev, dev.disk.type); > DUP_FIELD(dev, _dev, dev.disk.device); > DUP_FIELD(dev, _dev, dev.disk.driver); > + DUP_FIELD(dev, _dev, dev.disk.cache); > DUP_FIELD(dev, _dev, dev.disk.source); > DUP_FIELD(dev, _dev, dev.disk.virtual_dev); > DUP_FIELD(dev, _dev, dev.disk.bus_type); > diff -r 5217c96d817d -r a1bb536dcf5c libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Wed Feb 16 06:48:11 2011 -0800 > +++ b/libxkutil/device_parsing.h Wed Feb 16 09:51:44 2011 -0800 > @@ -53,6 +53,7 @@ > bool readonly; > bool shareable; > char *bus_type; > + char *cache; > }; > > struct net_device { > diff -r 5217c96d817d -r a1bb536dcf5c libxkutil/xmlgen.c > --- a/libxkutil/xmlgen.c Wed Feb 16 06:48:11 2011 -0800 > +++ b/libxkutil/xmlgen.c Wed Feb 16 09:51:44 2011 -0800 > @@ -84,6 +84,15 @@ > xmlNewProp(disk, BAD_CAST "type", BAD_CAST "file"); > xmlNewProp(disk, BAD_CAST "device", BAD_CAST dev->device); > > + tmp = xmlNewChild(disk, NULL, BAD_CAST "driver", NULL); > + if (tmp == NULL) > + return XML_ERROR; > + if(dev->driver != NULL) { > + xmlNewProp(tmp, BAD_CAST "name", BAD_CAST dev->driver); > + if(dev->cache != NULL) > + xmlNewProp(tmp, BAD_CAST "cache", BAD_CAST dev->cache); > + } > + > tmp = xmlNewChild(disk, NULL, BAD_CAST "source", NULL); > if (tmp == NULL) > return XML_ERROR; > diff -r 5217c96d817d -r a1bb536dcf5c schema/ResourceAllocationSettingData.mof > --- a/schema/ResourceAllocationSettingData.mof Wed Feb 16 06:48:11 2011 -0800 > +++ b/schema/ResourceAllocationSettingData.mof Wed Feb 16 09:51:44 2011 -0800 > @@ -20,6 +20,9 @@ > [Description ("readonly mode for disk")] > boolean readonly; > > + [Description ("cache setting for device")] > + string cache; > + > }; > > [Description ("KVM virtual disk configuration"), > @@ -41,6 +44,9 @@ > > [Description ("readonly mode for disk")] > boolean readonly; > + > + [Description ("cache setting for device")] > + string cache; > }; > > [Description ("LXC virtual disk configuration"), > diff -r 5217c96d817d -r a1bb536dcf5c src/Virt_RASD.c > --- a/src/Virt_RASD.c Wed Feb 16 06:48:11 2011 -0800 > +++ b/src/Virt_RASD.c Wed Feb 16 09:51:44 2011 -0800 > @@ -281,6 +281,12 @@ > (CMPIValue *)&(dev->dev.disk.readonly), > CMPI_boolean); > > + if(dev->dev.disk.cache) > + CMSetProperty(inst, > + "cache", > + (CMPIValue *)dev->dev.disk.cache, > + CMPI_chars); > + > return s; > } > > diff -r 5217c96d817d -r a1bb536dcf5c src/Virt_SettingsDefineCapabilities.c > --- a/src/Virt_SettingsDefineCapabilities.c Wed Feb 16 06:48:11 2011 -0800 > +++ b/src/Virt_SettingsDefineCapabilities.c Wed Feb 16 09:51:44 2011 -0800 > @@ -853,6 +853,7 @@ > uint64_t disk_size, > uint16_t emu_type, > bool readonly, > + const char *cache, > struct inst_list *list) > { > const char *dev; > @@ -899,6 +900,10 @@ > if(readonly) > CMSetProperty(inst, "readonly", > (CMPIValue *)&readonly, CMPI_boolean); > + > + if(cache != NULL) > + CMSetProperty(inst, "cache", > + (CMPIValue *)cache, CMPI_chars); > } > > inst_list_add(list, inst); > @@ -920,6 +925,7 @@ > const char *dev_str = NULL; > char *id_str = NULL; > bool readonly = true; > + const char *cache = "none"; > > if (emu_type == VIRT_DISK_TYPE_CDROM) > dev_str = "CDROM"; > @@ -966,6 +972,7 @@ > vol_size, > emu_type, > readonly, > + cache, > list); > } > } else if (STREQ(pfx, "KVM")) { > @@ -976,6 +983,7 @@ > vol_size, > emu_type, > readonly, > + cache, > list); > > } else if (!STREQ(pfx, "LXC")){ > @@ -1050,6 +1058,7 @@ > int type = 0; > bool ret; > bool readonly = true; > + const char *cache = "none"; > > CMPIStatus s = {CMPI_RC_OK, NULL}; > > @@ -1101,6 +1110,7 @@ > disk_size, > emu_type, > readonly, > + cache, > list); > if (s.rc != CMPI_RC_OK) > goto out; > @@ -1121,6 +1131,7 @@ > disk_size, > emu_type, > readonly, > + cache, > list); > } > > @@ -1247,6 +1258,7 @@ > int ret; > uint16_t emu_type = 0; > bool readonly = false; > + const char *cache = "none"; > > ret = virStorageVolGetInfo(volume_ptr,&vol_info); > if (ret == -1) { > @@ -1304,6 +1316,7 @@ > vol_size, > emu_type, > readonly, > + cache, > list); > } > } else if (STREQ(pfx, "KVM")) { > @@ -1314,6 +1327,7 @@ > vol_size, > emu_type, > readonly, > + cache, > list); > } else { > cu_statusf(_BROKER,&s, > diff -r 5217c96d817d -r a1bb536dcf5c src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Wed Feb 16 06:48:11 2011 -0800 > +++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 16 09:51:44 2011 -0800 > @@ -878,6 +878,12 @@ > dev->dev.disk.bus_type = NULL; > else > dev->dev.disk.bus_type = strdup(val); > + > + free(dev->dev.disk.cache); > + if (cu_get_str_prop(inst, "cache",&val) != CMPI_RC_OK) > + dev->dev.disk.cache = NULL; > + else > + dev->dev.disk.cache = strdup(val); > > free(dev->id); > dev->id = strdup(dev->dev.disk.virtual_dev); > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Thu Feb 24 17:22:10 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 24 Feb 2011 12:22:10 -0500 Subject: [Libvirt-cim] [PATCH] Set/Reset VM autostart In-Reply-To: <219b9e147e611772e9f5.1298472739@elm3a148.beaverton.ibm.com> References: <219b9e147e611772e9f5.1298472739@elm3a148.beaverton.ibm.com> Message-ID: <4D6693C2.6040102@linux.vnet.ibm.com> +1. The MOF code has the nit regarding cap convesion, but we've already agreed to clean-up at next schema bump. On 02/23/2011 09:52 AM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1298472523 28800 > # Node ID 219b9e147e611772e9f540800943653ce73acdfd > # Parent f3d3d546da029d62d3e5bceec52152a010e2e4b2 > Set/Reset VM autostart. > > Support for VM autostart was added few months back, but a defect was opened against libvirt-cim that autostart can only be set during VM creation and cannot be changed later. This patch fixes that issue. > > Signed-off-by: Sharad Mishra > > diff -r f3d3d546da02 -r 219b9e147e61 libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Thu Feb 17 12:00:51 2011 -0800 > +++ b/libxkutil/device_parsing.c Wed Feb 23 06:48:43 2011 -0800 > @@ -1086,12 +1086,17 @@ > { > char *xml; > int ret; > + int start; > xml = virDomainGetXMLDesc(dom, 0); > > if (xml == NULL) > return 0; > > ret = get_dominfo_from_xml(xml, dominfo); > + if (virDomainGetAutostart(dom,&start) != 0) > + return 0; > + > + (*dominfo)->autostrt = start; > > free(xml); > > diff -r f3d3d546da02 -r 219b9e147e61 libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Thu Feb 17 12:00:51 2011 -0800 > +++ b/libxkutil/device_parsing.h Wed Feb 23 06:48:43 2011 -0800 > @@ -136,13 +136,13 @@ > char *name; > char *typestr; /*xen, kvm, etc */ > char *uuid; > - int autostart; > char *bootloader; > char *bootloader_args; > char *clock; > bool acpi; > bool apic; > bool pae; > + int autostrt; > > union { > struct pv_os_info pv; > diff -r f3d3d546da02 -r 219b9e147e61 schema/ComputerSystem.mof > --- a/schema/ComputerSystem.mof Thu Feb 17 12:00:51 2011 -0800 > +++ b/schema/ComputerSystem.mof Wed Feb 23 06:48:43 2011 -0800 > @@ -10,9 +10,6 @@ > [Description("UUID assigned to this DomU.")] > string UUID; > > - [Description("Flag to set VM autostart.")] > - string autoStart; > - > }; > > [Description ( > @@ -26,9 +23,6 @@ > [Description("UUID assigned to this virtual machine.")] > string UUID; > > - [Description("Flag to set VM autostart.")] > - string autoStart; > - > }; > > [Description ( > @@ -42,8 +36,5 @@ > [Description("UUID assigned to this virtual machine.")] > string UUID; > > - [Description("Flag to set VM autostart.")] > - string autoStart; > - > }; > > diff -r f3d3d546da02 -r 219b9e147e61 schema/Virt_VSSD.mof > --- a/schema/Virt_VSSD.mof Thu Feb 17 12:00:51 2011 -0800 > +++ b/schema/Virt_VSSD.mof Wed Feb 23 06:48:43 2011 -0800 > @@ -24,4 +24,7 @@ > [Description ("Flag to determine whether this guest has pae enabled")] > boolean EnablePAE; > > + [Description ("Flag to determine whether this guest has to be autostarted on reboot")] > + uint16 AutoStart; > + > }; > diff -r f3d3d546da02 -r 219b9e147e61 src/Virt_ComputerSystem.c > --- a/src/Virt_ComputerSystem.c Thu Feb 17 12:00:51 2011 -0800 > +++ b/src/Virt_ComputerSystem.c Wed Feb 23 06:48:43 2011 -0800 > @@ -65,33 +65,6 @@ > return 1; > } > > -/* Set the "autoStart" property of an instance from a domain */ > -static int set_autostart_from_dom(virDomainPtr dom, > - CMPIInstance *instance, > - struct domain *dominfo) > -{ > - int autoFlag = 0; > - char autovalue[16]; > - > - if((virDomainGetAutostart(dom,&autoFlag)) == -1) { > - CU_DEBUG("Could not read autostart value from xml"); > - } else { > - CU_DEBUG("Autostart for current domain is set to %d", > - autoFlag); > - dominfo->autostart = autoFlag; > - } > - > - if(autoFlag) > - strcpy(autovalue, "enable"); > - else > - strcpy(autovalue, "disable"); > - > - CMSetProperty(instance, "autoStart", > - (CMPIValue *)autovalue, CMPI_chars); > - > - return 1; > -} > - > /* Set the "UUID" property of an instance from a domain */ > static int set_uuid_from_dom(virDomainPtr dom, > CMPIInstance *instance, > @@ -526,15 +499,6 @@ > goto out; > } > > - if (!set_autostart_from_dom(dom, instance, domain)) { > - virt_set_status(broker,&s, > - CMPI_RC_ERR_FAILED, > - virDomainGetConnect(dom), > - "Unable to get domain autostart flag"); > - > - goto out; > - } > - > if (!set_uuid_from_dom(dom, instance,&uuid)) { > virt_set_status(broker,&s, > CMPI_RC_ERR_FAILED, > diff -r f3d3d546da02 -r 219b9e147e61 src/Virt_VSSD.c > --- a/src/Virt_VSSD.c Thu Feb 17 12:00:51 2011 -0800 > +++ b/src/Virt_VSSD.c Wed Feb 23 06:48:43 2011 -0800 > @@ -220,6 +220,9 @@ > CMSetProperty(inst, "EnablePAE", > (CMPIValue *)&dominfo->pae, CMPI_boolean); > > + CMSetProperty(inst, "AutoStart", > + (CMPIValue *)&dominfo->autostrt, CMPI_uint16); > + > if (dominfo->clock != NULL) { > uint16_t clock = VSSD_CLOCK_UTC; > > diff -r f3d3d546da02 -r 219b9e147e61 src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Thu Feb 17 12:00:51 2011 -0800 > +++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 23 06:48:43 2011 -0800 > @@ -1374,8 +1374,6 @@ > virDomainPtr dom; > const char *name; > CMPIInstance *inst = NULL; > - const char *autoStartFlag = NULL; > - int autoflag; > > conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); > if (conn == NULL) { > @@ -1404,19 +1402,6 @@ > 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: > virDomainFree(dom); > virConnectClose(conn); > @@ -1663,6 +1648,74 @@ > > } > > +static CMPIStatus set_autostart(CMPIInstance *vssd, > + const CMPIObjectPath *ref, > + virDomainPtr dom) > +{ > + CMPIStatus s; > + const char *name = NULL; > + CMPIrc ret; > + virConnectPtr conn = NULL; > + virDomainPtr inst_dom = NULL; > + uint16_t val = 0; > + int i = 0; > + > + CU_DEBUG("Enter set_autostart"); > + ret = cu_get_str_prop(vssd, "VirtualSystemIdentifier",&name); > + if (ret != CMPI_RC_OK) { > + CU_DEBUG("Missing VirtualSystemIdentifier"); > + cu_statusf(_BROKER,&s, > + ret, > + "Missing VirtualSystemIdentifier"); > + goto out; > + } > + > + conn = connect_by_classname(_BROKER, CLASSNAME(ref),&s); > + if (conn == NULL) { > + CU_DEBUG("Failed to connect"); > + cu_statusf(_BROKER,&s, > + CMPI_RC_ERR_FAILED, > + "Failed to connect"); > + goto out; > + } > + > + inst_dom = virDomainLookupByName(conn, name); > + if (inst_dom == NULL) { > + CU_DEBUG("reference domain '%s' does not exist", name); > + virt_set_status(_BROKER,&s, > + CMPI_RC_ERR_NOT_FOUND, > + conn, > + "Referenced domain `%s' does not exist", name); > + goto out; > + } > + > + if (cu_get_u16_prop(vssd, "AutoStart",&val) != CMPI_RC_OK) { > + if (dom != NULL) { > + /* Read the current domain's autostart setting. > + Since the user did not specify any new > + autostart, the updated VM will use the same > + autostart setting as used before this > + update. */ > + if (virDomainGetAutostart(dom,&i) != 0) > + i = 0; > + } > + } > + else > + i = val; > + CU_DEBUG("setting VM's autostart to %d", i); > + if (virDomainSetAutostart(inst_dom, i) == -1) { > + CU_DEBUG("Failed to set autostart"); > + cu_statusf(_BROKER,&s, > + CMPI_RC_ERR_FAILED, > + "Failed to set autostart"); > + } > + > + out: > + virDomainFree(inst_dom); > + virConnectClose(conn); > + return s; > +} > + > static CMPIInstance *create_system(const CMPIContext *context, > CMPIInstance *vssd, > CMPIArray *resources, > @@ -1673,15 +1726,13 @@ > CMPIInstance *inst = NULL; > char *xml = NULL; > const char *msg = NULL; > - virConnectPtr conn = NULL; > - virDomainPtr dom = NULL; > struct inst_list list; > const char *props[] = {NULL}; > - > struct domain *domain = NULL; > > inst_list_init(&list); > > + CU_DEBUG("Enter create_system"); > if (refconf != NULL) { > *s = get_reference_domain(&domain, ref, refconf); > if (s->rc != CMPI_RC_OK) > @@ -1731,6 +1782,7 @@ > inst = connect_and_create(xml, ref, s); > if (inst != NULL) { > update_dominfo(domain, CLASSNAME(ref)); > + set_autostart(vssd, ref, NULL); > > *s = enum_rasds(_BROKER, > ref, > @@ -1755,8 +1807,6 @@ > out: > cleanup_dominfo(&domain); > free(xml); > - virDomainFree(dom); > - virConnectClose(conn); > inst_list_free(&list); > > return inst; > @@ -1943,6 +1993,7 @@ > char *xml = NULL; > const char *uuid = NULL; > > + CU_DEBUG("Enter update_system_settings"); > ret = cu_get_str_prop(vssd, "VirtualSystemIdentifier",&name); > if (ret != CMPI_RC_OK) { > cu_statusf(_BROKER,&s, > @@ -2002,6 +2053,7 @@ > } > > if (s.rc == CMPI_RC_OK) { > + set_autostart(vssd, ref, dom); > trigger_indication(context, > "ComputerSystemModifiedIndication", > ref); > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From snmishra at us.ibm.com Fri Feb 25 14:31:46 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Fri, 25 Feb 2011 06:31:46 -0800 Subject: [Libvirt-cim] [PATCH] Set CreationClassName property in VSMS Message-ID: <147d3bcdefe0b21076c6.1298644306@elm3a148.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1298644240 28800 # Node ID 147d3bcdefe0b21076c6aaa3eb66fbe7343db2fa # Parent 219b9e147e611772e9f540800943653ce73acdfd Set CreationClassName property in VSMS CCName was not getting set correctly. I do not understand why there was a check to see if CCName is set, and set it only if it is set. This patch removed the check, and sets the ccname if CMPIInstance is not null and ccname property is non-null. Signed-off-by: Sharad Mishra diff -r 219b9e147e61 -r 147d3bcdefe0 libxkutil/misc_util.c --- a/libxkutil/misc_util.c Wed Feb 23 06:48:43 2011 -0800 +++ b/libxkutil/misc_util.c Fri Feb 25 06:30:40 2011 -0800 @@ -260,10 +260,8 @@ if ((s.rc != CMPI_RC_OK) || CMIsNullObject(inst)) goto out; - data = CMGetProperty(inst, "CreationClassName", &s); - if (s.rc == CMPI_RC_OK) - CMSetProperty(inst, "CreationClassName", - (CMPIValue *)new_cn, CMPI_chars); + CMSetProperty(inst, "CreationClassName", + (CMPIValue *)new_cn, CMPI_chars); out: free(new_cn); From snmishra at us.ibm.com Mon Feb 28 13:59:46 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Mon, 28 Feb 2011 05:59:46 -0800 Subject: [Libvirt-cim] [PATCH] (#2) Set CreationClassName property in VSMS Message-ID: <7a2ce3106321ac1729ae.1298901586@elm3a148.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1298901442 28800 # Node ID 7a2ce3106321ac1729aeff2b9e42fb2e75da9295 # Parent 219b9e147e611772e9f540800943653ce73acdfd (#2) Set CreationClassName property in VSMS CCName was not getting set correctly. I do not understand why there was a check to see if CCName is set, and set it only if it is set. This patch removed the check, and sets the ccname if CMPIInstance is not null and ccname property is non-null. update #2: Removed unused 'data' variable. Signed-off-by: Sharad Mishra diff -r 219b9e147e61 -r 7a2ce3106321 libxkutil/misc_util.c --- a/libxkutil/misc_util.c Wed Feb 23 06:48:43 2011 -0800 +++ b/libxkutil/misc_util.c Mon Feb 28 05:57:22 2011 -0800 @@ -246,7 +246,6 @@ CMPIObjectPath *op; CMPIInstance *inst = NULL; CMPIStatus s; - CMPIData data; new_cn = get_typed_class(refcn, base); if (new_cn == NULL) @@ -260,10 +259,8 @@ if ((s.rc != CMPI_RC_OK) || CMIsNullObject(inst)) goto out; - data = CMGetProperty(inst, "CreationClassName", &s); - if (s.rc == CMPI_RC_OK) - CMSetProperty(inst, "CreationClassName", - (CMPIValue *)new_cn, CMPI_chars); + CMSetProperty(inst, "CreationClassName", + (CMPIValue *)new_cn, CMPI_chars); out: free(new_cn); From cvincent at linux.vnet.ibm.com Mon Feb 28 17:26:01 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Mon, 28 Feb 2011 12:26:01 -0500 Subject: [Libvirt-cim] [PATCH] (#2) Set CreationClassName property in VSMS In-Reply-To: <7a2ce3106321ac1729ae.1298901586@elm3a148.beaverton.ibm.com> References: <7a2ce3106321ac1729ae.1298901586@elm3a148.beaverton.ibm.com> Message-ID: <4D6BDAA9.7080404@linux.vnet.ibm.com> +1 On 02/28/2011 08:59 AM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1298901442 28800 > # Node ID 7a2ce3106321ac1729aeff2b9e42fb2e75da9295 > # Parent 219b9e147e611772e9f540800943653ce73acdfd > (#2) Set CreationClassName property in VSMS > > CCName was not getting set correctly. I do not understand why there was a check to see if CCName is set, and set it only if it is set. > This patch removed the check, and sets the ccname if CMPIInstance is not null and ccname property is non-null. > > update #2: Removed unused 'data' variable. > > Signed-off-by: Sharad Mishra > > diff -r 219b9e147e61 -r 7a2ce3106321 libxkutil/misc_util.c > --- a/libxkutil/misc_util.c Wed Feb 23 06:48:43 2011 -0800 > +++ b/libxkutil/misc_util.c Mon Feb 28 05:57:22 2011 -0800 > @@ -246,7 +246,6 @@ > CMPIObjectPath *op; > CMPIInstance *inst = NULL; > CMPIStatus s; > - CMPIData data; > > new_cn = get_typed_class(refcn, base); > if (new_cn == NULL) > @@ -260,10 +259,8 @@ > if ((s.rc != CMPI_RC_OK) || CMIsNullObject(inst)) > goto out; > > - data = CMGetProperty(inst, "CreationClassName",&s); > - if (s.rc == CMPI_RC_OK) > - CMSetProperty(inst, "CreationClassName", > - (CMPIValue *)new_cn, CMPI_chars); > + CMSetProperty(inst, "CreationClassName", > + (CMPIValue *)new_cn, CMPI_chars); > > out: > free(new_cn); > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com