[libvirt] [PATCH V2] AArch64: Porting of armv7l conditons to run qemu for aarch64.
by Pranavkumar Sawargaonkar
AArch64 qemu has similar behavior as armv7l, like use of mmio etc.
This patch adds similar bypass checks what we have for armv7l to aarch64.
E.g. we are enabling mmio transport for Nicdev.
Making addDefaultUSB and addDefaultMemballoon to false etc.
This patch also adds testcase to qemuxml2argvtest as suggested
during review comments of V1 of same patch.
Signed-off-by: Anup Patel <anup.patel(a)linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar(a)linaro.org>
---
src/qemu/qemu_capabilities.c | 2 +-
src/qemu/qemu_command.c | 8 ++--
src/qemu/qemu_domain.c | 4 ++
.../qemuxml2argv-aarch64-virt-virtio.args | 14 ++++++
.../qemuxml2argv-aarch64-virt-virtio.xml | 45 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 4 ++
6 files changed, 73 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a68e555..9df3292 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2889,7 +2889,7 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
return false;
- if (def->os.arch != VIR_ARCH_ARMV7L)
+ if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64))
return true;
/* This may not be true for all ARM machine types, but at least
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9539be7..62a16a2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -427,7 +427,8 @@ qemuDomainSupportsNicdev(virDomainDefPtr def,
return false;
/* non-virtio ARM nics require legacy -net nic */
- if (def->os.arch == VIR_ARCH_ARMV7L &&
+ if (((def->os.arch == VIR_ARCH_ARMV7L) ||
+ (def->os.arch == VIR_ARCH_AARCH64)) &&
net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
return false;
@@ -1340,7 +1341,8 @@ static int
qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
virQEMUCapsPtr qemuCaps)
{
- if (def->os.arch == VIR_ARCH_ARMV7L &&
+ if (((def->os.arch == VIR_ARCH_ARMV7L) ||
+ (def->os.arch == VIR_ARCH_AARCH64)) &&
(STRPREFIX(def->os.machine, "vexpress-") ||
STREQ(def->os.machine, "virt")) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) {
@@ -1872,7 +1874,7 @@ cleanup:
static bool
qemuDomainSupportsPCI(virDomainDefPtr def) {
- if (def->os.arch != VIR_ARCH_ARMV7L)
+ if ((def->os.arch != VIR_ARCH_ARMV7L) && (def->os.arch != VIR_ARCH_AARCH64))
return true;
if (STREQ(def->os.machine, "versatilepb"))
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 346fec3..529b367 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -727,6 +727,10 @@ qemuDomainDefPostParse(virDomainDefPtr def,
addDefaultUSB = false;
addDefaultMemballoon = false;
break;
+ case VIR_ARCH_AARCH64:
+ addDefaultUSB = false;
+ addDefaultMemballoon = false;
+ break;
case VIR_ARCH_ALPHA:
case VIR_ARCH_PPC:
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
new file mode 100644
index 0000000..afd6e41
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.args
@@ -0,0 +1,14 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 -S -M virt -m 1024 -smp 1 -nographic \
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
+-boot c -kernel /aarch64.kernel -initrd /aarch64.initrd -append \
+'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \
+-dtb /aarch64.dtb -device virtio-serial-device,id=virtio-serial0 -usb \
+-drive file=/aarch64.raw,if=none,id=drive-virtio-disk0 \
+-device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \
+-device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
+-net user,vlan=0,name=hostnet0 -serial pty -chardev pty,id=charconsole1 \
+-device virtconsole,chardev=charconsole1,id=console1 \
+-device virtio-balloon-device,id=balloon0 \
+-object rng-random,id=rng0,filename=/dev/random \
+-device virtio-rng-device,rng=rng0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
new file mode 100644
index 0000000..184b62c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-aarch64-virt-virtio.xml
@@ -0,0 +1,45 @@
+<domain type="qemu">
+ <name>aarch64test</name>
+ <uuid>496d7ea8-9739-544b-4ebd-ef08be936e8b</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch="aarch64" machine="virt">hvm</type>
+ <kernel>/aarch64.kernel</kernel>
+ <initrd>/aarch64.initrd</initrd>
+ <dtb>/aarch64.dtb</dtb>
+ <cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <clock offset="utc"/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-aarch64</emulator>
+ <disk type='file' device='disk'>
+ <source file='/aarch64.raw'/>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <interface type='user'>
+ <mac address='52:54:00:09:a4:37'/>
+ <model type='virtio'/>
+ </interface>
+ <console type='pty'/>
+ <console type='pty'>
+ <target type='virtio' port='0'/>
+ </console>
+ <memballoon model='virtio'/>
+ <!--
+ This actually doesn't work in practice because vexpress only has
+ 4 virtio slots available, rng makes 5 -->
+ <rng model='virtio'>
+ <backend model='random'>/dev/random</backend>
+ </rng>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index f9abf1b..1aec0c4 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1299,6 +1299,10 @@ mymain(void)
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
+ DO_TEST("aarch64-virt-virtio",
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
+ QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY);
DO_TEST("kvm-pit-delay", QEMU_CAPS_NO_KVM_PIT);
--
1.7.9.5
11 years, 4 months
[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
11 years, 4 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
11 years, 4 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
11 years, 4 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
11 years, 4 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
11 years, 4 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
11 years, 4 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
11 years, 4 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
11 years, 4 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
11 years, 4 months