[PATCH 0/7] qemu: Fix hot-(un-)plug of disks with FD-passed storage
by Peter Krempa
Peter Krempa (7):
qemu_fd: Remove declaration for 'qemuFDPassNewDirect'
qemuStorageSourcePrivateDataFormat: Rename 'tmp' to 'objectsChildBuf'
qemu: command: Handle FD passing commandline via
qemuBuildBlockStorageSourceAttachDataCommandline
qemuFDPassTransferCommand: Mark that FD was passed
qemu: fd: Add helpers allowing storing FD set data in status XML
qemu: domain: Store fdset ID for disks passed to qemu via FD
qemu: block: Properly handle FD-passed disk hot-(un-)plug
src/qemu/qemu_block.c | 7 +++
src/qemu/qemu_block.h | 2 +
src/qemu/qemu_command.c | 26 ++---------
src/qemu/qemu_domain.c | 31 +++++++++----
src/qemu/qemu_fd.c | 43 +++++++++++++++++++
src/qemu/qemu_fd.h | 8 +++-
tests/qemustatusxml2xmldata/modern-in.xml | 3 ++
.../disk-source-fd.x86_64-latest.args | 6 +--
8 files changed, 91 insertions(+), 35 deletions(-)
--
2.39.1
1 year, 9 months
[RFC PATCH] build: deprecate --enable-gprof builds and remove from CI
by Alex Bennée
As gprof relies on instrumentation you rarely get useful data compared
to a real optimised build. Lets deprecate the build option and
simplify the CI configuration as a result.
Signed-off-by: Alex Bennée <alex.bennee(a)linaro.org>
Cc: Thomas Huth <thuth(a)redhat.com>
---
docs/about/deprecated.rst | 14 ++++++++++++++
meson.build | 7 ++++++-
.gitlab-ci.d/buildtest.yml | 19 ++++---------------
meson_options.txt | 3 ++-
4 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 9f1bbc495d..87b4511535 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -20,6 +20,20 @@ they were first deprecated in the 2.10.0 release.
What follows is a list of all features currently marked as
deprecated.
+Build options
+-------------
+
+``gprof`` builds (since 8.0)
+''''''''''''''''''''''''''''
+
+The ``--enable-gprof`` configure setting relies on compiler
+instrumentation to gather its data which can distort the generated
+profile. As other non-instrumenting tools are available that give a
+more holistic view of the system with non-instrumented binaries we are
+deprecating the build option and no longer defend it in CI. The
+``--enable-gcov`` build option remains for analysis test case
+coverage.
+
System emulator command line arguments
--------------------------------------
diff --git a/meson.build b/meson.build
index 56320ae717..ecf44ea534 100644
--- a/meson.build
+++ b/meson.build
@@ -3791,7 +3791,12 @@ summary_info += {'mutex debugging': get_option('debug_mutex')}
summary_info += {'memory allocator': get_option('malloc')}
summary_info += {'avx2 optimization': config_host_data.get('CONFIG_AVX2_OPT')}
summary_info += {'avx512f optimization': config_host_data.get('CONFIG_AVX512F_OPT')}
-summary_info += {'gprof enabled': get_option('gprof')}
+if get_option('gprof')
+ gprof_info = 'YES (deprecated)'
+else
+ gprof_info = get_option('gprof')
+endif
+summary_info += {'gprof': gprof_info}
summary_info += {'gcov': get_option('b_coverage')}
summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
summary_info += {'CFI support': get_option('cfi')}
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 9a6ba1fe3b..dc8fa0a498 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -468,27 +468,16 @@ tsan-build:
TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
MAKE_CHECK_ARGS: bench V=1
-# gprof/gcov are GCC features
-build-gprof-gcov:
+# gcov is a GCC features
+gcov:
extends: .native_build_job_template
needs:
job: amd64-ubuntu2004-container
+ timeout: 80m
variables:
IMAGE: ubuntu2004
- CONFIGURE_ARGS: --enable-gprof --enable-gcov
+ CONFIGURE_ARGS: --enable-gcov
TARGETS: aarch64-softmmu ppc64-softmmu s390x-softmmu x86_64-softmmu
- artifacts:
- expire_in: 1 days
- paths:
- - build
-
-check-gprof-gcov:
- extends: .native_test_job_template
- needs:
- - job: build-gprof-gcov
- artifacts: true
- variables:
- IMAGE: ubuntu2004
MAKE_CHECK_ARGS: check
after_script:
- cd build
diff --git a/meson_options.txt b/meson_options.txt
index 559a571b6b..53459c15fc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -316,7 +316,8 @@ option('debug_stack_usage', type: 'boolean', value: false,
option('qom_cast_debug', type: 'boolean', value: false,
description: 'cast debugging support')
option('gprof', type: 'boolean', value: false,
- description: 'QEMU profiling with gprof')
+ description: 'QEMU profiling with gprof',
+ deprecated: true)
option('profiler', type: 'boolean', value: false,
description: 'profiler support')
option('slirp_smbd', type : 'feature', value : 'auto',
--
2.34.1
1 year, 9 months
Zoned storage support in libvirt
by Stefan Hajnoczi
Hi Peter,
Zoned storage support
(https://zonedstorage.io/docs/introduction/zoned-storage) is being added
to QEMU. Given a zoned host block device, the QEMU syntax will look like
this:
--blockdev zoned_host_device,node-name=drive0,filename=/dev/$BDEV,...
--device virtio-blk-pci,drive=drive0
Note that regular --blockdev host_device will not work.
For now the virtio-blk device is the only one that supports zoned
blockdevs.
This brings to mind a few questions:
1. Does libvirt need domain XML syntax for zoned storage? Alternatively,
it could probe /sys/block/$BDEV/queue/zoned and generate the correct
QEMU command-line arguments for zoned devices when the contents of
the file are not "none".
2. Should QEMU --blockdev host_device detected zoned devices so that
--blockdev zoned_host_device is not necessary? That way libvirt would
automatically support zoned storage without any domain XML syntax or
libvirt code changes.
The drawbacks I see when QEMU detects zoned storage automatically:
- You can't easiy tell if a blockdev is zoned from the command-line.
- It's possible to mismatch zoned and non-zoned devices across live
migration.
We still have time to decide on the QEMU command-line syntax for QEMU
8.0, so I wanted to raise this now.
Thanks,
Stefan
1 year, 9 months
[PATCH v2 0/5] logging: add log cleanup for obsolete domains
by Oleg Vasilev
Presently, logs from deleted domains remain forever. Particular motivation
comes from the case when libguestfs has repeatedly created transient VMs,
which in turn created plenty of logs. This takes up space and lots of files
troubles filesystem navigation.
More motivation in [1]. Patch solving same problem in [2].
Changes in v2: substantial rework according to Martin Kletzander's comments
v1: https://www.mail-archive.com/libvir-list@redhat.com/msg233754.html
[1]: https://listman.redhat.com/archives/libvir-list/2022-February/228149.html
[2]: https://listman.redhat.com/archives/libvir-list/2022-February/msg00865.html
CC: Martin Kletzander <mkletzan(a)redhat.com>
Oleg Vasilev (5):
logging: refactor to store config inside log handler
logging: move virLogHandler to header
logging: add configuration for future log cleaner
logging: add log cleanup for obsolete domains
logging: use the log cleaner
po/POTFILES | 1 +
src/logging/log_cleaner.c | 276 +++++++++++++++++++++++++++++++
src/logging/log_cleaner.h | 29 ++++
src/logging/log_daemon.c | 6 +-
src/logging/log_daemon_config.c | 9 +
src/logging/log_daemon_config.h | 3 +
src/logging/log_handler.c | 64 +++----
src/logging/log_handler.h | 50 ++++--
src/logging/meson.build | 1 +
src/logging/test_virtlogd.aug.in | 2 +
src/logging/virtlogd.aug | 2 +
src/logging/virtlogd.conf | 14 ++
12 files changed, 399 insertions(+), 58 deletions(-)
create mode 100644 src/logging/log_cleaner.c
create mode 100644 src/logging/log_cleaner.h
--
2.38.1
1 year, 9 months
Re: [PATCH] qemu: implement QEMU NBD source reconnect delay attribute
by Christian Nautze
Hi!
Is it possible to get a review on this patch I send before Christmas? :)
Thank you!
Christian
_____________________________________________________
Currently it's only possible to set this parameter during domain
creation via QEMU commandline passthrough feature.
With the new delay attribute it's also possible to set this
parameter if you want to attach a new NBD disk
using "virsh attach-device domain device.xml" e.g.:
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
<source protocol='nbd' name='foo'>
<host name='example.org' port='6000'/>
<reconnect enabled='yes' delay='10'/>
</source>
<target dev='vdb' bus='virtio'/>
</disk>
Signed-off-by: Christian Nautze <christian.nautze at exoscale.ch
<https://listman.redhat.com/mailman/listinfo/libvir-list>>
---
docs/formatdomain.rst | 10 ++++++--
src/conf/domain_conf.c | 19 +++++++++++++++
src/conf/schemas/domaincommon.rng | 3 +++
src/conf/schemas/storagecommon.rng | 5 ++++
src/conf/storage_source_conf.c | 1 +
src/conf/storage_source_conf.h | 4 ++++
src/qemu/qemu_block.c | 4 +++-
src/qemu/qemu_domain.c | 9 ++++++++
.../disk-network-nbd.x86_64-latest.args | 23 +++++++++++--------
tests/qemuxml2argvdata/disk-network-nbd.xml | 8 +++++++
tests/qemuxml2xmloutdata/disk-network-nbd.xml | 9 ++++++++
11 files changed, 82 insertions(+), 13 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index d7fffc6e0b..3fbeba644a 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -2938,13 +2938,19 @@ paravirtualized driver is specified via the
``disk`` element.
are intended to be default, then the entire element may be omitted.
``reconnect``
For disk type ``vhostuser`` configures reconnect timeout if the
connection
- is lost. It has two mandatory attributes:
+ is lost. This is set with the two mandatory attributes ``enabled`` and
+ ``timeout``. For disk type ``network`` and protocol ``nbd`` the QEMU NBD
+ reconnect delay can be set via the mandatory attributes ``enabled``
+ and ``delay``:
``enabled``
If the reconnect feature is enabled, accepts ``yes`` and ``no``
``timeout``
The amount of seconds after which hypervisor tries to reconnect.
-
+ ``delay``
+ The amount of seconds during which all requests are paused
and will be rerun
+ after a successful reconnect. After that time, any delayed
requests and all
+ future requests before a successful reconnect will immediately fail.
For a "file" or "volume" disk type which represents a cdrom or floppy (the
``device`` attribute), it is possible to define policy what to do with the
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6c088ff295..909c78ef28 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7024,6 +7024,22 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
src->tlsFromConfig = !!value;
}
+ if (src->protocol == VIR_STORAGE_NET_PROTOCOL_NBD) {
+ xmlNodePtr cur;
+ if ((cur = virXPathNode("./reconnect", ctxt))) {
+ virTristateBool enabled;
+ if (virXMLPropTristateBool(cur, "enabled", VIR_XML_PROP_NONE,
+ &enabled) < 0)
+ return -1;
+
+ if (enabled == VIR_TRISTATE_BOOL_YES) {
+ if (virXMLPropUInt(cur, "delay", 10, VIR_XML_PROP_REQUIRED,
+ &src->reconnectDelay) < 0)
+ return -1;
+ }
+ }
+ }
+
/* for historical reasons we store the volume and image name in one XML
* element although it complicates thing when attempting to access them. */
if (src->path &&
@@ -21729,6 +21745,9 @@ virDomainDiskSourceFormatNetwork(virBuffer *attrBuf,
virBufferAddLit(childBuf, "/>\n");
}
+ if (src->reconnectDelay) {
+ virBufferAsprintf(childBuf, "<reconnect enabled='yes'
delay='%u'/>\n", src->reconnectDelay);
+ }
virBufferEscapeString(childBuf, "<snapshot name='%s'/>\n", src->snapshot);
virBufferEscapeString(childBuf, "<config file='%s'/>\n", src->configFile);
diff --git a/src/conf/schemas/domaincommon.rng
b/src/conf/schemas/domaincommon.rng
index c588a48fd2..72587416fe 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -2184,6 +2184,9 @@
</optional>
<ref name="diskSourceCommon"/>
<ref name="diskSourceNetworkHost"/>
+ <optional>
+ <ref name="reconnect"/>
+ </optional>
<optional>
<ref name="encryption"/>
</optional>
diff --git a/src/conf/schemas/storagecommon.rng
b/src/conf/schemas/storagecommon.rng
index 76714c9aad..2842376e78 100644
--- a/src/conf/schemas/storagecommon.rng
+++ b/src/conf/schemas/storagecommon.rng
@@ -61,6 +61,11 @@
<ref name="unsignedInt"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="delay">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
</element>
</define>
diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c
index 2b4cf5e241..edfd17c77c 100644
--- a/src/conf/storage_source_conf.c
+++ b/src/conf/storage_source_conf.c
@@ -810,6 +810,7 @@ virStorageSourceCopy(const virStorageSource *src,
def->sslverify = src->sslverify;
def->readahead = src->readahead;
def->timeout = src->timeout;
+ def->reconnectDelay = src->reconnectDelay;
def->metadataCacheMaxSize = src->metadataCacheMaxSize;
/* storage driver metadata are not copied */
diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h
index f2440cec6a..b60a4b3346 100644
--- a/src/conf/storage_source_conf.h
+++ b/src/conf/storage_source_conf.h
@@ -290,6 +290,10 @@ struct _virStorageSource {
unsigned long long readahead; /* size of the readahead buffer in bytes */
unsigned long long timeout; /* connection timeout in seconds */
+ /* NBD QEMU reconnect-delay option,
+ * 0 as default value */
+ unsigned int reconnectDelay;
+
virStorageSourceNVMeDef *nvme; /* type == VIR_STORAGE_TYPE_NVME */
virDomainChrSourceDef *vhostuser; /* type == VIR_STORAGE_TYPE_VHOST_USER */
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 8a6f601b29..6913c380a0 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -530,6 +530,7 @@ qemuBlockStorageSourceGetNBDProps(virStorageSource *src,
"S:export", src->path,
"S:tls-creds", tlsAlias,
"S:tls-hostname", tlsHostname,
+ "p:reconnect-delay", src->reconnectDelay,
NULL) < 0)
return NULL;
@@ -1817,7 +1818,8 @@ qemuBlockGetBackingStoreString(virStorageSource *src,
src->ncookies == 0 &&
src->sslverify == VIR_TRISTATE_BOOL_ABSENT &&
src->timeout == 0 &&
- src->readahead == 0) {
+ src->readahead == 0 &&
+ src->reconnectDelay == 0) {
switch ((virStorageNetProtocol) src->protocol) {
case VIR_STORAGE_NET_PROTOCOL_NBD:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5c05032ce3..840d857f78 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4927,6 +4927,15 @@ qemuDomainValidateStorageSource(virStorageSource *src,
}
}
+ if (src->reconnectDelay > 0) {
+ if (actualType != VIR_STORAGE_TYPE_NETWORK ||
+ src->protocol != VIR_STORAGE_NET_PROTOCOL_NBD) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("reconnect delay is supported only with
NBD protocol"));
+ return -1;
+ }
+ }
+
if (src->query &&
(actualType != VIR_STORAGE_TYPE_NETWORK ||
(src->protocol != VIR_STORAGE_NET_PROTOCOL_HTTPS &&
diff --git a/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
b/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
index 21e619af3e..e8d13b0bd4 100644
--- a/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
@@ -28,21 +28,24 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-no-acpi \
-boot strict=on \
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}'
\
--blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"node-name":"libvirt-6-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"raw","file":"libvirt-6-storage"}'
\
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-6-format","id":"virtio-disk0","bootindex":1}'
\
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"export":"bar","node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev '{"node-name":"libvirt-5-format","read-only":false,"driver":"raw","file":"libvirt-5-storage"}'
\
--device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-5-format","id":"virtio-disk0","bootindex":1}'
\
--blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"export":"bar","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}'
\
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-5-format","id":"virtio-disk1"}'
\
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"::1","port":"6000"},"node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"raw","file":"libvirt-4-storage"}'
\
--device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-4-format","id":"virtio-disk1"}'
\
--blockdev '{"driver":"nbd","server":{"type":"inet","host":"::1","port":"6000"},"node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}'
\
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-4-format","id":"virtio-disk2"}'
\
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"::1","port":"6000"},"export":"bar","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"raw","file":"libvirt-3-storage"}'
\
--device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-3-format","id":"virtio-disk2"}'
\
--blockdev '{"driver":"nbd","server":{"type":"inet","host":"::1","port":"6000"},"export":"bar","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
\
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x5","drive":"libvirt-3-format","id":"virtio-disk3"}'
\
+-blockdev '{"driver":"nbd","server":{"type":"unix","path":"/var/run/nbdsock"},"export":"bar","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","file":"libvirt-2-storage"}'
\
--device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x5","drive":"libvirt-2-format","id":"virtio-disk3"}'
\
--blockdev '{"driver":"nbd","server":{"type":"unix","path":"/var/run/nbdsock"},"export":"bar","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-2-format","id":"virtio-disk4"}'
\
+-blockdev '{"driver":"nbd","server":{"type":"inet","host":"example.org","port":"6000"},"export":"foo","reconnect-delay":10,"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}'
\
--device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-1-format","id":"virtio-disk4"}'
\
+-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-1-format","id":"virtio-disk5"}'
\
-audiodev '{"id":"audio1","driver":"none"}' \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny
\
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-network-nbd.xml
b/tests/qemuxml2argvdata/disk-network-nbd.xml
index 8ac6cc3b7b..243ffeb1ed 100644
--- a/tests/qemuxml2argvdata/disk-network-nbd.xml
+++ b/tests/qemuxml2argvdata/disk-network-nbd.xml
@@ -49,6 +49,14 @@
</source>
<target dev='vde' bus='virtio'/>
</disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='nbd' name='foo'>
+ <host name='example.org' port='6000'/>
+ <reconnect enabled='yes' delay='10'/>
+ </source>
+ <target dev='vdf' bus='virtio'/>
+ </disk>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
diff --git a/tests/qemuxml2xmloutdata/disk-network-nbd.xml
b/tests/qemuxml2xmloutdata/disk-network-nbd.xml
index f8dcca4bab..ed0c760d5b 100644
--- a/tests/qemuxml2xmloutdata/disk-network-nbd.xml
+++ b/tests/qemuxml2xmloutdata/disk-network-nbd.xml
@@ -54,6 +54,15 @@
<target dev='vde' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06'
function='0x0'/>
</disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='nbd' name='foo'>
+ <host name='example.org' port='6000'/>
+ <reconnect enabled='yes' delay='10'/>
+ </source>
+ <target dev='vdf' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07'
function='0x0'/>
+ </disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x2'/>
</controller>
--
2.34.1
1 year, 9 months
Re: [RFC PATCH 14/19] mm: Introduce a cgroup for pinned memory
by Jason Gunthorpe
On Fri, Jan 27, 2023 at 11:44:19AM -1000, Tejun Heo wrote:
> On Tue, Jan 24, 2023 at 04:42:43PM +1100, Alistair Popple wrote:
> > If too much memory in a system is pinned or locked it can lead to
> > problems such as performance degredation or in the worst case
> > out-of-memory errors as such memory cannot be moved or paged out.
> >
> > In order to prevent users without CAP_IPC_LOCK from causing these
> > issues the amount of memory that can be pinned is typically limited by
> > RLIMIT_MEMLOCK. However this is inflexible as limits can't be shared
> > between tasks and the enforcement of these limits is inconsistent
> > between in-kernel users of pinned memory such as mlock() and device
> > drivers which may also pin pages with pin_user_pages().
> >
> > To allow for a single limit to be set introduce a cgroup controller
> > which can be used to limit the number of pages being pinned by all
> > tasks in the cgroup.
>
> The use case makes some sense to me but I wonder whether this'd fit a lot
> better in memcg rather than being its own controller.
As long as the pinned limitation has its own bucket it is probably
fine? The underlying memory allocations should have already been
charged to the memcg - so we don't want to double account.
Alex and Daniel were looking at this from the qemu/libvirt
perspective, perhaps they have some insight what they would like to
see?
Thanks,
Jason
1 year, 9 months
[PATCH] virsh: Make domif-setlink work more than once
by Michal Privoznik
In virsh, we have this convenient domif-setlink command, which is
just a wrapper over virDomainUpdateDeviceFlags() and which allows
setting link state of given guest NIC. It does so by fetching
corresponding <interface/> XML snippet and either putting <link
state=''/> into it, OR if the element already exists setting the
attribute to desired value. The XML is then fed into the update
API.
There's, however, a small bug in detecting the pre-existence of
the element and its attribute. The code looks at "link"
attribute, while in fact, the attribute is called "state".
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/426
Fixes: e575bf082ed4889280be07c986375f1ca15bb7ee
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 6b431bd1e5..59b2b3ce60 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -3209,7 +3209,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd)
}
}
- if (xmlHasProp(linkNode, BAD_CAST "link"))
+ if (xmlHasProp(linkNode, BAD_CAST "state"))
stateAttr = xmlSetProp(linkNode, BAD_CAST "state", BAD_CAST state);
else
stateAttr = xmlNewProp(linkNode, BAD_CAST "state", BAD_CAST state);
--
2.39.1
1 year, 9 months
[libvirt PATCH] remote: Fix memory leak in remoteDomainMigrateFinish3*
by Jiri Denemark
Theoretically, when remoteDomainMigrateFinish3* is called without a
pointer for storing migration cookie and its length (i.e., either
cookieout == NULL or cookieoutlen == NULL), we would leak the freshly
created virDomain object referenced by rv.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/remote/remote_driver.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 2f421fb5e0..9fc73f6d88 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5917,8 +5917,6 @@ remoteDomainMigrateFinish3(virConnectPtr dconn,
(xdrproc_t) xdr_remote_domain_migrate_finish3_ret, (char *) &ret) == -1)
return NULL;
- rv = get_nonnull_domain(dconn, ret.dom);
-
if (ret.cookie_out.cookie_out_len > 0) {
if (!cookieout || !cookieoutlen) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -5930,6 +5928,8 @@ remoteDomainMigrateFinish3(virConnectPtr dconn,
ret.cookie_out.cookie_out_len = 0;
}
+ rv = get_nonnull_domain(dconn, ret.dom);
+
xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_ret, (char *) &ret);
return rv;
@@ -6770,8 +6770,6 @@ remoteDomainMigrateFinish3Params(virConnectPtr dconn,
(char *) &ret) == -1)
goto cleanup;
- rv = get_nonnull_domain(dconn, ret.dom);
-
if (ret.cookie_out.cookie_out_len > 0) {
if (!cookieout || !cookieoutlen) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -6783,6 +6781,8 @@ remoteDomainMigrateFinish3Params(virConnectPtr dconn,
ret.cookie_out.cookie_out_len = 0;
}
+ rv = get_nonnull_domain(dconn, ret.dom);
+
xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_params_ret,
(char *) &ret);
--
2.39.1
1 year, 9 months
[PATCH v2 6/6] qemu: Allow mixing active internal and external active disk snapshots
by ORO@il.ibm.com
From: Or Ozeri <oro(a)il.ibm.com>
Previous commit added support for active RBD disk snapshots,
using the same qmp_transaction used also for external snapshots.
The same transaction can be used to mix internal and external snapshots.
To allow this, this commit simply removes the check that disallows mixing
for active snapshots.
Note that previous commits added validation disallowing deletion
and reverting of RBD disks. The same validation applies to the mixed
type of snapshots introduced by this commit.
Signed-off-by: Or Ozeri <oro(a)il.ibm.com>
---
src/qemu/qemu_snapshot.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index c72bdb4723..81b3e94988 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -746,10 +746,9 @@ qemuSnapshotPrepare(virDomainObj *vm,
return -1;
}
- /* For now, we don't allow mixing internal and external disks.
- * XXX technically, we could mix internal and external disks for
+ /* For now, we don't allow mixing internal and external disks for
* offline snapshots */
- if ((found_internal && external) ||
+ if ((found_internal && external && !active) ||
(def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL && external) ||
(def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL && found_internal)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
--
2.25.1
1 year, 9 months
[PATCH v2 5/6] qemu: Allow setting per-disk snapshot name for RBD disks
by ORO@il.ibm.com
From: Or Ozeri <oro(a)il.ibm.com>
This commit adds the option for setting per-disk snapshot name for
RBD disks. All other disk types are still disallowed to use the
snapshotName attribute.
Signed-off-by: Or Ozeri <oro(a)il.ibm.com>
---
src/qemu/qemu_snapshot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index a10bdf7bf2..c72bdb4723 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -664,7 +664,7 @@ qemuSnapshotPrepare(virDomainObj *vm,
return -1;
}
- if (disk->snapshot_name) {
+ if (disk->snapshot_name && !is_raw_rbd) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("snapshot name setting for disk %s unsupported "
"for storage type %s"),
--
2.25.1
1 year, 9 months