[libvirt] [PATCH RFC] spec: move hypvisor-specific files to hypervisor driver subpackages
by Jim Fehlig
The libvirt-daemon package contains several hypervisor-specific files,
directories, and script, which can be problematic when building the
package with multiple hypervisor support, e.g. both QEMU and Xen.
E.g. installing a QEMU+Xen enabled libvirt-daemon on a Xen-only system
will result in the creation of qemu and kvm groups and a qemu user.
Move the hypervisor-specific files, directories, and script to the
respective hypervisor driver subpackages.
---
libvirt.spec.in | 117 ++++++++++++++++++++++----------------------------------
1 file changed, 46 insertions(+), 71 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index cfd8890..76c21ec 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1522,23 +1522,6 @@ then
fi
%if %{with_libvirtd}
-%pre daemon
- %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
-# We want soft static allocation of well-known ids, as disk images
-# are commonly shared across NFS mounts by id rather than name; see
-# https://fedoraproject.org/wiki/Packaging:UsersAndGroups
-getent group kvm >/dev/null || groupadd -f -g 36 -r kvm
-getent group qemu >/dev/null || groupadd -f -g 107 -r qemu
-if ! getent passwd qemu >/dev/null; then
- if ! getent passwd 107 >/dev/null; then
- useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu
- else
- useradd -r -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu
- fi
-fi
-exit 0
- %endif
-
%post daemon
%if %{with_network}
@@ -1647,6 +1630,25 @@ fi
%endif
%endif
+ %if %{with_qemu}
+%pre daemon-driver-qemu
+ %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
+# We want soft static allocation of well-known ids, as disk images
+# are commonly shared across NFS mounts by id rather than name; see
+# https://fedoraproject.org/wiki/Packaging:UsersAndGroups
+getent group kvm >/dev/null || groupadd -f -g 36 -r kvm
+getent group qemu >/dev/null || groupadd -f -g 107 -r qemu
+if ! getent passwd qemu >/dev/null; then
+ if ! getent passwd 107 >/dev/null; then
+ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu
+ else
+ useradd -r -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu
+ fi
+fi
+exit 0
+ %endif
+ %endif
+
%if %{with_network}
%post daemon-config-network
if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ; then
@@ -1770,26 +1772,8 @@ exit 0
%if 0%{?fedora} >= 14 || 0%{?rhel} >= 6
%config(noreplace) %{_prefix}/lib/sysctl.d/libvirtd.conf
%endif
-%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
-%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
-%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
- %if %{with_libxl}
-%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
- %endif
%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd
- %if %{with_qemu}
-%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
-%config(noreplace) %{_sysconfdir}/libvirt/qemu-lockd.conf
-%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
- %endif
- %if %{with_lxc}
-%config(noreplace) %{_sysconfdir}/libvirt/lxc.conf
-%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc
- %endif
- %if %{with_uml}
-%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml
- %endif
%dir %{_datadir}/libvirt/
@@ -1805,28 +1789,6 @@ exit 0
%dir %attr(0711, root, root) %{_localstatedir}/lib/libvirt/boot/
%dir %attr(0711, root, root) %{_localstatedir}/cache/libvirt/
- %if %{with_qemu}
-%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
-%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
-%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/channel/
-%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/channel/target/
-%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
- %endif
- %if %{with_lxc}
-%ghost %dir %{_localstatedir}/run/libvirt/lxc/
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
- %endif
- %if %{with_uml}
-%ghost %dir %{_localstatedir}/run/libvirt/uml/
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
- %endif
- %if %{with_libxl}
-%ghost %dir %{_localstatedir}/run/libvirt/libxl/
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
- %endif
- %if %{with_xen}
-%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/xen/
- %endif
%if %{with_network}
%ghost %dir %{_localstatedir}/run/libvirt/network/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/network/
@@ -1836,16 +1798,6 @@ exit 0
%dir %attr(0755, root, root) %{_libdir}/libvirt/lock-driver
%attr(0755, root, root) %{_libdir}/libvirt/lock-driver/lockd.so
- %if %{with_qemu}
-%{_datadir}/augeas/lenses/libvirtd_qemu.aug
-%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
- %endif
-
- %if %{with_lxc}
-%{_datadir}/augeas/lenses/libvirtd_lxc.aug
-%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
- %endif
-
%{_datadir}/augeas/lenses/libvirtd.aug
%{_datadir}/augeas/lenses/tests/test_libvirtd.aug
%{_datadir}/augeas/lenses/virtlockd.aug
@@ -1864,10 +1816,6 @@ exit 0
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/
- %if %{with_lxc}
-%attr(0755, root, root) %{_libexecdir}/libvirt_lxc
- %endif
-
%if %{with_storage_disk}
%attr(0755, root, root) %{_libexecdir}/libvirt_parthelper
%endif
@@ -1933,30 +1881,57 @@ exit 0
%if %{with_qemu}
%files daemon-driver-qemu
%defattr(-, root, root)
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
+%config(noreplace) %{_sysconfdir}/libvirt/qemu.conf
+%config(noreplace) %{_sysconfdir}/libvirt/qemu-lockd.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu
+%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
+%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
+%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/channel/
+%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/channel/target/
+%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
+%{_datadir}/augeas/lenses/libvirtd_qemu.aug
+%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
%{_libdir}/%{name}/connection-driver/libvirt_driver_qemu.so
%endif
%if %{with_lxc}
%files daemon-driver-lxc
%defattr(-, root, root)
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
+%config(noreplace) %{_sysconfdir}/libvirt/lxc.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc
+%ghost %dir %{_localstatedir}/run/libvirt/lxc/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/
+%{_datadir}/augeas/lenses/libvirtd_lxc.aug
+%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
+%attr(0755, root, root) %{_libexecdir}/libvirt_lxc
%{_libdir}/%{name}/connection-driver/libvirt_driver_lxc.so
%endif
%if %{with_uml}
%files daemon-driver-uml
%defattr(-, root, root)
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/
+%config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml
+%ghost %dir %{_localstatedir}/run/libvirt/uml/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/
%{_libdir}/%{name}/connection-driver/libvirt_driver_uml.so
%endif
%if %{with_xen}
%files daemon-driver-xen
%defattr(-, root, root)
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/xen/
%{_libdir}/%{name}/connection-driver/libvirt_driver_xen.so
%endif
%if %{with_libxl}
%files daemon-driver-libxl
%defattr(-, root, root)
+%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
+%ghost %dir %{_localstatedir}/run/libvirt/libxl/
+%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
%{_libdir}/%{name}/connection-driver/libvirt_driver_libxl.so
%endif
--
1.8.0.1
10 years, 11 months
[libvirt] [PATCH] virThreadPoolFree: Set n(Prio)Workers after the pool is locked
by Michal Privoznik
In 78839da I am trying to join the worker threads. However, I can't
sipmly reuse pool->nWorkers (same applies for pool->nPrioWorkers),
because of the following flow that is currently implemented:
1) the main thread executing virThreadPoolFree sets pool->quit = true,
wakes up all the workers and wait on pool->quit_cond.
2) A worker is woken up and see quit request. It immediately jumps of
the while() loop and decrements pool->nWorkers (or pool->nPrioWorkers in
case of priority worker). The last thread signalizes pool->quit_cond.
3) Main thread is woken up, with both pool->nWorkers and
pool->nPrioWorkers being zero.
So there's a need to copy the original value of worker thread counts
into local variables. However, these need to set *after* the check for
pool being NULL (dereferencing a NULL is no no). And for safety they can
be set right after the pool is locked.
Reported-by: John Ferlan <jferlan(a)redhat.com>
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/util/virthreadpool.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index 99f36ec..aa442d1 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -242,13 +242,15 @@ void virThreadPoolFree(virThreadPoolPtr pool)
virThreadPoolJobPtr job;
bool priority = false;
size_t i;
- size_t nWorkers = pool->nWorkers;
- size_t nPrioWorkers = pool->nPrioWorkers;
+ size_t nWorkers;
+ size_t nPrioWorkers;
if (!pool)
return;
virMutexLock(&pool->mutex);
+ nWorkers = pool->nWorkers;
+ nPrioWorkers = pool->nPrioWorkers;
pool->quit = true;
if (pool->nWorkers > 0)
virCondBroadcast(&pool->cond);
--
1.8.4.4
10 years, 11 months
[libvirt] [PATCH v2 1/2] conf: add xml element devices/pvpanic
by Hu Tao
This patch adds a new xml element devices/pvpanic to support qemu device
pvpanic. It can be used to receive guest panic notification.
Signed-off-by: Hu Tao <hutao(a)cn.fujitsu.com>
---
docs/formatdomain.html.in | 25 +++++++++++++++++
src/conf/domain_conf.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 9 +++++++
3 files changed, 102 insertions(+)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 1850a2b..0a72baa 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5080,6 +5080,31 @@ qemu-kvm -net nic,model=? /dev/null
</dd>
</dl>
+ <h4><a name="elementsPvpanic">pvpanic device</a></h4>
+ <p>
+ pvpanic device enables libvirt to receive panic notification from a QEMU
+ guest.
+ <span class="since">Since 1.3.0, QEMU and KVM only</span>
+ </p>
+ <p>
+ Example: usage of pvpanic configuration
+ </p>
+<pre>
+ ...
+ <devices>
+ <pvpanic ioport='0x505'/>
+ </devices>
+ ...
+</pre>
+ <dl>
+ <dt><code>ioport</code></dt>
+ <dd>
+ <p>
+ ioport used by pvpanic.
+ </p>
+ </dd>
+ </dl>
+
<h3><a name="seclabel">Security label</a></h3>
<p>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 140eb80..1b8f66f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1876,6 +1876,11 @@ virDomainResourceDefFree(virDomainResourceDefPtr resource)
VIR_FREE(resource);
}
+void
+virDomainPvpanicDefFree(virDomainPvpanicDefPtr pvpanic)
+{
+ VIR_FREE(pvpanic);
+}
void virDomainDefFree(virDomainDefPtr def)
{
@@ -1964,6 +1969,8 @@ void virDomainDefFree(virDomainDefPtr def)
virDomainTPMDefFree(def->tpm);
+ virDomainPvpanicDefFree(def->pvpanic);
+
VIR_FREE(def->idmap.uidmap);
VIR_FREE(def->idmap.gidmap);
@@ -10626,6 +10633,31 @@ cleanup:
return idmap;
}
+static virDomainPvpanicDefPtr
+virDomainPvpanicDefParseXML(xmlNodePtr node)
+{
+ char *ioport = NULL;
+ virDomainPvpanicDefPtr pvpanic;
+
+ if (VIR_ALLOC(pvpanic) < 0)
+ return NULL;
+
+ ioport = virXMLPropString(node, "ioport");
+ if (!ioport) {
+ pvpanic->ioport = -1;
+ } else {
+ if (virStrToLong_i(ioport, NULL, 0, &pvpanic->ioport) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Cannot parse <pvpanic> 'ioport' attribute"));
+ goto error;
+ }
+ }
+
+ return pvpanic;
+error:
+ virDomainPvpanicDefFree(pvpanic);
+ return NULL;
+}
/* Parse the XML definition for a vcpupin or emulatorpin.
*
@@ -12453,6 +12485,27 @@ virDomainDefParseXML(xmlDocPtr xml,
}
VIR_FREE(nodes);
+ /* analysis of the pvpanic devices */
+ def->pvpanic = NULL;
+ if ((n = virXPathNodeSet("./devices/pvpanic", ctxt, &nodes)) < 0) {
+ goto error;
+ }
+ if (n > 1) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("only a single pvpanic device is supported"));
+ goto error;
+ }
+ if (n > 0) {
+ virDomainPvpanicDefPtr pvpanic =
+ virDomainPvpanicDefParseXML(nodes[0]);
+ if (!pvpanic)
+ goto error;
+
+ def->pvpanic = pvpanic;
+ VIR_FREE(nodes);
+ }
+
+
/* analysis of the user namespace mapping */
if ((n = virXPathNodeSet("./idmap/uid", ctxt, &nodes)) < 0)
goto error;
@@ -15715,6 +15768,18 @@ virDomainWatchdogDefFormat(virBufferPtr buf,
return 0;
}
+static int virDomainPvpanicDefFormat(virBufferPtr buf,
+ virDomainPvpanicDefPtr def)
+{
+ if (def->ioport > 0) {
+ virBufferAsprintf(buf, " <pvpanic ioport='%#x'/>\n",
+ def->ioport);
+ } else {
+ virBufferAsprintf(buf, " <pvpanic/>\n");
+ }
+
+ return 0;
+}
static int
virDomainRNGDefFormat(virBufferPtr buf,
@@ -17138,6 +17203,9 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (def->nvram)
virDomainNVRAMDefFormat(buf, def->nvram, flags);
+ if (def->pvpanic)
+ virDomainPvpanicDefFormat(buf, def->pvpanic);
+
virBufferAddLit(buf, " </devices>\n");
virBufferAdjustIndent(buf, 2);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4561ccc..9395852 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -126,6 +126,9 @@ typedef virDomainIdMapEntry *virDomainIdMapEntryPtr;
typedef struct _virDomainIdMapDef virDomainIdMapDef;
typedef virDomainIdMapDef *virDomainIdMapDefPtr;
+typedef struct _virDomainPvpanicDef virDomainPvpanicDef;
+typedef virDomainPvpanicDef *virDomainPvpanicDefPtr;
+
/* Flags for the 'type' field in virDomainDeviceDef */
typedef enum {
VIR_DOMAIN_DEVICE_NONE = 0,
@@ -1910,6 +1913,10 @@ struct _virDomainIdMapDef {
};
+struct _virDomainPvpanicDef {
+ int ioport;
+};
+
void virBlkioDeviceWeightArrayClear(virBlkioDeviceWeightPtr deviceWeights,
int ndevices);
@@ -2061,6 +2068,7 @@ struct _virDomainDef {
virSysinfoDefPtr sysinfo;
virDomainRedirFilterDefPtr redirfilter;
virDomainRNGDefPtr rng;
+ virDomainPvpanicDefPtr pvpanic;
void *namespaceData;
virDomainXMLNamespace ns;
@@ -2204,6 +2212,7 @@ virDomainObjPtr virDomainObjListFindByName(virDomainObjListPtr doms,
bool virDomainObjTaint(virDomainObjPtr obj,
enum virDomainTaintFlags taint);
+void virDomainPvpanicDefFree(virDomainPvpanicDefPtr pvpanic);
void virDomainResourceDefFree(virDomainResourceDefPtr resource);
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
void virDomainInputDefFree(virDomainInputDefPtr def);
--
1.7.11.7
10 years, 11 months
[libvirt] [PATCH] qemu: Fix indentation in qemuTranslateDiskSourcePool
by Peter Krempa
Commit e1a4d08baf9a8cc86c8b5ca27da9aeedb34b5908 was pushed with bad
indentation the iSCSI pool translation code.
---
Notes:
Pushing under the trivial rule.
src/qemu/qemu_conf.c | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 44e4320..4378791 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1416,28 +1416,28 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
}
switch (def->srcpool->mode) {
- case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DEFAULT:
- case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_LAST:
- def->srcpool->mode = VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST;
- /* fallthrough */
- case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST:
- def->srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_BLOCK;
- if (!(def->src = virStorageVolGetPath(vol)))
- goto cleanup;
- break;
-
- case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT:
- def->srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_NETWORK;
- def->protocol = VIR_DOMAIN_DISK_PROTOCOL_ISCSI;
-
- if (qemuTranslateDiskSourcePoolAuth(def, pooldef) < 0)
- goto cleanup;
-
- if (qemuAddISCSIPoolSourceHost(def, pooldef) < 0)
- goto cleanup;
- break;
- }
- break;
+ case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DEFAULT:
+ case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_LAST:
+ def->srcpool->mode = VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST;
+ /* fallthrough */
+ case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_HOST:
+ def->srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_BLOCK;
+ if (!(def->src = virStorageVolGetPath(vol)))
+ goto cleanup;
+ break;
+
+ case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT:
+ def->srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_NETWORK;
+ def->protocol = VIR_DOMAIN_DISK_PROTOCOL_ISCSI;
+
+ if (qemuTranslateDiskSourcePoolAuth(def, pooldef) < 0)
+ goto cleanup;
+
+ if (qemuAddISCSIPoolSourceHost(def, pooldef) < 0)
+ goto cleanup;
+ break;
+ }
+ break;
case VIR_STORAGE_POOL_MPATH:
case VIR_STORAGE_POOL_RBD:
--
1.8.4.3
10 years, 11 months
[libvirt] [PATCHv3 0/3] Implement RBD storage pool support
by Adam Walters
I have re-written the RBD storage pool patch to work properly under the
re-organized QEMU disk argument generation structure.
The patch is largely the same as last time, just using the new switch
statement and not modifying qemu_command.c anymore. Also of note in this
set of patches is a fix to a bug in configure.ac introduced in a recent
commit. I had to fix it in order to get my Archlinux package to compile
on another machine so I could test the code before submission, so I
figured that I would go ahead and share it with everyone, too.
Adam Walters (3):
qemu: conf: Add qemuAddRBDPoolSourceHost helper function
qemu: conf: Implement RBD storage pool support
configure: Resolve compile issue in configure.ac
configure.ac | 1 -
src/qemu/qemu_conf.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 74 insertions(+), 2 deletions(-)
--
1.8.4.2
10 years, 11 months
[libvirt] [PATCH 0/5] Fix snapshot xml test suite and add new test
by Peter Krempa
To cover the case fixed in 5a66c667ff5cae61c2ad2e646c8eb3eedc67f925
we need to upgrade the testsuite first.
Peter Krempa (5):
domainsnapshotxml2xmltest: Clean up labels and use bool instead of int
domainsnapshotxml2xmltest: Allow for better testing of snapshots
domainsnapshotxml2xml: Move files with conflicting names
domainsnapshotxml2xmltest: Add existing files as new tests
domainsnapshotxml2xmltest: Add test case for empty driver element
.../disk_driver_name_null.xml | 10 ++
tests/domainsnapshotxml2xmlin/external_vm.xml | 1 -
tests/domainsnapshotxml2xmlin/noparent.xml | 1 +
.../disk_driver_name_null.xml | 9 +
tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 67 +-------
.../disk_snapshot_redefine.xml | 80 +++++++++
tests/domainsnapshotxml2xmlout/empty.xml | 8 +
tests/domainsnapshotxml2xmlout/external_vm.xml | 39 -----
.../external_vm_redefine.xml | 44 +++++
.../name_and_description.xml | 5 +
tests/domainsnapshotxml2xmlout/noparent.xml | 2 +-
tests/domainsnapshotxml2xmltest.c | 190 ++++++++++++++++-----
12 files changed, 309 insertions(+), 147 deletions(-)
create mode 100644 tests/domainsnapshotxml2xmlin/disk_driver_name_null.xml
create mode 100644 tests/domainsnapshotxml2xmlout/disk_driver_name_null.xml
create mode 100644 tests/domainsnapshotxml2xmlout/disk_snapshot_redefine.xml
create mode 100644 tests/domainsnapshotxml2xmlout/empty.xml
create mode 100644 tests/domainsnapshotxml2xmlout/external_vm_redefine.xml
create mode 100644 tests/domainsnapshotxml2xmlout/name_and_description.xml
--
1.8.4.3
10 years, 11 months
[libvirt] [PATCH] qemuAgentDispose: Reset lastError
by Wangyufei (James)
When an error occurred in qemuAgentIO, it will be saved in mon->lastError,
but it will not be freed at last.
So I add the following code to fix it.
==22219== 54 bytes in 1 blocks are definitely lost in loss record 982 of 1,379
==22219== at 0x4C26B9B: malloc (vg_replace_malloc.c:263)
==22219== by 0x8520521: strdup (in /lib64/libc-2.11.3.so)
==22219== by 0x52E99CB: virStrdup (virstring.c:554)
==22219== by 0x52B44C4: virCopyError (virerror.c:195)
==22219== by 0x52B5123: virCopyLastError (virerror.c:312)
==22219== by 0x10905877: qemuAgentIO (qemu_agent.c:660)
==22219== by 0x52B6122: virEventPollDispatchHandles (vireventpoll.c:501)
==22219== by 0x52B7AEA: virEventPollRunOnce (vireventpoll.c:647)
==22219== by 0x52B5C1B: virEventRunDefaultImpl (virevent.c:274)
==22219== by 0x54181FD: virNetServerRun (virnetserver.c:1112)
==22219== by 0x11EF4D: main (libvirtd.c:1513)
Signed-off-by: Zhou Yimin <zhouyimin(a)huawei.com>
---
src/qemu/qemu_agent.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 2cd0ccc..4a3820c 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -161,6 +161,7 @@ static void qemuAgentDispose(void *obj)
(mon->cb->destroy)(mon, mon->vm);
virCondDestroy(&mon->notify);
VIR_FREE(mon->buffer);
+ virResetError(&mon->lastError);
}
static int
--
1.7.3.1.msysgit.0
Best Regards,
-WangYufei
10 years, 11 months
[libvirt] [PATCH v2] Fix memory leak in qemuBuildDriveStr()
by Nehal J Wani
This patch fixes memory leaks reported by valgrind on running qemuxml2argvtest
Most of them are of the form:
==24777== 15 bytes in 1 blocks are definitely lost in loss record 39 of 129
==24777== at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==24777== by 0x341F485E21: strdup (strdup.c:42)
==24777== by 0x4CADE5F: virStrdup (virstring.c:554)
==24777== by 0x4362B6: qemuBuildDriveStr (qemu_command.c:3848)
==24777== by 0x43EF73: qemuBuildCommandLine (qemu_command.c:8500)
==24777== by 0x426670: testCompareXMLToArgvHelper (qemuxml2argvtest.c:350)
==24777== by 0x427C01: virtTestRun (testutils.c:138)
==24777== by 0x41DDB5: mymain (qemuxml2argvtest.c:658)
==24777== by 0x4282A2: virtTestMain (testutils.c:593)
==24777== by 0x341F421A04: (below main) (libc-start.c:225)
==24777==
---
v2: Modified according to Eric's comments.
src/qemu/qemu_command.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 768fdc4..9539be7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4063,6 +4063,7 @@ qemuBuildDriveStr(virConnectPtr conn,
virBufferEscape(&opt, ',', ",", "%s,", source);
}
+ VIR_FREE(source);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
virBufferAddLit(&opt, "if=none");
@@ -4274,6 +4275,7 @@ qemuBuildDriveStr(virConnectPtr conn,
return virBufferContentAndReset(&opt);
error:
+ VIR_FREE(source);
virBufferFreeAndReset(&opt);
return NULL;
}
--
1.8.1.4
10 years, 11 months
[libvirt] [PATCH] Fix memory leak in qemuBuildDriveStr()
by Nehal J Wani
This patch fixes memory leaks reported by valgrind on running qemuxml2argvtest
Most of them are of the form:
==24777== 15 bytes in 1 blocks are definitely lost in loss record 39 of 129
==24777== at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==24777== by 0x341F485E21: strdup (strdup.c:42)
==24777== by 0x4CADE5F: virStrdup (virstring.c:554)
==24777== by 0x4362B6: qemuBuildDriveStr (qemu_command.c:3848)
==24777== by 0x43EF73: qemuBuildCommandLine (qemu_command.c:8500)
==24777== by 0x426670: testCompareXMLToArgvHelper (qemuxml2argvtest.c:350)
==24777== by 0x427C01: virtTestRun (testutils.c:138)
==24777== by 0x41DDB5: mymain (qemuxml2argvtest.c:658)
==24777== by 0x4282A2: virtTestMain (testutils.c:593)
==24777== by 0x341F421A04: (below main) (libc-start.c:225)
==24777==
---
src/qemu/qemu_command.c | 74 +++++++++++++++++++++++++------------------------
1 file changed, 38 insertions(+), 36 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 768fdc4..6a30a29 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4016,52 +4016,54 @@ qemuBuildDriveStr(virConnectPtr conn,
if (qemuDomainDiskGetSourceString(conn, disk, &source) < 0)
goto error;
- if (source &&
- !((disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY ||
- disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
- disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) {
+ if (source) {
+ if(!((disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY ||
+ disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) &&
+ disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) {
- virBufferAddLit(&opt, "file=");
+ virBufferAddLit(&opt, "file=");
- switch (actualType) {
- case VIR_DOMAIN_DISK_TYPE_DIR:
- /* QEMU only supports magic FAT format for now */
- if (disk->format > 0 && disk->format != VIR_STORAGE_FILE_FAT) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unsupported disk driver type for '%s'"),
- virStorageFileFormatTypeToString(disk->format));
- goto error;
- }
+ switch (actualType) {
+ case VIR_DOMAIN_DISK_TYPE_DIR:
+ /* QEMU only supports magic FAT format for now */
+ if (disk->format > 0 && disk->format != VIR_STORAGE_FILE_FAT) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported disk driver type for '%s'"),
+ virStorageFileFormatTypeToString(disk->format));
+ goto error;
+ }
- if (!disk->readonly) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("cannot create virtual FAT disks in read-write mode"));
- goto error;
- }
+ if (!disk->readonly) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("cannot create virtual FAT disks in read-write mode"));
+ goto error;
+ }
- virBufferAddLit(&opt, "fat:");
+ virBufferAddLit(&opt, "fat:");
- if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
- virBufferAddLit(&opt, "floppy:");
+ if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
+ virBufferAddLit(&opt, "floppy:");
- break;
+ break;
- case VIR_DOMAIN_DISK_TYPE_BLOCK:
- if (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- disk->type == VIR_DOMAIN_DISK_TYPE_VOLUME ?
- _("tray status 'open' is invalid for block type volume") :
- _("tray status 'open' is invalid for block type disk"));
- goto error;
- }
+ case VIR_DOMAIN_DISK_TYPE_BLOCK:
+ if (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ disk->type == VIR_DOMAIN_DISK_TYPE_VOLUME ?
+ _("tray status 'open' is invalid for block type volume") :
+ _("tray status 'open' is invalid for block type disk"));
+ goto error;
+ }
- break;
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- virBufferEscape(&opt, ',', ",", "%s,", source);
+ virBufferEscape(&opt, ',', ",", "%s,", source);
+ }
+ VIR_FREE(source);
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
--
1.8.1.4
10 years, 11 months
[libvirt] [PATCH python 00/15] Initial work porting to python3
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
This series starts, but does not complete, the work to port over
to build with python3. This involves making the code generator
able to run under python3, as well as making it generate code
which is python3 compatible. And of course the examples are fixed
up too
Some things still todo
- Deal with String vs Unicode problems - Python2 defaulted
to C strings, while Python3 defaults to Unicode
- Deal with Int vs Long problems - Python2 had two integer
types, Int & Long, but Python3 only has one, Long.
- Fix examples to not use libxml2 since it isn't compiled
for Python3 in Fedora.
- Probably more bugs to find...
Daniel P. Berrange (15):
generator: Don't use 'list' as a variable name
generator: Remove string.lower(XXX) with XXX.lower()
generator: Invoke print("...") instead of print "..."
generator: Cast iterators to a list() explicitly
generator: Remove use of 'has_key' function
generator: Update to use sort() 'key' param
generator: Remove use of string.replace and string.find functions
generator: Sort enums and functions when generating code
setup: Fix exception catching syntax
examples: Invoke print("...") instead of print "..."
examples: Fix exception catching syntax
examples: Ensure we write bytes to the self-pipe
generator: Fix exception catching syntax in generated code
override: Fix native module registration to work with Python3
override: Fix exception catching syntax
examples/consolecallback.py | 6 +-
examples/dominfo.py | 14 +-
examples/domrestore.py | 17 ++-
examples/domsave.py | 15 +-
examples/domstart.py | 19 ++-
examples/esxlist.py | 14 +-
examples/event-test.py | 74 +++++-----
examples/topology.py | 14 +-
generator.py | 328 +++++++++++++++++++++---------------------
libvirt-lxc-override.c | 73 +++++++---
libvirt-override-virStream.py | 6 +-
libvirt-override.c | 75 +++++++---
libvirt-override.py | 4 +-
libvirt-qemu-override.c | 73 +++++++---
setup.py | 2 +-
15 files changed, 417 insertions(+), 317 deletions(-)
--
1.8.3.1
10 years, 11 months