Commit Graph

336 Commits (master)

Author SHA1 Message Date
Vitaliy Filippov 8826fdad7b Add bdrv_co_block_status 2023-01-13 23:52:49 +03:00
Vitaliy Filippov 78a75914b3 Add Vitastor support 2022-12-15 19:32:46 +03:00
Thomas Lamprecht 55e33a045e bump version to 7.1.0-4
Signed-off-by: Thomas Lamprecht <>
2022-11-22 09:21:10 +01:00
Thomas Lamprecht 8a38e1da9e cherry-pick "block/block-backend: blk_set_enable_write_cache is IO_CODE"
albeit I was short from disarming that GLOBAL_STATE_CODE assert
completely, as its just bogus to assert that on runtime for a lot of
call sites, rather it should be verified on compilation (function
coloring with attributes and maybe a compiler plugin).

But, as this is already solved upstream lets take in that patch.

Signed-off-by: Thomas Lamprecht <>
2022-11-22 09:19:00 +01:00
Thomas Lamprecht 3b3d5516ee bump version to 7.1.0-3
Signed-off-by: Thomas Lamprecht <>
2022-10-28 10:27:54 +02:00
Thomas Lamprecht 509409fb64 init: daemonize: defuse PID file resolve error to warning
fixes file restore, where we actively unlink the PID file of the
transient VM ourself after opening it - while we use it only for
tracking when the QEMU process itself has finished start up, it's
easier and cleaner to fix this regression now, than to rework that to
something that doesn't depends on the PID file at all.

Applying Fiona's patch as patch-patch tracked under extra, as I
expect that something similar to this gets accepted upstreamed.

Signed-off-by: Thomas Lamprecht <>
2022-10-28 10:22:26 +02:00
Wolfgang Bumiller bf03cd367f bump version to 7.1.0-2
Signed-off-by: Wolfgang Bumiller <>
2022-10-18 15:35:09 +02:00
Fiona Ebner 0af826b448 savevm async IO channel: channel writev: fix return value in error case
The documentation in include/io/channel.h states that -1 or
QIO_CHANNEL_ERR_BLOCK should be returned upon error. Simply passing
along the return value from the blk-functions has the potential to
confuse the call sides. Non-blocking mode is not implemented
currently, so -1 it is.

The "return ret" was mistakenly left over from the previous
QEMUFileOps based implementation. Also, use error_setg_errno(), since
the blk(_co)_p{readv,writev} functions return errno codes.

Signed-off-by: Fiona Ebner <>
2022-10-18 15:32:13 +02:00
Wolfgang Bumiller ed23707ed7 bump version to 7.1.0-1
Signed-off-by: Wolfgang Bumiller <>
2022-10-14 14:55:53 +02:00
Fiona Ebner 4e1935c2c9 {alloc track, pbs} block driver: bdrv_co_preadv: adapt return values
to be in-line with what other implementations in QEMU do. Commit
1d39c7098bbfa6862cb96066c4f8f6735ea397c5 mentions the EIO bit and
the function is expected to return 0 upon success (see other

Signed-off-by: Fiona Ebner <>
2022-10-14 14:52:36 +02:00
Fiona Ebner a262e9642b savevm async: cleaner initialization of target_close_wait member
Suggested-by: Wolfgang Bumiller <>
Signed-off-by: Fiona Ebner <>
2022-10-14 14:52:34 +02:00
Fiona Ebner 73912aee39 cherry-pick upstream fixes for 7.1.0
Signed-off-by: Fiona Ebner <>
2022-10-14 14:52:32 +02:00
Fiona Ebner 5b15e2ecaf update submodule and patches to 7.1.0
Notable changes:
* The only big change is the switch to using a custom QIOChannel for
  savevm-async, because the previously used QEMUFileOps was dropped.

  Changes to the current implementation:

  * Switch to vector based methods as required for an IO channel. For
    short reads the passed-in IO vector is stuffed with zeroes at the
    end, just to be sure.

  * For reading: The documentation in include/io/channel.h states that
    at least one byte should be read, so also error out when whe are
    at the very end instead of returning 0.

  * For reading: Fix off-by-one error when request goes beyond end.

    The wrong code piece was:
    if ((pos + size) > maxlen) {
        size = maxlen - pos - 1;

    Previously, the last byte would not be read. It's actually
    possible to get a snapshot .raw file that has content all the way
    up the final 512 byte (= BDRV_SECTOR_SIZE) boundary without any
    trailing zero bytes (I wrote a script to do it).

    Luckily, it didn't cause a real issue, because qemu_loadvm_state()
    is not interested in the final (i.e. QEMU_VM_VMDESCRIPTION)
    section. The buffer for reading it is simply freed up afterwards
    and the function will assume that it read the whole section, even
    if that's not the case.

  * For writing: Make use of the generated blk_pwritev() wrapper
    instead of manually wrapping the coroutine to simplify and save a
    few lines.

* Adapt to changed interfaces for blk_{pread,pwrite}:
  * a9262f551e ("block: Change blk_{pread,pwrite}() param order")
  * 3b35d4542c ("block: Add a 'flags' param to blk_pread()")
  * bf5b16fa40 ("block: Make blk_{pread,pwrite}() return 0 on success")
  Those changes especially affected the qemu-img dd patches, because
  the context also changed, but also some of our block drivers used
  the functions.

* Drop qemu-common.h include: it got renamed after essentially
  everything was moved to other headers. The only remaining user I
  could find for things dropped from the header between 7.0 and 7.1
  was qemu_get_vm_name() in the iscsi-initiatorname patch, but it
  already includes the header to which the function was moved.

Signed-off-by: Fiona Ebner <>
2022-10-14 14:52:29 +02:00
Wolfgang Bumiller 2775b2e378 bump version to 7.0.0-4
Signed-off-by: Wolfgang Bumiller <>
2022-10-10 11:56:27 +02:00
Wolfgang Bumiller ed01236593 add patch: PVE Backup: allow passing max-workers performance setting
Signed-off-by: Wolfgang Bumiller <>
2022-10-10 11:55:15 +02:00
Fiona Ebner 2b259b70ec d/rules: add revision to package version
This version string can be queried with $BINARY --version as well as
the query-version QMP command.

Useful for qemu-server to be able to report the running QEMU version
exactly. Could also be used to version guard against features as an
alternative to the query-proxmox-support QMP command.

Signed-off-by: Fiona Ebner <>
2022-10-10 11:26:47 +02:00
Thomas Lamprecht a186335be5 bump version to 7.0.0-3
Signed-off-by: Thomas Lamprecht <>
2022-08-30 12:54:12 +02:00
Fiona Ebner 1976ca4607 savevm-async: set SAVE_STATE_DONE when closing state file was successful
Without this change, it's necessary to send a second savevm-end QMP
command after aborting a snaphsot, before a new savevm-start QMP
command can succeed.

In process_savevm_finalize(), no longer set an error in the abort
scenario. If there already is another error, there's no need to
override it. If canceling was done intentionally, qmp_savevm_end()
is responsible for setting the state now.

Reported-by: Mira Limbeck <>
Signed-off-by: Fiona Ebner <>
2022-08-19 09:44:16 +02:00
Fiona Ebner 563c592898 savevm-async: avoid segfault when aborting snapshot
Reported in the community forum[0].

For 6.1.0, there were a few changes to the coroutine-sleep API, but
the adaptations in f376b2b ("update and rebase to QEMU v6.1.0") made
a mistake.

Currently, target_close_wait is NULL when passed to
qemu_co_sleep_ns_wakeable(), which further passes it to
qemu_co_sleep(), but there, it is dereferenced when trying to access
the 'to_wake' member:

> Thread 1 "kvm" received signal SIGSEGV, Segmentation fault.
> qemu_co_sleep (w=0x0) at ../util/qemu-coroutine-sleep.c:57

To fix it, create a proper struct and pass its address instead. Also
call qemu_co_sleep_wake unconditionally, because the NULL check (for
the 'to_wake' member) is done inside the function itself.

This patch is based on what the QEMU commits introducing the changes
to the coroutine-sleep API did to the callers in QEMU:
eaee072085 ("coroutine-sleep: allow qemu_co_sleep_wake that wakes nothing")
29a6ea24eb ("coroutine-sleep: replace QemuCoSleepState pointer with struct in the API")


Tested-by: Mira Limbeck <>
Signed-off-by: Fiona Ebner <>
2022-08-19 09:44:14 +02:00
Thomas Lamprecht 1de53d8a45 bump version to 7.0.0-2
Signed-off-by: Thomas Lamprecht <>
2022-07-20 09:17:13 +02:00
Fabian Ebner 0e88ec19db add two more stable patches
For the io_uring patch, it's not very clear which configurations can
trigger it, but it should be rather uncommon. See qemu commit
be6a166fde652589761cf70471bcde623e9bd72a for a bit more information.

Signed-off-by: Fabian Ebner <>
2022-07-19 17:22:10 +02:00
Wolfgang Bumiller 9ee866b2e9 bump version to 7.0.0-1
Signed-off-by: Wolfgang Bumiller <>
2022-06-30 11:08:36 +02:00
Fabian Ebner 14ed554660 cherry-pick upstream fixes for 7.0.0
coming in via qemu-stable (except for the vdmk fix, which was tagged
for-7.0 on the qemu-devel list, but didn't make it into the release).

Also took the chance to switch the gluster fix to the version that
made it into upstream.

Signed-off-by: Fabian Ebner <>
Signed-off-by: Wolfgang Bumiller <>
2022-06-29 12:29:30 +02:00
Fabian Ebner eba403aafc d/rules: adapt to changed opensbi riscv filenames in 7.0.0
Signed-off-by: Fabian Ebner <>
Signed-off-by: Wolfgang Bumiller <>
2022-06-29 12:29:28 +02:00
Fabian Ebner b2685aee04 d/rules: drop outdated configure flags
See QEMU commits 9e8be4c546ce8469ca9702715bf8f198d604b685 and
a5730b8bd3675f484ed0eacea052452048eeb35d for more information.

Signed-off-by: Fabian Ebner <>
Signed-off-by: Wolfgang Bumiller <>
2022-06-29 12:29:25 +02:00
Fabian Ebner dc9827a6a4 update submodule and patches to 7.0.0
Only very minor changes needed:
* Most patches in extra (or some version of them) are part of 7.0.0.
* aio_set_fd_handler got an extra parameter, but can just pass NULL
  like we did for the related 'poll' parameter. See QEMU commit
  826cc32423db2a99d184dbf4f507c737d7e7a4ae for more.
* Add include for qemu/memalign.h in vma.c and vma-writer.c.
* Add reverts for fixups of already reverted 0347a8fd4c ("block/rbd:
  implement bdrv_co_block_status") that came in with 7.0.0. Those
  fixups are not enough, see Proxmox bugzilla #4047.
* Two trivial context changes for bitmap-mirror patches.
* block_int.h got split up into multiple headers.
* Some context changes in configure and
* Used the oppurtunity to squash fixup of bdrv_backuo_dump_create typo
  in a later patch into the patch introducing the function (had to
  move code to new header during rebase).

Signed-off-by: Fabian Ebner <>
Signed-off-by: Wolfgang Bumiller <>
2022-06-29 12:29:21 +02:00
Thomas Lamprecht 4e4b9ab13f bump version to 6.2.0-11
Signed-off-by: Thomas Lamprecht <>
2022-06-22 15:54:58 +02:00
Thomas Lamprecht 39e84ba82d vma/alloc-track improvements
Signed-off-by: Thomas Lamprecht <>
2022-06-22 15:52:16 +02:00
Thomas Lamprecht 4fd0fa7fb3 re-export patches in normalized form
iow. using:

git format-patch --zero-commit --no-signature --no-numbered --diff-algorithm=myers ...

Signed-off-by: Thomas Lamprecht <>
2022-06-22 15:49:53 +02:00
Dominik Csapak 539e333eaa add 'namespace' to BlockdevOptionsPbs
so that we can use it for the -blockdev options (used for live-restore)

Signed-off-by: Dominik Csapak <>
2022-06-22 15:10:49 +02:00
Fabian Grünbichler 68569ea2ff bump version to 6.2.0-10
Signed-off-by: Fabian Grünbichler <>
2022-06-09 16:35:57 +02:00
Fabian Grünbichler 41aedfb6db add d/source/include-binaries
to shutup dpkg-source when building a source package

Signed-off-by: Fabian Grünbichler <>
2022-06-09 16:35:01 +02:00
Fabian Ebner 7bd4d8645a fix #4101: acquire job's aio context before calling job_unref
Otherwise, we might run into an abort via bdrv_co_yield_to_drain()
(can at least happen when a disk with iothread is used):
> #0  0x00007fef4f5dece1 __GI_raise ( + 0x3bce1)
> #1  0x00007fef4f5c8537 __GI_abort ( + 0x25537)
> #2  0x00005641bce3c71f error_exit (qemu-system-x86_64 + 0x80371f)
> #3  0x00005641bce3d02b qemu_mutex_unlock_impl (qemu-system-x86_64 + 0x80402b)
> #4  0x00005641bcd51655 bdrv_co_yield_to_drain (qemu-system-x86_64 + 0x718655)
> #5  0x00005641bcd52de8 bdrv_do_drained_begin (qemu-system-x86_64 + 0x719de8)
> #6  0x00005641bcd47e07 blk_drain (qemu-system-x86_64 + 0x70ee07)
> #7  0x00005641bcd498cd blk_unref (qemu-system-x86_64 + 0x7108cd)
> #8  0x00005641bcd31e6f block_job_free (qemu-system-x86_64 + 0x6f8e6f)
> #9  0x00005641bcd32d65 job_unref (qemu-system-x86_64 + 0x6f9d65)
> #10 0x00005641bcd93b3d pvebackup_co_complete_stream (qemu-system-x86_64 + 0x75ab3d)
> #11 0x00005641bce4e353 coroutine_trampoline (qemu-system-x86_64 + 0x815353)

Signed-off-by: Fabian Ebner <>
Acked-by: Wolfgang Bumiller <>
2022-06-09 14:57:28 +02:00
Wolfgang Bumiller ed3b5b8ab8 bump version to 6.2.0-9
Signed-off-by: Wolfgang Bumiller <>
2022-06-08 14:04:09 +02:00
Wolfgang Bumiller 7f4326d1dc pbs cleanup fixes
Signed-off-by: Wolfgang Bumiller <>
2022-06-08 13:10:51 +02:00
Wolfgang Bumiller 53bff441c5 delete patches which were dropped from the series file
Signed-off-by: Wolfgang Bumiller <>
2022-06-08 13:07:04 +02:00
Thomas Lamprecht f9a4b1cea7 bump version to 6.2.0-8
Signed-off-by: Thomas Lamprecht <>
2022-05-19 09:25:11 +02:00
Fabian Ebner dc265df350 add revert to work around performance regression when backing up large RBD disk
resulting in QMP timeouts and very slow backups. The plan is to figure
out (ideally together with upstream) a way to make the implementation
of bdrv_co_block_status for RBD more efficient. But for now, revert
the problematic change as a stop-gap measure.

Upstream bug report:

Forum threads: (partially)

Signed-off-by: Fabian Ebner <>
2022-05-19 09:23:38 +02:00
Thomas Lamprecht e0076597c6 bump version to 6.2.0-7
Signed-off-by: Thomas Lamprecht <>
2022-05-12 16:06:00 +02:00
Thomas Lamprecht ee99c1f813 d/control: bump build-depenceny of proxmox-backup-qemu to 1.3.0-1
Signed-off-by: Thomas Lamprecht <>
2022-05-12 16:05:30 +02:00
Wolfgang Bumiller 58a5492e9c namespace support
Signed-off-by: Wolfgang Bumiller <>
2022-05-12 13:49:35 +02:00
Thomas Lamprecht e67b8b5bd9 bump version to 6.2.0-6
Signed-off-by: Thomas Lamprecht <>
2022-05-11 10:42:57 +02:00
Thomas Lamprecht 309b5c1694 backport various fixes for gluster, qxl and vnc
Signed-off-by: Thomas Lamprecht <>
2022-05-11 10:40:14 +02:00
Thomas Lamprecht 4ce5937f89 bump version to 6.2.0-5
Signed-off-by: Thomas Lamprecht <>
2022-04-25 10:13:50 +02:00
Thomas Lamprecht f87d0523df vma: allow partial restore
Introduce a new map line for skipping a certain drive, of the form

Since in PVE, most archives are compressed and piped to vma for
restore, it's not easily possible to skip reads.

For the reader, a new skip flag for VmaRestoreState is added and the
target is allowed to be NULL if skip is specified when registering.
the skip flag is set, no writes will be made as well as no check for
duplicate clusters. Therefore, the flag is not set for verify.

Originally-by: Fabian Ebner <>
Signed-off-by: Fabian Ebner <>
Acked-by: Wolfgang Bumiller <>
Signed-off-by: Thomas Lamprecht <>
2022-04-25 10:07:37 +02:00
Thomas Lamprecht 2fd4ea2813 patches: update context
Signed-off-by: Thomas Lamprecht <>
2022-04-25 10:07:01 +02:00
Thomas Lamprecht 2653a5f029 vma: restore: call blk_unref for all opened block devices
Originally-by: Fabian Ebner <>
Signed-off-by: Thomas Lamprecht <>
2022-04-25 10:05:29 +02:00
Thomas Lamprecht 664ecf59a9 bump version to 6.2.0-4
Signed-off-by: Thomas Lamprecht <>
2022-04-22 11:52:34 +02:00
Thomas Lamprecht 4de9440f87 various stable backports
Signed-off-by: Thomas Lamprecht <>
2022-04-22 10:22:39 +02:00
Thomas Lamprecht 9b348f8c6d d/copyright: drop trailing whitespace
Signed-off-by: Thomas Lamprecht <>
2022-04-22 09:16:23 +02:00