From snmishra at us.ibm.com Mon Mar 1 19:38:52 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Mon, 01 Mar 2010 11:38:52 -0800 Subject: [Libvirt-cim] [PATCH] [TEST] Test macvtap patch Message-ID: # HG changeset patch # User Sharad Mishra # Date 1267471822 28800 # Node ID ee89554f681d3aad027dbaa166cbe26267472448 # Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493 [TEST] Test macvtap patch. Verify that a vepa mode VM can be created. Signed-off-by: Sharad Mishra diff -r 3655b03ada11 -r ee89554f681d suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/27_definesystem_macvtap_dev.py Mon Mar 01 11:30:22 2010 -0800 @@ -0,0 +1,152 @@ +#!/usr/bin/python +# +# Copyright 2010 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 +# +# Purpose: +# Verify provider's support for macvtap. +# +# Steps: +# 1) Build RASD parameters, making sure to specify macvtap mode for network +# interface +# 2) Create guest +# 3) Verify guest is defined properly +# + +import sys +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_default_rasds +from XenKvmLib.const import do_main, get_provider_version +from XenKvmLib.vxml import get_class +from XenKvmLib.common_util import parse_instance_id +from XenKvmLib.enumclass import EnumInstances + +sup_types = ['Xen', 'XenFV', 'KVM'] +test_dom = 'rstest_nic' + +target_dev_rev = 1029 + +def get_rasd_list(ip, virt, target_dev, source_dev): + nrasd_cn = get_typed_class(virt, "NetResourceAllocationSettingData") + + rasds = get_default_rasds(ip, virt) + + rasd_list = {} + + for rasd in rasds: + if rasd.classname == nrasd_cn and "Default" in rasd['InstanceID']: + + rasd['NetworkMode'] = target_dev + rasd['NetworkType'] = "direct" + rasd['SourceDevice'] = source_dev + + rasd_list[rasd.classname] = inst_to_mof(rasd) + + return rasd_list + +def verify_net_rasd(ip, virt, target_dev, source_dev, guest_name): + inst = None + + try: + nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData') + enum_list = EnumInstances(ip, nrasd_cn) + + if enum_list < 1: + raise Exception("No %s instances returned" % nrasd_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: + raise Exception("%s instance for %s not found" % (nrasd_cn, + guest_name)) + + if inst.NetworkMode != target_dev: + raise Exception("Expected NetworkMode to be %s" % target_dev) + + if inst.SourceDevice != source_dev: + raise Exception("Expected SourceDevice to be %s" % source_dev) + + except Exception, details: + logger.error(details) + return FAIL + + return PASS + + at 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 < target_dev_rev: + logger.error("Network interface target device support is available" \ + " in rev >= %s", target_dev_rev) + return SKIP + + cxml = get_class(options.virt)(test_dom) + + target_dev = "vepa" + source_dev = "eth1" + + guest_defined = False + + try: + rasd_list = get_rasd_list(options.ip, options.virt, target_dev, source_dev) + 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 + + status = cxml.cim_start(options.ip) + if status != PASS: + raise Exception("Unable to start %s" % test_dom) + + status = verify_net_rasd(options.ip, options.virt, target_dev, + source_dev, test_dom) + if status != PASS: + raise Exception("Failed to net interface for %s" % test_dom) + + except Exception, details: + logger.error(details) + status = FAIL + + if guest_defined == True: + cxml.undefine(options.ip) + + return status + +if __name__ == "__main__": + sys.exit(main()) + From rmaciel at linux.vnet.ibm.com Tue Mar 2 17:52:11 2010 From: rmaciel at linux.vnet.ibm.com (Richard Maciel) Date: Tue, 02 Mar 2010 12:52:11 -0500 Subject: [Libvirt-cim] [PATCH 0 of 3] Add Vepa support In-Reply-To: References: Message-ID: <4B8D504B.9080504@linux.vnet.ibm.com> Sharad, the code looks good, but I can't test it because my libvirt version (0.7.6) doesn't support the "direct" network type. Which libvirt version are you using? Em 23-02-2010 15:21, Sharad Mishra escreveu: > Signed-off-by: Sharad Mishra > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From rmaciel at linux.vnet.ibm.com Tue Mar 2 17:59:22 2010 From: rmaciel at linux.vnet.ibm.com (Richard Maciel) Date: Tue, 02 Mar 2010 12:59:22 -0500 Subject: [Libvirt-cim] [PATCH 0 of 3] Add Vepa support In-Reply-To: References: Message-ID: <4B8D51FA.9060008@linux.vnet.ibm.com> Just to complement my last message: I saw that the libvirt domain XML was correctly generated by the provider, when I defined a new domain thru libvirt-cim. I also checked the RASD template and it is correct. So, to finish the tests, I just need to check if libvirt-cim can fetch the domain xml successfully and transform to a NetRASD instance. To do that, I need a libvirt that supports the "direct" type of interface device. Em 23-02-2010 15:21, Sharad Mishra escreveu: > Signed-off-by: Sharad Mishra > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From rmaciel at linux.vnet.ibm.com Tue Mar 2 18:28:54 2010 From: rmaciel at linux.vnet.ibm.com (Richard Maciel) Date: Tue, 02 Mar 2010 13:28:54 -0500 Subject: [Libvirt-cim] [PATCH 3 of 3] Update xml generation to support vepa In-Reply-To: <94e67df60eb8ca8ce580.1266956484@elm3b24.beaverton.ibm.com> References: <94e67df60eb8ca8ce580.1266956484@elm3b24.beaverton.ibm.com> Message-ID: <4B8D58E6.8020502@linux.vnet.ibm.com> +1 Em 23-02-2010 15:21, Sharad Mishra escreveu: > # HG changeset patch > # User Sharad Mishra > # Date 1266955067 28800 > # Node ID 94e67df60eb8ca8ce580c4a43b0958f6243d0f31 > # Parent 19918810d820fc1ea1296f4cf8c48ac442f571cb > Update xml generation to support vepa. > > Signed-of-by: Sharad Mishra > > diff -r 19918810d820 -r 94e67df60eb8 libxkutil/xmlgen.c > --- a/libxkutil/xmlgen.c Tue Feb 23 11:57:42 2010 -0800 > +++ b/libxkutil/xmlgen.c Tue Feb 23 11:57:47 2010 -0800 > @@ -169,7 +169,14 @@ > tmp = xmlNewChild(nic, NULL, BAD_CAST "source", NULL); > if (tmp == NULL) > return XML_ERROR; > - xmlNewProp(tmp, BAD_CAST src_type, BAD_CAST dev->source); > + if (STREQ(src_type, "direct")) { > + xmlNewProp(tmp, BAD_CAST "dev", BAD_CAST dev->source); > + if (dev->net_mode != NULL) > + xmlNewProp(tmp, BAD_CAST "mode", > + BAD_CAST dev->net_mode); > + } else > + xmlNewProp(tmp, BAD_CAST src_type, > + BAD_CAST dev->source); > } else > return XML_ERROR; > > @@ -212,10 +219,12 @@ > return XML_ERROR; > xmlNewProp(nic, BAD_CAST "type", BAD_CAST net->type); > > - tmp = xmlNewChild(nic, NULL, BAD_CAST "mac", NULL); > - if (tmp == NULL) > - return XML_ERROR; > - xmlNewProp(tmp, BAD_CAST "address", BAD_CAST net->mac); > + if (net->mac != NULL) { > + tmp = xmlNewChild(nic, NULL, BAD_CAST "mac", NULL); > + if (tmp == NULL) > + return XML_ERROR; > + xmlNewProp(tmp, BAD_CAST "address", BAD_CAST net->mac); > + } > > if (net->device != NULL) { > tmp = xmlNewChild(nic, NULL, BAD_CAST "target", NULL); > @@ -238,6 +247,8 @@ > msg = bridge_net_to_xml(nic, net); > else if (STREQ(dev->dev.net.type, "user")) > continue; > + else if (STREQ(dev->dev.net.type, "direct")) > + msg = set_net_source(nic, net, "direct"); > else > msg = "Unknown interface type"; > } > diff -r 19918810d820 -r 94e67df60eb8 src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Tue Feb 23 11:57:42 2010 -0800 > +++ b/src/Virt_VirtualSystemManagementService.c Tue Feb 23 11:57:47 2010 -0800 > @@ -63,6 +63,7 @@ > #define BRIDGE_TYPE "bridge" > #define NETWORK_TYPE "network" > #define USER_TYPE "user" > +#define DIRECT_TYPE "direct" > #define RASD_IND_CREATED "ResourceAllocationSettingDataCreatedIndication" > #define RASD_IND_DELETED "ResourceAllocationSettingDataDeletedIndication" > #define RASD_IND_MODIFIED "ResourceAllocationSettingDataModifiedIndication" > @@ -750,6 +751,15 @@ > dev->dev.net.source = strdup(network); > } else if (STREQC(val, USER_TYPE)) { > dev->dev.net.type = strdup(USER_TYPE); > + } else if (STREQC(val, DIRECT_TYPE)) { > + dev->dev.net.type = strdup(DIRECT_TYPE); > + if (cu_get_str_prop(inst, "SourceDevice",&val) == CMPI_RC_OK) > + if (strlen(val)> 0) > + dev->dev.net.source = strdup(val); > + else > + return "Source Device is empty"; > + else > + return "No Source Device specified"; > } else > return "Invalid Network Type specified"; > > @@ -759,6 +769,12 @@ > else > dev->dev.net.device = strdup(val); > > + free(dev->dev.net.net_mode); > + if (cu_get_str_prop(inst, "NetworkMode",&val) != CMPI_RC_OK) > + dev->dev.net.net_mode = NULL; > + else > + dev->dev.net.net_mode = strdup(val); > + > free(dev->dev.net.model); > > if (cu_get_str_prop(inst, "ResourceSubType",&val) != CMPI_RC_OK) > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From rmaciel at linux.vnet.ibm.com Tue Mar 2 18:29:08 2010 From: rmaciel at linux.vnet.ibm.com (Richard Maciel) Date: Tue, 02 Mar 2010 13:29:08 -0500 Subject: [Libvirt-cim] [PATCH 0 of 3] Add Vepa support In-Reply-To: References: Message-ID: <4B8D58F4.1030004@linux.vnet.ibm.com> +1 Em 23-02-2010 15:21, Sharad Mishra escreveu: > Signed-off-by: Sharad Mishra > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From rmaciel at linux.vnet.ibm.com Tue Mar 2 19:07:26 2010 From: rmaciel at linux.vnet.ibm.com (Richard Maciel) Date: Tue, 02 Mar 2010 14:07:26 -0500 Subject: [Libvirt-cim] [PATCH 2 of 3] Update mof and RASD to support Vepa In-Reply-To: <19918810d820fc1ea129.1266956483@elm3b24.beaverton.ibm.com> References: <19918810d820fc1ea129.1266956483@elm3b24.beaverton.ibm.com> Message-ID: <4B8D61EE.1070104@linux.vnet.ibm.com> +1 Em 23-02-2010 15:21, Sharad Mishra escreveu: > # HG changeset patch > # User Sharad Mishra > # Date 1266955062 28800 > # Node ID 19918810d820fc1ea1296f4cf8c48ac442f571cb > # Parent 0a41b5e876d601216cb3257409eee231b4aec8b0 > Update mof and RASD to support Vepa > > Signed-off-by: Sharad Mishra > > diff -r 0a41b5e876d6 -r 19918810d820 schema/ResourceAllocationSettingData.mof > --- a/schema/ResourceAllocationSettingData.mof Tue Feb 23 10:50:39 2010 -0800 > +++ b/schema/ResourceAllocationSettingData.mof Tue Feb 23 11:57:42 2010 -0800 > @@ -62,6 +62,12 @@ > > [Description ("Target device as seen by the guest")] > string VirtualDevice; > + > + [Description ("Source Device for bridge mode")] > + string SourceDevice; > + > + [Description ("Network mode, could be 'vepa', 'pepa' etc.")] > + string NetworkMode; > }; > > [Description ("KVM virtual network configuration"), > @@ -78,6 +84,12 @@ > > [Description ("Target device as seen by the guest")] > string VirtualDevice; > + > + [Description ("Source Device for bridge mode")] > + string SourceDevice; > + > + [Description ("Network mode, could be 'vepa', 'pepa' etc.")] > + string NetworkMode; > }; > > [Description ("LXC virtual network configuration"), > diff -r 0a41b5e876d6 -r 19918810d820 src/Virt_RASD.c > --- a/src/Virt_RASD.c Tue Feb 23 10:50:39 2010 -0800 > +++ b/src/Virt_RASD.c Tue Feb 23 11:57:42 2010 -0800 > @@ -302,12 +302,25 @@ > (CMPIValue *)dev->dev.net.source, > CMPI_chars); > > + if ((dev->dev.net.source != NULL)&& > + (STREQ(dev->dev.net.type, "direct"))) > + CMSetProperty(inst, > + "SourceDevice", > + (CMPIValue *)dev->dev.net.source, > + CMPI_chars); > + > if (dev->dev.net.device != NULL) > CMSetProperty(inst, > "VirtualDevice", > (CMPIValue *)dev->dev.net.device, > CMPI_chars); > > + if (dev->dev.net.net_mode != NULL) > + CMSetProperty(inst, > + "NetworkMode", > + (CMPIValue *)dev->dev.net.net_mode, > + CMPI_chars); > + > if (dev->dev.net.model != NULL) > CMSetProperty(inst, > "ResourceSubType", > diff -r 0a41b5e876d6 -r 19918810d820 src/Virt_SettingsDefineCapabilities.c > --- a/src/Virt_SettingsDefineCapabilities.c Tue Feb 23 10:50:39 2010 -0800 > +++ b/src/Virt_SettingsDefineCapabilities.c Tue Feb 23 11:57:42 2010 -0800 > @@ -547,6 +547,8 @@ > const char *net_name, > uint64_t num_nics, > const char *device, > + const char *src_dev, > + const char *net_mode, > const char *model, > struct inst_list *list) > { > @@ -565,10 +567,18 @@ > CMSetProperty(inst, "VirtualQuantity", > (CMPIValue *)&num_nics, CMPI_uint64); > > - if (model != NULL) > + if (device != NULL) > CMSetProperty(inst, "VirtualDevice", > (CMPIValue *)device, CMPI_chars); > > + if (net_mode != NULL) > + CMSetProperty(inst, "NetworkMode", > + (CMPIValue *)net_mode, CMPI_chars); > + > + if (src_dev != NULL) > + CMSetProperty(inst, "SourceDevice", > + (CMPIValue *)src_dev, CMPI_chars); > + > if (model != NULL) > CMSetProperty(inst, "ResourceSubType", > (CMPIValue *)model, CMPI_chars); > @@ -590,6 +600,8 @@ > int i,j; > const char *type[] = {"network", "bridge", "user"}; > const char *device[] = {"vtap1", NULL}; > + const char *src_dev[] = {NULL, NULL}; > + const char *net_mode[] = {NULL, NULL}; > const char *model[] = {"e1000", NULL}; > const char *name[] = {NULL, "br0", NULL}; > > @@ -629,13 +641,18 @@ > name[i], > num_nics, > device[j], > + src_dev[j], > + net_mode[j], > model[j], > list); > if (s.rc != CMPI_RC_OK) > goto out; > } > } > - > + > + s = set_net_props(template_type, ref, id, "direct", NULL, num_nics, > + NULL, "eth1", "vepa", NULL, list); > + > out: > return s; > } > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From rmaciel at linux.vnet.ibm.com Tue Mar 2 19:07:35 2010 From: rmaciel at linux.vnet.ibm.com (Richard Maciel) Date: Tue, 02 Mar 2010 14:07:35 -0500 Subject: [Libvirt-cim] [PATCH 1 of 3] Update xml parsing to support vepa In-Reply-To: <0a41b5e876d601216cb3.1266956482@elm3b24.beaverton.ibm.com> References: <0a41b5e876d601216cb3.1266956482@elm3b24.beaverton.ibm.com> Message-ID: <4B8D61F7.9000301@linux.vnet.ibm.com> +1 Em 23-02-2010 15:21, Sharad Mishra escreveu: > # HG changeset patch > # User Sharad Mishra > # Date 1266951039 28800 > # Node ID 0a41b5e876d601216cb3257409eee231b4aec8b0 > # Parent 5b37fac8372729a7da9817a8fc0661159fc710b8 > Update xml parsing to support vepa. > > Signed-off-by: Sharad Mishra > > diff -r 5b37fac83727 -r 0a41b5e876d6 libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Thu Jan 28 15:45:31 2010 -0800 > +++ b/libxkutil/device_parsing.c Tue Feb 23 10:50:39 2010 -0800 > @@ -65,6 +65,7 @@ > free(dev->source); > free(dev->model); > free(dev->device); > + free(dev->net_mode); > } > > static void cleanup_emu_device(struct emu_device *dev) > @@ -311,6 +312,10 @@ > ndev->source = get_attr_value(child, "network"); > if (ndev->source != NULL) > continue; > + ndev->source = get_attr_value(child, "dev"); > + ndev->net_mode = get_attr_value(child, "mode"); > + if ((ndev->source != NULL)&& (ndev->net_mode != NULL)) > + continue; > goto err; > } else if (XSTREQ(child->name, "target")) { > ndev->device = get_attr_value(child, "dev"); > @@ -666,6 +671,7 @@ > DUP_FIELD(dev, _dev, dev.net.source); > DUP_FIELD(dev, _dev, dev.net.model); > DUP_FIELD(dev, _dev, dev.net.device); > + DUP_FIELD(dev, _dev, dev.net.net_mode); > } else if (dev->type == CIM_RES_TYPE_DISK) { > DUP_FIELD(dev, _dev, dev.disk.type); > DUP_FIELD(dev, _dev, dev.disk.device); > diff -r 5b37fac83727 -r 0a41b5e876d6 libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Thu Jan 28 15:45:31 2010 -0800 > +++ b/libxkutil/device_parsing.h Tue Feb 23 10:50:39 2010 -0800 > @@ -51,6 +51,7 @@ > char *source; > char *model; > char *device; > + char *net_mode; > }; > > struct mem_device { > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From veillard at redhat.com Wed Mar 3 09:05:55 2010 From: veillard at redhat.com (Daniel Veillard) Date: Wed, 3 Mar 2010 10:05:55 +0100 Subject: [Libvirt-cim] [PATCH 0 of 3] Add Vepa support In-Reply-To: <4B8D504B.9080504@linux.vnet.ibm.com> References: <4B8D504B.9080504@linux.vnet.ibm.com> Message-ID: <20100303090555.GH5281@redhat.com> On Tue, Mar 02, 2010 at 12:52:11PM -0500, Richard Maciel wrote: > Sharad, the code looks good, but I can't test it because my libvirt > version (0.7.6) doesn't support the "direct" network type. Which > libvirt version are you using? That should be in 0.7.7, out hopefully by this week end, You can grab a snapshot for example: ftp://libvirt.org/libvirt/libvirt-git-snapshot.tar.gz Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ From snmishra at us.ibm.com Tue Mar 9 01:10:01 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Mon, 08 Mar 2010 17:10:01 -0800 Subject: [Libvirt-cim] [PATCH] Use libvirt to get StorageVolume Path to set SV InstanceID Message-ID: # HG changeset patch # User Sharad Mishra # Date 1268096483 28800 # Node ID fa15816439a7ef1e9ff212cf1833cafa7b1fd704 # Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13 Use libvirt to get StorageVolume Path to set SV InstanceID. InstanceID of a StorageVolume was set using the 'Path' field of StorageVolume RASD. If 'Path' was not set by the user, the InstanceID would be invalid. This patch fixed the issue by using libvirt to get the storage volume path. The path returned by libvirt is used to set the InstanceID. Signed-off-by: Sharad Mishra diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.c --- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800 +++ b/libxkutil/pool_parsing.c Mon Mar 08 17:01:23 2010 -0800 @@ -353,12 +353,12 @@ } #if VIR_USE_LIBVIRT_STORAGE -int create_resource(virConnectPtr conn, +char *create_resource(virConnectPtr conn, const char *pname, const char *xml, int res_type) { - int ret = 0; + char *path = NULL; virStoragePoolPtr ptr = NULL; virStorageVolPtr vptr = NULL; @@ -376,14 +376,19 @@ goto out; } - ret = 1; + path = virStorageVolGetPath(vptr); + if (path == NULL) { + CU_DEBUG("Unable to get storage volume path"); + goto out; + } + } out: virStoragePoolFree(ptr); virStorageVolFree(vptr); - return ret; + return path; } int delete_resource(virConnectPtr conn, @@ -414,13 +419,13 @@ return ret; } #else -int create_resource(virConnectPtr conn, +char *create_resource(virConnectPtr conn, const char *pname, const char *xml, int res_type) { CU_DEBUG("Creating resources within libvirt pools not supported"); - return 0; + return NULL; } int delete_resource(virConnectPtr conn, diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.h --- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800 +++ b/libxkutil/pool_parsing.h Mon Mar 08 17:01:23 2010 -0800 @@ -90,7 +90,7 @@ int define_pool(virConnectPtr conn, const char *xml, int res_type); int destroy_pool(virConnectPtr conn, const char *name, int res_type); -int create_resource(virConnectPtr conn, const char *pname, +char *create_resource(virConnectPtr conn, const char *pname, const char *xml, int res_type); int delete_resource(virConnectPtr conn, const char *rname, int res_type); diff -r 4ee7c4354bc5 -r fa15816439a7 src/Virt_ResourcePoolConfigurationService.c --- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 2010 -0800 +++ b/src/Virt_ResourcePoolConfigurationService.c Mon Mar 08 17:01:23 2010 -0800 @@ -832,6 +832,7 @@ { virConnectPtr conn; CMPIInstance *inst = NULL; + char *path = NULL; conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); if (conn == NULL) { @@ -839,7 +840,8 @@ return NULL; } - if (create_resource(conn, res->pool_id, xml, res->type) == 0) { + path = create_resource(conn, res->pool_id, xml, res->type); + if (path == NULL) { virt_set_status(_BROKER, s, CMPI_RC_ERR_FAILED, conn, @@ -855,6 +857,8 @@ "Failed to lookup resulting resource"); } + CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars); + out: virConnectClose(conn); From snmishra at us.ibm.com Tue Mar 9 19:10:58 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Tue, 09 Mar 2010 11:10:58 -0800 Subject: [Libvirt-cim] [PATCH] [TEST] Add check to verify StorageVolume InstanceID Message-ID: <12a2efa271d73ef7ed8d.1268161858@elm3b41.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1268161766 28800 # Node ID 12a2efa271d73ef7ed8d88bb27b39cce2505716a # Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493 [TEST] Add check to verify StorageVolume InstanceID. This test verifies that the InstanceID of StorageVolume is not dependent on the pool path in RASD. Rather it is set by virStorageVolGetPath. Signed-off-by: Sharad Mishra diff -r 3655b03ada11 -r 12a2efa271d7 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Tue Mar 09 11:09:26 2010 -0800 @@ -236,10 +236,15 @@ dp_inst_id, exp_vol_path) + if res[1]['Resource']['InstanceID'] != exp_vol_path: + status = FAIL + else: + status = PASS 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: + ret == PASS and stovol_status == PASS and \ + status == PASS: status = PASS else: return FAIL From tyreld at us.ibm.com Tue Mar 9 23:04:23 2010 From: tyreld at us.ibm.com (Tyrel Datwyler) Date: Tue, 9 Mar 2010 16:04:23 -0700 Subject: [Libvirt-cim] Tyrel Datwyler is out of the office. Message-ID: I will be out of the office starting 03/09/2010 and will not return until 03/12/2010. I will respond to your message when I return. -------------- next part -------------- An HTML attachment was scrubbed... URL: From deeptik at linux.vnet.ibm.com Wed Mar 10 06:30:39 2010 From: deeptik at linux.vnet.ibm.com (Deepti B Kalakeri) Date: Wed, 10 Mar 2010 12:00:39 +0530 Subject: [Libvirt-cim] [PATCH] [TEST] #2 Verify that user can specify target dev for network interfaces In-Reply-To: References: Message-ID: <4B973C8F.6080803@linux.vnet.ibm.com> +1 for me. -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik at linux.vnet.ibm.com From deeptik at linux.vnet.ibm.com Wed Mar 10 08:45:38 2010 From: deeptik at linux.vnet.ibm.com (Deepti B Kalakeri) Date: Wed, 10 Mar 2010 14:15:38 +0530 Subject: [Libvirt-cim] [PATCH] Use libvirt to get StorageVolume Path to set SV InstanceID In-Reply-To: References: Message-ID: <4B975C32.7060103@linux.vnet.ibm.com> Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1268096483 28800 > # Node ID fa15816439a7ef1e9ff212cf1833cafa7b1fd704 > # Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13 > Use libvirt to get StorageVolume Path to set SV InstanceID. > > InstanceID of a StorageVolume was set using the 'Path' field of StorageVolume RASD. If 'Path' was not set by the user, the InstanceID would be invalid. This patch fixed the issue by using libvirt to get the storage volume path. The path returned by libvirt is used to set the InstanceID. > The patch assigns the Path to the InstanceID. AFAIK, the InstanceID has always been name, for example for DiskPool it would be Poolname or for NetworkPool it would be the NetworkPool name. So, I think we should have the Volume Name as part of the InsanceID. Is there a DMTF which describes about this, which you referred before fixing this ? Between is there a plan to enumerate StorageVolumeRASD like the way we have DiskRASD and NetRASD? > Signed-off-by: Sharad Mishra > > diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.c > --- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800 > +++ b/libxkutil/pool_parsing.c Mon Mar 08 17:01:23 2010 -0800 > @@ -353,12 +353,12 @@ > } > > #if VIR_USE_LIBVIRT_STORAGE > -int create_resource(virConnectPtr conn, > +char *create_resource(virConnectPtr conn, > const char *pname, > const char *xml, > int res_type) > { > - int ret = 0; > + char *path = NULL; > virStoragePoolPtr ptr = NULL; > virStorageVolPtr vptr = NULL; > > @@ -376,14 +376,19 @@ > goto out; > } > > - ret = 1; > + path = virStorageVolGetPath(vptr); > + if (path == NULL) { > + CU_DEBUG("Unable to get storage volume path"); > + goto out; > + } > + > } > > out: > virStoragePoolFree(ptr); > virStorageVolFree(vptr); > > - return ret; > + return path; > } > > int delete_resource(virConnectPtr conn, > @@ -414,13 +419,13 @@ > return ret; > } > #else > -int create_resource(virConnectPtr conn, > +char *create_resource(virConnectPtr conn, > const char *pname, > const char *xml, > int res_type) > { > CU_DEBUG("Creating resources within libvirt pools not supported"); > - return 0; > + return NULL; > } > > int delete_resource(virConnectPtr conn, > diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.h > --- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800 > +++ b/libxkutil/pool_parsing.h Mon Mar 08 17:01:23 2010 -0800 > @@ -90,7 +90,7 @@ > int define_pool(virConnectPtr conn, const char *xml, int res_type); > int destroy_pool(virConnectPtr conn, const char *name, int res_type); > > -int create_resource(virConnectPtr conn, const char *pname, > +char *create_resource(virConnectPtr conn, const char *pname, > const char *xml, int res_type); > > int delete_resource(virConnectPtr conn, const char *rname, int res_type); > diff -r 4ee7c4354bc5 -r fa15816439a7 src/Virt_ResourcePoolConfigurationService.c > --- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 2010 -0800 > +++ b/src/Virt_ResourcePoolConfigurationService.c Mon Mar 08 17:01:23 2010 -0800 > @@ -832,6 +832,7 @@ > { > virConnectPtr conn; > CMPIInstance *inst = NULL; > + char *path = NULL; > > conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); > if (conn == NULL) { > @@ -839,7 +840,8 @@ > return NULL; > } > > - if (create_resource(conn, res->pool_id, xml, res->type) == 0) { > + path = create_resource(conn, res->pool_id, xml, res->type); > + if (path == NULL) { > virt_set_status(_BROKER, s, > CMPI_RC_ERR_FAILED, > conn, > @@ -855,6 +857,8 @@ > "Failed to lookup resulting resource"); > } > > + CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars); > + > out: > virConnectClose(conn); > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik at linux.vnet.ibm.com From deeptik at linux.vnet.ibm.com Thu Mar 11 08:33:52 2010 From: deeptik at linux.vnet.ibm.com (Deepti B Kalakeri) Date: Thu, 11 Mar 2010 14:03:52 +0530 Subject: [Libvirt-cim] [PATCH] [TEST] Add check to verify StorageVolume InstanceID In-Reply-To: <12a2efa271d73ef7ed8d.1268161858@elm3b41.beaverton.ibm.com> References: <12a2efa271d73ef7ed8d.1268161858@elm3b41.beaverton.ibm.com> Message-ID: <4B98AAF0.5020403@linux.vnet.ibm.com> Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1268161766 28800 > # Node ID 12a2efa271d73ef7ed8d88bb27b39cce2505716a > # Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493 > [TEST] Add check to verify StorageVolume InstanceID. > > This test verifies that the InstanceID of StorageVolume is not dependent on the pool path in RASD. Rather it is set by virStorageVolGetPath. > > Signed-off-by: Sharad Mishra > > diff -r 3655b03ada11 -r 12a2efa271d7 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py > --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800 > +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Tue Mar 09 11:09:26 2010 -0800 > @@ -236,10 +236,15 @@ > dp_inst_id, > exp_vol_path) > > + if res[1]['Resource']['InstanceID'] != exp_vol_path: > + status = FAIL > + else: > + status = PASS > This check should be done after the call to rpcs_conn.CreateResourceInPool() and res[0] != PASS. Also, include some debug messages when the match fails. > 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: > + ret == PASS and stovol_status == PASS and \ > + status == PASS: > status = PASS > else: > return FAIL > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik at linux.vnet.ibm.com From snmishra at us.ibm.com Thu Mar 11 18:29:38 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Thu, 11 Mar 2010 10:29:38 -0800 Subject: [Libvirt-cim] [PATCH] [TEST] Add check to verify StorageVolume InstanceID In-Reply-To: <4B98AAF0.5020403@linux.vnet.ibm.com> References: <12a2efa271d73ef7ed8d.1268161858@elm3b41.beaverton.ibm.com> <4B98AAF0.5020403@linux.vnet.ibm.com> Message-ID: > Sharad Mishra wrote: > > # HG changeset patch > > # User Sharad Mishra > > # Date 1268161766 28800 > > # Node ID 12a2efa271d73ef7ed8d88bb27b39cce2505716a > > # Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493 > > [TEST] Add check to verify StorageVolume InstanceID. > > > > This test verifies that the InstanceID of StorageVolume is not > dependent on the pool path in RASD. Rather it is set by virStorageVolGetPath. > > > > Signed-off-by: Sharad Mishra > > > > diff -r 3655b03ada11 -r 12a2efa271d7 suites/libvirt-cim/cimtest/ > ResourcePoolConfigurationService/10_create_storagevolume.py > > --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/ > 10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800 > > +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/ > 10_create_storagevolume.py Tue Mar 09 11:09:26 2010 -0800 > > @@ -236,10 +236,15 @@ > > dp_inst_id, > > exp_vol_path) > > > > + if res[1]['Resource']['InstanceID'] != exp_vol_path: > > + status = FAIL > > + else: > > + status = PASS > > > > This check should be done after the call to > rpcs_conn.CreateResourceInPool() and res[0] != PASS. Above code lines are after call to CreateResourceInPool and checking for res[0]. > Also, include some debug messages when the match fails. Agreed, I will do that in next revision of this patch. -Sharad > > > 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: > > + ret == PASS and stovol_status == PASS and \ > > + status == PASS: > > status = PASS > > else: > > return FAIL > > > > _______________________________________________ > > Libvirt-cim mailing list > > Libvirt-cim at redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > -- > Thanks and Regards, > Deepti B. Kalakeri > IBM Linux Technology Center > deeptik at linux.vnet.ibm.com > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From deeptik at linux.vnet.ibm.com Mon Mar 15 13:16:40 2010 From: deeptik at linux.vnet.ibm.com (Deepti B. Kalakeri) Date: Mon, 15 Mar 2010 09:16:40 -0400 Subject: [Libvirt-cim] [PATCH] [TEST] Updating rasd.py to include floppy changes and direct net type changes Message-ID: <888ca94fdbc69076a8ab.1268659000@elm3a148.beaverton.ibm.com> # HG changeset patch # User Deepti B. Kalakeri # Date 1268658975 14400 # Node ID 888ca94fdbc69076a8ab2f7dd805d314b3dbb27d # Parent a576cb1c855a8f507d7ec38c49467bfb018b46b7 [TEST] Updating rasd.py to include floppy changes and direct net type changes. This test fixes the SettingsDefineCapabilities/01_forward.py and HostSystem -t 03_hs_to_settdefcap.py. The test has been verified with KVM and Xen on current Libvirt-CIM Sources. Signed-off-by: Deepti B. Kalakeri diff -r a576cb1c855a -r 888ca94fdbc6 suites/libvirt-cim/lib/XenKvmLib/rasd.py --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py Tue Feb 02 12:30:20 2010 -0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py Mon Mar 15 09:16:15 2010 -0400 @@ -324,6 +324,8 @@ libvirt_rasd_template_changes = 707 libvirt_rasd_new_changes = 805 libvirt_rasd_dpool_changes = 839 + libvirt_rasd_floppy_changes = 1023 + libvirt_rasd_stvol_unit_changes = 1025 libvirt_ver = virsh_version(ip, virt) @@ -334,6 +336,13 @@ # StoragePoolRASD record 1 for each of Min, Max, Default, and Incr exp_storagevol_rasd = 4 exp_len = exp_base_num + + # StoragePoolRASD record with AllocationUnits=G 1 for each \ + # of Min, Max, Default, Incr + exp_storagevol_unit_changes = 4 + + # Floppy record 1 for each of Min, Max, Default, and Incr + exp_floppy = 4 if id == "DiskPool/0": pool_types = 7 @@ -350,7 +359,11 @@ elif rev >= libvirt_rasd_dpool_changes and libvirt_ver >= '0.4.1': volumes = enum_volumes(virt, ip) - exp_len = ((volumes * exp_base_num) + exp_cdrom) * xen_multi + if rev >= libvirt_rasd_floppy_changes: + exp_len = ((volumes * exp_base_num) + \ + exp_cdrom + exp_floppy) * xen_multi + else: + exp_len = ((volumes * exp_base_num) + exp_cdrom) * xen_multi else: exp_len = (exp_base_num + exp_cdrom) * xen_multi @@ -363,16 +376,28 @@ elif rev >= libvirt_rasd_dpool_changes: id = parse_instance_id(id) volumes = enum_volumes(virt, ip, id[1]) - exp_len = (volumes * exp_base_num) + exp_cdrom - if rev >= libvirt_rasd_storagepool_changes and libvirt_ver >= '0.4.1' \ - and virt != 'LXC': - exp_len += exp_storagevol_rasd + if rev >= libvirt_rasd_floppy_changes: + exp_len = (volumes * exp_base_num) + exp_cdrom + exp_floppy + else: + exp_len = (volumes * exp_base_num) + exp_cdrom + + + if virt != 'LXC' and libvirt_ver >= '0.4.1': + if rev >= libvirt_rasd_storagepool_changes: + exp_len += exp_storagevol_rasd + + if rev >= libvirt_rasd_stvol_unit_changes: + exp_len += exp_storagevol_unit_changes return exp_len def get_exp_net_rasd_len(virt, rev, id): net_rasd_template_changes = 861 + net_rasd_direct_nettype_changes = 1029 + + # NetRASD record for Direct NetType 1 for each min, max, incr, default + exp_direct = 4 exp_base_num = 4 @@ -385,8 +410,12 @@ if rev >= net_rasd_template_changes: dev_types = 2 net_types = 3 + exp_base_num = exp_base_num * dev_types * net_types - return exp_base_num * dev_types * net_types + if rev >= net_rasd_direct_nettype_changes: + exp_base_num += exp_direct + + return exp_base_num return exp_base_num From deeptik at linux.vnet.ibm.com Wed Mar 17 07:29:14 2010 From: deeptik at linux.vnet.ibm.com (Deepti B Kalakeri) Date: Wed, 17 Mar 2010 12:59:14 +0530 Subject: [Libvirt-cim] [PATCH] [TEST] Add check to verify StorageVolume InstanceID In-Reply-To: References: <12a2efa271d73ef7ed8d.1268161858@elm3b41.beaverton.ibm.com> <4B98AAF0.5020403@linux.vnet.ibm.com> Message-ID: <4BA084CA.4020206@linux.vnet.ibm.com> Sharad Mishra wrote: > > > Sharad Mishra wrote: > > > # HG changeset patch > > > # User Sharad Mishra > > > # Date 1268161766 28800 > > > # Node ID 12a2efa271d73ef7ed8d88bb27b39cce2505716a > > > # Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493 > > > [TEST] Add check to verify StorageVolume InstanceID. > > > > > > This test verifies that the InstanceID of StorageVolume is not > > dependent on the pool path in RASD. Rather it is set by > virStorageVolGetPath. > > > > > > Signed-off-by: Sharad Mishra > > > > > > diff -r 3655b03ada11 -r 12a2efa271d7 suites/libvirt-cim/cimtest/ > > ResourcePoolConfigurationService/10_create_storagevolume.py > > > --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/ > > 10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800 > > > +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/ > > 10_create_storagevolume.py Tue Mar 09 11:09:26 2010 -0800 > > > @@ -236,10 +236,15 @@ > > > dp_inst_id, > > > exp_vol_path) > > > > > > + if res[1]['Resource']['InstanceID'] != exp_vol_path: > > > + status = FAIL > > > + else: > > > + status = PASS > > > > > > > This check should be done after the call to > > rpcs_conn.CreateResourceInPool() and res[0] != PASS. > > Above code lines are after call to CreateResourceInPool and checking > for res[0]. > Sorry for late reply!! I meant to use it immediately after the call to the CreateResourceInPool(). Currently, you are using it after the call to verify_vol() and verify_template_rasd_exists which makes it little difficult to follow where the res would come from. > > > > Also, include some debug messages when the match fails. > > Agreed, I will do that in next revision of this patch. > > -Sharad > > > > > > 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: > > > + ret == PASS and stovol_status == PASS and \ > > > + status == PASS: > > > status = PASS > > > else: > > > return FAIL > > > > > > _______________________________________________ > > > Libvirt-cim mailing list > > > Libvirt-cim at redhat.com > > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > > > > -- > > Thanks and Regards, > > Deepti B. Kalakeri > > IBM Linux Technology Center > > deeptik at linux.vnet.ibm.com > > > > _______________________________________________ > > Libvirt-cim mailing list > > Libvirt-cim at redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > ------------------------------------------------------------------------ > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik at linux.vnet.ibm.com From deeptik at linux.vnet.ibm.com Wed Mar 17 08:55:08 2010 From: deeptik at linux.vnet.ibm.com (Deepti B. Kalakeri) Date: Wed, 17 Mar 2010 04:55:08 -0400 Subject: [Libvirt-cim] [PATCH] [TEST] Fixing the syntax err in VSMS/26_definesystem_nic_dev.py Message-ID: <930746e12eb08c3e5a26.1268816108@elm3a148.beaverton.ibm.com> # HG changeset patch # User Deepti B. Kalakeri # Date 1268816098 14400 # Node ID 930746e12eb08c3e5a262f70391ad312ba31fab0 # Parent a576cb1c855a8f507d7ec38c49467bfb018b46b7 [TEST] Fixing the syntax err in VSMS/26_definesystem_nic_dev.py Tested has been verified with KVM Libvirt-CIM Sources. Signed-off-by: Deepti B. Kalakeri diff -r a576cb1c855a -r 930746e12eb0 suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py Tue Feb 02 12:30:20 2010 -0800 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py Wed Mar 17 04:54:58 2010 -0400 @@ -95,7 +95,7 @@ return PASS - do_main(sup_types) + at do_main(sup_types) def main(): options = main.options From snmishra at us.ibm.com Wed Mar 17 14:43:49 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 17 Mar 2010 07:43:49 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] Fixing the syntax err in VSMS/26_definesystem_nic_dev.py In-Reply-To: <930746e12eb08c3e5a26.1268816108@elm3a148.beaverton.ibm.com> References: <930746e12eb08c3e5a26.1268816108@elm3a148.beaverton.ibm.com> Message-ID: Thank you Deepti for making this change. I saw the issue late yesterday and put this on my todo list for today. But you beat me :-) +1 Sharad Mishra System x Enablement Linux Technology Center IBM "Deepti B. Kalakeri" libvirt-cim at redhat.com Sent by: cc libvirt-cim-bounc es at redhat.com Subject [Libvirt-cim] [PATCH] [TEST] Fixing the syntax err in 03/17/10 01:55 AM VSMS/26_definesystem_nic_dev.py Please respond to List for discussion and development of libvirt CIM # HG changeset patch # User Deepti B. Kalakeri # Date 1268816098 14400 # Node ID 930746e12eb08c3e5a262f70391ad312ba31fab0 # Parent a576cb1c855a8f507d7ec38c49467bfb018b46b7 [TEST] Fixing the syntax err in VSMS/26_definesystem_nic_dev.py Tested has been verified with KVM Libvirt-CIM Sources. Signed-off-by: Deepti B. Kalakeri diff -r a576cb1c855a -r 930746e12eb0 suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py Tue Feb 02 12:30:20 2010 -0800 +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py Wed Mar 17 04:54:58 2010 -0400 @@ -95,7 +95,7 @@ return PASS - do_main(sup_types) + at do_main(sup_types) def main(): options = main.options _______________________________________________ Libvirt-cim mailing list Libvirt-cim at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: graycol.gif Type: image/gif Size: 105 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic11597.gif Type: image/gif Size: 1255 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ecblank.gif Type: image/gif Size: 45 bytes Desc: not available URL: From snmishra at us.ibm.com Wed Mar 17 23:01:44 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 17 Mar 2010 16:01:44 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] #2 Add check to verify StorageVolume InstanceID Message-ID: <2a7a2ab9e729227b40a4.1268866904@elm3b41.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1268864289 25200 # Node ID 2a7a2ab9e729227b40a40d67f6dec9e2555e7bb7 # Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493 [TEST] #2 Add check to verify StorageVolume InstanceID. Updates: Moved InstanceID check immediately after call to CreateResourceInPool. This test verifies that the InstanceID of StorageVolume is not dependent on the pool path in RASD. Rather it is set by virStorageVolGetPath. Signed-off-by: Sharad Mishra diff -r 3655b03ada11 -r 2a7a2ab9e729 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Wed Mar 17 15:18:09 2010 -0700 @@ -231,6 +231,11 @@ if res[0] != PASS: raise Exception("Failed to create the Vol %s" % vol_name) + if res[1]['Resource']['InstanceID'] != exp_vol_path: + status = FAIL + 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, @@ -239,7 +244,8 @@ 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: + ret == PASS and stovol_status == PASS and \ + status == PASS: status = PASS else: return FAIL From deeptik at linux.vnet.ibm.com Thu Mar 18 05:35:59 2010 From: deeptik at linux.vnet.ibm.com (Deepti B Kalakeri) Date: Thu, 18 Mar 2010 11:05:59 +0530 Subject: [Libvirt-cim] [PATCH] [TEST] Fixing the syntax err in VSMS/26_definesystem_nic_dev.py In-Reply-To: References: <930746e12eb08c3e5a26.1268816108@elm3a148.beaverton.ibm.com> Message-ID: <4BA1BBBF.4010802@linux.vnet.ibm.com> Sharad Mishra wrote: > > Thank you Deepti for making this change. I saw the issue late > yesterday and put this on my todo list for today. But you beat me :-) > oh! ho ... :-) .. > > > +1 > > Sharad Mishra > System x Enablement > Linux Technology Center > IBM > > Inactive hide details for "Deepti B. Kalakeri" ---03/17/2010 01:48:13 > AM---# HG changeset patch"Deepti B. Kalakeri" ---03/17/2010 01:48:13 > AM---# HG changeset patch > > *"Deepti B. Kalakeri" > * > Sent by: libvirt-cim-bounces at redhat.com > > 03/17/10 01:55 AM > Please respond to > List for discussion and development of libvirt > CIM > > > > To > > libvirt-cim at redhat.com > > cc > > > Subject > > [Libvirt-cim] [PATCH] [TEST] Fixing the syntax err in > VSMS/26_definesystem_nic_dev.py > > > > > # HG changeset patch > # User Deepti B. Kalakeri > # Date 1268816098 14400 > # Node ID 930746e12eb08c3e5a262f70391ad312ba31fab0 > # Parent a576cb1c855a8f507d7ec38c49467bfb018b46b7 > [TEST] Fixing the syntax err in VSMS/26_definesystem_nic_dev.py > > > Tested has been verified with KVM Libvirt-CIM Sources. > Signed-off-by: Deepti B. Kalakeri > > diff -r a576cb1c855a -r 930746e12eb0 > suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py > --- > a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py > Tue Feb 02 12:30:20 2010 -0800 > +++ > b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/26_definesystem_nic_dev.py > Wed Mar 17 04:54:58 2010 -0400 > @@ -95,7 +95,7 @@ > > return PASS > > - do_main(sup_types) > + at do_main(sup_types) > def main(): > options = main.options > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > > ------------------------------------------------------------------------ > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik at linux.vnet.ibm.com From deeptik at linux.vnet.ibm.com Thu Mar 18 05:41:32 2010 From: deeptik at linux.vnet.ibm.com (Deepti B Kalakeri) Date: Thu, 18 Mar 2010 11:11:32 +0530 Subject: [Libvirt-cim] [PATCH] [TEST] #2 Add check to verify StorageVolume InstanceID In-Reply-To: <2a7a2ab9e729227b40a4.1268866904@elm3b41.beaverton.ibm.com> References: <2a7a2ab9e729227b40a4.1268866904@elm3b41.beaverton.ibm.com> Message-ID: <4BA1BD0C.7080609@linux.vnet.ibm.com> Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1268864289 25200 > # Node ID 2a7a2ab9e729227b40a40d67f6dec9e2555e7bb7 > # Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493 > [TEST] #2 Add check to verify StorageVolume InstanceID. > > Updates: > Moved InstanceID check immediately after call to CreateResourceInPool. > > This test verifies that the InstanceID of StorageVolume is not dependent on the pool path in RASD. Rather it is set by virStorageVolGetPath. > > Signed-off-by: Sharad Mishra > > diff -r 3655b03ada11 -r 2a7a2ab9e729 suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py > --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800 > +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Wed Mar 17 15:18:09 2010 -0700 > @@ -231,6 +231,11 @@ > if res[0] != PASS: > raise Exception("Failed to create the Vol %s" % vol_name) > > + if res[1]['Resource']['InstanceID'] != exp_vol_path: > + status = FAIL > You can raise an exception with some meaningful information here and come out of the test if the InstanceID does not contain the expected exp_vol_path. Like this we can avoid waiting till the end of the test case to determine if it failed some verification. > + 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, > @@ -239,7 +244,8 @@ > 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: > + ret == PASS and stovol_status == PASS and \ > + status == PASS: > status = PASS > else: > return FAIL > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik at linux.vnet.ibm.com From snmishra at us.ibm.com Thu Mar 18 22:52:32 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Thu, 18 Mar 2010 15:52:32 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] #3 Add check to verify StorageVolume InstanceID Message-ID: # HG changeset patch # User Sharad Mishra # Date 1268952745 25200 # Node ID f3604141cbff1e1ccc2ec97d5594c5d54f965516 # Parent 3655b03ada11d9e99a1d10b97aaa7cdb737fc493 [TEST] #3 Add check to verify StorageVolume InstanceID. Updates: Moved InstanceID check immediately after call to CreateResourceInPool. Added exception on failure. This test verifies that the InstanceID of StorageVolume is not dependent on the pool path in RASD. Rather it is set by virStorageVolGetPath. Signed-off-by: Sharad Mishra diff -r 3655b03ada11 -r f3604141cbff suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py --- a/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Jan 28 14:00:59 2010 -0800 +++ b/suites/libvirt-cim/cimtest/ResourcePoolConfigurationService/10_create_storagevolume.py Thu Mar 18 15:52:25 2010 -0700 @@ -231,6 +231,11 @@ if res[0] != PASS: raise Exception("Failed to create the Vol %s" % vol_name) + if res[1]['Resource']['InstanceID'] != exp_vol_path: + 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, @@ -239,7 +244,8 @@ 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: + ret == PASS and stovol_status == PASS and \ + status == PASS: status = PASS else: return FAIL From deeptik at linux.vnet.ibm.com Fri Mar 19 11:08:30 2010 From: deeptik at linux.vnet.ibm.com (Deepti B Kalakeri) Date: Fri, 19 Mar 2010 16:38:30 +0530 Subject: [Libvirt-cim] [PATCH] [TEST] #3 Add check to verify StorageVolume InstanceID In-Reply-To: References: Message-ID: <4BA35B2E.7030201@linux.vnet.ibm.com> +1 -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik at linux.vnet.ibm.com From rmaciel at linux.vnet.ibm.com Fri Mar 19 22:50:53 2010 From: rmaciel at linux.vnet.ibm.com (Richard Maciel) Date: Fri, 19 Mar 2010 19:50:53 -0300 Subject: [Libvirt-cim] [PATCH] Use libvirt to get StorageVolume Path to set SV InstanceID In-Reply-To: References: Message-ID: <4BA3FFCD.1040602@linux.vnet.ibm.com> I tested volume creation, but I don't really have a way to check if this code work, since I can't directly access a StorageVolume to check the InstanceID. :-/ Em 08-03-2010 22:10, Sharad Mishra escreveu: > # HG changeset patch > # User Sharad Mishra > # Date 1268096483 28800 > # Node ID fa15816439a7ef1e9ff212cf1833cafa7b1fd704 > # Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13 > Use libvirt to get StorageVolume Path to set SV InstanceID. > > InstanceID of a StorageVolume was set using the 'Path' field of StorageVolume RASD. If 'Path' was not set by the user, the InstanceID would be invalid. This patch fixed the issue by using libvirt to get the storage volume path. The path returned by libvirt is used to set the InstanceID. > > Signed-off-by: Sharad Mishra > > diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.c > --- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800 > +++ b/libxkutil/pool_parsing.c Mon Mar 08 17:01:23 2010 -0800 > @@ -353,12 +353,12 @@ > } > > #if VIR_USE_LIBVIRT_STORAGE > -int create_resource(virConnectPtr conn, > +char *create_resource(virConnectPtr conn, > const char *pname, > const char *xml, > int res_type) All function parameters must be aligned > { > - int ret = 0; > + char *path = NULL; > virStoragePoolPtr ptr = NULL; > virStorageVolPtr vptr = NULL; > > @@ -376,14 +376,19 @@ > goto out; > } > > - ret = 1; > + path = virStorageVolGetPath(vptr); > + if (path == NULL) { > + CU_DEBUG("Unable to get storage volume path"); > + goto out; > + } > + > } > > out: > virStoragePoolFree(ptr); > virStorageVolFree(vptr); > > - return ret; > + return path; > } > > int delete_resource(virConnectPtr conn, > @@ -414,13 +419,13 @@ > return ret; > } > #else > -int create_resource(virConnectPtr conn, > +char *create_resource(virConnectPtr conn, > const char *pname, > const char *xml, > int res_type) Align those parameters too > { > CU_DEBUG("Creating resources within libvirt pools not supported"); > - return 0; > + return NULL; > } > > int delete_resource(virConnectPtr conn, > diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.h > --- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800 > +++ b/libxkutil/pool_parsing.h Mon Mar 08 17:01:23 2010 -0800 > @@ -90,7 +90,7 @@ > int define_pool(virConnectPtr conn, const char *xml, int res_type); > int destroy_pool(virConnectPtr conn, const char *name, int res_type); > > -int create_resource(virConnectPtr conn, const char *pname, > +char *create_resource(virConnectPtr conn, const char *pname, > const char *xml, int res_type); > > int delete_resource(virConnectPtr conn, const char *rname, int res_type); > diff -r 4ee7c4354bc5 -r fa15816439a7 src/Virt_ResourcePoolConfigurationService.c > --- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 2010 -0800 > +++ b/src/Virt_ResourcePoolConfigurationService.c Mon Mar 08 17:01:23 2010 -0800 > @@ -832,6 +832,7 @@ > { > virConnectPtr conn; > CMPIInstance *inst = NULL; > + char *path = NULL; > > conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); > if (conn == NULL) { > @@ -839,7 +840,8 @@ > return NULL; > } > > - if (create_resource(conn, res->pool_id, xml, res->type) == 0) { > + path = create_resource(conn, res->pool_id, xml, res->type); > + if (path == NULL) { > virt_set_status(_BROKER, s, > CMPI_RC_ERR_FAILED, > conn, > @@ -855,6 +857,8 @@ > "Failed to lookup resulting resource"); > } > > + CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars); > + Don't you need to free the path pointer as well? > out: > virConnectClose(conn); > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Richard Maciel, MSc IBM Linux Technology Center rmaciel at linux.vnet.ibm.com From snmishra at us.ibm.com Sat Mar 20 00:19:37 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Fri, 19 Mar 2010 17:19:37 -0700 Subject: [Libvirt-cim] [PATCH] Use libvirt to get StorageVolume Path to set SV InstanceID In-Reply-To: <4BA3FFCD.1040602@linux.vnet.ibm.com> References: <4BA3FFCD.1040602@linux.vnet.ibm.com> Message-ID: Richard, Apart from the test, does the code look okay? I have tested it and Deepti has tested it too. So if the code review is good, then please ack it. Thanks Sharad Mishra System x Enablement Linux Technology Center IBM Richard Maciel To Sent by: libvirt-cim at redhat.com libvirt-cim-bounc cc es at redhat.com Subject Re: [Libvirt-cim] [PATCH] Use 03/19/10 03:50 PM libvirt to get StorageVolume Path to set SV InstanceID Please respond to List for discussion and development of libvirt CIM I tested volume creation, but I don't really have a way to check if this code work, since I can't directly access a StorageVolume to check the InstanceID. :-/ Em 08-03-2010 22:10, Sharad Mishra escreveu: > # HG changeset patch > # User Sharad Mishra > # Date 1268096483 28800 > # Node ID fa15816439a7ef1e9ff212cf1833cafa7b1fd704 > # Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13 > Use libvirt to get StorageVolume Path to set SV InstanceID. > > InstanceID of a StorageVolume was set using the 'Path' field of StorageVolume RASD. If 'Path' was not set by the user, the InstanceID would be invalid. This patch fixed the issue by using libvirt to get the storage volume path. The path returned by libvirt is used to set the InstanceID. > > Signed-off-by: Sharad Mishra > > diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.c > --- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800 > +++ b/libxkutil/pool_parsing.c Mon Mar 08 17:01:23 2010 -0800 > @@ -353,12 +353,12 @@ > } > > #if VIR_USE_LIBVIRT_STORAGE > -int create_resource(virConnectPtr conn, > +char *create_resource(virConnectPtr conn, > const char *pname, > const char *xml, > int res_type) All function parameters must be aligned > { > - int ret = 0; > + char *path = NULL; > virStoragePoolPtr ptr = NULL; > virStorageVolPtr vptr = NULL; > > @@ -376,14 +376,19 @@ > goto out; > } > > - ret = 1; > + path = virStorageVolGetPath(vptr); > + if (path == NULL) { > + CU_DEBUG("Unable to get storage volume path"); > + goto out; > + } > + > } > > out: > virStoragePoolFree(ptr); > virStorageVolFree(vptr); > > - return ret; > + return path; > } > > int delete_resource(virConnectPtr conn, > @@ -414,13 +419,13 @@ > return ret; > } > #else > -int create_resource(virConnectPtr conn, > +char *create_resource(virConnectPtr conn, > const char *pname, > const char *xml, > int res_type) Align those parameters too > { > CU_DEBUG("Creating resources within libvirt pools not supported"); > - return 0; > + return NULL; > } > > int delete_resource(virConnectPtr conn, > diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.h > --- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800 > +++ b/libxkutil/pool_parsing.h Mon Mar 08 17:01:23 2010 -0800 > @@ -90,7 +90,7 @@ > int define_pool(virConnectPtr conn, const char *xml, int res_type); > int destroy_pool(virConnectPtr conn, const char *name, int res_type); > > -int create_resource(virConnectPtr conn, const char *pname, > +char *create_resource(virConnectPtr conn, const char *pname, > const char *xml, int res_type); > > int delete_resource(virConnectPtr conn, const char *rname, int res_type); > diff -r 4ee7c4354bc5 -r fa15816439a7 src/Virt_ResourcePoolConfigurationService.c > --- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 2010 -0800 > +++ b/src/Virt_ResourcePoolConfigurationService.c Mon Mar 08 17:01:23 2010 -0800 > @@ -832,6 +832,7 @@ > { > virConnectPtr conn; > CMPIInstance *inst = NULL; > + char *path = NULL; > > conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); > if (conn == NULL) { > @@ -839,7 +840,8 @@ > return NULL; > } > > - if (create_resource(conn, res->pool_id, xml, res->type) == 0) { > + path = create_resource(conn, res->pool_id, xml, res->type); > + if (path == NULL) { > virt_set_status(_BROKER, s, > CMPI_RC_ERR_FAILED, > conn, > @@ -855,6 +857,8 @@ > "Failed to lookup resulting resource"); > } > > + CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars); > + Don't you need to free the path pointer as well? > out: > virConnectClose(conn); > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Richard Maciel, MSc IBM Linux Technology Center rmaciel at linux.vnet.ibm.com _______________________________________________ Libvirt-cim mailing list Libvirt-cim at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: graycol.gif Type: image/gif Size: 105 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic02400.gif Type: image/gif Size: 1255 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ecblank.gif Type: image/gif Size: 45 bytes Desc: not available URL: From rmaciel at linux.vnet.ibm.com Mon Mar 22 11:48:17 2010 From: rmaciel at linux.vnet.ibm.com (Richard Maciel) Date: Mon, 22 Mar 2010 08:48:17 -0300 Subject: [Libvirt-cim] [PATCH] Use libvirt to get StorageVolume Path to set SV InstanceID In-Reply-To: References: <4BA3FFCD.1040602@linux.vnet.ibm.com> Message-ID: <4BA75901.6080105@linux.vnet.ibm.com> I didn't ack because there are changes to be made in the code. Please, check the comments. Em 19-03-2010 21:19, Sharad Mishra escreveu: > Richard, > > Apart from the test, does the code look okay? > I have tested it and Deepti has tested it too. So if the code review is > good, then please ack it. > > Thanks > Sharad Mishra > System x Enablement > Linux Technology Center > IBM > > Inactive hide details for Richard Maciel ---03/19/2010 03:54:31 PM---I > tested volume creation, but I don't really have a way toRichard Maciel > ---03/19/2010 03:54:31 PM---I tested volume creation, but I don't really > have a way to check if this > > *Richard Maciel * > Sent by: libvirt-cim-bounces at redhat.com > > 03/19/10 03:50 PM > Please respond to > List for discussion and development of libvirt > CIM > > > > To > > libvirt-cim at redhat.com > > cc > > > Subject > > Re: [Libvirt-cim] [PATCH] Use libvirt to get StorageVolume Path to set > SV InstanceID > > > > > I tested volume creation, but I don't really have a way to check if this > code work, since I can't directly access a StorageVolume to check the > InstanceID. :-/ > > > Em 08-03-2010 22:10, Sharad Mishra escreveu: > > # HG changeset patch > > # User Sharad Mishra > > # Date 1268096483 28800 > > # Node ID fa15816439a7ef1e9ff212cf1833cafa7b1fd704 > > # Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13 > > Use libvirt to get StorageVolume Path to set SV InstanceID. > > > > InstanceID of a StorageVolume was set using the 'Path' field of > StorageVolume RASD. If 'Path' was not set by the user, the InstanceID > would be invalid. This patch fixed the issue by using libvirt to get the > storage volume path. The path returned by libvirt is used to set the > InstanceID. > > > > Signed-off-by: Sharad Mishra > > > > diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.c > > --- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800 > > +++ b/libxkutil/pool_parsing.c Mon Mar 08 17:01:23 2010 -0800 > > @@ -353,12 +353,12 @@ > > } > > > > #if VIR_USE_LIBVIRT_STORAGE > > -int create_resource(virConnectPtr conn, > > +char *create_resource(virConnectPtr conn, > > const char *pname, > > const char *xml, > > int res_type) > > All function parameters must be aligned > > > { > > - int ret = 0; > > + char *path = NULL; > > virStoragePoolPtr ptr = NULL; > > virStorageVolPtr vptr = NULL; > > > > @@ -376,14 +376,19 @@ > > goto out; > > } > > > > - ret = 1; > > + path = virStorageVolGetPath(vptr); > > + if (path == NULL) { > > + CU_DEBUG("Unable to get storage volume path"); > > + goto out; > > + } > > + > > } > > > > out: > > virStoragePoolFree(ptr); > > virStorageVolFree(vptr); > > > > - return ret; > > + return path; > > } > > > > int delete_resource(virConnectPtr conn, > > @@ -414,13 +419,13 @@ > > return ret; > > } > > #else > > -int create_resource(virConnectPtr conn, > > +char *create_resource(virConnectPtr conn, > > const char *pname, > > const char *xml, > > int res_type) > > Align those parameters too > > > { > > CU_DEBUG("Creating resources within libvirt pools not supported"); > > - return 0; > > + return NULL; > > } > > > > int delete_resource(virConnectPtr conn, > > diff -r 4ee7c4354bc5 -r fa15816439a7 libxkutil/pool_parsing.h > > --- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800 > > +++ b/libxkutil/pool_parsing.h Mon Mar 08 17:01:23 2010 -0800 > > @@ -90,7 +90,7 @@ > > int define_pool(virConnectPtr conn, const char *xml, int res_type); > > int destroy_pool(virConnectPtr conn, const char *name, int res_type); > > > > -int create_resource(virConnectPtr conn, const char *pname, > > +char *create_resource(virConnectPtr conn, const char *pname, > > const char *xml, int res_type); > > > > int delete_resource(virConnectPtr conn, const char *rname, int res_type); > > diff -r 4ee7c4354bc5 -r fa15816439a7 > src/Virt_ResourcePoolConfigurationService.c > > --- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 > 2010 -0800 > > +++ b/src/Virt_ResourcePoolConfigurationService.c Mon Mar 08 17:01:23 > 2010 -0800 > > @@ -832,6 +832,7 @@ > > { > > virConnectPtr conn; > > CMPIInstance *inst = NULL; > > + char *path = NULL; > > > > conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); > > if (conn == NULL) { > > @@ -839,7 +840,8 @@ > > return NULL; > > } > > > > - if (create_resource(conn, res->pool_id, xml, res->type) == 0) { > > + path = create_resource(conn, res->pool_id, xml, res->type); > > + if (path == NULL) { > > virt_set_status(_BROKER, s, > > CMPI_RC_ERR_FAILED, > > conn, > > @@ -855,6 +857,8 @@ > > "Failed to lookup resulting resource"); > > } > > > > + CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars); > > + > > Don't you need to free the path pointer as well? > > > > out: > > virConnectClose(conn); > > > > > > _______________________________________________ > > Libvirt-cim mailing list > > Libvirt-cim at redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > -- > Richard Maciel, MSc > IBM Linux Technology Center > rmaciel at linux.vnet.ibm.com > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Richard Maciel, MSc IBM Linux Technology Center rmaciel at linux.vnet.ibm.com From snmishra at us.ibm.com Tue Mar 23 23:34:14 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Tue, 23 Mar 2010 16:34:14 -0700 Subject: [Libvirt-cim] [PATCH] (#2) Use libvirt to get StorageVolume Path to set SV InstanceID Message-ID: <22a4721a2d978fe611cb.1269387254@elm3b41.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1269387101 25200 # Node ID 22a4721a2d978fe611cb75255a094a0cc23abe5c # Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13 (#2) Use libvirt to get StorageVolume Path to set SV InstanceID. Updates: Coding style and free path pointer. InstanceID of a StorageVolume was set using the 'Path' field of StorageVolume RASD. If 'Path' was not set by the user, the InstanceID would be invalid. This patch fixed the issue by using libvirt to get the storage volume path. The path returned by libvirt is used to set the InstanceID. Signed-off-by: Sharad Mishra diff -r 4ee7c4354bc5 -r 22a4721a2d97 libxkutil/pool_parsing.c --- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800 +++ b/libxkutil/pool_parsing.c Tue Mar 23 16:31:41 2010 -0700 @@ -353,12 +353,12 @@ } #if VIR_USE_LIBVIRT_STORAGE -int create_resource(virConnectPtr conn, - const char *pname, - const char *xml, - int res_type) +char *create_resource(virConnectPtr conn, + const char *pname, + const char *xml, + int res_type) { - int ret = 0; + char *path = NULL; virStoragePoolPtr ptr = NULL; virStorageVolPtr vptr = NULL; @@ -376,14 +376,19 @@ goto out; } - ret = 1; + path = virStorageVolGetPath(vptr); + if (path == NULL) { + CU_DEBUG("Unable to get storage volume path"); + goto out; + } + } out: virStoragePoolFree(ptr); virStorageVolFree(vptr); - return ret; + return path; } int delete_resource(virConnectPtr conn, @@ -414,13 +419,13 @@ return ret; } #else -int create_resource(virConnectPtr conn, - const char *pname, - const char *xml, - int res_type) +char *create_resource(virConnectPtr conn, + const char *pname, + const char *xml, + int res_type) { CU_DEBUG("Creating resources within libvirt pools not supported"); - return 0; + return NULL; } int delete_resource(virConnectPtr conn, diff -r 4ee7c4354bc5 -r 22a4721a2d97 libxkutil/pool_parsing.h --- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800 +++ b/libxkutil/pool_parsing.h Tue Mar 23 16:31:41 2010 -0700 @@ -90,8 +90,8 @@ int define_pool(virConnectPtr conn, const char *xml, int res_type); int destroy_pool(virConnectPtr conn, const char *name, int res_type); -int create_resource(virConnectPtr conn, const char *pname, - const char *xml, int res_type); +char *create_resource(virConnectPtr conn, const char *pname, + const char *xml, int res_type); int delete_resource(virConnectPtr conn, const char *rname, int res_type); diff -r 4ee7c4354bc5 -r 22a4721a2d97 src/Virt_ResourcePoolConfigurationService.c --- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 2010 -0800 +++ b/src/Virt_ResourcePoolConfigurationService.c Tue Mar 23 16:31:41 2010 -0700 @@ -832,6 +832,7 @@ { virConnectPtr conn; CMPIInstance *inst = NULL; + char *path = NULL; conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); if (conn == NULL) { @@ -839,7 +840,8 @@ return NULL; } - if (create_resource(conn, res->pool_id, xml, res->type) == 0) { + path = create_resource(conn, res->pool_id, xml, res->type); + if (path == NULL) { virt_set_status(_BROKER, s, CMPI_RC_ERR_FAILED, conn, @@ -855,7 +857,10 @@ "Failed to lookup resulting resource"); } + CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars); + out: + free(path); virConnectClose(conn); return inst; From rmaciel at linux.vnet.ibm.com Wed Mar 24 14:02:13 2010 From: rmaciel at linux.vnet.ibm.com (Richard Maciel) Date: Wed, 24 Mar 2010 11:02:13 -0300 Subject: [Libvirt-cim] [PATCH] (#2) Use libvirt to get StorageVolume Path to set SV InstanceID In-Reply-To: <22a4721a2d978fe611cb.1269387254@elm3b41.beaverton.ibm.com> References: <22a4721a2d978fe611cb.1269387254@elm3b41.beaverton.ibm.com> Message-ID: <4BAA1B65.50500@linux.vnet.ibm.com> +1 Em 23-03-2010 20:34, Sharad Mishra escreveu: > # HG changeset patch > # User Sharad Mishra > # Date 1269387101 25200 > # Node ID 22a4721a2d978fe611cb75255a094a0cc23abe5c > # Parent 4ee7c4354bc550780bc02ef1f69fbda387b3fe13 > (#2) Use libvirt to get StorageVolume Path to set SV InstanceID. > > Updates: > Coding style and free path pointer. > > InstanceID of a StorageVolume was set using the 'Path' field of StorageVolume RASD. If 'Path' was not set by the user, the InstanceID would be invalid. This patch fixed the issue by using libvirt to get the storage volume path. The path returned by libvirt is used to set the InstanceID. > > Signed-off-by: Sharad Mishra > > diff -r 4ee7c4354bc5 -r 22a4721a2d97 libxkutil/pool_parsing.c > --- a/libxkutil/pool_parsing.c Tue Mar 02 15:23:45 2010 -0800 > +++ b/libxkutil/pool_parsing.c Tue Mar 23 16:31:41 2010 -0700 > @@ -353,12 +353,12 @@ > } > > #if VIR_USE_LIBVIRT_STORAGE > -int create_resource(virConnectPtr conn, > - const char *pname, > - const char *xml, > - int res_type) > +char *create_resource(virConnectPtr conn, > + const char *pname, > + const char *xml, > + int res_type) > { > - int ret = 0; > + char *path = NULL; > virStoragePoolPtr ptr = NULL; > virStorageVolPtr vptr = NULL; > > @@ -376,14 +376,19 @@ > goto out; > } > > - ret = 1; > + path = virStorageVolGetPath(vptr); > + if (path == NULL) { > + CU_DEBUG("Unable to get storage volume path"); > + goto out; > + } > + > } > > out: > virStoragePoolFree(ptr); > virStorageVolFree(vptr); > > - return ret; > + return path; > } > > int delete_resource(virConnectPtr conn, > @@ -414,13 +419,13 @@ > return ret; > } > #else > -int create_resource(virConnectPtr conn, > - const char *pname, > - const char *xml, > - int res_type) > +char *create_resource(virConnectPtr conn, > + const char *pname, > + const char *xml, > + int res_type) > { > CU_DEBUG("Creating resources within libvirt pools not supported"); > - return 0; > + return NULL; > } > > int delete_resource(virConnectPtr conn, > diff -r 4ee7c4354bc5 -r 22a4721a2d97 libxkutil/pool_parsing.h > --- a/libxkutil/pool_parsing.h Tue Mar 02 15:23:45 2010 -0800 > +++ b/libxkutil/pool_parsing.h Tue Mar 23 16:31:41 2010 -0700 > @@ -90,8 +90,8 @@ > int define_pool(virConnectPtr conn, const char *xml, int res_type); > int destroy_pool(virConnectPtr conn, const char *name, int res_type); > > -int create_resource(virConnectPtr conn, const char *pname, > - const char *xml, int res_type); > +char *create_resource(virConnectPtr conn, const char *pname, > + const char *xml, int res_type); > > int delete_resource(virConnectPtr conn, const char *rname, int res_type); > > diff -r 4ee7c4354bc5 -r 22a4721a2d97 src/Virt_ResourcePoolConfigurationService.c > --- a/src/Virt_ResourcePoolConfigurationService.c Tue Mar 02 15:23:45 2010 -0800 > +++ b/src/Virt_ResourcePoolConfigurationService.c Tue Mar 23 16:31:41 2010 -0700 > @@ -832,6 +832,7 @@ > { > virConnectPtr conn; > CMPIInstance *inst = NULL; > + char *path = NULL; > > conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); > if (conn == NULL) { > @@ -839,7 +840,8 @@ > return NULL; > } > > - if (create_resource(conn, res->pool_id, xml, res->type) == 0) { > + path = create_resource(conn, res->pool_id, xml, res->type); > + if (path == NULL) { > virt_set_status(_BROKER, s, > CMPI_RC_ERR_FAILED, > conn, > @@ -855,7 +857,10 @@ > "Failed to lookup resulting resource"); > } > > + CMSetProperty(inst, "InstanceID", (CMPIValue *)path, CMPI_chars); > + > out: > + free(path); > virConnectClose(conn); > > return inst; > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Richard Maciel, MSc IBM Linux Technology Center rmaciel at linux.vnet.ibm.com From snmishra at us.ibm.com Wed Mar 24 18:21:33 2010 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 24 Mar 2010 11:21:33 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] Updating rasd.py to include floppy changes and direct net type changes In-Reply-To: <888ca94fdbc69076a8ab.1268659000@elm3a148.beaverton.ibm.com> References: <888ca94fdbc69076a8ab.1268659000@elm3a148.beaverton.ibm.com> Message-ID: +1 Sharad Mishra Open Virtualization Linux Technology Center IBM "Deepti B. Kalakeri" libvirt-cim at redhat.com Sent by: cc libvirt-cim-bounc es at redhat.com Subject [Libvirt-cim] [PATCH] [TEST] Updating rasd.py to include floppy 03/15/2010 06:16 changes and direct net type AM changes Please respond to List for discussion and development of libvirt CIM # HG changeset patch # User Deepti B. Kalakeri # Date 1268658975 14400 # Node ID 888ca94fdbc69076a8ab2f7dd805d314b3dbb27d # Parent a576cb1c855a8f507d7ec38c49467bfb018b46b7 [TEST] Updating rasd.py to include floppy changes and direct net type changes. This test fixes the SettingsDefineCapabilities/01_forward.py and HostSystem -t 03_hs_to_settdefcap.py. The test has been verified with KVM and Xen on current Libvirt-CIM Sources. Signed-off-by: Deepti B. Kalakeri diff -r a576cb1c855a -r 888ca94fdbc6 suites/libvirt-cim/lib/XenKvmLib/rasd.py --- a/suites/libvirt-cim/lib/XenKvmLib/rasd.py Tue Feb 02 12:30:20 2010 -0800 +++ b/suites/libvirt-cim/lib/XenKvmLib/rasd.py Mon Mar 15 09:16:15 2010 -0400 @@ -324,6 +324,8 @@ libvirt_rasd_template_changes = 707 libvirt_rasd_new_changes = 805 libvirt_rasd_dpool_changes = 839 + libvirt_rasd_floppy_changes = 1023 + libvirt_rasd_stvol_unit_changes = 1025 libvirt_ver = virsh_version(ip, virt) @@ -334,6 +336,13 @@ # StoragePoolRASD record 1 for each of Min, Max, Default, and Incr exp_storagevol_rasd = 4 exp_len = exp_base_num + + # StoragePoolRASD record with AllocationUnits=G 1 for each \ + # of Min, Max, Default, Incr + exp_storagevol_unit_changes = 4 + + # Floppy record 1 for each of Min, Max, Default, and Incr + exp_floppy = 4 if id == "DiskPool/0": pool_types = 7 @@ -350,7 +359,11 @@ elif rev >= libvirt_rasd_dpool_changes and libvirt_ver >= '0.4.1': volumes = enum_volumes(virt, ip) - exp_len = ((volumes * exp_base_num) + exp_cdrom) * xen_multi + if rev >= libvirt_rasd_floppy_changes: + exp_len = ((volumes * exp_base_num) + \ + exp_cdrom + exp_floppy) * xen_multi + else: + exp_len = ((volumes * exp_base_num) + exp_cdrom) * xen_multi else: exp_len = (exp_base_num + exp_cdrom) * xen_multi @@ -363,16 +376,28 @@ elif rev >= libvirt_rasd_dpool_changes: id = parse_instance_id(id) volumes = enum_volumes(virt, ip, id[1]) - exp_len = (volumes * exp_base_num) + exp_cdrom - if rev >= libvirt_rasd_storagepool_changes and libvirt_ver >= '0.4.1' \ - and virt != 'LXC': - exp_len += exp_storagevol_rasd + if rev >= libvirt_rasd_floppy_changes: + exp_len = (volumes * exp_base_num) + exp_cdrom + exp_floppy + else: + exp_len = (volumes * exp_base_num) + exp_cdrom + + + if virt != 'LXC' and libvirt_ver >= '0.4.1': + if rev >= libvirt_rasd_storagepool_changes: + exp_len += exp_storagevol_rasd + + if rev >= libvirt_rasd_stvol_unit_changes: + exp_len += exp_storagevol_unit_changes return exp_len def get_exp_net_rasd_len(virt, rev, id): net_rasd_template_changes = 861 + net_rasd_direct_nettype_changes = 1029 + + # NetRASD record for Direct NetType 1 for each min, max, incr, default + exp_direct = 4 exp_base_num = 4 @@ -385,8 +410,12 @@ if rev >= net_rasd_template_changes: dev_types = 2 net_types = 3 + exp_base_num = exp_base_num * dev_types * net_types - return exp_base_num * dev_types * net_types + if rev >= net_rasd_direct_nettype_changes: + exp_base_num += exp_direct + + return exp_base_num return exp_base_num _______________________________________________ Libvirt-cim mailing list Libvirt-cim at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: graycol.gif Type: image/gif Size: 105 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pic14601.gif Type: image/gif Size: 1255 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ecblank.gif Type: image/gif Size: 45 bytes Desc: not available URL: