[libvirt] [PATCH 1/1] tests: xmconfigtest: Add test for os.cmdline
by Filip Alac
Add test case for the os cmdline.
Check if:
656151bf5dd299322dcf37d06d20534e667a1963
work as expected.
Signed-off-by: Filip Alac <filipalac(a)gmail.com>
---
tests/xmconfigdata/test-os-cmdline.cfg | 14 +++++++++
tests/xmconfigdata/test-os-cmdline.xml | 40 ++++++++++++++++++++++++++
tests/xmconfigtest.c | 2 ++
3 files changed, 56 insertions(+)
create mode 100644 tests/xmconfigdata/test-os-cmdline.cfg
create mode 100644 tests/xmconfigdata/test-os-cmdline.xml
diff --git a/tests/xmconfigdata/test-os-cmdline.cfg b/tests/xmconfigdata/test-os-cmdline.cfg
new file mode 100644
index 0000000..8ca8179
--- /dev/null
+++ b/tests/xmconfigdata/test-os-cmdline.cfg
@@ -0,0 +1,14 @@
+name = "test"
+uuid = "ab6eec38-06ad-4fa6-aa50-4bb3dac321ef"
+maxmem = 128
+memory = 128
+vcpus = 1
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vif = [ "mac=00:16:3e:70:61:00,bridge=xenbr0,script=vif-bridge" ]
+kernel = "/boot/vmlinuz-2.6.26-2-xen-amd64"
+ramdisk = "/boot/initrd.img-2.6.26-2-xen-amd64"
+extra = "root=/dev/xvda2 ro"
+disk = [ "file:/opt/xen/domains/test/swap.img,xvda1,w", "file:/opt/xen/domains/test/disk.img,xvda2,w" ]
diff --git a/tests/xmconfigdata/test-os-cmdline.xml b/tests/xmconfigdata/test-os-cmdline.xml
new file mode 100644
index 0000000..5f85b2e
--- /dev/null
+++ b/tests/xmconfigdata/test-os-cmdline.xml
@@ -0,0 +1,40 @@
+<domain type='xen'>
+ <name>test</name>
+ <uuid>ab6eec38-06ad-4fa6-aa50-4bb3dac321ef</uuid>
+ <memory unit='KiB'>131072</memory>
+ <currentMemory unit='KiB'>131072</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='xenpv'>linux</type>
+ <kernel>/boot/vmlinuz-2.6.26-2-xen-amd64</kernel>
+ <initrd>/boot/initrd.img-2.6.26-2-xen-amd64</initrd>
+ <cmdline>root=/dev/xvda2 ro</cmdline>
+ </os>
+ <clock offset='utc' adjustment='reset'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='file' type='raw'/>
+ <source file='/opt/xen/domains/test/swap.img'/>
+ <target dev='xvda1' bus='xen'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='file' type='raw'/>
+ <source file='/opt/xen/domains/test/disk.img'/>
+ <target dev='xvda2' bus='xen'/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:16:3e:70:61:00'/>
+ <source bridge='xenbr0'/>
+ <script path='vif-bridge'/>
+ </interface>
+ <console type='pty'>
+ <target type='xen' port='0'/>
+ </console>
+ <input type='mouse' bus='xen'/>
+ <input type='keyboard' bus='xen'/>
+ <memballoon model='xen'/>
+ </devices>
+</domain>
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 6851fa7..2820711 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -234,6 +234,8 @@ mymain(void)
DO_TEST("disk-drv-blktap-raw");
DO_TEST("disk-drv-blktap2-raw");
+ DO_TEST("os-cmdline");
+
virObjectUnref(caps);
virObjectUnref(xmlopt);
--
2.17.0
6 years, 6 months
[libvirt] [libvirt-python][PATCH] event-test.py: Sync list of storage lifecycle events
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1578337
Since libvirt 3.8.0 we have 6 events: defined, undefined,
started, stopped, created, deleted. However, the last two were
missing in a string list that translates libvirt events (int)
into human readable strings.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
examples/event-test.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/examples/event-test.py b/examples/event-test.py
index 3de333c..281e661 100755
--- a/examples/event-test.py
+++ b/examples/event-test.py
@@ -605,6 +605,8 @@ def storageEventToString(event):
"Undefined",
"Started",
"Stopped",
+ "Created",
+ "Deleted",
)
return storageEventStrings[event]
--
2.16.1
6 years, 6 months
[libvirt] [PATCH 0/5] Introduce virDomainDetachDeviceAlias
by Michal Privoznik
The idea is to allow user to detach device passing only alias. It is
enough to uniquely identify a device.
Michal Privoznik (5):
Introduce virDomainDetachDeviceAlias API
remote: Implement virDomainDetachDeviceAlias
qemu: Split qemuDomainDetachDeviceLiveAndConfig
qemu: Implement virDomainDetachDeviceAlias
virsh: Expose virDomainDetachDeviceAlias
include/libvirt/libvirt-domain.h | 3 ++
src/driver-hypervisor.h | 6 +++
src/libvirt-domain.c | 46 +++++++++++++++++++++
src/libvirt_public.syms | 5 +++
src/qemu/qemu_driver.c | 87 +++++++++++++++++++++++++++++++++++-----
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 16 +++++++-
src/remote_protocol-structs | 6 +++
tools/virsh-domain.c | 79 ++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 15 +++++++
10 files changed, 253 insertions(+), 11 deletions(-)
--
2.16.1
6 years, 6 months
[libvirt] [PATCH v3 0/4] qemu: Add support for -device hda-output (disable line-in)
by Filip Alac
Add support for hda 'output' codec for ich6 and ich9 sound devices,
which allow us to disable line-in for guest.
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1126641
v1:
https://www.redhat.com/archives/libvir-list/2018-May/msg01311.html
v2:
- Split patch into series of patches
- Add description of feature in docs/news.xml
- Improve the documentation in docs/formatdomain.html.in
- Fixes coding standard errors/inconsistencies
v3:
- Moved all tests to third patch
- Made possible to compile every patch by alone except fourth which
depends on the first and on the second patch.
Filip Alac (4):
Add 'output' codec in docs, qemu_command and qemu_capabilities
tests: Extend qemu_capabilities with 'hda-output'
docs: news: Describe 'output' codec
tests: qemu: Extends tests for 'output' codec
docs/formatdomain.html.in | 15 ++++++++++++---
docs/news.xml | 8 ++++++++
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 3 ++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 5 ++++-
tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_2.10.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 +
.../migration-in-params-in.xml | 1 +
.../migration-out-nbd-in.xml | 1 +
.../migration-out-nbd-out.xml | 1 +
.../migration-out-params-in.xml | 1 +
tests/qemustatusxml2xmldata/modern-in.xml | 1 +
tests/qemuxml2argvdata/sound-device.args | 2 ++
tests/qemuxml2argvdata/sound-device.xml | 2 ++
tests/qemuxml2argvtest.c | 1 +
tests/qemuxml2xmloutdata/sound-device.xml | 2 ++
36 files changed, 62 insertions(+), 5 deletions(-)
--
2.17.0
6 years, 6 months
[libvirt] [PATCHv1 0/7] Baseline CPU model using QEMU QMP exchanges
by Chris Venteicher
Some architectures (S390) depend on QEMU to compute baseline CPU model.
Interacting with QEMU requires starting the QEMU process and completing one or
more query-cpu-model-baseline QMP exchanges with QEMU.
This patch set depends on qemuMonitorGetCPUModelBaseline function exposed by
"query-cpu-model-baseline QMP Command" patch set discussed previously on
libvir-list.
See "s390x CPU models: exposing features" patch set on Qemu-devel for discussion
of QEMU aspects.
This is part of resolution of: https://bugzilla.redhat.com/show_bug.cgi?id=1511999
Signed-off-by: Chris Venteicher <cventeic(a)redhat.com>
Chris Venteicher (7):
qemu_monitor_json: Properties optional in QMP JSON for CPUModelInfo
qemu_capabilities: CPUModelInfo: XML/QMP format conversion
qemu_capabilities: Start and connect to QEMU
qemu_capabilities: Baseline CPUModel via QEMU
qemu_capabilities: Find QEMU binary for S390 arch
qemu_capabilities: qmperr pointer tracked in QMPCommand
qemu_driver: Baseline CPU model using QEMU
src/qemu/qemu_capabilities.c | 362 ++++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_capabilities.h | 9 ++
src/qemu/qemu_driver.c | 29 ++++
src/qemu/qemu_monitor_json.c | 34 ++--
4 files changed, 414 insertions(+), 20 deletions(-)
--
2.14.1
6 years, 6 months
[libvirt] [PATCH] travis: Print test log file from distcheck as well
by Martin Kletzander
Since we started using `make distcheck` in travis, the part that's printing the
tests/test-suite.log file is rather pointless. Let's check for both known
locations (keeping the previous one there on purpose) so that the output is
usable again.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
.travis.yml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index d3f72d46f3d9..f980884dfa1c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -118,8 +118,11 @@ script:
after_failure:
- echo '============================================================================'
- - 'if [ -f $(pwd)/tests/test-suite.log ]; then
+ - 'ver=$(sed -n "s/AC_INIT(\[libvirt\], \[\([0-9.]*\)\],.*/\1/p" configure.ac);
+ if [ -f $(pwd)/tests/test-suite.log ]; then
cat $(pwd)/tests/test-suite.log;
+ elif [ -f libvirt-$ver/_build/tests/test-suite.log ]; then
+ cat libvirt-$ver/_build/tests/test-suite.log;
else
echo "=== NO LOG FILE FOUND ===";
fi'
--
2.17.0
6 years, 6 months
[libvirt] [PATCH] tools: Tiny clean-ups for two functions in virsh-completer.c
by Martin Kletzander
These two functions were duplicating some cleanup paths, so let's just merge
both cleanup and error paths together. To distinguish whether we need to
clean-up the return value let's keep it in @tmp until the function is successful
in which case we set @ret to the value of @tmp and set @tmp to NULL.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
tools/virsh-completer.c | 48 ++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 27 deletions(-)
diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index eb091070c92b..1f9f8e76e90e 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -97,6 +97,7 @@ virshDomainInterfaceCompleter(vshControl *ctl,
size_t i;
unsigned int domainXMLFlags = 0;
char **ret = NULL;
+ char **tmp = NULL;
virCheckFlags(VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC, NULL);
@@ -107,39 +108,35 @@ virshDomainInterfaceCompleter(vshControl *ctl,
domainXMLFlags = VIR_DOMAIN_XML_INACTIVE;
if (virshDomainGetXML(ctl, cmd, domainXMLFlags, &xmldoc, &ctxt) < 0)
- goto error;
+ goto cleanup;
ninterfaces = virXPathNodeSet("./devices/interface", ctxt, &interfaces);
if (ninterfaces < 0)
- goto error;
+ goto cleanup;
- if (VIR_ALLOC_N(ret, ninterfaces + 1) < 0)
- goto error;
+ if (VIR_ALLOC_N(tmp, ninterfaces + 1) < 0)
+ goto cleanup;
for (i = 0; i < ninterfaces; i++) {
ctxt->node = interfaces[i];
if (!(flags & VIRSH_DOMAIN_INTERFACE_COMPLETER_MAC) &&
- (ret[i] = virXPathString("string(./target/@dev)", ctxt)))
+ (tmp[i] = virXPathString("string(./target/@dev)", ctxt)))
continue;
/* In case we are dealing with inactive domain XML there's no
* <target dev=''/>. Offer MAC addresses then. */
- if (!(ret[i] = virXPathString("string(./mac/@address)", ctxt)))
- goto error;
+ if (!(tmp[i] = virXPathString("string(./mac/@address)", ctxt)))
+ goto cleanup;
}
+ VIR_STEAL_PTR(ret, tmp);
+ cleanup:
VIR_FREE(interfaces);
xmlFreeDoc(xmldoc);
xmlXPathFreeContext(ctxt);
+ virStringListFree(tmp);
return ret;
-
- error:
- VIR_FREE(interfaces);
- xmlFreeDoc(xmldoc);
- xmlXPathFreeContext(ctxt);
- virStringListFree(ret);
- return NULL;
}
@@ -154,6 +151,7 @@ virshDomainDiskTargetCompleter(vshControl *ctl,
xmlNodePtr *disks = NULL;
int ndisks;
size_t i;
+ char **tmp = NULL;
char **ret = NULL;
virCheckFlags(0, NULL);
@@ -162,32 +160,28 @@ virshDomainDiskTargetCompleter(vshControl *ctl,
return NULL;
if (virshDomainGetXML(ctl, cmd, 0, &xmldoc, &ctxt) < 0)
- goto error;
+ goto cleanup;
ndisks = virXPathNodeSet("./devices/disk", ctxt, &disks);
if (ndisks < 0)
- goto error;
+ goto cleanup;
- if (VIR_ALLOC_N(ret, ndisks + 1) < 0)
- goto error;
+ if (VIR_ALLOC_N(tmp, ndisks + 1) < 0)
+ goto cleanup;
for (i = 0; i < ndisks; i++) {
ctxt->node = disks[i];
- if (!(ret[i] = virXPathString("string(./target/@dev)", ctxt)))
- goto error;
+ if (!(tmp[i] = virXPathString("string(./target/@dev)", ctxt)))
+ goto cleanup;
}
+ VIR_STEAL_PTR(ret, tmp);
+ cleanup:
VIR_FREE(disks);
xmlFreeDoc(xmldoc);
xmlXPathFreeContext(ctxt);
+ virStringListFree(tmp);
return ret;
-
- error:
- VIR_FREE(disks);
- xmlFreeDoc(xmldoc);
- xmlXPathFreeContext(ctxt);
- virStringListFree(ret);
- return NULL;
}
--
2.17.0
6 years, 6 months
[libvirt] [PATCH] Add virshAllocpagesPagesizeCompleter
by Roland Schulz
Returns list of host page sizes from capabilities xml
Signed-off-by: Roland Schulz <schullzroll(a)gmail.com>
---
tools/virsh-completer.c | 71 +++++++++++++++++++++++++++++++++++++++++
tools/virsh-completer.h | 4 +++
tools/virsh-host.c | 1 +
3 files changed, 76 insertions(+)
diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c
index eb091070c..5f8a35b5f 100644
--- a/tools/virsh-completer.c
+++ b/tools/virsh-completer.c
@@ -27,6 +27,7 @@
#include "virsh-pool.h"
#include "virsh-util.h"
#include "internal.h"
+#include "virutil.h"
#include "viralloc.h"
#include "virstring.h"
#include "virxml.h"
@@ -570,3 +571,73 @@ virshSnapshotNameCompleter(vshControl *ctl,
virshDomainFree(dom);
return NULL;
}
+
+char **
+virshAllocpagesPagesizeCompleter(vshControl *ctl,
+ const vshCmd *cmd ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+ unsigned long long byteval = 0;
+ xmlXPathContextPtr ctxt = NULL;
+ virshControlPtr priv = ctl->privData;
+ unsigned int npages = 0;
+ xmlNodePtr *pages = NULL;
+ double size = 0;
+ size_t i = 0;
+ const char *suffix = NULL;
+ char *pagesize = NULL;
+ char *cap_xml = NULL;
+ char **ret = NULL;
+ char *unit = NULL;
+
+ virCheckFlags(0, NULL);
+
+ if (!priv->conn || virConnectIsAlive(priv->conn) <= 0)
+ goto error;
+
+ if (!(cap_xml = virConnectGetCapabilities(priv->conn)))
+ goto error;
+
+ if (!(virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt)))
+ goto error;
+
+ npages = virXPathNodeSet("/capabilities/host/cpu/pages", ctxt, &pages);
+ if (npages <= 0)
+ goto error;
+
+ if (VIR_ALLOC_N(ret, npages + 1) < 0)
+ goto error;
+
+ for (i = 0; i < npages; i++) {
+ VIR_FREE(pagesize);
+ VIR_FREE(unit);
+ pagesize = virXMLPropString(pages[i], "size");
+ unit = virXMLPropString(pages[i], "unit");
+ if (virStrToLong_ull(pagesize, NULL, 10, &byteval) < 0)
+ goto error;
+ if (virScaleInteger(&byteval, unit, 1024, UINT_MAX) < 0)
+ goto error;
+ size = vshPrettyCapacity(byteval, &suffix);
+ if (virAsprintf(&ret[i], "%.0f%s", size, suffix) < 0)
+ goto error;
+ }
+
+ cleanup:
+ xmlXPathFreeContext(ctxt);
+ for (i = 0; i < npages; i++)
+ VIR_FREE(pages[i]);
+ VIR_FREE(pages);
+ VIR_FREE(cap_xml);
+ VIR_FREE(pagesize);
+ VIR_FREE(unit);
+
+ return ret;
+
+ error:
+ if (ret) {
+ for (i = 0; i < npages; i++)
+ VIR_FREE(ret[i]);
+ }
+ VIR_FREE(ret);
+ goto cleanup;
+}
diff --git a/tools/virsh-completer.h b/tools/virsh-completer.h
index ae9626fea..c7b181879 100644
--- a/tools/virsh-completer.h
+++ b/tools/virsh-completer.h
@@ -74,4 +74,8 @@ char ** virshSnapshotNameCompleter(vshControl *ctl,
const vshCmd *cmd,
unsigned int flags);
+char ** virshAllocpagesPagesizeCompleter(vshControl *ctl,
+ const vshCmd *cmd,
+ unsigned int flags);
+
#endif
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index ecaf830e3..293f06e9e 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -472,6 +472,7 @@ static const vshCmdOptDef opts_allocpages[] = {
{.name = "pagesize",
.type = VSH_OT_INT,
.flags = VSH_OFLAG_REQ,
+ .completer = virshAllocpagesPagesizeCompleter,
.help = N_("page size (in kibibytes)")
},
{.name = "pagecount",
--
2.17.0
6 years, 6 months
[libvirt] nwfilter deadlock with libpcap and TPACKET_V3
by Daniel P. Berrangé
I've just found a deadlock in nwfilter caused by something in libpcap.
There are 2 VMs running with the nwfilter stress test, but the deadlock
in fact only involves VM VM.
Three threads in libvirtd
Thread 1 (Thread 0x7f3a26f726c0 (LWP 15384)):
#0 __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1 0x00007f3a22ae1cc4 in __GI___pthread_mutex_lock (mutex=0x7f39fc023de0) at ../nptl/pthread_mutex_lock.c:78
#2 0x00007f3a264817f5 in virMutexLock (m=<optimized out>) at util/virthread.c:89
#3 0x00007f3a2645c34b in virObjectLock (anyobj=anyobj@entry=0x7f39fc023dd0) at util/virobject.c:429
#4 0x00007f39deca2b93 in qemuProcessHandleEvent (mon=<optimized out>, vm=0x7f39fc023dd0, eventName=0x5601c3940500 "SHUTDOWN",
seconds=1526658178, micros=453867, details=0x5601c3a468b0 "{\"guest\":false}", opaque=0x7f39ac11ba20) at qemu/qemu_process.c:630
#5 0x00007f39decc2686 in qemuMonitorEmitEvent (mon=mon@entry=0x7f39fc049d70, event=event@entry=0x5601c3940500 "SHUTDOWN",
seconds=1526658178, micros=453867, details=0x5601c3a468b0 "{\"guest\":false}") at qemu/qemu_monitor.c:1336
#6 0x00007f39decd6cce in qemuMonitorJSONIOProcessEvent (obj=0x5601c391fcc0, mon=0x7f39fc049d70) at qemu/qemu_monitor_json.c:174
#7 qemuMonitorJSONIOProcessLine (mon=mon@entry=0x7f39fc049d70, line=<optimized out>, msg=msg@entry=0x0)
at qemu/qemu_monitor_json.c:211
#8 0x00007f39decd6f59 in qemuMonitorJSONIOProcess (mon=mon@entry=0x7f39fc049d70,
data=0x5601c3964670 "{\"timestamp\": {\"seconds\": 1526658178, \"microseconds\": 453867}, \"event\": \"SHUTDOWN\", \"data\": {\"guest\": false}}\r\n", len=111, msg=msg@entry=0x0) at qemu/qemu_monitor_json.c:253
#9 0x00007f39decc11fc in qemuMonitorIOProcess (mon=0x7f39fc049d70) at qemu/qemu_monitor.c:446
#10 qemuMonitorIO (watch=watch@entry=323, fd=<optimized out>, events=0, events@entry=1, opaque=opaque@entry=0x7f39fc049d70)
at qemu/qemu_monitor.c:706
#11 0x00007f3a26425743 in virEventPollDispatchHandles (fds=0x5601c39a3410, nfds=<optimized out>) at util/vireventpoll.c:508
#12 virEventPollRunOnce () at util/vireventpoll.c:657
#13 0x00007f3a26423e71 in virEventRunDefaultImpl () at util/virevent.c:327
#14 0x00007f3a26549ff5 in virNetDaemonRun (dmn=0x5601c38cd1b0) at rpc/virnetdaemon.c:850
#15 0x00005601c281544a in main (argc=<optimized out>, argv=<optimized out>) at remote/remote_daemon.c:1483
Thread 4 (Thread 0x7f3a0e011700 (LWP 15400)):
#0 __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
#1 0x00007f3a22ae1d64 in __GI___pthread_mutex_lock (mutex=0x7f39ac1cb3e0) at ../nptl/pthread_mutex_lock.c:113
#2 0x00007f3a264817f5 in virMutexLock (m=<optimized out>) at util/virthread.c:89
---Type <return> to continue, or q <return> to quit---
#3 0x00007f39f518653f in virNWFilterLockIface (ifname=ifname@entry=0x7f39fc025b60 "tck-vm2-if0")
at nwfilter/nwfilter_learnipaddr.c:197
#4 0x00007f39f517aae5 in _virNWFilterTeardownFilter (ifname=0x7f39fc025b60 "tck-vm2-if0") at nwfilter/nwfilter_gentech_driver.c:1021
#5 0x00007f39f517b5fc in virNWFilterTeardownFilter (net=0x7f39fc044f80) at nwfilter/nwfilter_gentech_driver.c:1039
#6 0x00007f3a264da77c in virDomainConfVMNWFilterTeardown (vm=vm@entry=0x7f39fc023dd0) at conf/domain_nwfilter.c:65
#7 0x00007f39decab77a in qemuProcessStop (driver=driver@entry=0x7f39ac11ba20, vm=0x7f39fc023dd0,
reason=reason@entry=VIR_DOMAIN_SHUTOFF_DESTROYED, asyncJob=asyncJob@entry=QEMU_ASYNC_JOB_NONE, flags=0)
at qemu/qemu_process.c:6767
#8 0x00007f39decfd47e in qemuDomainDestroyFlags (dom=<optimized out>, flags=<optimized out>) at qemu/qemu_driver.c:2237
#9 0x00007f3a2661c593 in virDomainDestroy (domain=domain@entry=0x7f39f00191e0) at libvirt-domain.c:475
#10 0x00005601c284052a in remoteDispatchDomainDestroy (server=0x5601c38cd240, msg=0x5601c3a189e0, args=<optimized out>,
rerr=0x7f3a0e010b60, client=0x5601c393d9f0) at remote/remote_daemon_dispatch_stubs.h:4615
#11 remoteDispatchDomainDestroyHelper (server=0x5601c38cd240, client=0x5601c393d9f0, msg=0x5601c3a189e0, rerr=0x7f3a0e010b60,
args=<optimized out>, ret=0x7f39f0004970) at remote/remote_daemon_dispatch_stubs.h:4591
#12 0x00007f3a265443f4 in virNetServerProgramDispatchCall (msg=0x5601c3a189e0, client=0x5601c393d9f0, server=0x5601c38cd240,
prog=0x5601c3938d70) at rpc/virnetserverprogram.c:437
#13 virNetServerProgramDispatch (prog=0x5601c3938d70, server=server@entry=0x5601c38cd240, client=0x5601c393d9f0, msg=0x5601c3a189e0)
at rpc/virnetserverprogram.c:304
#14 0x00007f3a2654a778 in virNetServerProcessMsg (msg=<optimized out>, prog=<optimized out>, client=<optimized out>,
srv=0x5601c38cd240) at rpc/virnetserver.c:145
#15 virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x5601c38cd240) at rpc/virnetserver.c:166
#16 0x00007f3a264822f0 in virThreadPoolWorker (opaque=opaque@entry=0x5601c38d9da0) at util/virthreadpool.c:167
#17 0x00007f3a26481678 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
#18 0x00007f3a22adf564 in start_thread (arg=<optimized out>) at pthread_create.c:463
#19 0x00007f3a2281331f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 19 (Thread 0x7f39ceacb700 (LWP 17216)):
#0 0x00007f3a22808929 in __GI___poll (fds=fds@entry=0x7f39ceaca930, nfds=nfds@entry=1, timeout=-1)
at ../sysdeps/unix/sysv/linux/poll.c:29
#1 0x00007f39f4f3409d in poll (__timeout=<optimized out>, __nfds=1, __fds=0x7f39ceaca930) at /usr/include/bits/poll2.h:46
#2 pcap_wait_for_frames_mmap (handle=handle@entry=0x7f39ac1a7260) at ./pcap-linux.c:4561
#3 0x00007f39f4f38b98 in pcap_read_linux_mmap_v3 (handle=0x7f39ac1a7260, max_packets=1,
callback=0x7f39f4f339f0 <pcap_oneshot_mmap>, user=0x7f39ceaca9d0 "@\252\254\316\071\177") at ./pcap-linux.c:5059
#4 0x00007f39f4f3d632 in pcap_next (p=p@entry=0x7f39ac1a7260, h=h@entry=0x7f39ceacaa40) at ./pcap.c:243
#5 0x00007f39f5186ace in learnIPAddressThread (arg=0x7f39fc058f10) at nwfilter/nwfilter_learnipaddr.c:486
#6 0x00007f3a264816a2 in virThreadHelper (data=<optimized out>) at util/virthread.c:206
#7 0x00007f3a22adf564 in start_thread (arg=<optimized out>) at pthread_create.c:463
#8 0x00007f3a2281331f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
So in summary:
Thread 1 is responding to QEMU SHUTDOWN event
Waiting on lock VM mutex due to thread 4
Thread 4 is responding to virDomainDestroy
Holds lock on VM mutex
Holds lock on nwfilter update mutex
Waiting on lock interface mutex due to thread 19
Thread 19 is doing nwfilter address learning
Holds lock on interface mutex
Thread 19 is using libpcap to capture packets, and has told it to use a
500ms timeout. So it is in pcap_next() while holding the interface
lock waiting in poll(). The code is written such that pcap_next() is
expected to return on hitting the 500ms timeout and check for a request
for learning to terminate. Whereupon it would release the interface lock
allowing thread 4 to continnue.
As we can see from the stack trace though, pcap_next() is not honouring
our 500ms timeout, and has done poll() with an infinite timeout.
This seems to be intentional behaviour from libpcap to ignore our requested
timeout....
} else if (handlep->timeout > 0) {
#ifdef HAVE_TPACKET3
/*
* For TPACKET_V3, the timeout is handled by the kernel,
* so block forever; that way, we don't get extra timeouts.
* Don't do that if we have a broken TPACKET_V3, though.
*/
if (handlep->tp_version == TPACKET_V3 && !broken_tpacket_v3)
handlep->poll_timeout = -1; /* block forever, let TPACKET_V3 wake us up */
else
#endif
handlep->poll_timeout = handlep->timeout; /* block for that amount of time */
We've taken the path tp_version == TPACKET_V3 && !broken_tpacket_v3.
This is the case for anything with kernel >= 3.19
/*
* OK, that was a valid minor version.
* Is this 3.19 or newer?
*/
if (major >= 4 || (major == 3 && minor >= 19)) {
/* Yes. TPACKET_V3 works correctly. */
broken_tpacket_v3 = 0;
}
I've no clue what it is about TPACKET_V3 that is supposed to wake us
up from poll, but it clearly isn't happening :-(
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
6 years, 6 months
[libvirt] [PATCH] qemu: clarify message about block peek format restriction
by Daniel P. Berrangé
Include the actual disk format in the error message to help the user see
what is wrong.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_driver.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e61af23870..3a328e5d46 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11544,8 +11544,9 @@ qemuDomainBlockPeek(virDomainPtr dom,
}
if (disk->src->format != VIR_STORAGE_FILE_RAW) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("peeking is supported only for RAW disks"));
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+ _("peeking is only supported for disk with 'raw' format not '%s'"),
+ virStorageFileFormatTypeToString(disk->src->format));
goto cleanup;
}
--
2.17.0
6 years, 6 months