[PATCH v2] lxc: fix variable storage order before call
by Adam Julis
virDomainConfNWFilterInstantiate() was called without updated
net->ifname, it caused in some cases throwing error message. If
function failed, change is reverted.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/658
Signed-off-by: Adam Julis <ajulis(a)redhat.com>
---
src/lxc/lxc_process.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 205ab96ebb..0233d17f4e 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -271,6 +271,7 @@ virLXCProcessSetupInterfaceTap(virDomainDef *vm,
{
g_autofree char *parentVeth = NULL;
g_autofree char *containerVeth = NULL;
+ g_autofree char *backupIfname = NULL;
const virNetDevVPortProfile *vport = virDomainNetGetActualVirtPortProfile(net);
VIR_DEBUG("calling vethCreate()");
@@ -315,14 +316,17 @@ virLXCProcessSetupInterfaceTap(virDomainDef *vm,
return NULL;
}
- if (net->filter &&
- virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, false) < 0)
- return NULL;
-
- /* success is guaranteed, so update the interface object */
- g_free(net->ifname);
+ /* success almost guaranteed, next function needs updated net->ifname */
+ backupIfname = g_steal_pointer(net->ifname);
net->ifname = g_steal_pointer(&parentVeth);
+ if (net->filter &&
+ virDomainConfNWFilterInstantiate(vm->name, vm->uuid, net, false) < 0) {
+ g_free(net->ifname);
+ net->ifname = g_steal_pointer(&backupIfname);
+ return NULL;
+ }
+
return g_steal_pointer(&containerVeth);
}
--
2.45.2
1 month
[PATCH 0/3] Do not relabel existing device files on hotplug
by Martin Kletzander
When hotplugging a /dev device that already exists in the process namespace we
reset all the permissions, labels etc. to the same state as the parent
namespace. Then, when we are trying to label the device for qemu we find out
there are label-remembering attributes with a positive reference count and
because we are trying to set a different label (the device now has the label of
the original device from the parent namespace) we refuse to reset it. Not only
the hotplug fails (purposefully not questioning the usability of hotplugging the
same device for a second time) but it also resets the labels to something we do
not want. Now the quiestion is: What does this patchset do? You can have a guess.
Martin Kletzander (3):
qemu_namespace: Rename variable
qemu_namespace: Properly report new files
qemu_namespace: Only replicate labels on created files
src/qemu/qemu_namespace.c | 64 +++++++++++++++++++++------------------
1 file changed, 34 insertions(+), 30 deletions(-)
--
2.47.0
1 month
[PATCH 00/10] qemu: Prepare for 'qemu-9.2' and add qemu-9.2 (dev cycle) capabilities
by Peter Krempa
Adapt to deprecation of 'gluster' replacement of 'reconnect' by
'reconnect-ms' and add qemu-9.2 caps. See individual patches for
details.
Peter Krempa (10):
qemublocktest: Convert all 'gluster' instances to 'nbd' in 'xml2json'
cases
qemublocktest: Mark gluster cases in XML->json->XML tests as
deprecated
qemublocktest: Mark 'gluster' case in image creation test as
deprecated
qemuxmlconftest: Use only 'nfs' protocol in 'disk-network-nfs'
qemuxml(conf|active)test: Use 'nbd' instead of 'gluster' in
'disk-backing-chains-(no)index' cases
qemuxmlconftest: Pin 'disk-network-gluster' case to qemu-9.1
qemu: capabilities: Introduce QEMU_CAPS_CHARDEV_RECONNECT_MILISECONDS
qemu: chardev: Use 'reconnect-ms' instead of deprecated 'reconnect'
qemuxmlconftest: Add '9.1.0' versions of test cases for 'reconnect'
option of chardevs
tests: qemucapabilities: Add test data for the qemu-9.2 dev cycle
src/qemu/qemu_block.c | 2 +-
src/qemu/qemu_block.h | 1 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_chardev.c | 20 +-
src/qemu/qemu_chardev.h | 1 +
src/qemu/qemu_command.c | 12 +-
src/qemu/qemu_command.h | 3 +-
src/qemu/qemu_hotplug.c | 19 +-
.../domaincapsdata/qemu_9.2.0-q35.x86_64.xml | 305 +
.../domaincapsdata/qemu_9.2.0-tcg.x86_64.xml | 301 +
tests/domaincapsdata/qemu_9.2.0.x86_64.xml | 305 +
tests/qemublocktest.c | 16 +-
...le-backing_basic-aio_io_uring-srconly.json | 19 +-
.../file-backing_basic-aio_io_uring.json | 17 +-
.../file-backing_basic-aio_io_uring.xml | 2 +-
...ile-backing_basic-aio_threads-srconly.json | 19 +-
.../file-backing_basic-aio_threads.json | 17 +-
.../file-backing_basic-aio_threads.xml | 2 +-
...acking_basic-cache-directsync-srconly.json | 19 +-
.../file-backing_basic-cache-directsync.json | 17 +-
.../file-backing_basic-cache-directsync.xml | 2 +-
...file-backing_basic-cache-none-srconly.json | 19 +-
.../file-backing_basic-cache-none.json | 17 +-
.../file-backing_basic-cache-none.xml | 2 +-
...le-backing_basic-cache-unsafe-srconly.json | 19 +-
.../file-backing_basic-cache-unsafe.json | 17 +-
.../file-backing_basic-cache-unsafe.xml | 2 +-
...backing_basic-cache-writeback-srconly.json | 19 +-
.../file-backing_basic-cache-writeback.json | 17 +-
.../file-backing_basic-cache-writeback.xml | 2 +-
...king_basic-cache-writethrough-srconly.json | 19 +-
...file-backing_basic-cache-writethrough.json | 17 +-
.../file-backing_basic-cache-writethrough.xml | 2 +-
.../file-backing_basic-detect-srconly.json | 19 +-
.../xml2json/file-backing_basic-detect.json | 17 +-
.../xml2json/file-backing_basic-detect.xml | 2 +-
...le-backing_basic-unmap-detect-srconly.json | 19 +-
.../file-backing_basic-unmap-detect.json | 17 +-
.../file-backing_basic-unmap-detect.xml | 2 +-
...le-backing_basic-unmap-ignore-srconly.json | 19 +-
.../file-backing_basic-unmap-ignore.json | 17 +-
.../file-backing_basic-unmap-ignore.xml | 2 +-
.../file-backing_basic-unmap-srconly.json | 19 +-
.../xml2json/file-backing_basic-unmap.json | 17 +-
.../xml2json/file-backing_basic-unmap.xml | 2 +-
.../caps_9.2.0_x86_64.replies | 44205 ++++++++++++++++
.../caps_9.2.0_x86_64.xml | 3970 ++
tests/qemumonitorjsontest.c | 2 +-
...king-chains-index-active.x86_64-latest.xml | 4 +-
...ng-chains-index-inactive.x86_64-latest.xml | 4 +-
.../chardev-backends-json.x86_64-9.1.0.args | 79 +
.../chardev-backends-json.x86_64-9.1.0.xml | 149 +
.../chardev-backends-json.x86_64-latest.args | 6 +-
.../chardev-backends.x86_64-9.1.0.args | 79 +
.../chardev-backends.x86_64-9.1.0.xml | 149 +
.../chardev-backends.x86_64-latest.args | 6 +-
.../chardev-reconnect.x86_64-9.1.0.args | 46 +
.../chardev-reconnect.x86_64-9.1.0.xml | 72 +
.../chardev-reconnect.x86_64-latest.args | 10 +-
...isk-backing-chains-index.x86_64-latest.xml | 4 +-
.../disk-backing-chains-index.xml | 4 +-
...-backing-chains-noindex.x86_64-latest.args | 4 +-
...k-backing-chains-noindex.x86_64-latest.xml | 4 +-
.../disk-backing-chains-noindex.xml | 4 +-
...=> disk-network-gluster.x86_64-9.1.0.args} | 2 +-
... => disk-network-gluster.x86_64-9.1.0.xml} | 2 +-
.../qemuxmlconfdata/disk-network-gluster.xml | 2 +-
.../disk-network-nfs.x86_64-latest.args | 2 +-
.../disk-network-nfs.x86_64-latest.xml | 4 +-
tests/qemuxmlconfdata/disk-network-nfs.xml | 4 +-
.../disk-vhostuser-numa.x86_64-latest.args | 2 +-
.../disk-vhostuser.x86_64-latest.args | 2 +-
.../net-vhostuser-multiq.x86_64-latest.args | 4 +-
tests/qemuxmlconftest.c | 8 +-
75 files changed, 49938 insertions(+), 301 deletions(-)
create mode 100644 tests/domaincapsdata/qemu_9.2.0-q35.x86_64.xml
create mode 100644 tests/domaincapsdata/qemu_9.2.0-tcg.x86_64.xml
create mode 100644 tests/domaincapsdata/qemu_9.2.0.x86_64.xml
create mode 100644 tests/qemucapabilitiesdata/caps_9.2.0_x86_64.replies
create mode 100644 tests/qemucapabilitiesdata/caps_9.2.0_x86_64.xml
create mode 100644 tests/qemuxmlconfdata/chardev-backends-json.x86_64-9.1.0.args
create mode 100644 tests/qemuxmlconfdata/chardev-backends-json.x86_64-9.1.0.xml
create mode 100644 tests/qemuxmlconfdata/chardev-backends.x86_64-9.1.0.args
create mode 100644 tests/qemuxmlconfdata/chardev-backends.x86_64-9.1.0.xml
create mode 100644 tests/qemuxmlconfdata/chardev-reconnect.x86_64-9.1.0.args
create mode 100644 tests/qemuxmlconfdata/chardev-reconnect.x86_64-9.1.0.xml
rename tests/qemuxmlconfdata/{disk-network-gluster.x86_64-latest.args => disk-network-gluster.x86_64-9.1.0.args} (96%)
rename tests/qemuxmlconfdata/{disk-network-gluster.x86_64-latest.xml => disk-network-gluster.x86_64-9.1.0.xml} (97%)
--
2.46.2
1 month
[PATCH] apparmor: Allow running i686 VMs on Debian 12
by Andrea Bolognani
In Debian 12, the qemu-system-i386 binary in /usr/bin is a wrapper
script, with the actual executable living in /usr/libexec instead.
This makes it impossible to run i686 VMs when AppArmor is enabled.
Allow running the actual binary.
https://bugs.debian.org/1030926
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/security/apparmor/libvirt-qemu.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/security/apparmor/libvirt-qemu.in b/src/security/apparmor/libvirt-qemu.in
index 8f17256554..694da26dea 100644
--- a/src/security/apparmor/libvirt-qemu.in
+++ b/src/security/apparmor/libvirt-qemu.in
@@ -172,6 +172,9 @@
/usr/bin/qemu-system-xtensaeb rmix,
/usr/bin/qemu-unicore32 rmix,
/usr/bin/qemu-x86_64 rmix,
+ # Debian 12 has a wrapper script in /usr/bin while the actual
+ # binary lives in /usr/libexec (Debian: #1030926)
+ /usr/libexec/qemu-system-i386 rmix,
# for Debian/Ubuntu qemu-block-extra / RPMs qemu-block-* (LP: #1554761)
/usr/{lib,lib64}/qemu/*.so mr,
/usr/lib/(a){multiarch}/qemu/*.so mr,
--
2.46.2
1 month
[PATCH 0/5] ci: various CI fixes
by Daniel P. Berrangé
This fixes various issues with CI across multiple platforms, debian,
Fedora and macOS.
Daniel P. Berrangé (5):
meson: unconditionally enable polkit on non-Windows
ci: drop polkit from build deps
tests: stop stubbing libselinux APIs for purpose of data overrides
wireshark: drop gmodule.h include to avoid glib warnings
ci: update macOS versions under test
ci/buildenv/almalinux-9.sh | 1 -
ci/buildenv/alpine-319.sh | 1 -
ci/buildenv/alpine-edge.sh | 1 -
ci/buildenv/centos-stream-9.sh | 1 -
ci/buildenv/debian-11-cross-aarch64.sh | 1 -
ci/buildenv/debian-11-cross-armv6l.sh | 1 -
ci/buildenv/debian-11-cross-armv7l.sh | 1 -
ci/buildenv/debian-11-cross-i686.sh | 1 -
ci/buildenv/debian-11-cross-mips64el.sh | 1 -
ci/buildenv/debian-11-cross-mipsel.sh | 1 -
ci/buildenv/debian-11-cross-ppc64le.sh | 1 -
ci/buildenv/debian-11-cross-s390x.sh | 1 -
ci/buildenv/debian-11.sh | 1 -
ci/buildenv/debian-12-cross-aarch64.sh | 1 -
ci/buildenv/debian-12-cross-armv6l.sh | 1 -
ci/buildenv/debian-12-cross-armv7l.sh | 1 -
ci/buildenv/debian-12-cross-i686.sh | 1 -
ci/buildenv/debian-12-cross-mips64el.sh | 1 -
ci/buildenv/debian-12-cross-mipsel.sh | 1 -
ci/buildenv/debian-12-cross-ppc64le.sh | 1 -
ci/buildenv/debian-12-cross-s390x.sh | 1 -
ci/buildenv/debian-12.sh | 1 -
ci/buildenv/debian-sid-cross-aarch64.sh | 1 -
ci/buildenv/debian-sid-cross-armv6l.sh | 1 -
ci/buildenv/debian-sid-cross-armv7l.sh | 1 -
ci/buildenv/debian-sid-cross-i686.sh | 1 -
ci/buildenv/debian-sid-cross-mips64el.sh | 1 -
ci/buildenv/debian-sid-cross-ppc64le.sh | 1 -
ci/buildenv/debian-sid-cross-s390x.sh | 1 -
ci/buildenv/debian-sid.sh | 1 -
ci/buildenv/fedora-39.sh | 1 -
ci/buildenv/fedora-40-cross-mingw32.sh | 1 -
ci/buildenv/fedora-40-cross-mingw64.sh | 1 -
ci/buildenv/fedora-40.sh | 1 -
ci/buildenv/fedora-rawhide-cross-mingw32.sh | 1 -
ci/buildenv/fedora-rawhide-cross-mingw64.sh | 1 -
ci/buildenv/fedora-rawhide.sh | 1 -
ci/buildenv/opensuse-leap-15.sh | 2 +-
ci/buildenv/opensuse-tumbleweed.sh | 1 -
ci/buildenv/ubuntu-2204.sh | 1 -
ci/buildenv/ubuntu-2404.sh | 1 -
ci/cirrus/build.yml | 2 ++
ci/cirrus/freebsd-13.vars | 2 +-
ci/cirrus/freebsd-14.vars | 2 +-
ci/cirrus/macos-13.vars | 16 ------------
ci/containers/almalinux-9.Dockerfile | 1 -
ci/containers/alpine-319.Dockerfile | 1 -
ci/containers/alpine-edge.Dockerfile | 1 -
ci/containers/centos-stream-9.Dockerfile | 1 -
.../debian-11-cross-aarch64.Dockerfile | 1 -
.../debian-11-cross-armv6l.Dockerfile | 1 -
.../debian-11-cross-armv7l.Dockerfile | 1 -
ci/containers/debian-11-cross-i686.Dockerfile | 1 -
.../debian-11-cross-mips64el.Dockerfile | 1 -
.../debian-11-cross-mipsel.Dockerfile | 1 -
.../debian-11-cross-ppc64le.Dockerfile | 1 -
.../debian-11-cross-s390x.Dockerfile | 1 -
ci/containers/debian-11.Dockerfile | 1 -
.../debian-12-cross-aarch64.Dockerfile | 1 -
.../debian-12-cross-armv6l.Dockerfile | 1 -
.../debian-12-cross-armv7l.Dockerfile | 1 -
ci/containers/debian-12-cross-i686.Dockerfile | 1 -
.../debian-12-cross-mips64el.Dockerfile | 1 -
.../debian-12-cross-mipsel.Dockerfile | 1 -
.../debian-12-cross-ppc64le.Dockerfile | 1 -
.../debian-12-cross-s390x.Dockerfile | 1 -
ci/containers/debian-12.Dockerfile | 1 -
.../debian-sid-cross-aarch64.Dockerfile | 1 -
.../debian-sid-cross-armv6l.Dockerfile | 1 -
.../debian-sid-cross-armv7l.Dockerfile | 1 -
.../debian-sid-cross-i686.Dockerfile | 1 -
.../debian-sid-cross-mips64el.Dockerfile | 1 -
.../debian-sid-cross-ppc64le.Dockerfile | 1 -
.../debian-sid-cross-s390x.Dockerfile | 1 -
ci/containers/debian-sid.Dockerfile | 1 -
ci/containers/fedora-39.Dockerfile | 1 -
.../fedora-40-cross-mingw32.Dockerfile | 1 -
.../fedora-40-cross-mingw64.Dockerfile | 1 -
ci/containers/fedora-40.Dockerfile | 1 -
.../fedora-rawhide-cross-mingw32.Dockerfile | 1 -
.../fedora-rawhide-cross-mingw64.Dockerfile | 1 -
ci/containers/fedora-rawhide.Dockerfile | 1 -
ci/containers/opensuse-leap-15.Dockerfile | 2 +-
ci/containers/opensuse-tumbleweed.Dockerfile | 1 -
ci/containers/ubuntu-2204.Dockerfile | 1 -
ci/containers/ubuntu-2404.Dockerfile | 1 -
ci/gitlab/builds.yml | 12 +++++----
ci/lcitool/projects/libvirt.yml | 1 -
ci/manifest.yml | 9 ++++---
meson.build | 5 ----
tests/securityselinuxhelper.c | 25 -------------------
tests/securityselinuxlabeltest.c | 5 +++-
tests/securityselinuxtest.c | 2 +-
tests/viridentitytest.c | 4 +--
tools/wireshark/src/plugin.c | 2 --
95 files changed, 25 insertions(+), 146 deletions(-)
delete mode 100644 ci/cirrus/macos-13.vars
--
2.46.0
1 month, 1 week
[PATCH v2 00/13] Implement support for QCOW2 data files
by Nikolai Barybin
Hello everyone!
With help of Peter's review and after researching Cole's patches I've
come up with the second version.
Changes since last revision:
- properly taken in account (while probing disk chain) usecase when we have
data-file as part of some backing image
- added proper integration with security drivers instead of call to
chown
- data-file is added to qemu cmdline as a reference to blockdev
- added XML formatiing and parsing
- added basic tests to qemublocktest
Nikolai Barybin (13):
conf: add data-file feature and related fields to virStorageSource
storage file: add getDataFile function to FileTypeInfo
storage file: add qcow2 data-file path parsing from header
storage file: fill in src->dataFileStore during file probe
security: DAC: handle qcow2 data-file on image label set/restore
security: selinux: handle qcow2 data-file on image label set/restore
security: apparmor: handle qcow2 data-file
qemu: put data-file path to VM's cgroup and namespace
qemu: factor out qemuDomainPrepareStorageSource()
qemu: enable basic qcow2 data-file feature support
conf: schemas: add data-file store to domain rng schema
conf: implement XML parsing/formatingo for dataFileStore
tests: add qcow2 data-file basic tests to qemublocktest
src/conf/domain_conf.c | 98 +++++++++++++++++++
src/conf/domain_conf.h | 13 +++
src/conf/schemas/domaincommon.rng | 15 +++
src/conf/storage_source_conf.c | 11 +++
src/conf/storage_source_conf.h | 5 +
src/qemu/qemu_block.c | 7 ++
src/qemu/qemu_cgroup.c | 4 +
src/qemu/qemu_command.c | 5 +
src/qemu/qemu_domain.c | 50 +++++++---
src/qemu/qemu_namespace.c | 5 +
src/security/security_dac.c | 26 ++++-
src/security/security_selinux.c | 20 +++-
src/security/virt-aa-helper.c | 4 +
src/storage_file/storage_file_probe.c | 85 ++++++++++++----
src/storage_file/storage_source.c | 28 ++++++
src/storage_file/storage_source.h | 3 +
tests/qemublocktest.c | 78 +++++++++------
...backing-with-data-file-noopts-srconly.json | 27 +++++
...e-qcow2-backing-with-data-file-noopts.json | 41 ++++++++
...le-qcow2-backing-with-data-file-noopts.xml | 35 +++++++
.../file-qcow2-data-file-noopts-srconly.json | 18 ++++
.../xml2json/file-qcow2-data-file-noopts.json | 27 +++++
.../xml2json/file-qcow2-data-file-noopts.xml | 24 +++++
23 files changed, 558 insertions(+), 71 deletions(-)
create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-with-data-file-noopts-srconly.json
create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-with-data-file-noopts.json
create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-backing-with-data-file-noopts.xml
create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-data-file-noopts-srconly.json
create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-data-file-noopts.json
create mode 100644 tests/qemublocktestdata/xml2json/file-qcow2-data-file-noopts.xml
--
2.43.5
1 month, 1 week
[PATCH] qemu: migration: Fix blockdev config with VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES
by Peter Krempa
The idea of migration with VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES
populated is to sparsify the image. The QEMU NBD client as it was
configured in commit 621f879adf98e2c93ac5c8c869733a57f06cd9aa would
signal to the destination to do thick allocation of holes which would
result in a non-sparse image for any backend except a qcow2 image which
I used to test it.
Switch to VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP and
VIR_DOMAIN_DISK_DISCARD_UNMAP which tells the NBD client (and that in
turn the NBD server) to preserve the sparse blocks it detected from the
image.
Fixes: 621f879adf98e2c93ac5c8c869733a57f06cd9aa
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_migration.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 179e9d7c83..832b2946e0 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1092,8 +1092,14 @@ qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource(virDomainDiskDef *disk,
copysrc->protocol = VIR_STORAGE_NET_PROTOCOL_NBD;
copysrc->format = VIR_STORAGE_FILE_RAW;
- if (detect_zeroes)
- copysrc->detect_zeroes = VIR_DOMAIN_DISK_DETECT_ZEROES_ON;
+ if (detect_zeroes) {
+ /* We need to use both VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP and
+ * VIR_DOMAIN_DISK_DISCARD_UNMAP as the qemu NBD client otherwise singals
+ * to the server to fully allocate the zero blocks
+ */
+ copysrc->detect_zeroes = VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP;
+ copysrc->discard = VIR_DOMAIN_DISK_DISCARD_UNMAP;
+ }
copysrc->backingStore = virStorageSourceNew();
--
2.46.2
1 month, 1 week
Re: [PATCH RFC v4 11/17] qemu: block: Support block disk along with
throttle filters
by Peter Krempa
On Mon, Sep 30, 2024 at 10:14:59 +0000, Edward Arulanadam wrote:
> Dear All,
>
> My sincere apologies on reaching out regarding this change as I know, someone would be reviewing the change and provide review comments as per the community guidelines. Since this change is very critical for us to move forward, may I request for a review and let us know if this is good now.
Hi,
when this last iteration was posted I got a note (off-list) from the
author stating that they might not be able to continue work on that
series.
Are you going to pick up the work on that series? If so make sure to
configure your mail client to avoid breaking threads (as you did with
this mail). I'll use the existing convention of using 'reply-all' to the
patches so you might not get CC'd for the postings which are already
on-list. If that's a problem please re-post the series (obviously
keeping authorship intact).
I'm keeping it on my to-do list but due to personal reasons I'm really
backlogged in reviews so please be patient.
1 month, 1 week
[PATCH] qemu: snapshot: Remove dead code in 'qemuSnapshotDeleteBlockJobRunning'
by Peter Krempa
'qemuSnapshotDeleteBlockJobIsRunning' returns only 0 and 1. Convert it
to bool and remove the dead code handling -1 return in the caller.
Closes: https://gitlab.com/libvirt/libvirt/-/issues/682
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_snapshot.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 77ff842fab..1187ebf276 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -3303,7 +3303,7 @@ qemuSnapshotDeleteUpdateDisks(void *payload,
/* Deleting external snapshot is started by running qemu block-commit job.
* We need to wait for all block-commit jobs to be 'ready' or 'pending' to
* continue with external snapshot deletion. */
-static int
+static bool
qemuSnapshotDeleteBlockJobIsRunning(qemuBlockjobState state)
{
switch (state) {
@@ -3311,7 +3311,7 @@ qemuSnapshotDeleteBlockJobIsRunning(qemuBlockjobState state)
case QEMU_BLOCKJOB_STATE_RUNNING:
case QEMU_BLOCKJOB_STATE_ABORTING:
case QEMU_BLOCKJOB_STATE_PIVOTING:
- return 1;
+ return true;
case QEMU_BLOCKJOB_STATE_COMPLETED:
case QEMU_BLOCKJOB_STATE_FAILED:
@@ -3323,7 +3323,7 @@ qemuSnapshotDeleteBlockJobIsRunning(qemuBlockjobState state)
break;
}
- return 0;
+ return false;
}
@@ -3359,18 +3359,14 @@ static int
qemuSnapshotDeleteBlockJobRunning(virDomainObj *vm,
qemuBlockJobData *job)
{
- int rc;
qemuBlockJobUpdate(vm, job, VIR_ASYNC_JOB_SNAPSHOT);
- while ((rc = qemuSnapshotDeleteBlockJobIsRunning(job->state)) > 0) {
+ while (qemuSnapshotDeleteBlockJobIsRunning(job->state)) {
if (qemuDomainObjWait(vm) < 0)
return -1;
qemuBlockJobUpdate(vm, job, VIR_ASYNC_JOB_SNAPSHOT);
}
- if (rc < 0)
- return -1;
-
return 0;
}
--
2.46.2
1 month, 1 week