[libvirt] [PATCH] ESX: Fix memory leak in list handling functions.
by Matthias Bolte
If an error occurs between the allocation of an item and appending it
to the list, the item leaks. Free such orphaned items in error cases.
* src/esx/esx_vi.c: free orphaned items in error cases
---
src/esx/esx_vi.c | 24 ++++++++----------------
1 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index bcf110f..04860e2 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -959,28 +959,22 @@ esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
esxVI_AnyType_Free(&childAnyType);
- if (esxVI_AnyType_Deserialize(conn, childNode, &childAnyType) < 0) {
+ if (esxVI_AnyType_Deserialize(conn, childNode, &childAnyType) < 0 ||
+ castFromAnyTypeFunc(conn, childAnyType, &item) < 0 ||
+ esxVI_List_Append(conn, list, item) < 0) {
goto failure;
}
item = NULL;
-
- if (castFromAnyTypeFunc(conn, childAnyType, &item) < 0) {
- goto failure;
- }
-
- if (esxVI_List_Append(conn, list, item) < 0) {
- goto failure;
- }
}
-
cleanup:
esxVI_AnyType_Free(&childAnyType);
return result;
failure:
+ freeFunc(&item);
freeFunc(list);
result = -1;
@@ -1039,20 +1033,18 @@ esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node, esxVI_List **list,
goto failure;
}
- item = NULL;
-
- if (deserializeFunc(conn, node, &item) < 0) {
+ if (deserializeFunc(conn, node, &item) < 0 ||
+ esxVI_List_Append(conn, list, item) < 0) {
goto failure;
}
- if (esxVI_List_Append(conn, list, item) < 0) {
- goto failure;
- }
+ item = NULL;
}
return 0;
failure:
+ freeFunc(&item);
freeFunc(list);
return -1;
--
1.6.0.4
15 years
[libvirt] [PATCH 0/4] Support for SPICE graphics
by Daniel P. Berrange
This series of patches adds minimal support for SPICE graphics
which is newly introduced in RHEL-5.4's fork of KVM. Since this
is not yet merged in upstream QEMU/KVM, I'm not proposing to merge
all these patches. The two XML schema patches are straightforward
to merge.
The two implementation ones are RHEL5 specific and I want to
avoid declaring them supported until we have a sign of what the
upstream merge will look like, since previous attempst to support
KVM args prior to QEMU acceptance have been very painful long
term.
Daniel
15 years
[libvirt] [PATCH] libvirt-devel should only require libvirt-client
by Mark McLoughlin
There's a long known issue where if you install libvirt in a guest,
the default virtual network will conflict with the default virtual
network in the host.
That's one of the reasons we have the libvirt-client RPM - it allows
you to install the client library without having the host side
installed.
Rich Jones points out that if you install libvirt-devel in a guest,
then you get libvirtd installed and the network conflict:
https://bugzilla.redhat.com/531200
libvirt-devel should only require libvirt-client - e.g. nothing in
the devel package pertains to anything in the libvirt RPM. The Fedora
packaging guidelines say:
https://fedoraproject.org/wiki/Packaging/Guidelines#Devel_Packages
Devel packages must require the base package using a fully versioned
dependency ...
But for all intents and purposes, libvirt-client is our base RPM.
* libvirt.spec.in: make libvirt-devel require libvirt-client
---
libvirt.spec.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 6cd0888..7e1550e 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -341,7 +341,7 @@ virtualization capabilities of recent versions of Linux (and other OSes).
%package devel
Summary: Libraries, includes, etc. to compile with the libvirt library
Group: Development/Libraries
-Requires: libvirt = %{version}-%{release}
+Requires: libvirt-client = %{version}-%{release}
Requires: pkgconfig
%if %{with_xen}
Requires: xen-devel
--
1.6.2.5
15 years
[libvirt] [PATCH] qemu: Fix an error message in GetVcpus
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 082cb04..a3beedb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3481,7 +3481,8 @@ qemudDomainGetVcpus(virDomainPtr dom,
if (!virDomainIsActive(vm)) {
qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
- "%s",_("cannot pin vcpus on an inactive domain"));
+ "%s",
+ _("cannot list vcpu pinning for an inactive domain"));
goto cleanup;
}
--
1.6.5.rc2
15 years
[libvirt] [PATCH] Fix p2p migration without a passed uri.
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/libvirt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 926c539..126675e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3217,7 +3217,7 @@ virDomainMigrate (virDomainPtr domain,
char *dstURI = NULL;
if (uri == NULL) {
dstURI = virConnectGetURI(dconn);
- if (!uri)
+ if (!dstURI)
return NULL;
}
--
1.6.5.rc2
15 years
[libvirt] [PATCH] virterror: Add a missing 'break' for VIR_ERR_INVALID_SECRET
by Cole Robinson
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/util/virterror.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 657cb3f..10f979c 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -1082,6 +1082,7 @@ virErrorMsg(virErrorNumber error, const char *info)
errmsg = _("Invalid secret");
else
errmsg = _("Invalid secret: %s");
+ break;
case VIR_ERR_NO_SECRET:
if (info == NULL)
errmsg = _("Secret not found");
--
1.6.5.rc2
15 years
[libvirt] [PATCH] qemu: migrate: Don't require manual URI to specify a port
by Cole Robinson
The xen driver will generate a migration port if only a hostname is passed
in the optional migrate URI, so let's do the same in qemu.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu/qemu_driver.c | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fb952d8..3ef29a6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6304,15 +6304,32 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
/* Get the port number. */
p = strrchr (uri_in, ':');
- p++; /* definitely has a ':' in it, see above */
- this_port = virParseNumber (&p);
- if (this_port == -1 || p-uri_in != strlen (uri_in)) {
- qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG,
- "%s", _("URI did not have ':port' at the end"));
- goto cleanup;
+ if (p == strchr(uri_in, ':')) {
+ /* Generate a port */
+ this_port = QEMUD_MIGRATION_FIRST_PORT + port++;
+ if (port == QEMUD_MIGRATION_NUM_PORTS)
+ port = 0;
+
+ /* Caller frees */
+ if (virAsprintf(uri_out, "%s:%d", uri_in, this_port) < 0) {
+ virReportOOMError (dconn);
+ goto cleanup;
+ }
+
+ } else {
+ p++; /* definitely has a ':' in it, see above */
+ this_port = virParseNumber (&p);
+ if (this_port == -1 || p-uri_in != strlen (uri_in)) {
+ qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG,
+ "%s", _("URI ended with incorrect ':port'"));
+ goto cleanup;
+ }
}
}
+ if (uri_out && *uri_out)
+ VIR_DEBUG("Generated uri_out=%s", *uri_out);
+
/* Parse the domain XML. */
if (!(def = virDomainDefParseString(dconn, driver->caps, dom_xml,
VIR_DOMAIN_XML_INACTIVE))) {
--
1.6.5.rc2
15 years
[libvirt] [PATCH 0/4] test: Support virStorageFindPoolSources
by Cole Robinson
The following series refactors the storage pool parsing code to better
facilitate FindPoolSources (both for the test driver, and future pool backend
implementations). The last patch implements a FindPoolSources for the test
driver, with hardcoded results for test:///default.
Thanks,
Cole
Cole Robinson (4):
storage: Break out pool source parsing to a separate function.
storage: Break out function to add pool source to a SourceList.
storage: Add ParseSourceString function for use with FindPoolSources.
test: Support virStorageFindPoolSources
src/conf/storage_conf.c | 259 +++++++++++++++++++++++----------
src/conf/storage_conf.h | 7 +
src/libvirt_private.syms | 2 +
src/storage/storage_backend_fs.c | 65 ++++-----
src/storage/storage_backend_logical.c | 9 +-
src/test/test_driver.c | 75 +++++++++-
6 files changed, 291 insertions(+), 126 deletions(-)
15 years
[libvirt] [PATCH] Update the documentation for virDomainMigrateToURI
by Chris Lalancette
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/libvirt.c | 41 ++++++++++++++++++++++-------------------
1 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 9e87900..5787f22 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3154,7 +3154,7 @@ virDomainMigrateDirect (virDomainPtr domain,
* XML includes details of the support URI schemes. If omitted
* the dconn will be asked for a default URI.
*
- * In either case it is typically only neccessary to specify a
+ * In either case it is typically only necessary to specify a
* URI if the destination host has multiple interfaces and a
* specific interface is required to transmit migration data.
*
@@ -3273,7 +3273,7 @@ error:
/**
* virDomainMigrateToURI:
* @domain: a domain object
- * @duri: mandatory URI for the destination host
+ * @duri: mandatory URI for the destination host (see below)
* @flags: flags
* @dname: (optional) rename domain to this at destination
* @bandwidth: (optional) specify migration bandwidth limit in Mbps
@@ -3285,28 +3285,31 @@ error:
* VIR_MIGRATE_LIVE Do not pause the VM during migration
* VIR_MIGRATE_PEER2PEER Direct connection between source & destination hosts
* VIR_MIGRATE_TUNNELLED Tunnel migration data over the libvirt RPC channel
+ * VIR_MIGRATE_PERSIST_DEST If the migration is successful, persist the domain
+ * on the destination host.
+ * VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful, undefine the
+ * domain on the source host.
*
- * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
- * Applications using the VIR_MIGRATE_PEER2PEER flag will probably
- * prefer to invoke virDomainMigrateToURI, avoiding the need to
- * open connection to the destination host themselves.
- *
- * If a hypervisor supports renaming domains during migration,
- * then you may set the dname parameter to the new name (otherwise
- * it keeps the same name). If this is not supported by the
- * hypervisor, dname must be NULL or else you will get an error.
- *
- * If the VIR_MIGRATE_PEER2PEER flag is set, the duri parameter
- * must be a valid libvirt connection URI, by which the source
- * libvirt driver can connect to the destination libvirt.
- *
+ * The operation of this API hinges on the VIR_MIGRATE_PEER2PEER flag.
* If the VIR_MIGRATE_PEER2PEER flag is NOT set, the duri parameter
* takes a hypervisor specific format. The hypervisor capabilities
- * XML includes details of the support URI schemes. Not all hypervisors
+ * XML includes details of the supported URI schemes. Not all hypervisors
* will support this mode of migration, so if the VIR_MIGRATE_PEER2PEER
- * flag is not set, then it may be neccessary to use the alternative
+ * flag is not set, then it may be necessary to use the alternative
* virDomainMigrate API providing an explicit virConnectPtr for the
- * destination host
+ * destination host.
+ *
+ * If the VIR_MIGRATE_PEER2PEER flag IS set, the duri parameter
+ * must be a valid libvirt connection URI, by which the source
+ * libvirt driver can connect to the destination libvirt.
+ *
+ * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
+ *
+ * If a hypervisor supports renaming domains during migration,
+ * the dname parameter specifies the new name for the domain.
+ * Setting dname to NULL keeps the domain name the same. If domain
+ * renaming is not supported by the hypervisor, dname must be NULL or
+ * else an error will be returned.
*
* The maximum bandwidth (in Mbps) that will be used to do migration
* can be specified with the bandwidth parameter. If set to 0,
--
1.6.0.6
15 years
[libvirt] [PATCH] Better error message when libvirtd fails to start.
by Chris Lalancette
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
daemon/libvirtd.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 78dfb2d..03bc1b4 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -2972,7 +2972,9 @@ int main(int argc, char **argv) {
if (mkdir (rundir, 0755)) {
if (errno != EEXIST) {
- VIR_ERROR0 (_("unable to create rundir"));
+ char ebuf[1024];
+ VIR_ERROR(_("unable to create rundir %s: %s"), rundir,
+ virStrerror(errno, ebuf, sizeof(ebuf)));
return -1;
}
}
--
1.6.0.6
15 years