[PATCH 0/2] Small fixes for restrictive numatune mode
by Martin Kletzander
See individual commit messages for explanations (duh!)
Martin Kletzander (2):
qemu, ch: Move threads to cgroup dir before changing parameters
docs: Clarify restrictive numatune mode
docs/formatdomain.rst | 11 ++++++++++-
src/ch/ch_process.c | 12 ++++++------
src/qemu/qemu_process.c | 10 +++++-----
3 files changed, 21 insertions(+), 12 deletions(-)
--
2.40.0
1 year, 6 months
[PATCH 0/3] docs improvements
by Peter Krempa
Peter Krempa (3):
kbase: debuglogs: Emphasize disabling daemon timeout in 'TL;DR'
section
docs: manpages: Clarify that only TLS/TCP remote access needs
'virtproxyd'
docs: manpages: State that TCP connection is insecure in 'virtproxyd'
man page
docs/kbase/debuglogs.rst | 6 ++++--
docs/manpages/virtbhyved.rst | 4 ++--
docs/manpages/virtinterfaced.rst | 4 ++--
docs/manpages/virtlxcd.rst | 4 ++--
docs/manpages/virtnetworkd.rst | 4 ++--
docs/manpages/virtnodedevd.rst | 4 ++--
docs/manpages/virtnwfilterd.rst | 4 ++--
docs/manpages/virtproxyd.rst | 3 +++
docs/manpages/virtqemud.rst | 4 ++--
docs/manpages/virtsecretd.rst | 4 ++--
docs/manpages/virtstoraged.rst | 4 ++--
docs/manpages/virtvboxd.rst | 4 ++--
docs/manpages/virtvzd.rst | 4 ++--
docs/manpages/virtxend.rst | 4 ++--
14 files changed, 31 insertions(+), 26 deletions(-)
--
2.39.2
1 year, 6 months
[PATCH 0/7] Various watchdog fixes
by Martin Kletzander
Los blurbos aqui.
Martin Kletzander (7):
conf: Add missing empty lines before virDomainWatchdogDefParseXML
qemu: Fix grammar and quoting in watchdog error message on hotplug
qemu: Forbid device attach of existing platform watchdog
qemu: Forbid ib700 watchdogs for non-i440fx machine types
qemu: Check all watchdogs for iTCO duplicates
qemu: Validate watchdog action compatibility per-device
qemu: Forbid most duplicated watchdogs
src/conf/domain_conf.c | 2 +
src/qemu/qemu_driver.c | 13 +++++
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_validate.c | 51 +++++++++++--------
tests/qemuhotplugtest.c | 3 ++
.../qemuhotplug-watchdog-reset.xml | 1 +
...plug-base-live+watchdog+watchdog-reset.xml | 1 +
.../watchdog-q35-multiple.x86_64-latest.args | 4 +-
.../watchdog-q35-multiple.xml | 2 +-
.../watchdog-q35-multiple.x86_64-latest.xml | 4 +-
10 files changed, 58 insertions(+), 25 deletions(-)
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-watchdog-reset.xml
create mode 120000 tests/qemuhotplugtestdomains/qemuhotplug-base-live+watchdog+watchdog-reset.xml
--
2.40.0
1 year, 6 months
[libvirt PATCH] qemu: Allow sockets in long or deep paths.
by Nick Guenther
The qemu driver creates IPC sockets using absolute paths,
but under POSIX socket paths are constrained pretty tightly.
On systems with homedirs on an unusual mount point, like
network homedirs, or just particularly long usernames, this
could make starting VMs under qemu:///session impossible.
Resolves https://gitlab.com/libvirt/libvirt/-/issues/466
Signed-off-by: Nick Guenther <nick.guenther(a)polymtl.ca>
---
src/qemu/qemu_command.c | 52 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 49 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4ca93bf3dc..3f180d5fb6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -53,6 +53,7 @@
#include "virmdev.h"
#include "virutil.h"
+#include <libgen.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -4866,6 +4867,37 @@ qemuOpenChrChardevUNIXSocket(const virDomainChrSourceDef *dev)
struct sockaddr_un addr;
socklen_t addrlen = sizeof(addr);
int fd;
+ char* wd = NULL;
+ char* socket_dir_c = NULL;
+ char* socket_name_c = NULL;
+ char* socket_dir = NULL;
+ char* socket_name = NULL;
+
+ /* The path length is limited to what fits in sockaddr_un.
+ * It's pretty short: 108 on Linux, and this is too easy to hit.
+ * Work around this limit by using a *relative path*.
+ *
+ * background: https://stackoverflow.com/questions/34829600/why-is-the-maximal-path-leng...
+ *
+ * docker added a different workaround: https://github.com/moby/moby/pull/13408
+ */
+ if ((wd = getcwd(NULL, 0)) == NULL) {
+ virReportSystemError(errno, "%s",
+ _("Unable to get working directory"));
+ goto error;
+ }
+
+ socket_dir_c = strdup(dev->data.nix.path); // dirname edits the string given it, so it must be copied
+ socket_name_c = strdup(dev->data.nix.path);
+
+ socket_dir = dirname(socket_dir_c);
+ socket_name = basename(socket_name_c);
+
+ if (chdir(socket_dir) < 0) {
+ virReportSystemError(errno, "%s",
+ _("Unable to get change to socket directory"));
+ goto error;
+ }
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
virReportSystemError(errno, "%s",
@@ -4875,10 +4907,10 @@ qemuOpenChrChardevUNIXSocket(const virDomainChrSourceDef *dev)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
- if (virStrcpyStatic(addr.sun_path, dev->data.nix.path) < 0) {
+ if (virStrcpyStatic(addr.sun_path, socket_name) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("UNIX socket path '%1$s' too long"),
- dev->data.nix.path);
+ _("UNIX socket name '%1$s' too long"),
+ socket_name);
goto error;
}
@@ -4909,9 +4941,23 @@ qemuOpenChrChardevUNIXSocket(const virDomainChrSourceDef *dev)
if (virFileUpdatePerm(dev->data.nix.path, 0002, 0664) < 0)
goto error;
+ /* restore working directory */
+ if (chdir(wd) < 0) {
+ virReportSystemError(errno, "%s",
+ _("Unable to restore working directory"));
+ goto error;
+ }
+
+ free(socket_name_c);
+ free(socket_dir_c);
+ free(wd);
+
return fd;
error:
+ if (socket_name_c != NULL) { free(socket_name_c); }
+ if (socket_dir_c != NULL) { free(socket_dir_c); }
+ if (wd != NULL) { free(wd); }
VIR_FORCE_CLOSE(fd);
return -1;
}
--
2.34.1
1 year, 6 months
[PATCH 0/3] qemu: hotplug: Fix media change in a hotplugged cdrom
by Peter Krempa
We need to update private data to handle it properly.
Peter Krempa (3):
qemuProcessRefreshDisks: Properly compare tray status
qemuProcessRefreshDisks: Extract update of a single disk
qemu: hotplug: Update disk private data after hotplug
src/qemu/qemu_hotplug.c | 21 ++++++++++++----
src/qemu/qemu_process.c | 55 ++++++++++++++++++++++++-----------------
src/qemu/qemu_process.h | 3 +++
tests/qemuhotplugtest.c | 40 ++++++++++++++++++++----------
4 files changed, 79 insertions(+), 40 deletions(-)
--
2.39.2
1 year, 6 months
[PATCH 0/2] qemu_domain: Increase memlock limit for NVMe disks
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (2):
qemu_domain: Increase memlock limit for NVMe disks
qemumemlocktest: Introduce pc-hostdev-nvme test case
src/qemu/qemu_domain.c | 35 +++++++++++++------
.../qemumemlock-pc-hostdev-nvme.xml | 24 +++++++++++++
tests/qemumemlocktest.c | 1 +
3 files changed, 50 insertions(+), 10 deletions(-)
create mode 100644 tests/qemumemlockdata/qemumemlock-pc-hostdev-nvme.xml
--
2.39.2
1 year, 6 months
[PATCH v3 00/25] Setup iothread polling attributes in the XML
by Peter Krempa
Previous version:
https://listman.redhat.com/archives/libvir-list/2023-March/239164.html
Changes:
- patches 1 - 23 are new and do the following
- refactors to typed param handling 1 - 15, 18
- addition of new typed param APIs needed for changing the type we
use to store the poll parameters currently, 16, 17, 19
- conversion of the existing parameter handling for iothread poll
attributes to unsigned long long 20 - 23
- patches 24 and 25 are patches 1 and 2 of the previous posting:
- use unsigned long long to store the values and adjust the code
Peter Krempa (25):
virTypedParameterAssignValue: Drop 'copystr' parameter
util: virtypedparam: Use proper enum type for all switch() statements
virTypedParamsDeserialize: Remove unnecessary line breaks
virTypedParameterAssignValueVArgs: Ensure proper typed param type in
caller
util: virtypedparam: Simplify error handling in virTypedParamListAdd*
virtypedparam.h: Consistently use contemporary header style
util: virtypedparam: Introduce virTypedParamListNew()
util: typedparam: Introduce 'virTypedParamListConcat'
qemuDomainGetStatsBlock: Don't directly access virTypedParamList
util: virtypedparam: Introduce 'virTypedParamListFetch'
Use 'virTypedParamListFetch' for extracting identity parameters list
util: virtypedparam: Privatize definition of struct _virTypedParamList
util: virtypedparam: Refactor return value of
virTypedParamListStealParams
util: virtypedparam: Store errors inside virTypedParamList
util: virtypedparam: Remove return values from virTypedParamListAdd*
APIs
util: typedparam: Introduce virTypedParamListAddUnsigned
util: virtypedparam: Introduce virTypedParamsGetUnsigned
virTypedParamsValidate: Refactor variable declaration and cleanup
virTypedParamsValidate: Allow typed params to be both _UINT and
_ULLONG
virsh: cmdIOThreadSet: Refactor to use virTypedParamList
qemu: Remove iothread 'poll-' value validation
qemu: Store all iothread's 'poll*' attributes as unsigned long long
virsh: cmdIOThreadSet: Use bigger types for --poll-grow and
--poll-shrink
conf: Store the iothread 'poll' settings in the XML
qemu: Use configured iothread poll parameters on startup
docs/formatdomain.rst | 11 +-
include/libvirt/libvirt-domain.h | 4 +-
src/admin/admin_server.c | 118 ++---
src/conf/domain_conf.c | 41 +-
src/conf/domain_conf.h | 7 +
src/conf/schemas/domaincommon.rng | 19 +
src/driver.c | 7 +-
src/libvirt-domain.c | 14 +-
src/libvirt_private.syms | 7 +-
src/qemu/qemu_command.c | 18 +
src/qemu/qemu_domainjob.c | 49 +--
src/qemu/qemu_driver.c | 409 ++++++------------
src/qemu/qemu_monitor.h | 4 +-
src/qemu/qemu_monitor_json.c | 48 +-
src/remote/remote_daemon_dispatch.c | 8 +-
src/test/test_driver.c | 34 +-
src/util/virtypedparam.c | 401 +++++++++++------
src/util/virtypedparam.h | 187 +++++---
...othreads-ids-pool-sizes.x86_64-latest.args | 6 +-
.../iothreads-ids-pool-sizes.xml | 12 +-
tools/virsh-domain.c | 83 ++--
21 files changed, 781 insertions(+), 706 deletions(-)
--
2.39.2
1 year, 6 months
[PATCH 0/3] A couple of network related fixes
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (3):
networkUpdateState: do not assume dnsmasq_caps
conf: Initialize _virNetworkObj::dnsmasqPid to -1 in
virNetworkObjNew()
networkRefreshDhcpDaemon: Get dnsmasq's PID once
src/conf/virnetworkobj.c | 1 +
src/network/bridge_driver.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
--
2.39.2
1 year, 6 months
Re: [libvirt] [RFC] support vhost-user-scsi configuration
by wangjian
On 2023/4/18 21:50, wangjian (AN) wrote:
>
> On 4/15/23 15:48, wangjian (AN) wrote:
>> Hi Guys,
>>
>>
>>
>> Currently qemu and spdk already support vhost-user-scsi, but there is
>> no vhost-user-scsi configuration in libvirt.
>>
>> We hope that libvirt supports the following configurations to
>> facilitate docking with qemu.
>>
>>
>>
>> <controller type='scsi' index='0' model='vhost-user-scsi'>
>>
>> <driver queues='4'/>
>>
>> <source type='unix' path='/var/tmp/scsi'>
>>
>> <reconnect enabled='yes' timeout='3'/>
>>
>> </source>
>>
>> <address type='pci' domain='0x0000' bus='0x02' slot='0x02'
>> function='0x0'/>
>>
>> </controller>
>>
>>
>>
>> The usage in qemu like this:
>>
>> -chardev socket,id=chr-vu-virtio-disk10,path=/var/tmp/scsi,reconnect=3
>>
>> -device
>> vhost-user-blk-pci,num-queues=4,bus=pci.2,addr=0x0,chardev=chr-vu-virt
>> io-disk10,id=scsi0
>>
>>
>>
>> Could anyone give some suggestions?
>>
>
> That's very likely because nobody wrote patches for it. I do not think there was a discussion where we decided to deliberately not support it.
> But I guess, what advantage there is in letting an external helper manage a <controller/> ? I though, vhost-user-* is ideal for individual devices rather than controllers.
>
> Meanwhile, for testing purposes (definitely NOT production), you can use qemu:command line passthrough:
>
> https://libvirt.org/kbase/qemu-passthrough-security.html
>
> Michal
>
In spdk, a vhost-user-blk controller will only be associated with one disk, and a vhost-user-blk controller will only be associated with one socket file.
Therefore, for the vhost-user-blk disk, it is appropriate to use the vhost-user-blk disk associated socket file configuration in libvirt.
But in spdk, a vhost-user-scsi controller will be associated with multiple disks, and a vhost-user-scsi controller will only be associated with one socket file.
Therefore, we think that for vhost-user-scsi, it is appropriate to use the controller to associate the socket file configuration in libvirt.
1 year, 6 months
[libvirt PATCH] conf: Restrict use of <portForward> to the passt backend
by Andrea Bolognani
That's already the case in practice, but it's a better
experience for the user if we reject this configuration
outright instead of silently ignoring part of it.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/conf/domain_validate.c | 9 +++++++++
...t-user-slirp-portforward.x86_64-latest.err | 1 +
.../net-user-slirp-portforward.xml | 20 +++++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
4 files changed, 31 insertions(+)
create mode 100644 tests/qemuxml2argvdata/net-user-slirp-portforward.x86_64-latest.err
create mode 100644 tests/qemuxml2argvdata/net-user-slirp-portforward.xml
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index ce6b8bf5a0..9c7ee6d75d 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2097,6 +2097,15 @@ virDomainNetDefValidate(const virDomainNetDef *net)
}
}
+ if (net->nPortForwards > 0 &&
+ (net->type != VIR_DOMAIN_NET_TYPE_USER ||
+ (net->type == VIR_DOMAIN_NET_TYPE_USER &&
+ net->backend.type != VIR_DOMAIN_NET_BACKEND_PASST))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("The <portForward> element can only be used with <interface type='user'> and its 'passt' backend"));
+ return -1;
+ }
+
switch (net->type) {
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
if (!virDomainNetIsVirtioModel(net)) {
diff --git a/tests/qemuxml2argvdata/net-user-slirp-portforward.x86_64-latest.err b/tests/qemuxml2argvdata/net-user-slirp-portforward.x86_64-latest.err
new file mode 100644
index 0000000000..f296db1e8c
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-user-slirp-portforward.x86_64-latest.err
@@ -0,0 +1 @@
+internal error: The <portForward> element can only be used with <interface type='user'> and its 'passt' backend
diff --git a/tests/qemuxml2argvdata/net-user-slirp-portforward.xml b/tests/qemuxml2argvdata/net-user-slirp-portforward.xml
new file mode 100644
index 0000000000..721f04c878
--- /dev/null
+++ b/tests/qemuxml2argvdata/net-user-slirp-portforward.xml
@@ -0,0 +1,20 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <interface type='user'>
+ <mac address='00:11:22:33:44:55'/>
+ <portForward proto='tcp'>
+ <range start='443' to='344'/>
+ </portForward>
+ <model type='virtio'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1808d9fc02..23e0c4054c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1413,6 +1413,7 @@ mymain(void)
DO_TEST_NOCAPS("net-user-addr");
DO_TEST_CAPS_LATEST("net-user-passt");
DO_TEST_CAPS_VER("net-user-passt", "7.2.0");
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("net-user-slirp-portforward");
DO_TEST_NOCAPS("net-virtio");
DO_TEST_NOCAPS("net-virtio-device");
DO_TEST_NOCAPS("net-virtio-disable-offloads");
--
2.39.2
1 year, 6 months