From jferlan at redhat.com Tue Jan 21 21:32:53 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 21 Jan 2014 16:32:53 -0500 Subject: [Libvirt-cim] [PATCH] spec: Fix docs/*.html packaging issue Message-ID: <1390339973-16247-1-git-send-email-jferlan@redhat.com> Using a more recent rpmbuild on f20, I found that the 'make rpm' was failing: Installed (but unpackaged) file(s) found: /usr/share/doc/libvirt-cim-0.6.3/html/architecture.html /usr/share/doc/libvirt-cim-0.6.3/html/downloads.html /usr/share/doc/libvirt-cim-0.6.3/html/index.html /usr/share/doc/libvirt-cim-0.6.3/html/intro.html /usr/share/doc/libvirt-cim-0.6.3/html/libvirt-cim.html /usr/share/doc/libvirt-cim-0.6.3/html/news.html /usr/share/doc/libvirt-cim-0.6.3/html/patches.html /usr/share/doc/libvirt-cim-0.6.3/html/platforms.html /usr/share/doc/libvirt-cim-0.6.3/html/schema.html make: *** [rpm] Error 1 After a bit of research - I found the following page that describes a workaround to add "%define _unpackaged_files_terminate_build 0" to the spec file: http://www.oldrpm.org/hintskinks/unpackaged/ However, figuring that wasn't a great solution - I found a libvirt change that provided a way to work around what was being seen, see: http://www.redhat.com/archives/libvir-list/2013-November/msg00441.html It seems as though having that %doc doc/*.html is not proper any more. With this change I can once again build RPM packages Signed-off-by: John Ferlan --- libvirt-cim.spec.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in index c96451b..24ef280 100644 --- a/libvirt-cim.spec.in +++ b/libvirt-cim.spec.in @@ -60,6 +60,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libxkutil.so mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d echo %{_libdir}/cmpi > $RPM_BUILD_ROOT/etc/ld.so.conf.d/libvirt-cim.%{_arch}.conf mkdir -p $RPM_BUILD_ROOT at INFO_STORE@ +mv $RPM_BUILD_ROOT%{_datadir}/doc/libvirt-cim-%{version} libvirt-cim-docs %clean rm -fr $RPM_BUILD_ROOT @@ -347,9 +348,8 @@ fi %defattr(-, root, root) %{_sysconfdir}/libvirt/cim -%doc README COPYING doc/CodingStyle doc/SubmittingPatches +%doc README COPYING doc/CodingStyle doc/SubmittingPatches libvirt-cim-docs/* %doc base_schema/README.DMTF -%doc doc/*.html %{_libdir}/lib*.so* %{_libdir}/cmpi/lib*.so* %{_datadir}/libvirt-cim -- 1.8.4.2 From jferlan at redhat.com Tue Jan 21 22:22:06 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 21 Jan 2014 17:22:06 -0500 Subject: [Libvirt-cim] Any updates/news regarding tog-pegasus and libvirt-cim Message-ID: <52DEF30E.7050308@redhat.com> Back in November I discovered that tog-pegasus 2.12.1-8 the libvirt-cim usage of root/PG_InterOp would no longer work properly. For more context, see: http://www.redhat.com/archives/libvirt-cim/2013-November/msg00008.html and followups. Based on that I created an RFC/patch: http://www.redhat.com/archives/libvirt-cim/2013-November/msg00083.html I'm curious to know if there's any more progress/thoughts on this issue. If it's easier I can resend the patch, but figured since I've finally been able to devote some cycles to libvirt-cim - I'd ping again. NB: I recently updated to f20 which has 2.12.1-11 and it's broken there. Although it seems I don't need change the schema (e.g. FilterList fixes). Tks, John From jferlan at redhat.com Tue Jan 21 22:24:49 2014 From: jferlan at redhat.com (John Ferlan) Date: Tue, 21 Jan 2014 17:24:49 -0500 Subject: [Libvirt-cim] [PATCH] VSMS: fv_vssd_to_domain() resolve Coverity error In-Reply-To: <1384298978-31672-1-git-send-email-jferlan@redhat.com> References: <1384298978-31672-1-git-send-email-jferlan@redhat.com> Message-ID: <52DEF3B1.3090506@redhat.com> On 11/12/2013 06:29 PM, John Ferlan wrote: > Coverity discovered that the free(domain->os_info.fv.arch) and then > usage later on during get_default_machine() and get_default_emulator() > calls could result in using free()'d memory. > > If the 'cu_get_str_prop() failed or capsinfo == NULL, then the fv.arch > wouldn't necessarily be strdup()'d. > > Passing a NULL os_info.fv_arch into the get*() API's is fine since > they'll call findDomainInfo() which can handle a NULL arch value. > > Also added an initialization of val just to be safe. I don't think it's > necessary though. > > --- > NOTE: > > I found this during a Coverity run applying the endianness patches. For > some reason Coverity "woke up" and saw this even though it hasn't found > this issue in a couple months of runs since the changes to this module > were made. See commit id '117dabb9'. > > > src/Virt_VirtualSystemManagementService.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > I'm going to revisit this as part of a larger set of Coverity patches. I've updated to Coverity 7.0 and there's 27 "issues" (although some in the same module). Once they are pushed maybe we can go with another release. John From mprivozn at redhat.com Wed Jan 22 08:49:46 2014 From: mprivozn at redhat.com (Michal Privoznik) Date: Wed, 22 Jan 2014 09:49:46 +0100 Subject: [Libvirt-cim] [PATCH] spec: Fix docs/*.html packaging issue In-Reply-To: <1390339973-16247-1-git-send-email-jferlan@redhat.com> References: <1390339973-16247-1-git-send-email-jferlan@redhat.com> Message-ID: <52DF862A.6060606@redhat.com> On 21.01.2014 22:32, John Ferlan wrote: > Using a more recent rpmbuild on f20, I found that the 'make rpm' was failing: > > Installed (but unpackaged) file(s) found: > /usr/share/doc/libvirt-cim-0.6.3/html/architecture.html > /usr/share/doc/libvirt-cim-0.6.3/html/downloads.html > /usr/share/doc/libvirt-cim-0.6.3/html/index.html > /usr/share/doc/libvirt-cim-0.6.3/html/intro.html > /usr/share/doc/libvirt-cim-0.6.3/html/libvirt-cim.html > /usr/share/doc/libvirt-cim-0.6.3/html/news.html > /usr/share/doc/libvirt-cim-0.6.3/html/patches.html > /usr/share/doc/libvirt-cim-0.6.3/html/platforms.html > /usr/share/doc/libvirt-cim-0.6.3/html/schema.html > make: *** [rpm] Error 1 > > After a bit of research - I found the following page that describes a > workaround to add "%define _unpackaged_files_terminate_build 0" to the > spec file: > > http://www.oldrpm.org/hintskinks/unpackaged/ > > However, figuring that wasn't a great solution - I found a libvirt change > that provided a way to work around what was being seen, see: > > http://www.redhat.com/archives/libvir-list/2013-November/msg00441.html > > It seems as though having that %doc doc/*.html is not proper any more. > With this change I can once again build RPM packages > > Signed-off-by: John Ferlan > --- > libvirt-cim.spec.in | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) ACK Michal From fiuczy at linux.vnet.ibm.com Wed Jan 22 09:26:00 2014 From: fiuczy at linux.vnet.ibm.com (Boris Fiuczynski) Date: Wed, 22 Jan 2014 10:26:00 +0100 Subject: [Libvirt-cim] [PATCH] VSMS: fv_vssd_to_domain() resolve Coverity error In-Reply-To: <1384298978-31672-1-git-send-email-jferlan@redhat.com> References: <1384298978-31672-1-git-send-email-jferlan@redhat.com> Message-ID: <52DF8EA8.7010106@linux.vnet.ibm.com> On 11/13/2013 12:29 AM, John Ferlan wrote: > Coverity discovered that the free(domain->os_info.fv.arch) and then > usage later on during get_default_machine() and get_default_emulator() > calls could result in using free()'d memory. > > If the 'cu_get_str_prop() failed or capsinfo == NULL, then the fv.arch > wouldn't necessarily be strdup()'d. > > Passing a NULL os_info.fv_arch into the get*() API's is fine since > they'll call findDomainInfo() which can handle a NULL arch value. > > Also added an initialization of val just to be safe. I don't think it's > necessary though. > > --- > NOTE: > > I found this during a Coverity run applying the endianness patches. For > some reason Coverity "woke up" and saw this even though it hasn't found > this issue in a couple months of runs since the changes to this module > were made. See commit id '117dabb9'. > > > src/Virt_VirtualSystemManagementService.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c > index d51f230..9f8b5b9 100644 > --- a/src/Virt_VirtualSystemManagementService.c > +++ b/src/Virt_VirtualSystemManagementService.c > @@ -464,7 +464,7 @@ static int fv_vssd_to_domain(CMPIInstance *inst, > { > int ret = 1; > int retr; > - const char *val; > + const char *val = NULL; > const char *domtype = NULL; > const char *ostype = "hvm"; > struct capabilities *capsinfo = NULL; > @@ -494,6 +494,7 @@ static int fv_vssd_to_domain(CMPIInstance *inst, > } > > free(domain->os_info.fv.arch); > + domain->os_info.fv.arch = NULL; > retr = cu_get_str_prop(inst, "Arch", &val); > if (retr != CMPI_RC_OK) { > if (capsinfo != NULL) { /* set default */ > ACK -- Mit freundlichen Gr??en/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martina K?deritz Gesch?ftsf?hrung: Dirk Wittkopp Sitz der Gesellschaft: B?blingen Registergericht: Amtsgericht Stuttgart, HRB 243294 From jferlan at redhat.com Wed Jan 22 18:30:37 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 22 Jan 2014 13:30:37 -0500 Subject: [Libvirt-cim] [PATCH] spec: Fix docs/*.html packaging issue In-Reply-To: <52DF862A.6060606@redhat.com> References: <1390339973-16247-1-git-send-email-jferlan@redhat.com> <52DF862A.6060606@redhat.com> Message-ID: <52E00E4D.4000703@redhat.com> On 01/22/2014 03:49 AM, Michal Privoznik wrote: > On 21.01.2014 22:32, John Ferlan wrote: >> Signed-off-by: John Ferlan >> --- >> libvirt-cim.spec.in | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) > > ACK > > Michal > Thanks - this has been pushed John From jferlan at redhat.com Wed Jan 22 19:30:31 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 22 Jan 2014 14:30:31 -0500 Subject: [Libvirt-cim] [PATCH 0/6] Coverity cleanups Message-ID: <1390419037-10777-1-git-send-email-jferlan@redhat.com> A recent Coverity version update discovered some existing issues (and some benign cases). This patch set cleans them all up. John Ferlan (6): VSMS: Coverity cleanups libxkutil:pool_parsing: Coverity cleanups libxkutil:device_parsing: Coverity cleanups libxkutil/xml_parse_test: Coverity cleanup RAFP: Coverity cleanup EAFP: Coverity cleanup libxkutil/device_parsing.c | 41 +++++++++++++++++-------------- libxkutil/pool_parsing.c | 39 +++++++++++++++-------------- libxkutil/xml_parse_test.c | 1 + src/Virt_ElementAllocatedFromPool.c | 6 ++++- src/Virt_ResourceAllocationFromPool.c | 7 ++++-- src/Virt_SettingsDefineCapabilities.c | 2 +- src/Virt_VirtualSystemManagementService.c | 11 ++++++--- 7 files changed, 63 insertions(+), 44 deletions(-) -- 1.8.4.2 From jferlan at redhat.com Wed Jan 22 19:30:32 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 22 Jan 2014 14:30:32 -0500 Subject: [Libvirt-cim] [PATCH 1/6] VSMS: Coverity cleanups In-Reply-To: <1390419037-10777-1-git-send-email-jferlan@redhat.com> References: <1390419037-10777-1-git-send-email-jferlan@redhat.com> Message-ID: <1390419037-10777-2-git-send-email-jferlan@redhat.com> A new version of Coverity found a number of issues: parse_ip_address(): FORWARD_NULL - Benign issue regarding how 'tmp_ip' was compared against NULL for the IPv6 processing and then used blindly later when strdup()'ing into *ip. Rather than use NULL check, compare against return of 1 or more which indicates that something is there update_system_settings(): RESOURCE_LEAK - The 'uuid' value was being leaked if strdup()'d. Also rather than strdup()'g and strdup()'d value and risking failure, just assign the initially strdup()'d value and reinitialize uuid to NULL fv_vssd_to_domain(): USE_AFTER_FREE - The domain->os_info.fv.arch is free()'d only to be potentially strdup()'d after processing the 'cu_get_str_prop()' for "Arch". The complaint was that it was possible to not strdup() a new value and thus possible to pass a free()'d value to get_default_machine(). Passing a NULL is not an issue as that is checked. Additionally found by inspection, 'val' was not initialized to NULL, so the setting of os_info.fv.arch may not be what was expected. Also, after processing "Arch" it was not reinitialized to NULL so its contents could potentially have been saved in os_info.fv.machine. Signed-off-by: John Ferlan --- src/Virt_VirtualSystemManagementService.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index 5c7238f..b624d8c 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -464,7 +464,7 @@ static int fv_vssd_to_domain(CMPIInstance *inst, { int ret = 1; int retr; - const char *val; + const char *val = NULL; const char *domtype = NULL; const char *ostype = "hvm"; struct capabilities *capsinfo = NULL; @@ -494,6 +494,7 @@ static int fv_vssd_to_domain(CMPIInstance *inst, } free(domain->os_info.fv.arch); + domain->os_info.fv.arch = NULL; retr = cu_get_str_prop(inst, "Arch", &val); if (retr != CMPI_RC_OK) { if (capsinfo != NULL) { /* set default */ @@ -506,6 +507,8 @@ static int fv_vssd_to_domain(CMPIInstance *inst, domain->os_info.fv.arch = strdup(val); free(domain->os_info.fv.machine); + domain->os_info.fv.machine = NULL; + val = NULL; retr = cu_get_str_prop(inst, "Machine", &val); if (retr != CMPI_RC_OK) { if (capsinfo != NULL && domtype != NULL) { /* set default */ @@ -1415,7 +1418,7 @@ static int parse_ip_address(const char *id, if (strstr(id, "[") != NULL) { /* its an ipv6 address */ ret = sscanf(id, "%a[^]]]:%as", &tmp_ip, &tmp_port); - if (tmp_ip != NULL) { + if (ret >= 1) { tmp_ip = realloc(tmp_ip, strlen(tmp_ip) + 2); if (tmp_ip == NULL) { ret = 0; @@ -2798,7 +2801,8 @@ static CMPIStatus update_system_settings(const CMPIContext *context, } if ((dominfo->uuid == NULL) || (STREQ(dominfo->uuid, ""))) { - dominfo->uuid = strdup(uuid); + dominfo->uuid = uuid; + uuid = NULL; } else if (!STREQ(uuid, dominfo->uuid)) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, @@ -2829,6 +2833,7 @@ static CMPIStatus update_system_settings(const CMPIContext *context, } out: + free(uuid); free(xml); virDomainFree(dom); virConnectClose(conn); -- 1.8.4.2 From jferlan at redhat.com Wed Jan 22 19:30:33 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 22 Jan 2014 14:30:33 -0500 Subject: [Libvirt-cim] [PATCH 2/6] libxkutil:pool_parsing: Coverity cleanups In-Reply-To: <1390419037-10777-1-git-send-email-jferlan@redhat.com> References: <1390419037-10777-1-git-send-email-jferlan@redhat.com> Message-ID: <1390419037-10777-3-git-send-email-jferlan@redhat.com> A new version of Coverity found a number of issues: get_pool_from_xml(): FORWARD_NULL parse_disk_pool(): RESOURCE_LEAK - If parse_disk_pool() returned name == NULL, then the strdup() of name into pool->id would dereference the NULL pointer leading to a segfault. Furthermore parse_disk_pool() had a few issues. First the 'type_str' could be NULL, so that needs to be checked. Second, 'type_str' was never free()'d (the get_attr_value returns a strdup()'d value). Realizing all that resulted in a few extra changes to not strdup() a value that we strdup()'d Eventually get_pool_from_xml() will return to get_disk_pool() which returns to diskpool_set_capacity() or _new_volume_template() which both error out when return value != 0 (although, I did change the latter to be more explicit and match the former). Finally, even though the parsing of the element will only ever have one "name" value - Coverity doesn't know that, so as a benign fix be sure to not overwrite 'name' if "name" isn't already set. Signed-off-by: John Ferlan --- libxkutil/pool_parsing.c | 39 ++++++++++++++++++----------------- src/Virt_SettingsDefineCapabilities.c | 2 +- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/libxkutil/pool_parsing.c b/libxkutil/pool_parsing.c index 922ff32..80bd4ca 100644 --- a/libxkutil/pool_parsing.c +++ b/libxkutil/pool_parsing.c @@ -194,15 +194,17 @@ char *get_disk_pool_type(uint16_t type) } -static const char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool) +static char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool) { xmlNode **nodes = nsv->nodeTab; xmlNode *child; - const char *type_str = NULL; - const char *name = NULL; + char *type_str = NULL; + char *name = NULL; int type = 0; type_str = get_attr_value(nodes[0], "type"); + if (type_str == NULL) + return NULL; if (STREQC(type_str, "dir")) type = DISK_POOL_DIR; @@ -220,12 +222,15 @@ static const char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool) type = DISK_POOL_SCSI; else type = DISK_POOL_UNKNOWN; + free(type_str); pool->pool_type = type; - + for (child = nodes[0]->children; child != NULL; child = child->next) { - if (XSTREQ(child->name, "name")) { + if (XSTREQ(child->name, "name") && name == NULL) { name = get_node_content(child); + if (name == NULL) + return NULL; } else if (XSTREQ(child->name, "target")) parse_disk_target(child, pool); else if (XSTREQ(child->name, "source")) @@ -238,14 +243,18 @@ static const char *parse_disk_pool(xmlNodeSet *nsv, struct disk_pool *pool) int get_pool_from_xml(const char *xml, struct virt_pool *pool, int type) { int len; - int ret = 0; + int ret = 1; xmlDoc *xmldoc; xmlXPathContext *xpathctx; xmlXPathObject *xpathobj; const xmlChar *xpathstr = (xmlChar *)"/pool"; - const char *name; CU_DEBUG("Pool XML : %s", xml); + + /* FIXME: Add support for parsing network pools */ + if (type == CIM_RES_TYPE_NET) + return 0; + len = strlen(xml) + 1; if ((xmldoc = xmlParseMemory(xml, len)) == NULL) @@ -257,22 +266,14 @@ int get_pool_from_xml(const char *xml, struct virt_pool *pool, int type) if ((xpathobj = xmlXPathEvalExpression(xpathstr, xpathctx)) == NULL) goto err3; - /* FIXME: Add support for parsing network pools */ - if (type == CIM_RES_TYPE_NET) { - ret = 0; - goto err1; - } - memset(pool, 0, sizeof(*pool)); - pool->type = CIM_RES_TYPE_DISK; - name = parse_disk_pool(xpathobj->nodesetval, - &(pool)->pool_info.disk); - if (name == NULL) + pool->type = CIM_RES_TYPE_DISK; + pool->id = parse_disk_pool(xpathobj->nodesetval, + &(pool)->pool_info.disk); + if (pool->id != NULL) ret = 0; - pool->id = strdup(name); - xmlXPathFreeObject(xpathobj); err3: xmlXPathFreeContext(xpathctx); diff --git a/src/Virt_SettingsDefineCapabilities.c b/src/Virt_SettingsDefineCapabilities.c index fe16e3f..756e46b 100644 --- a/src/Virt_SettingsDefineCapabilities.c +++ b/src/Virt_SettingsDefineCapabilities.c @@ -1376,7 +1376,7 @@ static CMPIStatus _new_volume_template(const CMPIObjectPath *ref, } ret = get_disk_pool(poolptr, &pool); - if (ret == 1) { + if (ret != 0) { virt_set_status(_BROKER, &s, CMPI_RC_ERR_FAILED, virStoragePoolGetConnect(poolptr), -- 1.8.4.2 From jferlan at redhat.com Wed Jan 22 19:30:34 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 22 Jan 2014 14:30:34 -0500 Subject: [Libvirt-cim] [PATCH 3/6] libxkutil:device_parsing: Coverity cleanups In-Reply-To: <1390419037-10777-1-git-send-email-jferlan@redhat.com> References: <1390419037-10777-1-git-send-email-jferlan@redhat.com> Message-ID: <1390419037-10777-4-git-send-email-jferlan@redhat.com> A new version of Coverity found a number of issues: parse_os(): RESOURCE_LEAK - A benign issue due to using a for() loop in order to process the XML fields. Although it's not possible to have a second entry with the same text, Coverity doesn't know that so flagged each of the get_attr_value() calls with a possible overwrite of allocated memory. In order to "fix' that - just check for each being NULL prior to the setting - a benign fix that shuts Coverity up - A real issue was found - the 'loader' variable wasn't free()'d parse_console_device(): RESOURCE_LEAK - A benign issue due to using a for() loop in order to process the XML fields results in 'target_port_ID' and 'udp_source_mode' being flagged for possible overwrites. For the 'udp_source_mode' changed the code to declare, use, free only within the scope of the case. Signed-off-by: John Ferlan --- libxkutil/device_parsing.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index 56e39c7..4dd9e58 100644 --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -853,7 +853,6 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) struct console_device *cdev = NULL; char *source_type_str = NULL; char *target_port_ID = NULL; - char *udp_source_mode = NULL; xmlNode *child = NULL; @@ -875,7 +874,7 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) CU_DEBUG("console device type ID = %d", cdev->source_type); for (child = node->children; child != NULL; child = child->next) { - if (XSTREQ(child->name, "target")) { + if (XSTREQ(child->name, "target") && target_port_ID == NULL) { cdev->target_type = get_attr_value(child, "type"); CU_DEBUG("Console device target type = '%s'", cdev->target_type ? : "NULL"); @@ -910,7 +909,9 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) get_attr_value(child, "path"); break; case CIM_CHARDEV_SOURCE_TYPE_UDP: - udp_source_mode = get_attr_value(child, "mode"); + { + char *udp_source_mode = get_attr_value(child, + "mode"); if (udp_source_mode == NULL) goto err; if (STREQC(udp_source_mode, "bind")) { @@ -925,10 +926,13 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) get_attr_value(child, "service"); } else { CU_DEBUG("unknown udp mode: %s", - udp_source_mode ? : "NULL"); + udp_source_mode); + free(udp_source_mode); goto err; } + free(udp_source_mode); break; + } case CIM_CHARDEV_SOURCE_TYPE_TCP: cdev->source_dev.tcp.mode = get_attr_value(child, "mode"); @@ -965,14 +969,12 @@ static int parse_console_device(xmlNode *node, struct virt_device **vdevs) *vdevs = vdev; free(source_type_str); free(target_port_ID); - free(udp_source_mode); return 1; err: free(source_type_str); free(target_port_ID); - free(udp_source_mode); cleanup_console_device(cdev); free(vdev); @@ -1500,33 +1502,35 @@ static int parse_os(struct domain *dominfo, xmlNode *os) for (child = os->children; child != NULL; child = child->next) { if (XSTREQ(child->name, "type")) { STRPROP(dominfo, os_info.pv.type, child); - arch = get_attr_value(child, "arch"); - machine = get_attr_value(child, "machine"); - } else if (XSTREQ(child->name, "kernel")) + if (arch == NULL) + arch = get_attr_value(child, "arch"); + if (machine == NULL) + machine = get_attr_value(child, "machine"); + } else if (XSTREQ(child->name, "kernel") && kernel == NULL) kernel = get_node_content(child); - else if (XSTREQ(child->name, "initrd")) + else if (XSTREQ(child->name, "initrd") && initrd == NULL) initrd = get_node_content(child); - else if (XSTREQ(child->name, "cmdline")) + else if (XSTREQ(child->name, "cmdline") && cmdline == NULL) cmdline = get_node_content(child); - else if (XSTREQ(child->name, "loader")) + else if (XSTREQ(child->name, "loader") && loader == NULL) loader = get_node_content(child); - else if (XSTREQ(child->name, "boot")) { + else if (XSTREQ(child->name, "boot") && boot == NULL) { char **tmp_list = NULL; - tmp_list = (char **)realloc(blist, - (bl_size + 1) * + tmp_list = (char **)realloc(blist, + (bl_size + 1) * sizeof(char *)); if (tmp_list == NULL) { // Nothing you can do. Just go on. CU_DEBUG("Could not alloc space for " "boot device"); - continue; + continue; } blist = tmp_list; - + blist[bl_size] = get_attr_value(child, "dev"); bl_size++; - } else if (XSTREQ(child->name, "init")) + } else if (XSTREQ(child->name, "init") && init == NULL) init = get_node_content(child); } @@ -1580,6 +1584,7 @@ static int parse_os(struct domain *dominfo, xmlNode *os) free(kernel); free(initrd); free(cmdline); + free(loader); free(boot); free(init); cleanup_bootlist(blist, bl_size); -- 1.8.4.2 From jferlan at redhat.com Wed Jan 22 19:30:35 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 22 Jan 2014 14:30:35 -0500 Subject: [Libvirt-cim] [PATCH 4/6] libxkutil/xml_parse_test: Coverity cleanup In-Reply-To: <1390419037-10777-1-git-send-email-jferlan@redhat.com> References: <1390419037-10777-1-git-send-email-jferlan@redhat.com> Message-ID: <1390419037-10777-5-git-send-email-jferlan@redhat.com> A new version of Coverity found: print_domxml(): RESOURCE_LEAK - The 'xml' variable needs to be free()'d Signed-off-by: John Ferlan --- libxkutil/xml_parse_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libxkutil/xml_parse_test.c b/libxkutil/xml_parse_test.c index 374bcf6..303880d 100644 --- a/libxkutil/xml_parse_test.c +++ b/libxkutil/xml_parse_test.c @@ -192,6 +192,7 @@ static void print_domxml(struct domain *dominfo, printf("Failed to create system XML\n"); else printf("%s\n", xml); + free(xml); } static char *read_from_file(FILE *file) -- 1.8.4.2 From jferlan at redhat.com Wed Jan 22 19:30:36 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 22 Jan 2014 14:30:36 -0500 Subject: [Libvirt-cim] [PATCH 5/6] RAFP: Coverity cleanup In-Reply-To: <1390419037-10777-1-git-send-email-jferlan@redhat.com> References: <1390419037-10777-1-git-send-email-jferlan@redhat.com> Message-ID: <1390419037-10777-6-git-send-email-jferlan@redhat.com> A new version of Coverity found: filter_by_pool(): RESOURCE_LEAK - Because the code is run within a for() loop Coverity complains that the returned 'poolid' is not free'd during each pass through the loop. So even though it may not be fetched again, just free() and reinitialize 'poolid' after usage Signed-off-by: John Ferlan --- src/Virt_ResourceAllocationFromPool.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Virt_ResourceAllocationFromPool.c b/src/Virt_ResourceAllocationFromPool.c index 7088900..7bee729 100644 --- a/src/Virt_ResourceAllocationFromPool.c +++ b/src/Virt_ResourceAllocationFromPool.c @@ -120,9 +120,12 @@ static int filter_by_pool(struct inst_list *dest, poolid = pool_member_of(_BROKER, CLASSNAME(op), type, rasd_id); if ((poolid != NULL) && STREQ(poolid, _poolid)) inst_list_add(dest, inst); - } - free(poolid); + if (poolid != NULL) { + free(poolid); + poolid = NULL; + } + } return dest->cur; } -- 1.8.4.2 From jferlan at redhat.com Wed Jan 22 19:30:37 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 22 Jan 2014 14:30:37 -0500 Subject: [Libvirt-cim] [PATCH 6/6] EAFP: Coverity cleanup In-Reply-To: <1390419037-10777-1-git-send-email-jferlan@redhat.com> References: <1390419037-10777-1-git-send-email-jferlan@redhat.com> Message-ID: <1390419037-10777-7-git-send-email-jferlan@redhat.com> A new version of Coverity found: get_dev_from_pool(): RESOURCE_LEAK - Because the code is run within a for() loop Coverity complains that the returned 'poolid' is not free'd during each pass through the loop. So even though it may not be fetched again, just free() and reinitialize 'poolid' after usage Signed-off-by: John Ferlan --- src/Virt_ElementAllocatedFromPool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Virt_ElementAllocatedFromPool.c b/src/Virt_ElementAllocatedFromPool.c index 03d856a..2c2f2d1 100644 --- a/src/Virt_ElementAllocatedFromPool.c +++ b/src/Virt_ElementAllocatedFromPool.c @@ -124,10 +124,14 @@ static CMPIStatus get_dev_from_pool(const CMPIObjectPath *ref, poolid = pool_member_of(_BROKER, cn, type, dev_id); if (poolid && STREQ(poolid, _poolid)) inst_list_add(list, inst); + + if (poolid) { + free(poolid); + poolid = NULL; + } } out: - free(poolid); inst_list_free(&tmp); return s; -- 1.8.4.2 From jferlan at redhat.com Wed Jan 22 21:21:40 2014 From: jferlan at redhat.com (John Ferlan) Date: Wed, 22 Jan 2014 16:21:40 -0500 Subject: [Libvirt-cim] [PATCH 7/6] Adjust sscanf format string In-Reply-To: <1390419037-10777-1-git-send-email-jferlan@redhat.com> References: <1390419037-10777-1-git-send-email-jferlan@redhat.com> Message-ID: <1390425700-17121-1-git-send-email-jferlan@redhat.com> Currently the sscanf() calls use "%as" or "%a[" in order to allocate and return strings for read fields. It was pointed out to me that this is an older and non-portable method. Instead the "%ms" or "%m[" should be used. Signed-off-by: John Ferlan --- libxkutil/acl_parsing.c | 2 +- libxkutil/device_parsing.c | 2 +- libxkutil/misc_util.c | 2 +- src/Virt_ComputerSystemIndication.c | 2 +- src/Virt_Device.c | 6 +++--- src/Virt_DevicePool.c | 8 ++++---- src/Virt_SettingsDefineState.c | 2 +- src/Virt_VirtualSystemManagementService.c | 12 ++++++------ 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libxkutil/acl_parsing.c b/libxkutil/acl_parsing.c index 3de6a65..c368b99 100644 --- a/libxkutil/acl_parsing.c +++ b/libxkutil/acl_parsing.c @@ -666,7 +666,7 @@ int parse_rule_id(const char *rule_id, char **filter, int *index) if ((filter == NULL) || (index == NULL)) return 0; - ret = sscanf(rule_id, "%as[^:]:%u", filter, index); + ret = sscanf(rule_id, "%ms[^:]:%u", filter, index); if (ret != 2) { free(*filter); *filter = NULL; diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c index 4dd9e58..c9ae886 100644 --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -1463,7 +1463,7 @@ int parse_fq_devid(const char *devid, char **host, char **device) { int ret; - ret = sscanf(devid, "%a[^/]/%a[^\n]", host, device); + ret = sscanf(devid, "%m[^/]/%m[^\n]", host, device); if (ret != 2) { free(*host); free(*device); diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c index 2164dd0..6a54815 100644 --- a/libxkutil/misc_util.c +++ b/libxkutil/misc_util.c @@ -671,7 +671,7 @@ int parse_id(const char *id, char *tmp_pfx = NULL; char *tmp_name = NULL; - ret = sscanf(id, "%a[^:]:%a[^\n]", &tmp_pfx, &tmp_name); + ret = sscanf(id, "%m[^:]:%m[^\n]", &tmp_pfx, &tmp_name); if (ret != 2) { ret = 0; goto out; diff --git a/src/Virt_ComputerSystemIndication.c b/src/Virt_ComputerSystemIndication.c index 20c60bc..32bee97 100644 --- a/src/Virt_ComputerSystemIndication.c +++ b/src/Virt_ComputerSystemIndication.c @@ -382,7 +382,7 @@ static char *sys_name_from_xml(char *xml) goto out; } - rc = sscanf(tmp, "%a[^<]s", &name); + rc = sscanf(tmp, "%m[^<]s", &name); if (rc != 1) { name = NULL; } diff --git a/src/Virt_Device.c b/src/Virt_Device.c index b93e592..12ae6bd 100644 --- a/src/Virt_Device.c +++ b/src/Virt_Device.c @@ -675,7 +675,7 @@ static CMPIStatus return_enum_devices(const CMPIObjectPath *reference, s = enum_devices(_BROKER, reference, - NULL, + NULL, res_type_from_device_classname(CLASSNAME(reference)), &list); if (s.rc != CMPI_RC_OK) @@ -696,7 +696,7 @@ static int parse_devid(const char *devid, char **dom, char **dev) { int ret; - ret = sscanf(devid, "%a[^/]/%as", dom, dev); + ret = sscanf(devid, "%m[^/]/%ms", dom, dev); if (ret != 2) { free(*dom); free(*dev); @@ -711,7 +711,7 @@ static int proc_dev_list(uint64_t quantity, { int i; - *list = (struct virt_device *)calloc(quantity, + *list = (struct virt_device *)calloc(quantity, sizeof(struct virt_device)); for (i = 0; i < quantity; i++) { diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c index d6e51ba..aae7ed4 100644 --- a/src/Virt_DevicePool.c +++ b/src/Virt_DevicePool.c @@ -383,11 +383,11 @@ static bool _diskpool_is_member(virConnectPtr conn, pool_vol = virStoragePoolLookupByVolume(vol); if (vol != NULL) { - pool_name = virStoragePoolGetName(pool_vol); + pool_name = virStoragePoolGetName(pool_vol); if ((pool_name != NULL) && (STREQC(pool_name, pool->tag))) result = true; } - + out: CU_DEBUG("Image %s in pool %s: %s", file, @@ -405,7 +405,7 @@ static bool parse_diskpool_line(struct tmp_disk_pool *pool, { int ret; - ret = sscanf(line, "%as %as", &pool->tag, &pool->path); + ret = sscanf(line, "%ms %ms", &pool->tag, &pool->path); if (ret != 2) { free(pool->tag); free(pool->path); @@ -1610,7 +1610,7 @@ CMPIStatus get_pool_by_name(const CMPIBroker *broker, goto out; } - ret = sscanf(id, "%*[^/]/%a[^\n]", &poolid); + ret = sscanf(id, "%*[^/]/%m[^\n]", &poolid); if (ret != 1) { cu_statusf(broker, &s, CMPI_RC_ERR_NOT_FOUND, diff --git a/src/Virt_SettingsDefineState.c b/src/Virt_SettingsDefineState.c index be2ded5..c8cda97 100644 --- a/src/Virt_SettingsDefineState.c +++ b/src/Virt_SettingsDefineState.c @@ -298,7 +298,7 @@ static CMPIStatus vssd_to_vs(const CMPIObjectPath *ref, goto out; } - ret = sscanf(id, "%a[^:]:%as", &pfx, &name); + ret = sscanf(id, "%m[^:]:%ms", &pfx, &name); if (ret != 2) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c index b624d8c..d31e477 100644 --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -1330,7 +1330,7 @@ static int parse_console_address(const char *id, CU_DEBUG("Entering parse_console_address, address is %s", id); - ret = sscanf(id, "%a[^:]:%as", &tmp_path, &tmp_port); + ret = sscanf(id, "%m[^:]:%ms", &tmp_path, &tmp_port); if (ret != 2) { ret = 0; @@ -1366,10 +1366,10 @@ static int parse_sdl_address(const char *id, CU_DEBUG("Entering parse_sdl_address, address is %s", id); - ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display); + ret = sscanf(id, "%m[^:]:%ms", &tmp_xauth, &tmp_display); if (ret <= 0) { - ret = sscanf(id, ":%as", &tmp_display); + ret = sscanf(id, ":%ms", &tmp_display); if (ret <= 0) { if (STREQC(id, ":")) { /* do nothing, it is empty */ @@ -1417,7 +1417,7 @@ static int parse_ip_address(const char *id, CU_DEBUG("Entering parse_ip_address, address is %s", id); if (strstr(id, "[") != NULL) { /* its an ipv6 address */ - ret = sscanf(id, "%a[^]]]:%as", &tmp_ip, &tmp_port); + ret = sscanf(id, "%m[^]]]:%ms", &tmp_ip, &tmp_port); if (ret >= 1) { tmp_ip = realloc(tmp_ip, strlen(tmp_ip) + 2); if (tmp_ip == NULL) { @@ -1427,7 +1427,7 @@ static int parse_ip_address(const char *id, strcat(tmp_ip, "]"); } } else { - ret = sscanf(id, "%a[^:]:%as", &tmp_ip, &tmp_port); + ret = sscanf(id, "%m[^:]:%ms", &tmp_ip, &tmp_port); } /* ret == 2: address and port, ret == 1: address only */ @@ -1464,7 +1464,7 @@ static bool parse_console_url(const char *url, CU_DEBUG("Entering parse_console_url:'%s'", url); - if (sscanf(url,"%a[^:]://%as", &tmp_protocol, &tmp_address) != 2) + if (sscanf(url,"%m[^:]://%ms", &tmp_protocol, &tmp_address) != 2) goto out; if (parse_ip_address(tmp_address, host, port) < 1) -- 1.8.4.2 From bouabid.medamine at gmail.com Mon Jan 27 08:06:39 2014 From: bouabid.medamine at gmail.com (Bouabid Mohamed Amine) Date: Mon, 27 Jan 2014 09:06:39 +0100 Subject: [Libvirt-cim] libvirt-cim compil errors Message-ID: Hello, I have compile errors when installing libvirt-cim from sources on UBUNTU 13.10 (amd-64 platform) I am using openpegasus as cimom, and i installed libcmpiutil successfully Bellow are the errors i get after make command (i followed instructions on the website http://wiki.libvirt.org/page/Libvirt-cim_setup) ..... make[2]: Entering directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' CC Virt_VirtualSystemManagementService.lo Virt_VirtualSystemManagementService.c: In function '_update_resources_for': Virt_VirtualSystemManagementService.c:2936:17: warning: implicit declaration of function 'cu_merge_instances' [-Wimplicit-function-declaration] s = cu_merge_instances(rasd, orig_inst); ^ Virt_VirtualSystemManagementService.c:2936:19: error: incompatible types when assigning to type 'CMPIStatus' from type 'int' s = cu_merge_instances(rasd, orig_inst); ^ make[2]: *** [Virt_VirtualSystemManagementService.lo] Error 1 make[2]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3' make: *** [all] Error 2 ... PS: the following commands do not working: $ hg clone http://libvirt.org/hg/libcmpiutil/ $ hg clone http://libvirt.org/hg/libvirt-cim/ the server says : abort: HTTP Error 404: Not Found Best Regards Amine Bouabid -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmiao at redhat.com Mon Jan 27 08:19:54 2014 From: jmiao at redhat.com (Jincheng Miao) Date: Mon, 27 Jan 2014 16:19:54 +0800 Subject: [Libvirt-cim] libvirt-cim compil errors In-Reply-To: References: Message-ID: <52E616AA.4080200@redhat.com> On 01/27/2014 04:06 PM, Bouabid Mohamed Amine wrote: > Hello, > > I have compile errors when installing libvirt-cim from sources on UBUNTU > 13.10 (amd-64 platform) > > I am using openpegasus as cimom, and i installed libcmpiutil successfully > > Bellow are the errors i get after make command (i followed instructions on > the websitehttp://wiki.libvirt.org/page/Libvirt-cim_setup) > > ..... > make[2]: Entering directory > `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' > CC Virt_VirtualSystemManagementService.lo > Virt_VirtualSystemManagementService.c: In function '_update_resources_for': > Virt_VirtualSystemManagementService.c:2936:17: warning: implicit > declaration of function 'cu_merge_instances' > [-Wimplicit-function-declaration] > s = cu_merge_instances(rasd, orig_inst); > ^ > Virt_VirtualSystemManagementService.c:2936:19: error: incompatible types > when assigning to type 'CMPIStatus' from type 'int' > s = cu_merge_instances(rasd, orig_inst); > ^ > make[2]: *** [Virt_VirtualSystemManagementService.lo] Error 1 > make[2]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3' > make: *** [all] Error 2 > ... > > PS: > the following commands do not working: > > $ hg clonehttp://libvirt.org/hg/libcmpiutil/ > $ hg clonehttp://libvirt.org/hg/libvirt-cim/ > > the server says : > abort: HTTP Error 404: Not Found libvirt-cim is hosted by git server, check out: git clone git://libvirt.org/libvirt-cim.git > > Best Regards > Amine Bouabid > > > _______________________________________________ > 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 bouabid.medamine at gmail.com Mon Jan 27 08:41:58 2014 From: bouabid.medamine at gmail.com (Bouabid Amine) Date: Mon, 27 Jan 2014 09:41:58 +0100 Subject: [Libvirt-cim] libvirt-cim compil errors In-Reply-To: <52E616AA.4080200@redhat.com> References: <52E616AA.4080200@redhat.com> Message-ID: <52E61BD6.8090308@gmail.com> Thanks for the response, but i get again the same errors: Virt_VirtualSystemManagementService.c: In function '_update_resources_for': Virt_VirtualSystemManagementService.c:3292:17: warning: implicit declaration of function 'cu_merge_instances' [-Wimplicit-function-declaration] s = cu_merge_instances(rasd, orig_inst); ^ Virt_VirtualSystemManagementService.c:3292:19: error: incompatible types when assigning to type 'CMPIStatus' from type 'int' s = cu_merge_instances(rasd, orig_inst); ^ make[2]: *** [Virt_VirtualSystemManagementService.lo] Error 1 make[2]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim' make: *** [all] Error 2 On 27/01/2014 09:19, Jincheng Miao wrote: > On 01/27/2014 04:06 PM, Bouabid Mohamed Amine wrote: >> Hello, >> >> I have compile errors when installing libvirt-cim from sources on UBUNTU >> 13.10 (amd-64 platform) >> >> I am using openpegasus as cimom, and i installed libcmpiutil successfully >> >> Bellow are the errors i get after make command (i followed instructions on >> the websitehttp://wiki.libvirt.org/page/Libvirt-cim_setup) >> >> ..... >> make[2]: Entering directory >> `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' >> CC Virt_VirtualSystemManagementService.lo >> Virt_VirtualSystemManagementService.c: In function '_update_resources_for': >> Virt_VirtualSystemManagementService.c:2936:17: warning: implicit >> declaration of function 'cu_merge_instances' >> [-Wimplicit-function-declaration] >> s = cu_merge_instances(rasd, orig_inst); >> ^ >> Virt_VirtualSystemManagementService.c:2936:19: error: incompatible types >> when assigning to type 'CMPIStatus' from type 'int' >> s = cu_merge_instances(rasd, orig_inst); >> ^ >> make[2]: *** [Virt_VirtualSystemManagementService.lo] Error 1 >> make[2]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' >> make[1]: *** [all-recursive] Error 1 >> make[1]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3' >> make: *** [all] Error 2 >> ... >> >> PS: >> the following commands do not working: >> >> $ hg clonehttp://libvirt.org/hg/libcmpiutil/ >> $ hg clonehttp://libvirt.org/hg/libvirt-cim/ >> >> the server says : >> abort: HTTP Error 404: Not Found > > libvirt-cim is hosted by git server, check out: > git clone git://libvirt.org/libvirt-cim.git > >> Best Regards >> Amine Bouabid >> >> >> _______________________________________________ >> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmiao at redhat.com Mon Jan 27 09:20:57 2014 From: jmiao at redhat.com (Jincheng Miao) Date: Mon, 27 Jan 2014 17:20:57 +0800 Subject: [Libvirt-cim] libvirt-cim compil errors In-Reply-To: <52E61BD6.8090308@gmail.com> References: <52E616AA.4080200@redhat.com> <52E61BD6.8090308@gmail.com> Message-ID: <52E624F9.3080708@redhat.com> On 01/27/2014 04:41 PM, Bouabid Amine wrote: > Thanks for the response, but i get again the same errors: > > Virt_VirtualSystemManagementService.c: In function > '_update_resources_for': > Virt_VirtualSystemManagementService.c:3292:17: warning: implicit > declaration of function 'cu_merge_instances' > [-Wimplicit-function-declaration] > s = cu_merge_instances(rasd, orig_inst); > ^ > Virt_VirtualSystemManagementService.c:3292:19: error: incompatible > types when assigning to type 'CMPIStatus' from type 'int' > s = cu_merge_instances(rasd, orig_inst); > ^ > make[2]: *** [Virt_VirtualSystemManagementService.lo] Error 1 > make[2]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim/src' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim' > make: *** [all] Error 2 I am not sure about this, do you install your new built libcmpiutil? This cu_merge_instances() will return CMPIStatus, but the error seems it return int. > > > On 27/01/2014 09:19, Jincheng Miao wrote: >> On 01/27/2014 04:06 PM, Bouabid Mohamed Amine wrote: >>> Hello, >>> >>> I have compile errors when installing libvirt-cim from sources on UBUNTU >>> 13.10 (amd-64 platform) >>> >>> I am using openpegasus as cimom, and i installed libcmpiutil successfully >>> >>> Bellow are the errors i get after make command (i followed instructions on >>> the websitehttp://wiki.libvirt.org/page/Libvirt-cim_setup) >>> >>> ..... >>> make[2]: Entering directory >>> `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' >>> CC Virt_VirtualSystemManagementService.lo >>> Virt_VirtualSystemManagementService.c: In function '_update_resources_for': >>> Virt_VirtualSystemManagementService.c:2936:17: warning: implicit >>> declaration of function 'cu_merge_instances' >>> [-Wimplicit-function-declaration] >>> s = cu_merge_instances(rasd, orig_inst); >>> ^ >>> Virt_VirtualSystemManagementService.c:2936:19: error: incompatible types >>> when assigning to type 'CMPIStatus' from type 'int' >>> s = cu_merge_instances(rasd, orig_inst); >>> ^ >>> make[2]: *** [Virt_VirtualSystemManagementService.lo] Error 1 >>> make[2]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' >>> make[1]: *** [all-recursive] Error 1 >>> make[1]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3' >>> make: *** [all] Error 2 >>> ... >>> >>> PS: >>> the following commands do not working: >>> >>> $ hg clonehttp://libvirt.org/hg/libcmpiutil/ >>> $ hg clonehttp://libvirt.org/hg/libvirt-cim/ >>> >>> the server says : >>> abort: HTTP Error 404: Not Found >> >> libvirt-cim is hosted by git server, check out: >> git clone git://libvirt.org/libvirt-cim.git >> >>> Best Regards >>> Amine Bouabid >>> >>> >>> _______________________________________________ >>> 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 > > > > _______________________________________________ > 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 bouabid.medamine at gmail.com Mon Jan 27 10:55:10 2014 From: bouabid.medamine at gmail.com (Bouabid Amine) Date: Mon, 27 Jan 2014 11:55:10 +0100 Subject: [Libvirt-cim] libvirt-cim compil errors In-Reply-To: <52E624F9.3080708@redhat.com> References: <52E616AA.4080200@redhat.com> <52E61BD6.8090308@gmail.com> <52E624F9.3080708@redhat.com> Message-ID: <52E63B0E.6030305@gmail.com> Thank you again, I have an old version of libcmpiutil headers installed, The compile process is working fine, I have to create a symbolic link of the /usr/lib64/include/libcmpiutil to /usr/local/include/libncmpiutil default headers dirctory search Best regards Amine Bouabid On 27/01/2014 10:20, Jincheng Miao wrote: > On 01/27/2014 04:41 PM, Bouabid Amine wrote: >> Thanks for the response, but i get again the same errors: >> >> Virt_VirtualSystemManagementService.c: In function >> '_update_resources_for': >> Virt_VirtualSystemManagementService.c:3292:17: warning: implicit >> declaration of function 'cu_merge_instances' >> [-Wimplicit-function-declaration] >> s = cu_merge_instances(rasd, orig_inst); >> ^ >> Virt_VirtualSystemManagementService.c:3292:19: error: incompatible >> types when assigning to type 'CMPIStatus' from type 'int' >> s = cu_merge_instances(rasd, orig_inst); >> ^ >> make[2]: *** [Virt_VirtualSystemManagementService.lo] Error 1 >> make[2]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim/src' >> make[1]: *** [all-recursive] Error 1 >> make[1]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim' >> make: *** [all] Error 2 > > I am not sure about this, do you install your new built libcmpiutil? > This cu_merge_instances() > will return CMPIStatus, but the error seems it return int. > >> >> >> On 27/01/2014 09:19, Jincheng Miao wrote: >>> On 01/27/2014 04:06 PM, Bouabid Mohamed Amine wrote: >>>> Hello, >>>> >>>> I have compile errors when installing libvirt-cim from sources on UBUNTU >>>> 13.10 (amd-64 platform) >>>> >>>> I am using openpegasus as cimom, and i installed libcmpiutil successfully >>>> >>>> Bellow are the errors i get after make command (i followed instructions on >>>> the websitehttp://wiki.libvirt.org/page/Libvirt-cim_setup) >>>> >>>> ..... >>>> make[2]: Entering directory >>>> `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' >>>> CC Virt_VirtualSystemManagementService.lo >>>> Virt_VirtualSystemManagementService.c: In function '_update_resources_for': >>>> Virt_VirtualSystemManagementService.c:2936:17: warning: implicit >>>> declaration of function 'cu_merge_instances' >>>> [-Wimplicit-function-declaration] >>>> s = cu_merge_instances(rasd, orig_inst); >>>> ^ >>>> Virt_VirtualSystemManagementService.c:2936:19: error: incompatible types >>>> when assigning to type 'CMPIStatus' from type 'int' >>>> s = cu_merge_instances(rasd, orig_inst); >>>> ^ >>>> make[2]: *** [Virt_VirtualSystemManagementService.lo] Error 1 >>>> make[2]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' >>>> make[1]: *** [all-recursive] Error 1 >>>> make[1]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3' >>>> make: *** [all] Error 2 >>>> ... >>>> >>>> PS: >>>> the following commands do not working: >>>> >>>> $ hg clonehttp://libvirt.org/hg/libcmpiutil/ >>>> $ hg clonehttp://libvirt.org/hg/libvirt-cim/ >>>> >>>> the server says : >>>> abort: HTTP Error 404: Not Found >>> >>> libvirt-cim is hosted by git server, check out: >>> git clone git://libvirt.org/libvirt-cim.git >>> >>>> Best Regards >>>> Amine Bouabid >>>> >>>> >>>> _______________________________________________ >>>> 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 >> >> >> >> _______________________________________________ >> 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From bouabid.medamine at gmail.com Mon Jan 27 11:04:45 2014 From: bouabid.medamine at gmail.com (Bouabid Amine) Date: Mon, 27 Jan 2014 12:04:45 +0100 Subject: [Libvirt-cim] libvirt-cim libvirt versions compatility In-Reply-To: <52E624F9.3080708@redhat.com> References: <52E616AA.4080200@redhat.com> <52E61BD6.8090308@gmail.com> <52E624F9.3080708@redhat.com> Message-ID: <52E63D4D.4070009@gmail.com> Hello, I installed libvirt from UBUNTU repository (using apt-get command) version: 1.1.1-0ubuntu8 And i just installed libvirt-cim from sources, is there a risk of incompatibility between the two ? Best Regards From jferlan at redhat.com Mon Jan 27 11:30:16 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 27 Jan 2014 06:30:16 -0500 Subject: [Libvirt-cim] libvirt-cim compil errors In-Reply-To: References: Message-ID: <52E64348.1030504@redhat.com> Once you have things working... patches are always welcome! Updating the web pages has been on a todo list of mine for a while, but it's never reached the top of the list. As for your install question - how did you 'install' your built version of libvirt-cim? Via the 'make install'? or from a built rpm? John From bouabid.medamine at gmail.com Mon Jan 27 12:31:48 2014 From: bouabid.medamine at gmail.com (Bouabid Amine) Date: Mon, 27 Jan 2014 13:31:48 +0100 Subject: [Libvirt-cim] libvirt-cim compil errors In-Reply-To: <52E64348.1030504@redhat.com> References: <52E64348.1030504@redhat.com> Message-ID: <52E651B4.1070509@gmail.com> Ok, I installed libvirt from built APT (my machine is under ubuntu 13.10) Amine Bouabid On 27/01/2014 12:30, John Ferlan wrote: > Once you have things working... patches are always welcome! > > Updating the web pages has been on a todo list of mine for a while, but > it's never reached the top of the list. > > As for your install question - how did you 'install' your built version > of libvirt-cim? Via the 'make install'? or from a built rpm? > > John > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim From jferlan at redhat.com Mon Jan 27 15:48:58 2014 From: jferlan at redhat.com (John Ferlan) Date: Mon, 27 Jan 2014 10:48:58 -0500 Subject: [Libvirt-cim] libvirt-cim compil errors In-Reply-To: <52E651B4.1070509@gmail.com> References: <52E64348.1030504@redhat.com> <52E651B4.1070509@gmail.com> Message-ID: <52E67FEA.90407@redhat.com> On 01/27/2014 07:31 AM, Bouabid Amine wrote: > Ok, > I installed libvirt from built APT (my machine is under ubuntu 13.10) > Amine Bouabid > On 27/01/2014 12:30, John Ferlan wrote: >> Once you have things working... patches are always welcome! >> >> Updating the web pages has been on a todo list of mine for a while, but >> it's never reached the top of the list. >> >> As for your install question - how did you 'install' your built version >> of libvirt-cim? Via the 'make install'? or from a built rpm? >> I'm not familiar with apt, but I think you should be OK - that is the rpm (and I assume apt) process will replace the existing installation with the new one completely and restart the tog-pegasus server. I wasn't as confident the 'make install' processing would do all the right steps. In my Fedora environment I will use make rpm, then remove the existing via rpm -e libvirt-cim, and replace with the new via yum install . I do this quite frequently when I'm making changes/adjustments to the code without bumping version numbers in the libvirt-cim.spec file. John From bouabid at dtri.cerist.dz Sun Jan 26 08:00:12 2014 From: bouabid at dtri.cerist.dz (bouabid at dtri.cerist.dz) Date: Sun, 26 Jan 2014 09:00:12 +0100 (CET) Subject: [Libvirt-cim] errors when compilling libvirt-cim In-Reply-To: <1390425700-17121-1-git-send-email-jferlan@redhat.com> References: <1390419037-10777-1-git-send-email-jferlan@redhat.com> <1390425700-17121-1-git-send-email-jferlan@redhat.com> Message-ID: <55535.193.194.64.146.1390723212.squirrel@dtri.cerist.dz> Hello, I have compile errors when installing libvirt-cim from sources on UBUNTU 13.10 (amd-64 plateform) I am using openpegasus as cimom, and i installed libcmpiutil successfully Bellow are the erros i get after make command (i followed instructions on the website http://wiki.libvirt.org/page/Libvirt-cim_setup) ..... make[2]: Entering directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' CC Virt_VirtualSystemManagementService.lo Virt_VirtualSystemManagementService.c: In function '_update_resources_for': Virt_VirtualSystemManagementService.c:2936:17: warning: implicit declaration of function 'cu_merge_instances' [-Wimplicit-function-declaration] s = cu_merge_instances(rasd, orig_inst); ^ Virt_VirtualSystemManagementService.c:2936:19: error: incompatible types when assigning to type 'CMPIStatus' from type 'int' s = cu_merge_instances(rasd, orig_inst); ^ make[2]: *** [Virt_VirtualSystemManagementService.lo] Error 1 make[2]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/local/src/libvirt-cim/libvirt-cim-0.6.3' make: *** [all] Error 2 ... PS: the following commands do not working: $ hg clone http://libvirt.org/hg/libcmpiutil/ $ hg clone http://libvirt.org/hg/libvirt-cim/ the server says : abort: HTTP Error 404: Not Found Best Regards Amine Bouabid From bouabid.medamine at gmail.com Wed Jan 29 15:15:07 2014 From: bouabid.medamine at gmail.com (Bouabid Amine) Date: Wed, 29 Jan 2014 16:15:07 +0100 Subject: [Libvirt-cim] cimtest errors In-Reply-To: <52E67FEA.90407@redhat.com> References: <52E64348.1030504@redhat.com> <52E651B4.1070509@gmail.com> <52E67FEA.90407@redhat.com> Message-ID: <52E91AFB.6080003@gmail.com> Hello, I succeeded to install libvirt-cim and i verified this using some wbemcli requests (i am using the latest GITHUB version) I am testing now libvirt-cim using cimtest and i get errors like this: -------------------------------------------------------------------------------------------------------------------------- #:/usr/local/src/libvirt/cimtest# ./runtests libvirt-cim -g ComputerSystem -t 03_defineVS.py Starting test suite: libvirt-cim Testing Xen hypervisor -------------------------------------------------------------------- ComputerSystem - 03_defineVS.py: FAIL ERROR - Got CIM error CIM_ERR_FAILED: Unable to parse embedded object with return code 1 ERROR - Failed to define a domain with the name domU1 from virsh InvokeMethod(DefineSystem): CIM_ERR_FAILED: Unable to parse embedded object -------------------------------------------------------------------- Unable to determine hypervisior version -------------------------------------------------------------------------------------------------------------------------- Actually i am interested in using libvirt-cim to manage VMs life cycle (define, create, destroy etc.) Best regards Amine Bouabid From bouabid.medamine at gmail.com Thu Jan 30 08:40:39 2014 From: bouabid.medamine at gmail.com (Bouabid Mohamed Amine) Date: Thu, 30 Jan 2014 09:40:39 +0100 Subject: [Libvirt-cim] How LIBVIRT-CIM actually works Message-ID: Hello, I am a CIM developer and i am interested in LIBVIRT-CIM as a foundation for a futur work, so i have some questions about its design: How the VMs' life cycle methods are mapped with libvirt API? i mean the methods of the class CIM_VirtualSystemManagementService (DefineSystem, DestroySystem, ModifyResourceSettings, ModifySystemSettings, RemoveResourceSettings) What is the relation between the command wirsh and its XML description with the classes CIM_VirtualSystemSettingData, CIM_ResourceAllocationSettingData ? Is the libvirt-cim provider invoking the virsh command ? Thanks in advance Amine Bouabid -------------- next part -------------- An HTML attachment was scrubbed... URL: From bouabid.medamine at gmail.com Thu Jan 30 08:52:55 2014 From: bouabid.medamine at gmail.com (Bouabid Mohamed Amine) Date: Thu, 30 Jan 2014 09:52:55 +0100 Subject: [Libvirt-cim] cimtest errors In-Reply-To: <52E91AFB.6080003@gmail.com> References: <52E64348.1030504@redhat.com> <52E651B4.1070509@gmail.com> <52E67FEA.90407@redhat.com> <52E91AFB.6080003@gmail.com> Message-ID: Hello, Please do not consider my last mail, th problem was in my libvirt-cim installation Now cimtest works fine fore me Best regards Amine Bouabid On Wed, Jan 29, 2014 at 4:15 PM, Bouabid Amine wrote: > Hello, > > I succeeded to install libvirt-cim and i verified this using some wbemcli > requests (i am using the latest GITHUB version) > > I am testing now libvirt-cim using cimtest and i get errors like this: > > ------------------------------------------------------------ > -------------------------------------------------------------- > #:/usr/local/src/libvirt/cimtest# ./runtests libvirt-cim -g > ComputerSystem -t 03_defineVS.py > Starting test suite: libvirt-cim > > Testing Xen hypervisor > -------------------------------------------------------------------- > ComputerSystem - 03_defineVS.py: FAIL > ERROR - Got CIM error CIM_ERR_FAILED: Unable to parse embedded object > with return code 1 > ERROR - Failed to define a domain with the name domU1 from virsh > InvokeMethod(DefineSystem): CIM_ERR_FAILED: Unable to parse embedded object > -------------------------------------------------------------------- > > > Unable to determine hypervisior version > ------------------------------------------------------------ > -------------------------------------------------------------- > > Actually i am interested in using libvirt-cim to manage VMs life cycle > (define, create, destroy etc.) > > Best regards > > Amine Bouabid > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lagarcia at linux.vnet.ibm.com Thu Jan 30 17:39:22 2014 From: lagarcia at linux.vnet.ibm.com (=?ISO-8859-1?Q?Leonardo_Augusto_Guimar=E3es_Garcia?=) Date: Thu, 30 Jan 2014 15:39:22 -0200 Subject: [Libvirt-cim] How LIBVIRT-CIM actually works In-Reply-To: References: Message-ID: <52EA8E4A.1070608@linux.vnet.ibm.com> Hi Amine, On 01/30/2014 06:40 AM, Bouabid Mohamed Amine wrote: > Hello, > > I am a CIM developer and i am interested in LIBVIRT-CIM as a > foundation for a futur work, so i have some questions about its design: > > How the VMs' life cycle methods are mapped with libvirt API? i mean > the methods of the class CIM_VirtualSystemManagementService > (DefineSystem, DestroySystem, ModifyResourceSettings, > ModifySystemSettings, RemoveResourceSettings) > > What is the relation between the command wirsh and its XML description > with the classes CIM_VirtualSystemSettingData, > CIM_ResourceAllocationSettingData ? I am not a libvirt-cim expert so I don't know the answer for your above questions... > > Is the libvirt-cim provider invoking the virsh command ? No, libvirt-cim is not invoking virsh in the backend. It is directly invoking libvirt library API. virsh executable invokes the livbvirt library API as well. Best regards, Leonardo Garcia > > Thanks in advance > > Amine Bouabid > > > > > > > _______________________________________________ > 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 jferlan at redhat.com Fri Jan 31 19:52:31 2014 From: jferlan at redhat.com (John Ferlan) Date: Fri, 31 Jan 2014 14:52:31 -0500 Subject: [Libvirt-cim] How LIBVIRT-CIM actually works In-Reply-To: References: Message-ID: <52EBFEFF.1060709@redhat.com> On 01/30/2014 03:40 AM, Bouabid Mohamed Amine wrote: > Hello, > > I am a CIM developer and i am interested in LIBVIRT-CIM as a foundation > for a futur work, so i have some questions about its design: > > How the VMs' life cycle methods are mapped with libvirt API? i mean the > methods of the class CIM_VirtualSystemManagementService (DefineSystem, > DestroySystem, ModifyResourceSettings, ModifySystemSettings, > RemoveResourceSettings) Suffice to say libvirt-cim hasn't been very active for a number of years now. You can look through the monthly archives if you want: http://www.redhat.com/archives/libvirt-cim/index.html As such, the libvirt-cim provider does not have as rich an XML parsing as virsh does since virsh is developed along with features/commands added to libvirt. Not keeping up causes numerous bugs along the way where new XML is introduced, but libvirt-cim doesn't know/recognize it so when it goes to write out the XML again it may not "keep" the newer XML. There were some patches posted last month to try and help that situation out, but they haven't been accepted. You are certainly welcome to look at the code and provide patches. I assume some amount of git and code reading experience: git clone git://libvirt.org/libvirt-cim.git libvirt-cim I then use things like 'cscope' in order to peruse sources. Looking up "DefineSystem" brings me to the 'define_system()' API which calls 'create_system()', then connect_and_create()', and eventually 'virDomainDefineXML()'. Most API's end up calling some 'virDomain*()' or 'virConnect*()' API. Because the code is older and must build back to an older version of libvirt, some of the newer API's aren't utilized. There are instances in the code using LIBVIR_VERSION_NUMBER. > > What is the relation between the command wirsh and its XML description > with the classes CIM_VirtualSystemSettingData, > CIM_ResourceAllocationSettingData ? > No relationship with virsh at all. Is there something specific that virsh *dumpxml is providing that you're not seeing perhaps in either of the two classes you referenced? I'm assuming yes, but you have to be a bit more specific as the dartboard is large. > Is the libvirt-cim provider invoking the virsh command ? > As already been answered. Nope. virsh is a "CLI" command of sorts for libvirt. libvirt-cim is a "CLI" command of sorts for a CIM based application. I'm not the most proficient CIM developer and far from an expert. Currently activity is minimal with a few IBM folks still chipping away at mostly minor point changes. John