* [pve-devel] [PATCH pve-qemu 1/3] udpate and rebase to QEMU v6.0.0
2021-05-27 10:43 [pve-devel] [PATCH 0/3] Upgrade to QEMU 6.0 Stefan Reiter
@ 2021-05-27 10:43 ` Stefan Reiter
2021-05-27 10:43 ` [pve-devel] [PATCH pve-qemu 2/3] debian: ignore submodule checks in QEMU build Stefan Reiter
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Reiter @ 2021-05-27 10:43 UTC (permalink / raw)
To: pve-devel
Mostly minor changes, bigger ones summarized:
* QEMU's internal backup code now uses a new async system, which allows
parallel requests - the default max_workers settings is 64, I chose
less, since 64 put enough stress on QEMU that the guest became
practically unusable during the backup, and 16 still shows quite a
nice measureable performance improvement. Little code changes for us
though.
* 'malformed' QAPI parameters/functions are now a build error (i.e.
using '_' vs '-'), I chose to just whitelist our calls in the name of
backwards compatibility.
* monitor OOB race fix now uses the upstream variant, cherry-picked from
origin/master since it's not in 6.0 by default
* last patch fixes a bug with snapshot rollback related to the new yank
system
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
debian/changelog | 6 +
...d-support-for-sync-bitmap-mode-never.patch | 94 +++---
...-support-for-conditional-and-always-.patch | 10 +-
...check-for-bitmap-mode-without-bitmap.patch | 4 +-
...-to-bdrv_dirty_bitmap_merge_internal.patch | 19 +-
...5-iotests-add-test-for-bitmap-mirror.patch | 15 +-
.../0006-mirror-move-some-checks-to-qmp.patch | 10 +-
...mu-img-convert-Don-t-pre-zero-images.patch | 33 --
...race-on-CHR_EVENT_CLOSED-without-OOB.patch | 84 +++++
...ll-man-page-if-guest-agent-is-disabl.patch | 38 ---
...heck-page-size-match-if-RAM-postcopy.patch | 31 --
| 143 ---------
...ally-return-inode-pointer-from-lo_do.patch | 107 -------
...t-opening-of-special-files-CVE-2020-.patch | 296 ------------------
...Add-_llseek-to-the-seccomp-whitelist.patch | 29 --
...start_syscall-to-the-seccomp-whiteli.patch | 31 --
...restore-device-paths-for-pre-5.1-vms.patch | 108 -------
...race-on-CHR_EVENT_CLOSED-without-OOB.patch | 48 ---
...lock-Fix-locking-in-qmp_block_resize.patch | 42 ---
...x-deadlock-in-bdrv_co_yield_to_drain.patch | 118 -------
...k-file-change-locking-default-to-off.patch | 6 +-
...djust-network-script-path-to-etc-kvm.patch | 4 +-
...he-CPU-model-to-kvm64-32-instead-of-.patch | 2 +-
...ui-spice-default-to-pve-certificates.patch | 4 +-
.../0005-PVE-Config-smm_available-false.patch | 4 +-
...erfs-no-default-logfile-if-daemonize.patch | 2 +-
...lock-rbd-disable-rbd_cache_writethro.patch | 4 +-
.../0008-PVE-Up-qmp-add-get_link_status.patch | 20 +-
...PVE-Up-glusterfs-allow-partial-reads.patch | 12 +-
...return-success-on-info-without-snaps.patch | 4 +-
...dd-add-osize-and-read-from-to-stdin-.patch | 165 +++++-----
...E-Up-qemu-img-dd-add-isize-parameter.patch | 12 +-
...PVE-Up-qemu-img-dd-add-n-skip_create.patch | 10 +-
...virtio-balloon-improve-query-balloon.patch | 14 +-
.../0015-PVE-qapi-modify-query-machines.patch | 12 +-
.../0016-PVE-qapi-modify-spice-query.patch | 10 +-
...async-for-background-state-snapshots.patch | 88 +++---
...add-optional-buffer-size-to-QEMUFile.patch | 4 +-
...add-the-zeroinit-block-driver-filter.patch | 6 +-
...-Add-dummy-id-command-line-parameter.patch | 24 +-
...t-target-i386-disable-LINT0-after-re.patch | 4 +-
...le-posix-make-locking-optiono-on-cre.patch | 31 +-
...3-PVE-monitor-disable-oob-capability.patch | 4 +-
...sed-balloon-qemu-4-0-config-size-fal.patch | 4 +-
...E-Allow-version-code-in-machine-type.patch | 22 +-
...VE-Backup-add-vma-backup-format-code.patch | 14 +-
...-Backup-add-backup-dump-block-driver.patch | 47 ++-
...ckup-proxmox-backup-patches-for-qemu.patch | 70 +++--
...estore-new-command-to-restore-from-p.patch | 4 +-
...irty-bitmap-tracking-for-incremental.patch | 50 +--
.../pve/0031-PVE-various-PBS-fixes.patch | 26 +-
...k-driver-to-map-backup-archives-into.patch | 50 +--
...dd-query_proxmox_support-QMP-command.patch | 8 +-
...E-add-query-pbs-bitmap-info-QMP-call.patch | 38 +--
...ct-stderr-to-journal-when-daemonized.patch | 22 +-
...d-sequential-job-transaction-support.patch | 10 +-
...-transaction-to-synchronize-job-stat.patch | 20 +-
...-block-on-finishing-and-cleanup-crea.patch | 28 +-
...igrate-dirty-bitmap-state-via-savevm.patch | 44 +--
...dirty-bitmap-migrate-other-bitmaps-e.patch | 4 +-
...all-back-to-open-iscsi-initiatorname.patch | 4 +-
...routine-QMP-for-backup-cancel_backup.patch | 56 ++--
.../pve/0043-PBS-add-master-key-support.patch | 22 +-
...st-path-reads-without-allocation-if-.patch | 2 +-
...PVE-block-stream-increase-chunk-size.patch | 4 +-
...accept-NULL-qiov-in-bdrv_pad_request.patch | 31 +-
.../0047-block-add-alloc-track-driver.patch | 8 +-
...valid-QAPI-names-for-backwards-compa.patch | 32 ++
...-register-yank-before-migration_inco.patch | 34 ++
debian/patches/series | 15 +-
qemu | 2 +-
71 files changed, 747 insertions(+), 1636 deletions(-)
delete mode 100644 debian/patches/extra/0001-Revert-qemu-img-convert-Don-t-pre-zero-images.patch
create mode 100644 debian/patches/extra/0001-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch
delete mode 100644 debian/patches/extra/0002-docs-don-t-install-man-page-if-guest-agent-is-disabl.patch
delete mode 100644 debian/patches/extra/0003-migration-only-check-page-size-match-if-RAM-postcopy.patch
delete mode 100644 debian/patches/extra/0004-virtiofsd-extract-lo_do_open-from-lo_open.patch
delete mode 100644 debian/patches/extra/0005-virtiofsd-optionally-return-inode-pointer-from-lo_do.patch
delete mode 100644 debian/patches/extra/0006-virtiofsd-prevent-opening-of-special-files-CVE-2020-.patch
delete mode 100644 debian/patches/extra/0007-virtiofsd-Add-_llseek-to-the-seccomp-whitelist.patch
delete mode 100644 debian/patches/extra/0008-virtiofsd-Add-restart_syscall-to-the-seccomp-whiteli.patch
delete mode 100644 debian/patches/extra/0009-i386-acpi-restore-device-paths-for-pre-5.1-vms.patch
delete mode 100644 debian/patches/extra/0010-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch
delete mode 100644 debian/patches/extra/0011-block-Fix-locking-in-qmp_block_resize.patch
delete mode 100644 debian/patches/extra/0012-block-Fix-deadlock-in-bdrv_co_yield_to_drain.patch
create mode 100644 debian/patches/pve/0048-PVE-whitelist-invalid-QAPI-names-for-backwards-compa.patch
create mode 100644 debian/patches/pve/0049-PVE-savevm-async-register-yank-before-migration_inco.patch
diff --git a/debian/changelog b/debian/changelog
index d7f17a1..bcd2164 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+pve-qemu-kvm (6.0.0-1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+
+ -- Stefan Reiter <sreiter@mila.proxmox.com> Wed, 26 May 2021 15:39:15 +0200
+
pve-qemu-kvm (5.2.0-11) bullseye; urgency=medium
* re-build for Proxmox VE 7 / Debian Bullseye
diff --git a/debian/patches/bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch b/debian/patches/bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
index 60d0105..91554dd 100644
--- a/debian/patches/bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
+++ b/debian/patches/bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
@@ -27,15 +27,15 @@ Signed-off-by: Ma Haocong <mahaocong@didichuxing.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
- block/mirror.c | 98 ++++++++++++++++++++++++++++++-------
- blockdev.c | 39 +++++++++++++--
- include/block/block_int.h | 4 +-
- qapi/block-core.json | 29 +++++++++--
- tests/test-block-iothread.c | 4 +-
+ block/mirror.c | 98 +++++++++++++++++++++++++-------
+ blockdev.c | 39 ++++++++++++-
+ include/block/block_int.h | 4 +-
+ qapi/block-core.json | 29 ++++++++--
+ tests/unit/test-block-iothread.c | 4 +-
5 files changed, 145 insertions(+), 29 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
-index 8e1ad6eceb..97843992c2 100644
+index 5a71bd8bbc..f1416d96f3 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -50,7 +50,7 @@ typedef struct MirrorBlockJob {
@@ -56,7 +56,7 @@ index 8e1ad6eceb..97843992c2 100644
BdrvDirtyBitmap *dirty_bitmap;
BdrvDirtyBitmapIter *dbi;
uint8_t *buf;
-@@ -677,7 +679,8 @@ static int mirror_exit_common(Job *job)
+@@ -678,7 +680,8 @@ static int mirror_exit_common(Job *job)
bdrv_child_refresh_perms(mirror_top_bs, mirror_top_bs->backing,
&error_abort);
if (!abort && s->backing_mode == MIRROR_SOURCE_BACKING_CHAIN) {
@@ -66,7 +66,7 @@ index 8e1ad6eceb..97843992c2 100644
BlockDriverState *unfiltered_target = bdrv_skip_filters(target_bs);
if (bdrv_cow_bs(unfiltered_target) != backing) {
-@@ -774,6 +777,16 @@ static void mirror_abort(Job *job)
+@@ -783,6 +786,16 @@ static void mirror_abort(Job *job)
assert(ret == 0);
}
@@ -83,7 +83,7 @@ index 8e1ad6eceb..97843992c2 100644
static void coroutine_fn mirror_throttle(MirrorBlockJob *s)
{
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
-@@ -955,7 +968,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
+@@ -964,7 +977,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
mirror_free_init(s);
s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
@@ -93,7 +93,15 @@ index 8e1ad6eceb..97843992c2 100644
ret = mirror_dirty_init(s);
if (ret < 0 || job_is_cancelled(&s->common.job)) {
goto immediate_exit;
-@@ -1188,6 +1202,7 @@ static const BlockJobDriver mirror_job_driver = {
+@@ -1195,6 +1209,7 @@ static const BlockJobDriver mirror_job_driver = {
+ .run = mirror_run,
+ .prepare = mirror_prepare,
+ .abort = mirror_abort,
++ .clean = mirror_clean,
+ .pause = mirror_pause,
+ .complete = mirror_complete,
+ .cancel = mirror_cancel,
+@@ -1211,6 +1226,7 @@ static const BlockJobDriver commit_active_job_driver = {
.run = mirror_run,
.prepare = mirror_prepare,
.abort = mirror_abort,
@@ -101,15 +109,7 @@ index 8e1ad6eceb..97843992c2 100644
.pause = mirror_pause,
.complete = mirror_complete,
},
-@@ -1203,6 +1218,7 @@ static const BlockJobDriver commit_active_job_driver = {
- .run = mirror_run,
- .prepare = mirror_prepare,
- .abort = mirror_abort,
-+ .clean = mirror_clean,
- .pause = mirror_pause,
- .complete = mirror_complete,
- },
-@@ -1550,7 +1566,10 @@ static BlockJob *mirror_start_job(
+@@ -1572,7 +1588,10 @@ static BlockJob *mirror_start_job(
BlockCompletionFunc *cb,
void *opaque,
const BlockJobDriver *driver,
@@ -121,8 +121,8 @@ index 8e1ad6eceb..97843992c2 100644
bool auto_complete, const char *filter_node_name,
bool is_mirror, MirrorCopyMode copy_mode,
Error **errp)
-@@ -1563,10 +1582,39 @@ static BlockJob *mirror_start_job(
- Error *local_err = NULL;
+@@ -1584,10 +1603,39 @@ static BlockJob *mirror_start_job(
+ uint64_t target_perms, target_shared_perms;
int ret;
- if (granularity == 0) {
@@ -163,7 +163,7 @@ index 8e1ad6eceb..97843992c2 100644
assert(is_power_of_2(granularity));
if (buf_size < 0) {
-@@ -1705,7 +1753,9 @@ static BlockJob *mirror_start_job(
+@@ -1728,7 +1776,9 @@ static BlockJob *mirror_start_job(
s->replaces = g_strdup(replaces);
s->on_source_error = on_source_error;
s->on_target_error = on_target_error;
@@ -174,7 +174,7 @@ index 8e1ad6eceb..97843992c2 100644
s->backing_mode = backing_mode;
s->zero_target = zero_target;
s->copy_mode = copy_mode;
-@@ -1726,6 +1776,18 @@ static BlockJob *mirror_start_job(
+@@ -1749,6 +1799,18 @@ static BlockJob *mirror_start_job(
bdrv_disable_dirty_bitmap(s->dirty_bitmap);
}
@@ -193,7 +193,7 @@ index 8e1ad6eceb..97843992c2 100644
ret = block_job_add_bdrv(&s->common, "source", bs, 0,
BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
BLK_PERM_CONSISTENT_READ,
-@@ -1803,6 +1865,9 @@ fail:
+@@ -1826,6 +1888,9 @@ fail:
if (s->dirty_bitmap) {
bdrv_release_dirty_bitmap(s->dirty_bitmap);
}
@@ -203,7 +203,7 @@ index 8e1ad6eceb..97843992c2 100644
job_early_fail(&s->common.job);
}
-@@ -1820,29 +1885,23 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
+@@ -1843,29 +1908,23 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
BlockDriverState *target, const char *replaces,
int creation_flags, int64_t speed,
uint32_t granularity, int64_t buf_size,
@@ -238,7 +238,7 @@ index 8e1ad6eceb..97843992c2 100644
}
BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
-@@ -1868,7 +1927,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
+@@ -1890,7 +1949,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
job_id, bs, creation_flags, base, NULL, speed, 0, 0,
MIRROR_LEAVE_BACKING_CHAIN, false,
on_error, on_error, true, cb, opaque,
@@ -246,13 +246,13 @@ index 8e1ad6eceb..97843992c2 100644
+ &commit_active_job_driver, MIRROR_SYNC_MODE_FULL,
+ NULL, 0, base, auto_complete,
filter_node_name, false, MIRROR_COPY_MODE_BACKGROUND,
- &local_err);
- if (local_err) {
+ errp);
+ if (!job) {
diff --git a/blockdev.c b/blockdev.c
-index fe6fb5dc1d..394920613d 100644
+index a57590aae4..798d02704f 100644
--- a/blockdev.c
+++ b/blockdev.c
-@@ -2930,6 +2930,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2963,6 +2963,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
BlockDriverState *target,
bool has_replaces, const char *replaces,
enum MirrorSyncMode sync,
@@ -263,7 +263,7 @@ index fe6fb5dc1d..394920613d 100644
BlockMirrorBackingMode backing_mode,
bool zero_target,
bool has_speed, int64_t speed,
-@@ -2949,6 +2953,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2982,6 +2986,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
{
BlockDriverState *unfiltered_bs;
int job_flags = JOB_DEFAULT;
@@ -271,7 +271,7 @@ index fe6fb5dc1d..394920613d 100644
if (!has_speed) {
speed = 0;
-@@ -3003,6 +3008,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -3036,6 +3041,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
sync = MIRROR_SYNC_MODE_FULL;
}
@@ -301,7 +301,7 @@ index fe6fb5dc1d..394920613d 100644
if (!has_replaces) {
/* We want to mirror from @bs, but keep implicit filters on top */
unfiltered_bs = bdrv_skip_implicit_filters(bs);
-@@ -3049,8 +3077,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -3082,8 +3110,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
* and will allow to check whether the node still exist at mirror completion
*/
mirror_start(job_id, bs, target,
@@ -312,7 +312,7 @@ index fe6fb5dc1d..394920613d 100644
on_source_error, on_target_error, unmap, filter_node_name,
copy_mode, errp);
}
-@@ -3195,6 +3223,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
+@@ -3228,6 +3256,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs,
arg->has_replaces, arg->replaces, arg->sync,
@@ -321,7 +321,7 @@ index fe6fb5dc1d..394920613d 100644
backing_mode, zero_target,
arg->has_speed, arg->speed,
arg->has_granularity, arg->granularity,
-@@ -3216,6 +3246,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
+@@ -3249,6 +3279,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
const char *device, const char *target,
bool has_replaces, const char *replaces,
MirrorSyncMode sync,
@@ -330,7 +330,7 @@ index fe6fb5dc1d..394920613d 100644
bool has_speed, int64_t speed,
bool has_granularity, uint32_t granularity,
bool has_buf_size, int64_t buf_size,
-@@ -3265,7 +3297,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
+@@ -3298,7 +3330,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
}
blockdev_mirror_common(has_job_id ? job_id : NULL, bs, target_bs,
@@ -341,10 +341,10 @@ index fe6fb5dc1d..394920613d 100644
has_granularity, granularity,
has_buf_size, buf_size,
diff --git a/include/block/block_int.h b/include/block/block_int.h
-index 95d9333be1..6f8eda629a 100644
+index 88e4111939..1c399bdb16 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
-@@ -1230,7 +1230,9 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
+@@ -1258,7 +1258,9 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
BlockDriverState *target, const char *replaces,
int creation_flags, int64_t speed,
uint32_t granularity, int64_t buf_size,
@@ -356,10 +356,10 @@ index 95d9333be1..6f8eda629a 100644
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 04ad80bc1e..9db3120716 100644
+index 6d227924d0..4b6fb6ca44 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -1971,10 +1971,19 @@
+@@ -1921,10 +1921,19 @@
# (all the disk, only the sectors allocated in the topmost image, or
# only new I/O).
#
@@ -380,7 +380,7 @@ index 04ad80bc1e..9db3120716 100644
#
# @buf-size: maximum amount of data in flight from source to
# target (since 1.4).
-@@ -2012,7 +2021,9 @@
+@@ -1962,7 +1971,9 @@
{ 'struct': 'DriveMirror',
'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
'*format': 'str', '*node-name': 'str', '*replaces': 'str',
@@ -391,7 +391,7 @@ index 04ad80bc1e..9db3120716 100644
'*speed': 'int', '*granularity': 'uint32',
'*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
'*on-target-error': 'BlockdevOnError',
-@@ -2280,10 +2291,19 @@
+@@ -2230,10 +2241,19 @@
# (all the disk, only the sectors allocated in the topmost image, or
# only new I/O).
#
@@ -412,7 +412,7 @@ index 04ad80bc1e..9db3120716 100644
#
# @buf-size: maximum amount of data in flight from source to
# target
-@@ -2332,7 +2352,8 @@
+@@ -2282,7 +2302,8 @@
{ 'command': 'blockdev-mirror',
'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
'*replaces': 'str',
@@ -422,10 +422,10 @@ index 04ad80bc1e..9db3120716 100644
'*speed': 'int', '*granularity': 'uint32',
'*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
'*on-target-error': 'BlockdevOnError',
-diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c
-index 3f866a35c6..500ede71c8 100644
---- a/tests/test-block-iothread.c
-+++ b/tests/test-block-iothread.c
+diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
+index 8cf172cb7a..65f652819d 100644
+--- a/tests/unit/test-block-iothread.c
++++ b/tests/unit/test-block-iothread.c
@@ -623,8 +623,8 @@ static void test_propagate_mirror(void)
/* Start a mirror job */
diff --git a/debian/patches/bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch b/debian/patches/bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
index 5a87360..b97ff89 100644
--- a/debian/patches/bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
+++ b/debian/patches/bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
@@ -23,10 +23,10 @@ Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
-index 97843992c2..d1cce079da 100644
+index f1416d96f3..3e37967365 100644
--- a/block/mirror.c
+++ b/block/mirror.c
-@@ -654,8 +654,6 @@ static int mirror_exit_common(Job *job)
+@@ -655,8 +655,6 @@ static int mirror_exit_common(Job *job)
bdrv_unfreeze_backing_chain(mirror_top_bs, target_bs);
}
@@ -35,7 +35,7 @@ index 97843992c2..d1cce079da 100644
/* Make sure that the source BDS doesn't go away during bdrv_replace_node,
* before we can call bdrv_drained_end */
bdrv_ref(src);
-@@ -755,6 +753,18 @@ static int mirror_exit_common(Job *job)
+@@ -764,6 +762,18 @@ static int mirror_exit_common(Job *job)
blk_set_perm(bjob->blk, 0, BLK_PERM_ALL, &error_abort);
blk_insert_bs(bjob->blk, mirror_top_bs, &error_abort);
@@ -54,7 +54,7 @@ index 97843992c2..d1cce079da 100644
bs_opaque->job = NULL;
bdrv_drained_end(src);
-@@ -1592,10 +1602,6 @@ static BlockJob *mirror_start_job(
+@@ -1613,10 +1623,6 @@ static BlockJob *mirror_start_job(
" sync mode",
MirrorSyncMode_str(sync_mode));
return NULL;
@@ -65,7 +65,7 @@ index 97843992c2..d1cce079da 100644
}
} else if (bitmap) {
error_setg(errp,
-@@ -1612,6 +1618,12 @@ static BlockJob *mirror_start_job(
+@@ -1633,6 +1639,12 @@ static BlockJob *mirror_start_job(
return NULL;
}
granularity = bdrv_dirty_bitmap_granularity(bitmap);
diff --git a/debian/patches/bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch b/debian/patches/bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
index 84fd5f9..1d9ec68 100644
--- a/debian/patches/bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
+++ b/debian/patches/bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
@@ -15,10 +15,10 @@ Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
1 file changed, 3 insertions(+)
diff --git a/blockdev.c b/blockdev.c
-index 394920613d..4f8bd38b58 100644
+index 798d02704f..c025fbf567 100644
--- a/blockdev.c
+++ b/blockdev.c
-@@ -3029,6 +3029,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -3062,6 +3062,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
return;
}
diff --git a/debian/patches/bitmap-mirror/0004-mirror-switch-to-bdrv_dirty_bitmap_merge_internal.patch b/debian/patches/bitmap-mirror/0004-mirror-switch-to-bdrv_dirty_bitmap_merge_internal.patch
index 8b3c1e2..c645c3f 100644
--- a/debian/patches/bitmap-mirror/0004-mirror-switch-to-bdrv_dirty_bitmap_merge_internal.patch
+++ b/debian/patches/bitmap-mirror/0004-mirror-switch-to-bdrv_dirty_bitmap_merge_internal.patch
@@ -11,14 +11,14 @@ beforehand.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
- block/mirror.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
+ block/mirror.c | 11 ++++-------
+ 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
-index d1cce079da..e6140cf018 100644
+index 3e37967365..c6f759e279 100644
--- a/block/mirror.c
+++ b/block/mirror.c
-@@ -759,8 +759,8 @@ static int mirror_exit_common(Job *job)
+@@ -768,8 +768,8 @@ static int mirror_exit_common(Job *job)
job->ret == 0 && ret == 0)) {
/* Success; synchronize copy back to sync. */
bdrv_clear_dirty_bitmap(s->sync_bitmap, NULL);
@@ -29,14 +29,17 @@ index d1cce079da..e6140cf018 100644
}
}
bdrv_release_dirty_bitmap(s->dirty_bitmap);
-@@ -1793,8 +1793,8 @@ static BlockJob *mirror_start_job(
+@@ -1816,11 +1816,8 @@ static BlockJob *mirror_start_job(
}
if (s->sync_mode == MIRROR_SYNC_MODE_BITMAP) {
- bdrv_merge_dirty_bitmap(s->dirty_bitmap, s->sync_bitmap,
- NULL, &local_err);
+- if (local_err) {
+- goto fail;
+- }
+ bdrv_dirty_bitmap_merge_internal(s->dirty_bitmap, s->sync_bitmap,
+ NULL, true);
- if (local_err) {
- goto fail;
- }
+ }
+
+ ret = block_job_add_bdrv(&s->common, "source", bs, 0,
diff --git a/debian/patches/bitmap-mirror/0005-iotests-add-test-for-bitmap-mirror.patch b/debian/patches/bitmap-mirror/0005-iotests-add-test-for-bitmap-mirror.patch
index 07a66d6..bb7eaae 100644
--- a/debian/patches/bitmap-mirror/0005-iotests-add-test-for-bitmap-mirror.patch
+++ b/debian/patches/bitmap-mirror/0005-iotests-add-test-for-bitmap-mirror.patch
@@ -23,8 +23,7 @@ Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
tests/qemu-iotests/384 | 547 +++++++
tests/qemu-iotests/384.out | 2846 ++++++++++++++++++++++++++++++++++++
- tests/qemu-iotests/group | 1 +
- 3 files changed, 3394 insertions(+)
+ 2 files changed, 3393 insertions(+)
create mode 100755 tests/qemu-iotests/384
create mode 100644 tests/qemu-iotests/384.out
@@ -3433,15 +3432,3 @@ index 0000000000..9b7408b6d6
+{"execute": "blockdev-mirror", "arguments": {"bitmap": "bitmap0", "device": "drive0", "filter-node-name": "mirror-top", "job-id": "api_job", "sync": "none", "target": "mirror_target"}}
+{"error": {"class": "GenericError", "desc": "bitmap-mode must be specified if a bitmap is provided"}}
+
-diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
-index 2960dff728..952dceba1f 100644
---- a/tests/qemu-iotests/group
-+++ b/tests/qemu-iotests/group
-@@ -270,6 +270,7 @@
- 253 rw quick
- 254 rw backing quick
- 255 rw quick
-+384 rw
- 256 rw auto quick
- 257 rw
- 258 rw quick
diff --git a/debian/patches/bitmap-mirror/0006-mirror-move-some-checks-to-qmp.patch b/debian/patches/bitmap-mirror/0006-mirror-move-some-checks-to-qmp.patch
index 16551ef..6681cbe 100644
--- a/debian/patches/bitmap-mirror/0006-mirror-move-some-checks-to-qmp.patch
+++ b/debian/patches/bitmap-mirror/0006-mirror-move-some-checks-to-qmp.patch
@@ -18,11 +18,11 @@ Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 files changed, 70 insertions(+), 59 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
-index e6140cf018..3a08239a78 100644
+index c6f759e279..ce2b13b4d8 100644
--- a/block/mirror.c
+++ b/block/mirror.c
-@@ -1592,31 +1592,13 @@ static BlockJob *mirror_start_job(
- Error *local_err = NULL;
+@@ -1613,31 +1613,13 @@ static BlockJob *mirror_start_job(
+ uint64_t target_perms, target_shared_perms;
int ret;
- if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
@@ -59,10 +59,10 @@ index e6140cf018..3a08239a78 100644
if (bitmap_mode != BITMAP_SYNC_MODE_NEVER) {
diff --git a/blockdev.c b/blockdev.c
-index 4f8bd38b58..a40c6fd0f6 100644
+index c025fbf567..9cab29e567 100644
--- a/blockdev.c
+++ b/blockdev.c
-@@ -3008,7 +3008,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -3041,7 +3041,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
sync = MIRROR_SYNC_MODE_FULL;
}
diff --git a/debian/patches/extra/0001-Revert-qemu-img-convert-Don-t-pre-zero-images.patch b/debian/patches/extra/0001-Revert-qemu-img-convert-Don-t-pre-zero-images.patch
deleted file mode 100644
index 0e7331f..0000000
--- a/debian/patches/extra/0001-Revert-qemu-img-convert-Don-t-pre-zero-images.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Thomas Lamprecht <t.lamprecht@proxmox.com>
-Date: Mon, 14 Sep 2020 19:32:21 +0200
-Subject: [PATCH] Revert "qemu-img convert: Don't pre-zero images"
-
-This reverts commit edafc70c0c8510862f2f213a3acf7067113bcd08.
-
-As it correlates with causing issues on LVM allocation
-https://bugzilla.proxmox.com/show_bug.cgi?id=3002
----
- qemu-img.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/qemu-img.c b/qemu-img.c
-index 8bdea40b58..f9050bfaad 100644
---- a/qemu-img.c
-+++ b/qemu-img.c
-@@ -2104,6 +2104,15 @@ static int convert_do_copy(ImgConvertState *s)
- s->has_zero_init = bdrv_has_zero_init(blk_bs(s->target));
- }
-
-+ if (!s->has_zero_init && !s->target_has_backing &&
-+ bdrv_can_write_zeroes_with_unmap(blk_bs(s->target)))
-+ {
-+ ret = blk_make_zero(s->target, BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK);
-+ if (ret == 0) {
-+ s->has_zero_init = true;
-+ }
-+ }
-+
- /* Allocate buffer for copied data. For compressed images, only one cluster
- * can be copied at a time. */
- if (s->compressed) {
diff --git a/debian/patches/extra/0001-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch b/debian/patches/extra/0001-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch
new file mode 100644
index 0000000..0bc54dc
--- /dev/null
+++ b/debian/patches/extra/0001-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch
@@ -0,0 +1,84 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Stefan Reiter <s.reiter@proxmox.com>
+Date: Mon, 22 Mar 2021 16:40:24 +0100
+Subject: [PATCH] monitor/qmp: fix race on CHR_EVENT_CLOSED without OOB
+
+The QMP dispatcher coroutine holds the qmp_queue_lock over a yield
+point, where it expects to be rescheduled from the main context. If a
+CHR_EVENT_CLOSED event is received just then, it can race and block the
+main thread on the mutex in monitor_qmp_cleanup_queue_and_resume.
+
+monitor_resume does not need to be called from main context, so we can
+call it immediately after popping a request from the queue, which allows
+us to drop the qmp_queue_lock mutex before yielding.
+
+Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
+Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
+Message-Id: <20210322154024.15011-1-s.reiter@proxmox.com>
+Reviewed-by: Kevin Wolf <kwolf@redhat.com>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Markus Armbruster <armbru@redhat.com>
+---
+ monitor/qmp.c | 40 ++++++++++++++++++++++------------------
+ 1 file changed, 22 insertions(+), 18 deletions(-)
+
+diff --git a/monitor/qmp.c b/monitor/qmp.c
+index 2b0308f933..092c527b6f 100644
+--- a/monitor/qmp.c
++++ b/monitor/qmp.c
+@@ -257,24 +257,6 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
+ trace_monitor_qmp_in_band_dequeue(req_obj,
+ req_obj->mon->qmp_requests->length);
+
+- if (qatomic_xchg(&qmp_dispatcher_co_busy, true) == true) {
+- /*
+- * Someone rescheduled us (probably because a new requests
+- * came in), but we didn't actually yield. Do that now,
+- * only to be immediately reentered and removed from the
+- * list of scheduled coroutines.
+- */
+- qemu_coroutine_yield();
+- }
+-
+- /*
+- * Move the coroutine from iohandler_ctx to qemu_aio_context for
+- * executing the command handler so that it can make progress if it
+- * involves an AIO_WAIT_WHILE().
+- */
+- aio_co_schedule(qemu_get_aio_context(), qmp_dispatcher_co);
+- qemu_coroutine_yield();
+-
+ /*
+ * @req_obj has a request, we hold req_obj->mon->qmp_queue_lock
+ */
+@@ -298,8 +280,30 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
+ monitor_resume(&mon->common);
+ }
+
++ /*
++ * Drop the queue mutex now, before yielding, otherwise we might
++ * deadlock if the main thread tries to lock it.
++ */
+ qemu_mutex_unlock(&mon->qmp_queue_lock);
+
++ if (qatomic_xchg(&qmp_dispatcher_co_busy, true) == true) {
++ /*
++ * Someone rescheduled us (probably because a new requests
++ * came in), but we didn't actually yield. Do that now,
++ * only to be immediately reentered and removed from the
++ * list of scheduled coroutines.
++ */
++ qemu_coroutine_yield();
++ }
++
++ /*
++ * Move the coroutine from iohandler_ctx to qemu_aio_context for
++ * executing the command handler so that it can make progress if it
++ * involves an AIO_WAIT_WHILE().
++ */
++ aio_co_schedule(qemu_get_aio_context(), qmp_dispatcher_co);
++ qemu_coroutine_yield();
++
+ /* Process request */
+ if (req_obj->req) {
+ if (trace_event_get_state(TRACE_MONITOR_QMP_CMD_IN_BAND)) {
diff --git a/debian/patches/extra/0002-docs-don-t-install-man-page-if-guest-agent-is-disabl.patch b/debian/patches/extra/0002-docs-don-t-install-man-page-if-guest-agent-is-disabl.patch
deleted file mode 100644
index d5fb596..0000000
--- a/debian/patches/extra/0002-docs-don-t-install-man-page-if-guest-agent-is-disabl.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Stefan Reiter <s.reiter@proxmox.com>
-Date: Thu, 28 Jan 2021 15:19:51 +0100
-Subject: [PATCH] docs: don't install man page if guest agent is disabled
-
-No sense outputting the qemu-ga and qemu-ga-ref man pages when the guest
-agent binary itself is disabled. This mirrors behaviour from before the
-meson switch.
-
-Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
----
- docs/meson.build | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/docs/meson.build b/docs/meson.build
-index ebd85d59f9..cc6f5007f8 100644
---- a/docs/meson.build
-+++ b/docs/meson.build
-@@ -46,6 +46,8 @@ if build_docs
- meson.source_root() / 'docs/sphinx/qmp_lexer.py',
- qapi_gen_depends ]
-
-+ have_ga = have_tools and config_host.has_key('CONFIG_GUEST_AGENT')
-+
- configure_file(output: 'index.html',
- input: files('index.html.in'),
- configuration: {'VERSION': meson.project_version()},
-@@ -53,8 +55,8 @@ if build_docs
- manuals = [ 'devel', 'interop', 'tools', 'specs', 'system', 'user' ]
- man_pages = {
- 'interop' : {
-- 'qemu-ga.8': (have_tools ? 'man8' : ''),
-- 'qemu-ga-ref.7': 'man7',
-+ 'qemu-ga.8': (have_ga ? 'man8' : ''),
-+ 'qemu-ga-ref.7': (have_ga ? 'man7' : ''),
- 'qemu-qmp-ref.7': 'man7',
- },
- 'tools': {
diff --git a/debian/patches/extra/0003-migration-only-check-page-size-match-if-RAM-postcopy.patch b/debian/patches/extra/0003-migration-only-check-page-size-match-if-RAM-postcopy.patch
deleted file mode 100644
index 8c2548b..0000000
--- a/debian/patches/extra/0003-migration-only-check-page-size-match-if-RAM-postcopy.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Stefan Reiter <s.reiter@proxmox.com>
-Date: Thu, 4 Feb 2021 17:06:19 +0100
-Subject: [PATCH] migration: only check page size match if RAM postcopy is
- enabled
-
-Postcopy may also be advised for dirty-bitmap migration only, in which
-case the remote page size will not be available and we'll instead read
-bogus data, blocking migration with a mismatch error if the VM uses
-hugepages.
-
-Fixes: 58110f0acb ("migration: split common postcopy out of ram postcopy")
-Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
-Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
----
- migration/ram.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/migration/ram.c b/migration/ram.c
-index 7811cde643..6ace15261c 100644
---- a/migration/ram.c
-+++ b/migration/ram.c
-@@ -3521,7 +3521,7 @@ static int ram_load_precopy(QEMUFile *f)
- }
- }
- /* For postcopy we need to check hugepage sizes match */
-- if (postcopy_advised &&
-+ if (postcopy_advised && migrate_postcopy_ram() &&
- block->page_size != qemu_host_page_size) {
- uint64_t remote_page_size = qemu_get_be64(f);
- if (remote_page_size != block->page_size) {
diff --git a/debian/patches/extra/0004-virtiofsd-extract-lo_do_open-from-lo_open.patch b/debian/patches/extra/0004-virtiofsd-extract-lo_do_open-from-lo_open.patch
deleted file mode 100644
index 24ea1aa..0000000
--- a/debian/patches/extra/0004-virtiofsd-extract-lo_do_open-from-lo_open.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Thu, 4 Feb 2021 18:34:35 +0000
-Subject: [PATCH] virtiofsd: extract lo_do_open() from lo_open()
-
-Both lo_open() and lo_create() have similar code to open a file. Extract
-a common lo_do_open() function from lo_open() that will be used by
-lo_create() in a later commit.
-
-Since lo_do_open() does not otherwise need fuse_req_t req, convert
-lo_add_fd_mapping() to use struct lo_data *lo instead.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Message-Id: <20210204150208.367837-2-stefanha@redhat.com>
-Reviewed-by: Greg Kurz <groug@kaod.org>
-Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
----
- tools/virtiofsd/passthrough_ll.c | 73 ++++++++++++++++++++------------
- 1 file changed, 46 insertions(+), 27 deletions(-)
-
-diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
-index 97485b22b4..218e20e9d7 100644
---- a/tools/virtiofsd/passthrough_ll.c
-+++ b/tools/virtiofsd/passthrough_ll.c
-@@ -471,17 +471,17 @@ static void lo_map_remove(struct lo_map *map, size_t key)
- }
-
- /* Assumes lo->mutex is held */
--static ssize_t lo_add_fd_mapping(fuse_req_t req, int fd)
-+static ssize_t lo_add_fd_mapping(struct lo_data *lo, int fd)
- {
- struct lo_map_elem *elem;
-
-- elem = lo_map_alloc_elem(&lo_data(req)->fd_map);
-+ elem = lo_map_alloc_elem(&lo->fd_map);
- if (!elem) {
- return -1;
- }
-
- elem->fd = fd;
-- return elem - lo_data(req)->fd_map.elems;
-+ return elem - lo->fd_map.elems;
- }
-
- /* Assumes lo->mutex is held */
-@@ -1661,6 +1661,38 @@ static void update_open_flags(int writeback, int allow_direct_io,
- }
- }
-
-+static int lo_do_open(struct lo_data *lo, struct lo_inode *inode,
-+ struct fuse_file_info *fi)
-+{
-+ char buf[64];
-+ ssize_t fh;
-+ int fd;
-+
-+ update_open_flags(lo->writeback, lo->allow_direct_io, fi);
-+
-+ sprintf(buf, "%i", inode->fd);
-+ fd = openat(lo->proc_self_fd, buf, fi->flags & ~O_NOFOLLOW);
-+ if (fd == -1) {
-+ return errno;
-+ }
-+
-+ pthread_mutex_lock(&lo->mutex);
-+ fh = lo_add_fd_mapping(lo, fd);
-+ pthread_mutex_unlock(&lo->mutex);
-+ if (fh == -1) {
-+ close(fd);
-+ return ENOMEM;
-+ }
-+
-+ fi->fh = fh;
-+ if (lo->cache == CACHE_NONE) {
-+ fi->direct_io = 1;
-+ } else if (lo->cache == CACHE_ALWAYS) {
-+ fi->keep_cache = 1;
-+ }
-+ return 0;
-+}
-+
- static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
- mode_t mode, struct fuse_file_info *fi)
- {
-@@ -1701,7 +1733,7 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
- ssize_t fh;
-
- pthread_mutex_lock(&lo->mutex);
-- fh = lo_add_fd_mapping(req, fd);
-+ fh = lo_add_fd_mapping(lo, fd);
- pthread_mutex_unlock(&lo->mutex);
- if (fh == -1) {
- close(fd);
-@@ -1892,38 +1924,25 @@ static void lo_fsyncdir(fuse_req_t req, fuse_ino_t ino, int datasync,
-
- static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
- {
-- int fd;
-- ssize_t fh;
-- char buf[64];
- struct lo_data *lo = lo_data(req);
-+ struct lo_inode *inode = lo_inode(req, ino);
-+ int err;
-
- fuse_log(FUSE_LOG_DEBUG, "lo_open(ino=%" PRIu64 ", flags=%d)\n", ino,
- fi->flags);
-
-- update_open_flags(lo->writeback, lo->allow_direct_io, fi);
--
-- sprintf(buf, "%i", lo_fd(req, ino));
-- fd = openat(lo->proc_self_fd, buf, fi->flags & ~O_NOFOLLOW);
-- if (fd == -1) {
-- return (void)fuse_reply_err(req, errno);
-- }
--
-- pthread_mutex_lock(&lo->mutex);
-- fh = lo_add_fd_mapping(req, fd);
-- pthread_mutex_unlock(&lo->mutex);
-- if (fh == -1) {
-- close(fd);
-- fuse_reply_err(req, ENOMEM);
-+ if (!inode) {
-+ fuse_reply_err(req, EBADF);
- return;
- }
-
-- fi->fh = fh;
-- if (lo->cache == CACHE_NONE) {
-- fi->direct_io = 1;
-- } else if (lo->cache == CACHE_ALWAYS) {
-- fi->keep_cache = 1;
-+ err = lo_do_open(lo, inode, fi);
-+ lo_inode_put(lo, &inode);
-+ if (err) {
-+ fuse_reply_err(req, err);
-+ } else {
-+ fuse_reply_open(req, fi);
- }
-- fuse_reply_open(req, fi);
- }
-
- static void lo_release(fuse_req_t req, fuse_ino_t ino,
diff --git a/debian/patches/extra/0005-virtiofsd-optionally-return-inode-pointer-from-lo_do.patch b/debian/patches/extra/0005-virtiofsd-optionally-return-inode-pointer-from-lo_do.patch
deleted file mode 100644
index 713bcc0..0000000
--- a/debian/patches/extra/0005-virtiofsd-optionally-return-inode-pointer-from-lo_do.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Thu, 4 Feb 2021 18:34:36 +0000
-Subject: [PATCH] virtiofsd: optionally return inode pointer from
- lo_do_lookup()
-
-lo_do_lookup() finds an existing inode or allocates a new one. It
-increments nlookup so that the inode stays alive until the client
-releases it.
-
-Existing callers don't need the struct lo_inode so the function doesn't
-return it. Extend the function to optionally return the inode. The next
-commit will need it.
-
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Reviewed-by: Greg Kurz <groug@kaod.org>
-Message-Id: <20210204150208.367837-3-stefanha@redhat.com>
-Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
----
- tools/virtiofsd/passthrough_ll.c | 29 +++++++++++++++++++++--------
- 1 file changed, 21 insertions(+), 8 deletions(-)
-
-diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
-index 218e20e9d7..2bd050b620 100644
---- a/tools/virtiofsd/passthrough_ll.c
-+++ b/tools/virtiofsd/passthrough_ll.c
-@@ -843,11 +843,13 @@ static int do_statx(struct lo_data *lo, int dirfd, const char *pathname,
- }
-
- /*
-- * Increments nlookup and caller must release refcount using
-- * lo_inode_put(&parent).
-+ * Increments nlookup on the inode on success. unref_inode_lolocked() must be
-+ * called eventually to decrement nlookup again. If inodep is non-NULL, the
-+ * inode pointer is stored and the caller must call lo_inode_put().
- */
- static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
-- struct fuse_entry_param *e)
-+ struct fuse_entry_param *e,
-+ struct lo_inode **inodep)
- {
- int newfd;
- int res;
-@@ -857,6 +859,10 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
- struct lo_inode *inode = NULL;
- struct lo_inode *dir = lo_inode(req, parent);
-
-+ if (inodep) {
-+ *inodep = NULL;
-+ }
-+
- /*
- * name_to_handle_at() and open_by_handle_at() can reach here with fuse
- * mount point in guest, but we don't have its inode info in the
-@@ -924,7 +930,14 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
- pthread_mutex_unlock(&lo->mutex);
- }
- e->ino = inode->fuse_ino;
-- lo_inode_put(lo, &inode);
-+
-+ /* Transfer ownership of inode pointer to caller or drop it */
-+ if (inodep) {
-+ *inodep = inode;
-+ } else {
-+ lo_inode_put(lo, &inode);
-+ }
-+
- lo_inode_put(lo, &dir);
-
- fuse_log(FUSE_LOG_DEBUG, " %lli/%s -> %lli\n", (unsigned long long)parent,
-@@ -959,7 +972,7 @@ static void lo_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
- return;
- }
-
-- err = lo_do_lookup(req, parent, name, &e);
-+ err = lo_do_lookup(req, parent, name, &e, NULL);
- if (err) {
- fuse_reply_err(req, err);
- } else {
-@@ -1067,7 +1080,7 @@ static void lo_mknod_symlink(fuse_req_t req, fuse_ino_t parent,
- goto out;
- }
-
-- saverr = lo_do_lookup(req, parent, name, &e);
-+ saverr = lo_do_lookup(req, parent, name, &e, NULL);
- if (saverr) {
- goto out;
- }
-@@ -1544,7 +1557,7 @@ static void lo_do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
-
- if (plus) {
- if (!is_dot_or_dotdot(name)) {
-- err = lo_do_lookup(req, ino, name, &e);
-+ err = lo_do_lookup(req, ino, name, &e, NULL);
- if (err) {
- goto error;
- }
-@@ -1742,7 +1755,7 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
- }
-
- fi->fh = fh;
-- err = lo_do_lookup(req, parent, name, &e);
-+ err = lo_do_lookup(req, parent, name, &e, NULL);
- }
- if (lo->cache == CACHE_NONE) {
- fi->direct_io = 1;
diff --git a/debian/patches/extra/0006-virtiofsd-prevent-opening-of-special-files-CVE-2020-.patch b/debian/patches/extra/0006-virtiofsd-prevent-opening-of-special-files-CVE-2020-.patch
deleted file mode 100644
index 338b28f..0000000
--- a/debian/patches/extra/0006-virtiofsd-prevent-opening-of-special-files-CVE-2020-.patch
+++ /dev/null
@@ -1,296 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Stefan Hajnoczi <stefanha@redhat.com>
-Date: Thu, 4 Feb 2021 18:34:37 +0000
-Subject: [PATCH] virtiofsd: prevent opening of special files (CVE-2020-35517)
-
-A well-behaved FUSE client does not attempt to open special files with
-FUSE_OPEN because they are handled on the client side (e.g. device nodes
-are handled by client-side device drivers).
-
-The check to prevent virtiofsd from opening special files is missing in
-a few cases, most notably FUSE_OPEN. A malicious client can cause
-virtiofsd to open a device node, potentially allowing the guest to
-escape. This can be exploited by a modified guest device driver. It is
-not exploitable from guest userspace since the guest kernel will handle
-special files inside the guest instead of sending FUSE requests.
-
-This patch fixes this issue by introducing the lo_inode_open() function
-to check the file type before opening it. This is a short-term solution
-because it does not prevent a compromised virtiofsd process from opening
-device nodes on the host.
-
-Restructure lo_create() to try O_CREAT | O_EXCL first. Note that O_CREAT
-| O_EXCL does not follow symlinks, so O_NOFOLLOW masking is not
-necessary here. If the file exists and the user did not specify O_EXCL,
-open it via lo_do_open().
-
-Reported-by: Alex Xu <alex@alxu.ca>
-Fixes: CVE-2020-35517
-Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
-Reviewed-by: Greg Kurz <groug@kaod.org>
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-Message-Id: <20210204150208.367837-4-stefanha@redhat.com>
-Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
----
- tools/virtiofsd/passthrough_ll.c | 144 ++++++++++++++++++++-----------
- 1 file changed, 92 insertions(+), 52 deletions(-)
-
-diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
-index 2bd050b620..03c5e0d13c 100644
---- a/tools/virtiofsd/passthrough_ll.c
-+++ b/tools/virtiofsd/passthrough_ll.c
-@@ -567,6 +567,38 @@ static int lo_fd(fuse_req_t req, fuse_ino_t ino)
- return fd;
- }
-
-+/*
-+ * Open a file descriptor for an inode. Returns -EBADF if the inode is not a
-+ * regular file or a directory.
-+ *
-+ * Use this helper function instead of raw openat(2) to prevent security issues
-+ * when a malicious client opens special files such as block device nodes.
-+ * Symlink inodes are also rejected since symlinks must already have been
-+ * traversed on the client side.
-+ */
-+static int lo_inode_open(struct lo_data *lo, struct lo_inode *inode,
-+ int open_flags)
-+{
-+ g_autofree char *fd_str = g_strdup_printf("%d", inode->fd);
-+ int fd;
-+
-+ if (!S_ISREG(inode->filetype) && !S_ISDIR(inode->filetype)) {
-+ return -EBADF;
-+ }
-+
-+ /*
-+ * The file is a symlink so O_NOFOLLOW must be ignored. We checked earlier
-+ * that the inode is not a special file but if an external process races
-+ * with us then symlinks are traversed here. It is not possible to escape
-+ * the shared directory since it is mounted as "/" though.
-+ */
-+ fd = openat(lo->proc_self_fd, fd_str, open_flags & ~O_NOFOLLOW);
-+ if (fd < 0) {
-+ return -errno;
-+ }
-+ return fd;
-+}
-+
- static void lo_init(void *userdata, struct fuse_conn_info *conn)
- {
- struct lo_data *lo = (struct lo_data *)userdata;
-@@ -696,9 +728,9 @@ static void lo_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
- if (fi) {
- truncfd = fd;
- } else {
-- sprintf(procname, "%i", ifd);
-- truncfd = openat(lo->proc_self_fd, procname, O_RDWR);
-+ truncfd = lo_inode_open(lo, inode, O_RDWR);
- if (truncfd < 0) {
-+ errno = -truncfd;
- goto out_err;
- }
- }
-@@ -860,7 +892,7 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
- struct lo_inode *dir = lo_inode(req, parent);
-
- if (inodep) {
-- *inodep = NULL;
-+ *inodep = NULL; /* in case there is an error */
- }
-
- /*
-@@ -1674,19 +1706,26 @@ static void update_open_flags(int writeback, int allow_direct_io,
- }
- }
-
-+/*
-+ * Open a regular file, set up an fd mapping, and fill out the struct
-+ * fuse_file_info for it. If existing_fd is not negative, use that fd instead
-+ * opening a new one. Takes ownership of existing_fd.
-+ *
-+ * Returns 0 on success or a positive errno.
-+ */
- static int lo_do_open(struct lo_data *lo, struct lo_inode *inode,
-- struct fuse_file_info *fi)
-+ int existing_fd, struct fuse_file_info *fi)
- {
-- char buf[64];
- ssize_t fh;
-- int fd;
-+ int fd = existing_fd;
-
- update_open_flags(lo->writeback, lo->allow_direct_io, fi);
-
-- sprintf(buf, "%i", inode->fd);
-- fd = openat(lo->proc_self_fd, buf, fi->flags & ~O_NOFOLLOW);
-- if (fd == -1) {
-- return errno;
-+ if (fd < 0) {
-+ fd = lo_inode_open(lo, inode, fi->flags);
-+ if (fd < 0) {
-+ return -fd;
-+ }
- }
-
- pthread_mutex_lock(&lo->mutex);
-@@ -1709,9 +1748,10 @@ static int lo_do_open(struct lo_data *lo, struct lo_inode *inode,
- static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
- mode_t mode, struct fuse_file_info *fi)
- {
-- int fd;
-+ int fd = -1;
- struct lo_data *lo = lo_data(req);
- struct lo_inode *parent_inode;
-+ struct lo_inode *inode = NULL;
- struct fuse_entry_param e;
- int err;
- struct lo_cred old = {};
-@@ -1737,36 +1777,38 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
-
- update_open_flags(lo->writeback, lo->allow_direct_io, fi);
-
-- fd = openat(parent_inode->fd, name, (fi->flags | O_CREAT) & ~O_NOFOLLOW,
-- mode);
-+ /* Try to create a new file but don't open existing files */
-+ fd = openat(parent_inode->fd, name, fi->flags | O_CREAT | O_EXCL, mode);
- err = fd == -1 ? errno : 0;
-- lo_restore_cred(&old);
-
-- if (!err) {
-- ssize_t fh;
-+ lo_restore_cred(&old);
-
-- pthread_mutex_lock(&lo->mutex);
-- fh = lo_add_fd_mapping(lo, fd);
-- pthread_mutex_unlock(&lo->mutex);
-- if (fh == -1) {
-- close(fd);
-- err = ENOMEM;
-- goto out;
-- }
-+ /* Ignore the error if file exists and O_EXCL was not given */
-+ if (err && (err != EEXIST || (fi->flags & O_EXCL))) {
-+ goto out;
-+ }
-
-- fi->fh = fh;
-- err = lo_do_lookup(req, parent, name, &e, NULL);
-+ err = lo_do_lookup(req, parent, name, &e, &inode);
-+ if (err) {
-+ goto out;
- }
-- if (lo->cache == CACHE_NONE) {
-- fi->direct_io = 1;
-- } else if (lo->cache == CACHE_ALWAYS) {
-- fi->keep_cache = 1;
-+
-+ err = lo_do_open(lo, inode, fd, fi);
-+ fd = -1; /* lo_do_open() takes ownership of fd */
-+ if (err) {
-+ /* Undo lo_do_lookup() nlookup ref */
-+ unref_inode_lolocked(lo, inode, 1);
- }
-
- out:
-+ lo_inode_put(lo, &inode);
- lo_inode_put(lo, &parent_inode);
-
- if (err) {
-+ if (fd >= 0) {
-+ close(fd);
-+ }
-+
- fuse_reply_err(req, err);
- } else {
- fuse_reply_create(req, &e, fi);
-@@ -1780,7 +1822,6 @@ static struct lo_inode_plock *lookup_create_plock_ctx(struct lo_data *lo,
- pid_t pid, int *err)
- {
- struct lo_inode_plock *plock;
-- char procname[64];
- int fd;
-
- plock =
-@@ -1797,12 +1838,10 @@ static struct lo_inode_plock *lookup_create_plock_ctx(struct lo_data *lo,
- }
-
- /* Open another instance of file which can be used for ofd locks. */
-- sprintf(procname, "%i", inode->fd);
--
- /* TODO: What if file is not writable? */
-- fd = openat(lo->proc_self_fd, procname, O_RDWR);
-- if (fd == -1) {
-- *err = errno;
-+ fd = lo_inode_open(lo, inode, O_RDWR);
-+ if (fd < 0) {
-+ *err = -fd;
- free(plock);
- return NULL;
- }
-@@ -1949,7 +1988,7 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
- return;
- }
-
-- err = lo_do_open(lo, inode, fi);
-+ err = lo_do_open(lo, inode, -1, fi);
- lo_inode_put(lo, &inode);
- if (err) {
- fuse_reply_err(req, err);
-@@ -2005,39 +2044,40 @@ static void lo_flush(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
- static void lo_fsync(fuse_req_t req, fuse_ino_t ino, int datasync,
- struct fuse_file_info *fi)
- {
-+ struct lo_inode *inode = lo_inode(req, ino);
-+ struct lo_data *lo = lo_data(req);
- int res;
- int fd;
-- char *buf;
-
- fuse_log(FUSE_LOG_DEBUG, "lo_fsync(ino=%" PRIu64 ", fi=0x%p)\n", ino,
- (void *)fi);
-
-- if (!fi) {
-- struct lo_data *lo = lo_data(req);
--
-- res = asprintf(&buf, "%i", lo_fd(req, ino));
-- if (res == -1) {
-- return (void)fuse_reply_err(req, errno);
-- }
-+ if (!inode) {
-+ fuse_reply_err(req, EBADF);
-+ return;
-+ }
-
-- fd = openat(lo->proc_self_fd, buf, O_RDWR);
-- free(buf);
-- if (fd == -1) {
-- return (void)fuse_reply_err(req, errno);
-+ if (!fi) {
-+ fd = lo_inode_open(lo, inode, O_RDWR);
-+ if (fd < 0) {
-+ res = -fd;
-+ goto out;
- }
- } else {
- fd = lo_fi_fd(req, fi);
- }
-
- if (datasync) {
-- res = fdatasync(fd);
-+ res = fdatasync(fd) == -1 ? errno : 0;
- } else {
-- res = fsync(fd);
-+ res = fsync(fd) == -1 ? errno : 0;
- }
- if (!fi) {
- close(fd);
- }
-- fuse_reply_err(req, res == -1 ? errno : 0);
-+out:
-+ lo_inode_put(lo, &inode);
-+ fuse_reply_err(req, res);
- }
-
- static void lo_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t offset,
diff --git a/debian/patches/extra/0007-virtiofsd-Add-_llseek-to-the-seccomp-whitelist.patch b/debian/patches/extra/0007-virtiofsd-Add-_llseek-to-the-seccomp-whitelist.patch
deleted file mode 100644
index 1eb919b..0000000
--- a/debian/patches/extra/0007-virtiofsd-Add-_llseek-to-the-seccomp-whitelist.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Greg Kurz <groug@kaod.org>
-Date: Thu, 4 Feb 2021 18:34:38 +0000
-Subject: [PATCH] virtiofsd: Add _llseek to the seccomp whitelist
-
-This is how glibc implements lseek(2) on POWER.
-
-BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1917692
-Signed-off-by: Greg Kurz <groug@kaod.org>
-Message-Id: <20210121171540.1449777-1-groug@kaod.org>
-Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
----
- tools/virtiofsd/passthrough_seccomp.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/tools/virtiofsd/passthrough_seccomp.c b/tools/virtiofsd/passthrough_seccomp.c
-index 11623f56f2..bb8ef5b17f 100644
---- a/tools/virtiofsd/passthrough_seccomp.c
-+++ b/tools/virtiofsd/passthrough_seccomp.c
-@@ -68,6 +68,7 @@ static const int syscall_whitelist[] = {
- SCMP_SYS(linkat),
- SCMP_SYS(listxattr),
- SCMP_SYS(lseek),
-+ SCMP_SYS(_llseek), /* For POWER */
- SCMP_SYS(madvise),
- SCMP_SYS(mkdirat),
- SCMP_SYS(mknodat),
diff --git a/debian/patches/extra/0008-virtiofsd-Add-restart_syscall-to-the-seccomp-whiteli.patch b/debian/patches/extra/0008-virtiofsd-Add-restart_syscall-to-the-seccomp-whiteli.patch
deleted file mode 100644
index 2399eae..0000000
--- a/debian/patches/extra/0008-virtiofsd-Add-restart_syscall-to-the-seccomp-whiteli.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Greg Kurz <groug@kaod.org>
-Date: Thu, 4 Feb 2021 18:34:39 +0000
-Subject: [PATCH] virtiofsd: Add restart_syscall to the seccomp whitelist
-
-This is how linux restarts some system calls after SIGSTOP/SIGCONT.
-This is needed to avoid virtiofsd termination when resuming execution
-under GDB for example.
-
-Signed-off-by: Greg Kurz <groug@kaod.org>
-Message-Id: <20210201193305.136390-1-groug@kaod.org>
-Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
----
- tools/virtiofsd/passthrough_seccomp.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/tools/virtiofsd/passthrough_seccomp.c b/tools/virtiofsd/passthrough_seccomp.c
-index bb8ef5b17f..44d75e0e36 100644
---- a/tools/virtiofsd/passthrough_seccomp.c
-+++ b/tools/virtiofsd/passthrough_seccomp.c
-@@ -92,6 +92,7 @@ static const int syscall_whitelist[] = {
- SCMP_SYS(renameat),
- SCMP_SYS(renameat2),
- SCMP_SYS(removexattr),
-+ SCMP_SYS(restart_syscall),
- SCMP_SYS(rt_sigaction),
- SCMP_SYS(rt_sigprocmask),
- SCMP_SYS(rt_sigreturn),
diff --git a/debian/patches/extra/0009-i386-acpi-restore-device-paths-for-pre-5.1-vms.patch b/debian/patches/extra/0009-i386-acpi-restore-device-paths-for-pre-5.1-vms.patch
deleted file mode 100644
index 0539608..0000000
--- a/debian/patches/extra/0009-i386-acpi-restore-device-paths-for-pre-5.1-vms.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Vitaly Cheptsov <cheptsov@ispras.ru>
-Date: Tue, 2 Mar 2021 09:21:10 -0500
-Subject: [PATCH] i386/acpi: restore device paths for pre-5.1 vms
-
-After fixing the _UID value for the primary PCI root bridge in
-af1b80ae it was discovered that this change updates Windows
-configuration in an incompatible way causing network configuration
-failure unless DHCP is used. More details provided on the list:
-
-https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg08484.html
-
-This change reverts the _UID update from 1 to 0 for q35 and i440fx
-VMs before version 5.2 to maintain the original behaviour when
-upgrading.
-
-Cc: qemu-stable@nongnu.org
-Cc: qemu-devel@nongnu.org
-Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
-Suggested-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
-Message-Id: <20210301195919.9333-1-cheptsov@ispras.ru>
-Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
-Reviewed-by: Igor Mammedov <imammedo@redhat.com>
-Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-Fixes: af1b80ae56c9 ("i386/acpi: fix inconsistent QEMU/OVMF device paths")
----
- hw/i386/acpi-build.c | 4 ++--
- hw/i386/pc_piix.c | 2 ++
- hw/i386/pc_q35.c | 2 ++
- include/hw/i386/pc.h | 1 +
- 4 files changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
-index 1f5c211245..b5616582a5 100644
---- a/hw/i386/acpi-build.c
-+++ b/hw/i386/acpi-build.c
-@@ -1513,7 +1513,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
- dev = aml_device("PCI0");
- aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
- aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
-- aml_append(dev, aml_name_decl("_UID", aml_int(0)));
-+ aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid)));
- aml_append(sb_scope, dev);
- aml_append(dsdt, sb_scope);
-
-@@ -1530,7 +1530,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
- aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08")));
- aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03")));
- aml_append(dev, aml_name_decl("_ADR", aml_int(0)));
-- aml_append(dev, aml_name_decl("_UID", aml_int(0)));
-+ aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid)));
- aml_append(dev, build_q35_osc_method());
- aml_append(sb_scope, dev);
-
-diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
-index 13d1628f13..2524c96216 100644
---- a/hw/i386/pc_piix.c
-+++ b/hw/i386/pc_piix.c
-@@ -417,6 +417,7 @@ static void pc_i440fx_machine_options(MachineClass *m)
- {
- PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
- pcmc->default_nic_model = "e1000";
-+ pcmc->pci_root_uid = 0;
-
- m->family = "pc_piix";
- m->desc = "Standard PC (i440FX + PIIX, 1996)";
-@@ -448,6 +449,7 @@ static void pc_i440fx_5_1_machine_options(MachineClass *m)
- compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len);
- compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len);
- pcmc->kvmclock_create_always = false;
-+ pcmc->pci_root_uid = 1;
- }
-
- DEFINE_I440FX_MACHINE(v5_1, "pc-i440fx-5.1", NULL,
-diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
-index a3f4959c43..c58dad5ae3 100644
---- a/hw/i386/pc_q35.c
-+++ b/hw/i386/pc_q35.c
-@@ -329,6 +329,7 @@ static void pc_q35_machine_options(MachineClass *m)
- {
- PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
- pcmc->default_nic_model = "e1000e";
-+ pcmc->pci_root_uid = 0;
-
- m->family = "pc_q35";
- m->desc = "Standard PC (Q35 + ICH9, 2009)";
-@@ -364,6 +365,7 @@ static void pc_q35_5_1_machine_options(MachineClass *m)
- compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len);
- compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len);
- pcmc->kvmclock_create_always = false;
-+ pcmc->pci_root_uid = 1;
- }
-
- DEFINE_Q35_MACHINE(v5_1, "pc-q35-5.1", NULL,
-diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
-index 911e460097..7f8e1a791f 100644
---- a/include/hw/i386/pc.h
-+++ b/include/hw/i386/pc.h
-@@ -99,6 +99,7 @@ struct PCMachineClass {
- int legacy_acpi_table_size;
- unsigned acpi_data_size;
- bool do_not_add_smb_acpi;
-+ int pci_root_uid;
-
- /* SMBIOS compat: */
- bool smbios_defaults;
diff --git a/debian/patches/extra/0010-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch b/debian/patches/extra/0010-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch
deleted file mode 100644
index 9d6df71..0000000
--- a/debian/patches/extra/0010-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Stefan Reiter <s.reiter@proxmox.com>
-Date: Mon, 22 Mar 2021 15:20:04 +0100
-Subject: [PATCH] monitor/qmp: fix race on CHR_EVENT_CLOSED without OOB
-
-The QMP dispatcher coroutine holds the qmp_queue_lock over a yield
-point, where it expects to be rescheduled from the main context. If a
-CHR_EVENT_CLOSED event is received just then, it can race and block the
-main thread on the mutex in monitor_qmp_cleanup_queue_and_resume.
-
-Calculate need_resume immediately after we pop a request from the queue,
-so that we can release the mutex before yielding.
-
-Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
-Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
----
- monitor/qmp.c | 11 ++++++-----
- 1 file changed, 6 insertions(+), 5 deletions(-)
-
-diff --git a/monitor/qmp.c b/monitor/qmp.c
-index 2e37d11bd3..2aff833f7a 100644
---- a/monitor/qmp.c
-+++ b/monitor/qmp.c
-@@ -252,6 +252,12 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
- }
- }
-
-+ mon = req_obj->mon;
-+ /* qmp_oob_enabled() might change after "qmp_capabilities" */
-+ need_resume = !qmp_oob_enabled(mon) ||
-+ mon->qmp_requests->length == QMP_REQ_QUEUE_LEN_MAX - 1;
-+ qemu_mutex_unlock(&mon->qmp_queue_lock);
-+
- if (qatomic_xchg(&qmp_dispatcher_co_busy, true) == true) {
- /*
- * Someone rescheduled us (probably because a new requests
-@@ -270,11 +276,6 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)
- aio_co_schedule(qemu_get_aio_context(), qmp_dispatcher_co);
- qemu_coroutine_yield();
-
-- mon = req_obj->mon;
-- /* qmp_oob_enabled() might change after "qmp_capabilities" */
-- need_resume = !qmp_oob_enabled(mon) ||
-- mon->qmp_requests->length == QMP_REQ_QUEUE_LEN_MAX - 1;
-- qemu_mutex_unlock(&mon->qmp_queue_lock);
- if (req_obj->req) {
- QDict *qdict = qobject_to(QDict, req_obj->req);
- QObject *id = qdict ? qdict_get(qdict, "id") : NULL;
diff --git a/debian/patches/extra/0011-block-Fix-locking-in-qmp_block_resize.patch b/debian/patches/extra/0011-block-Fix-locking-in-qmp_block_resize.patch
deleted file mode 100644
index 4260c75..0000000
--- a/debian/patches/extra/0011-block-Fix-locking-in-qmp_block_resize.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Thu, 3 Dec 2020 18:23:10 +0100
-Subject: [PATCH] block: Fix locking in qmp_block_resize()
-
-The drain functions assume that we hold the AioContext lock of the
-drained block node. Make sure to actually take the lock.
-
-Cc: qemu-stable@nongnu.org
-Fixes: eb94b81a94bce112e6b206df846c1551aaf6cab6
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-Id: <20201203172311.68232-3-kwolf@redhat.com>
-Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
----
- blockdev.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/blockdev.c b/blockdev.c
-index fe6fb5dc1d..9a86e9fb4b 100644
---- a/blockdev.c
-+++ b/blockdev.c
-@@ -2481,14 +2481,17 @@ void coroutine_fn qmp_block_resize(bool has_device, const char *device,
- goto out;
- }
-
-+ bdrv_co_lock(bs);
- bdrv_drained_begin(bs);
-+ bdrv_co_unlock(bs);
-+
- old_ctx = bdrv_co_enter(bs);
- blk_truncate(blk, size, false, PREALLOC_MODE_OFF, 0, errp);
- bdrv_co_leave(bs, old_ctx);
-- bdrv_drained_end(bs);
-
- out:
- bdrv_co_lock(bs);
-+ bdrv_drained_end(bs);
- blk_unref(blk);
- bdrv_co_unlock(bs);
- }
diff --git a/debian/patches/extra/0012-block-Fix-deadlock-in-bdrv_co_yield_to_drain.patch b/debian/patches/extra/0012-block-Fix-deadlock-in-bdrv_co_yield_to_drain.patch
deleted file mode 100644
index 0e35160..0000000
--- a/debian/patches/extra/0012-block-Fix-deadlock-in-bdrv_co_yield_to_drain.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Kevin Wolf <kwolf@redhat.com>
-Date: Thu, 3 Dec 2020 18:23:11 +0100
-Subject: [PATCH] block: Fix deadlock in bdrv_co_yield_to_drain()
-
-If bdrv_co_yield_to_drain() is called for draining a block node that
-runs in a different AioContext, it keeps that AioContext locked while it
-yields and schedules a BH in the AioContext to do the actual drain.
-
-As long as executing the BH is the very next thing that the event loop
-of the node's AioContext does, this actually happens to work, but when
-it tries to execute something else that wants to take the AioContext
-lock, it will deadlock. (In the bug report, this other thing is a
-virtio-scsi device running virtio_scsi_data_plane_handle_cmd().)
-
-Instead, always drop the AioContext lock across the yield and reacquire
-it only when the coroutine is reentered. The BH needs to unconditionally
-take the lock for itself now.
-
-This fixes the 'block_resize' QMP command on a block node that runs in
-an iothread.
-
-Cc: qemu-stable@nongnu.org
-Fixes: eb94b81a94bce112e6b206df846c1551aaf6cab6
-Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1903511
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Message-Id: <20201203172311.68232-4-kwolf@redhat.com>
-Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
-Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
----
- block/io.c | 41 ++++++++++++++++++++++++-----------------
- 1 file changed, 24 insertions(+), 17 deletions(-)
-
-diff --git a/block/io.c b/block/io.c
-index ec5e152bb7..a9f56a9ab1 100644
---- a/block/io.c
-+++ b/block/io.c
-@@ -306,17 +306,7 @@ static void bdrv_co_drain_bh_cb(void *opaque)
-
- if (bs) {
- AioContext *ctx = bdrv_get_aio_context(bs);
-- AioContext *co_ctx = qemu_coroutine_get_aio_context(co);
--
-- /*
-- * When the coroutine yielded, the lock for its home context was
-- * released, so we need to re-acquire it here. If it explicitly
-- * acquired a different context, the lock is still held and we don't
-- * want to lock it a second time (or AIO_WAIT_WHILE() would hang).
-- */
-- if (ctx == co_ctx) {
-- aio_context_acquire(ctx);
-- }
-+ aio_context_acquire(ctx);
- bdrv_dec_in_flight(bs);
- if (data->begin) {
- assert(!data->drained_end_counter);
-@@ -328,9 +318,7 @@ static void bdrv_co_drain_bh_cb(void *opaque)
- data->ignore_bds_parents,
- data->drained_end_counter);
- }
-- if (ctx == co_ctx) {
-- aio_context_release(ctx);
-- }
-+ aio_context_release(ctx);
- } else {
- assert(data->begin);
- bdrv_drain_all_begin();
-@@ -348,13 +336,16 @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs,
- int *drained_end_counter)
- {
- BdrvCoDrainData data;
-+ Coroutine *self = qemu_coroutine_self();
-+ AioContext *ctx = bdrv_get_aio_context(bs);
-+ AioContext *co_ctx = qemu_coroutine_get_aio_context(self);
-
- /* Calling bdrv_drain() from a BH ensures the current coroutine yields and
- * other coroutines run if they were queued by aio_co_enter(). */
-
- assert(qemu_in_coroutine());
- data = (BdrvCoDrainData) {
-- .co = qemu_coroutine_self(),
-+ .co = self,
- .bs = bs,
- .done = false,
- .begin = begin,
-@@ -368,13 +359,29 @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs,
- if (bs) {
- bdrv_inc_in_flight(bs);
- }
-- replay_bh_schedule_oneshot_event(bdrv_get_aio_context(bs),
-- bdrv_co_drain_bh_cb, &data);
-+
-+ /*
-+ * Temporarily drop the lock across yield or we would get deadlocks.
-+ * bdrv_co_drain_bh_cb() reaquires the lock as needed.
-+ *
-+ * When we yield below, the lock for the current context will be
-+ * released, so if this is actually the lock that protects bs, don't drop
-+ * it a second time.
-+ */
-+ if (ctx != co_ctx) {
-+ aio_context_release(ctx);
-+ }
-+ replay_bh_schedule_oneshot_event(ctx, bdrv_co_drain_bh_cb, &data);
-
- qemu_coroutine_yield();
- /* If we are resumed from some other event (such as an aio completion or a
- * timer callback), it is a bug in the caller that should be fixed. */
- assert(data.done);
-+
-+ /* Reaquire the AioContext of bs if we dropped it */
-+ if (ctx != co_ctx) {
-+ aio_context_acquire(ctx);
-+ }
- }
-
- void bdrv_do_drained_begin_quiesce(BlockDriverState *bs,
diff --git a/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch b/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch
index 9d7bec1..6c7a27c 100644
--- a/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch
+++ b/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch
@@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c
-index d5fd1dbcd2..bda3e606dc 100644
+index 20e14f8e96..9242b76c04 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
-@@ -508,7 +508,7 @@ static QemuOptsList raw_runtime_opts = {
+@@ -522,7 +522,7 @@ static QemuOptsList raw_runtime_opts = {
{
.name = "locking",
.type = QEMU_OPT_STRING,
@@ -26,7 +26,7 @@ index d5fd1dbcd2..bda3e606dc 100644
},
{
.name = "pr-manager",
-@@ -606,7 +606,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
+@@ -620,7 +620,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
s->use_lock = false;
break;
case ON_OFF_AUTO_AUTO:
diff --git a/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch b/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch
index 17e6fa5..d35c0ec 100644
--- a/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch
+++ b/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch
@@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/net/net.h b/include/net/net.h
-index 778fc787ca..fb2db6bb75 100644
+index 1ef536d771..2f4073678b 100644
--- a/include/net/net.h
+++ b/include/net/net.h
-@@ -210,8 +210,8 @@ void netdev_add(QemuOpts *opts, Error **errp);
+@@ -217,8 +217,8 @@ void netdev_add(QemuOpts *opts, Error **errp);
int net_hub_id_for_client(NetClientState *nc, int *id);
NetClientState *net_hub_port_find(int hub_id);
diff --git a/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch b/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch
index 3b08513..7dbdd1c 100644
--- a/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch
+++ b/debian/patches/pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch
@@ -10,7 +10,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
-index 88e8586f8f..93563ee0c2 100644
+index 570f916878..796cd534ee 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1973,9 +1973,9 @@ uint64_t cpu_get_tsc(CPUX86State *env);
diff --git a/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch b/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch
index f02a0f8..da5d55e 100644
--- a/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch
+++ b/debian/patches/pve/0004-PVE-Config-ui-spice-default-to-pve-certificates.patch
@@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/ui/spice-core.c b/ui/spice-core.c
-index eea52f5389..d09ee7f09e 100644
+index 272d19b0c1..9719214f19 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
-@@ -667,32 +667,35 @@ static void qemu_spice_init(void)
+@@ -694,32 +694,35 @@ static void qemu_spice_init(void)
if (tls_port) {
x509_dir = qemu_opt_get(opts, "x509-dir");
diff --git a/debian/patches/pve/0005-PVE-Config-smm_available-false.patch b/debian/patches/pve/0005-PVE-Config-smm_available-false.patch
index 59fd521..a661926 100644
--- a/debian/patches/pve/0005-PVE-Config-smm_available-false.patch
+++ b/debian/patches/pve/0005-PVE-Config-smm_available-false.patch
@@ -10,10 +10,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
-index 5944fc44ed..31b481b4e9 100644
+index ed796fe6ba..455ee54bae 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
-@@ -1115,7 +1115,7 @@ bool x86_machine_is_smm_enabled(const X86MachineState *x86ms)
+@@ -1145,7 +1145,7 @@ bool x86_machine_is_smm_enabled(const X86MachineState *x86ms)
if (tcg_enabled() || qtest_enabled()) {
smm_available = true;
} else if (kvm_enabled()) {
diff --git a/debian/patches/pve/0006-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch b/debian/patches/pve/0006-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch
index 110833e..cec81b1 100644
--- a/debian/patches/pve/0006-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch
+++ b/debian/patches/pve/0006-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch
@@ -9,7 +9,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/block/gluster.c b/block/gluster.c
-index 4f1448e2bc..715f06394c 100644
+index e8ee14c8e9..3eb6a05500 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -42,7 +42,7 @@
diff --git a/debian/patches/pve/0007-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch b/debian/patches/pve/0007-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch
index 7180411..ffd9644 100644
--- a/debian/patches/pve/0007-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch
+++ b/debian/patches/pve/0007-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch
@@ -18,10 +18,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+)
diff --git a/block/rbd.c b/block/rbd.c
-index 9bd2bce716..c7195a2342 100644
+index f098a89c7b..b691c32c70 100644
--- a/block/rbd.c
+++ b/block/rbd.c
-@@ -609,6 +609,8 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx,
+@@ -610,6 +610,8 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx,
rados_conf_set(*cluster, "rbd_cache", "false");
}
diff --git a/debian/patches/pve/0008-PVE-Up-qmp-add-get_link_status.patch b/debian/patches/pve/0008-PVE-Up-qmp-add-get_link_status.patch
index 4930618..322201c 100644
--- a/debian/patches/pve/0008-PVE-Up-qmp-add-get_link_status.patch
+++ b/debian/patches/pve/0008-PVE-Up-qmp-add-get_link_status.patch
@@ -11,10 +11,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 files changed, 43 insertions(+)
diff --git a/net/net.c b/net/net.c
-index 6a2c3d9567..a1e9514fb8 100644
+index edf9b95418..c2fa8bc9b4 100644
--- a/net/net.c
+++ b/net/net.c
-@@ -1277,6 +1277,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict)
+@@ -1315,6 +1315,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict)
}
}
@@ -49,7 +49,7 @@ index 6a2c3d9567..a1e9514fb8 100644
{
NetClientState *nc;
diff --git a/qapi/net.json b/qapi/net.json
-index a3a1336001..b8092c4e20 100644
+index af3f5b0fda..6e3ec838c7 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -35,6 +35,21 @@
@@ -75,14 +75,14 @@ index a3a1336001..b8092c4e20 100644
# @netdev_add:
#
diff --git a/qapi/pragma.json b/qapi/pragma.json
-index cffae27666..5a3e3de95f 100644
+index 3bc0335d1f..7c91ea3685 100644
--- a/qapi/pragma.json
+++ b/qapi/pragma.json
-@@ -5,6 +5,7 @@
- { 'pragma': {
- # Commands allowed to return a non-dictionary:
- 'returns-whitelist': [
-+ 'get_link_status',
+@@ -22,6 +22,7 @@
+ 'system_reset',
+ 'system_wakeup' ],
+ 'command-returns-exceptions': [
++ 'get_link_status',
'human-monitor-command',
'qom-get',
- 'query-migrate-cache-size',
+ 'query-tpm-models',
diff --git a/debian/patches/pve/0009-PVE-Up-glusterfs-allow-partial-reads.patch b/debian/patches/pve/0009-PVE-Up-glusterfs-allow-partial-reads.patch
index 1459988..a0fdc22 100644
--- a/debian/patches/pve/0009-PVE-Up-glusterfs-allow-partial-reads.patch
+++ b/debian/patches/pve/0009-PVE-Up-glusterfs-allow-partial-reads.patch
@@ -16,7 +16,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/block/gluster.c b/block/gluster.c
-index 715f06394c..6d02170d9b 100644
+index 3eb6a05500..b612918ee8 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -57,6 +57,7 @@ typedef struct GlusterAIOCB {
@@ -27,7 +27,7 @@ index 715f06394c..6d02170d9b 100644
} GlusterAIOCB;
typedef struct BDRVGlusterState {
-@@ -759,8 +760,10 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret,
+@@ -752,8 +753,10 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret,
acb->ret = 0; /* Success */
} else if (ret < 0) {
acb->ret = -errno; /* Read/Write failed */
@@ -39,7 +39,7 @@ index 715f06394c..6d02170d9b 100644
}
aio_co_schedule(acb->aio_context, acb->coroutine);
-@@ -1028,6 +1031,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs,
+@@ -1021,6 +1024,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs,
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
acb.aio_context = bdrv_get_aio_context(bs);
@@ -47,7 +47,7 @@ index 715f06394c..6d02170d9b 100644
ret = glfs_zerofill_async(s->fd, offset, size, gluster_finish_aiocb, &acb);
if (ret < 0) {
-@@ -1209,9 +1213,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs,
+@@ -1202,9 +1206,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs,
acb.aio_context = bdrv_get_aio_context(bs);
if (write) {
@@ -59,7 +59,7 @@ index 715f06394c..6d02170d9b 100644
ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0,
gluster_finish_aiocb, &acb);
}
-@@ -1275,6 +1281,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
+@@ -1268,6 +1274,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
acb.aio_context = bdrv_get_aio_context(bs);
@@ -67,7 +67,7 @@ index 715f06394c..6d02170d9b 100644
ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb);
if (ret < 0) {
-@@ -1321,6 +1328,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs,
+@@ -1314,6 +1321,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs,
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
acb.aio_context = bdrv_get_aio_context(bs);
diff --git a/debian/patches/pve/0010-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch b/debian/patches/pve/0010-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch
index d15050e..6599772 100644
--- a/debian/patches/pve/0010-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch
+++ b/debian/patches/pve/0010-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch
@@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/qemu-img.c b/qemu-img.c
-index f9050bfaad..7e6666b5f7 100644
+index babb5573ab..6377499c5e 100644
--- a/qemu-img.c
+++ b/qemu-img.c
-@@ -3022,7 +3022,8 @@ static int img_info(int argc, char **argv)
+@@ -2932,7 +2932,8 @@ static int img_info(int argc, char **argv)
list = collect_image_info_list(image_opts, filename, fmt, chain,
force_share);
if (!list) {
diff --git a/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch b/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch
index 07a877e..b385e66 100644
--- a/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch
+++ b/debian/patches/pve/0011-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch
@@ -33,8 +33,8 @@ Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
qemu-img-cmds.hx | 4 +-
- qemu-img.c | 191 +++++++++++++++++++++++++++++------------------
- 2 files changed, 121 insertions(+), 74 deletions(-)
+ qemu-img.c | 187 +++++++++++++++++++++++++++++------------------
+ 2 files changed, 119 insertions(+), 72 deletions(-)
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index b3620f29e5..e70ef3dc91 100644
@@ -53,10 +53,10 @@ index b3620f29e5..e70ef3dc91 100644
DEF("info", img_info,
diff --git a/qemu-img.c b/qemu-img.c
-index 7e6666b5f7..44cf942bd2 100644
+index 6377499c5e..10db094561 100644
--- a/qemu-img.c
+++ b/qemu-img.c
-@@ -4897,10 +4897,12 @@ static int img_bitmap(int argc, char **argv)
+@@ -4742,10 +4742,12 @@ static int img_bitmap(int argc, char **argv)
#define C_IF 04
#define C_OF 010
#define C_SKIP 020
@@ -69,7 +69,7 @@ index 7e6666b5f7..44cf942bd2 100644
};
struct DdIo {
-@@ -4976,6 +4978,19 @@ static int img_dd_skip(const char *arg,
+@@ -4821,6 +4823,19 @@ static int img_dd_skip(const char *arg,
return 0;
}
@@ -89,7 +89,7 @@ index 7e6666b5f7..44cf942bd2 100644
static int img_dd(int argc, char **argv)
{
int ret = 0;
-@@ -5016,6 +5031,7 @@ static int img_dd(int argc, char **argv)
+@@ -4861,6 +4876,7 @@ static int img_dd(int argc, char **argv)
{ "if", img_dd_if, C_IF },
{ "of", img_dd_of, C_OF },
{ "skip", img_dd_skip, C_SKIP },
@@ -97,7 +97,7 @@ index 7e6666b5f7..44cf942bd2 100644
{ NULL, NULL, 0 }
};
const struct option long_options[] = {
-@@ -5094,8 +5110,13 @@ static int img_dd(int argc, char **argv)
+@@ -4936,91 +4952,112 @@ static int img_dd(int argc, char **argv)
arg = NULL;
}
@@ -105,53 +105,30 @@ index 7e6666b5f7..44cf942bd2 100644
- error_report("Must specify both input and output files");
+ if (!(dd.flags & C_IF) && (!fmt || strcmp(fmt, "raw") != 0)) {
+ error_report("Input format must be raw when readin from stdin");
-+ ret = -1;
-+ goto out;
-+ }
+ ret = -1;
+ goto out;
+ }
+-
+- blk1 = img_open(image_opts, in.filename, fmt, 0, false, false,
+- force_share);
+-
+- if (!blk1) {
+ if (!(dd.flags & C_OF) && strcmp(out_fmt, "raw") != 0) {
+ error_report("Output format must be raw when writing to stdout");
ret = -1;
goto out;
}
-@@ -5107,85 +5128,101 @@ static int img_dd(int argc, char **argv)
- goto out;
- }
-
-- blk1 = img_open(image_opts, in.filename, fmt, 0, false, false,
-- force_share);
-+ if (dd.flags & C_IF) {
-+ blk1 = img_open(image_opts, in.filename, fmt, 0, false, false,
-+ force_share);
-
-- if (!blk1) {
-- ret = -1;
-- goto out;
-+ if (!blk1) {
-+ ret = -1;
-+ goto out;
-+ }
- }
- drv = bdrv_find_format(out_fmt);
- if (!drv) {
- error_report("Unknown file format");
-+ if (dd.flags & C_OSIZE) {
-+ size = dd.osize;
-+ } else if (dd.flags & C_IF) {
-+ size = blk_getlength(blk1);
-+ if (size < 0) {
-+ error_report("Failed to get size for '%s'", in.filename);
-+ ret = -1;
-+ goto out;
-+ }
-+ } else if (dd.flags & C_COUNT) {
-+ size = dd.count * in.bsz;
-+ } else {
-+ error_report("Output size must be known when reading from stdin");
- ret = -1;
- goto out;
- }
+- ret = -1;
+- goto out;
+- }
- proto_drv = bdrv_find_protocol(out.filename, true, &local_err);
++ if (dd.flags & C_IF) {
++ blk1 = img_open(image_opts, in.filename, fmt, 0, false, false,
++ force_share);
- if (!proto_drv) {
- error_report_err(local_err);
@@ -169,14 +146,50 @@ index 7e6666b5f7..44cf942bd2 100644
- proto_drv->format_name);
- ret = -1;
- goto out;
-+ if (!(dd.flags & C_OSIZE) && dd.flags & C_COUNT && dd.count <= INT64_MAX / in.bsz &&
-+ dd.count * in.bsz < size) {
-+ size = dd.count * in.bsz;
++ if (!blk1) {
++ ret = -1;
++ goto out;
++ }
}
- create_opts = qemu_opts_append(create_opts, drv->create_opts);
- create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
- opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
+-
+- size = blk_getlength(blk1);
+- if (size < 0) {
+- error_report("Failed to get size for '%s'", in.filename);
++ if (dd.flags & C_OSIZE) {
++ size = dd.osize;
++ } else if (dd.flags & C_IF) {
++ size = blk_getlength(blk1);
++ if (size < 0) {
++ error_report("Failed to get size for '%s'", in.filename);
++ ret = -1;
++ goto out;
++ }
++ } else if (dd.flags & C_COUNT) {
++ size = dd.count * in.bsz;
++ } else {
++ error_report("Output size must be known when reading from stdin");
+ ret = -1;
+ goto out;
+ }
+
+- if (dd.flags & C_COUNT && dd.count <= INT64_MAX / in.bsz &&
++ if (!(dd.flags & C_OSIZE) && dd.flags & C_COUNT && dd.count <= INT64_MAX / in.bsz &&
+ dd.count * in.bsz < size) {
+ size = dd.count * in.bsz;
+ }
+
+- /* Overflow means the specified offset is beyond input image's size */
+- if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz ||
+- size < in.bsz * in.offset)) {
+- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, 0, &error_abort);
+- } else {
+- qemu_opt_set_number(opts, BLOCK_OPT_SIZE,
+- size - in.bsz * in.offset, &error_abort);
+- }
+ if (dd.flags & C_OF) {
+ drv = bdrv_find_format(out_fmt);
+ if (!drv) {
@@ -186,9 +199,11 @@ index 7e6666b5f7..44cf942bd2 100644
+ }
+ proto_drv = bdrv_find_protocol(out.filename, true, &local_err);
-- size = blk_getlength(blk1);
-- if (size < 0) {
-- error_report("Failed to get size for '%s'", in.filename);
+- ret = bdrv_create(drv, out.filename, opts, &local_err);
+- if (ret < 0) {
+- error_reportf_err(local_err,
+- "%s: error while creating output image: ",
+- out.filename);
- ret = -1;
- goto out;
- }
@@ -212,20 +227,18 @@ index 7e6666b5f7..44cf942bd2 100644
+ create_opts = qemu_opts_append(create_opts, drv->create_opts);
+ create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
-- if (dd.flags & C_COUNT && dd.count <= INT64_MAX / in.bsz &&
-- dd.count * in.bsz < size) {
-- size = dd.count * in.bsz;
-- }
+- /* TODO, we can't honour --image-opts for the target,
+- * since it needs to be given in a format compatible
+- * with the bdrv_create() call above which does not
+- * support image-opts style.
+- */
+- blk2 = img_open_file(out.filename, NULL, out_fmt, BDRV_O_RDWR,
+- false, false, false);
+ opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
-- /* Overflow means the specified offset is beyond input image's size */
-- if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz ||
-- size < in.bsz * in.offset)) {
-- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, 0, &error_abort);
-- } else {
-- qemu_opt_set_number(opts, BLOCK_OPT_SIZE,
-- size - in.bsz * in.offset, &error_abort);
-- }
+- if (!blk2) {
+- ret = -1;
+- goto out;
+ /* Overflow means the specified offset is beyond input image's size */
+ if (dd.flags & C_OSIZE) {
+ qemu_opt_set_number(opts, BLOCK_OPT_SIZE, size, &error_abort);
@@ -236,15 +249,7 @@ index 7e6666b5f7..44cf942bd2 100644
+ qemu_opt_set_number(opts, BLOCK_OPT_SIZE,
+ size - in.bsz * in.offset, &error_abort);
+ }
-
-- ret = bdrv_create(drv, out.filename, opts, &local_err);
-- if (ret < 0) {
-- error_reportf_err(local_err,
-- "%s: error while creating output image: ",
-- out.filename);
-- ret = -1;
-- goto out;
-- }
++
+ ret = bdrv_create(drv, out.filename, opts, &local_err);
+ if (ret < 0) {
+ error_reportf_err(local_err,
@@ -253,14 +258,7 @@ index 7e6666b5f7..44cf942bd2 100644
+ ret = -1;
+ goto out;
+ }
-
-- /* TODO, we can't honour --image-opts for the target,
-- * since it needs to be given in a format compatible
-- * with the bdrv_create() call above which does not
-- * support image-opts style.
-- */
-- blk2 = img_open_file(out.filename, NULL, out_fmt, BDRV_O_RDWR,
-- false, false, false);
++
+ /* TODO, we can't honour --image-opts for the target,
+ * since it needs to be given in a format compatible
+ * with the bdrv_create() call above which does not
@@ -268,10 +266,7 @@ index 7e6666b5f7..44cf942bd2 100644
+ */
+ blk2 = img_open_file(out.filename, NULL, out_fmt, BDRV_O_RDWR,
+ false, false, false);
-
-- if (!blk2) {
-- ret = -1;
-- goto out;
++
+ if (!blk2) {
+ ret = -1;
+ goto out;
@@ -279,7 +274,7 @@ index 7e6666b5f7..44cf942bd2 100644
}
if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz ||
-@@ -5203,11 +5240,17 @@ static int img_dd(int argc, char **argv)
+@@ -5038,11 +5075,17 @@ static int img_dd(int argc, char **argv)
for (out_pos = 0; in_pos < size; block_count++) {
int in_ret, out_ret;
@@ -301,7 +296,7 @@ index 7e6666b5f7..44cf942bd2 100644
}
if (in_ret < 0) {
error_report("error while reading from input image file: %s",
-@@ -5217,9 +5260,13 @@ static int img_dd(int argc, char **argv)
+@@ -5052,9 +5095,13 @@ static int img_dd(int argc, char **argv)
}
in_pos += in_ret;
diff --git a/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-isize-parameter.patch b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-isize-parameter.patch
index ff2ff47..8cd47f1 100644
--- a/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-isize-parameter.patch
+++ b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-isize-parameter.patch
@@ -15,10 +15,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
-index 44cf942bd2..5ce60e8a45 100644
+index 10db094561..fb1031223d 100644
--- a/qemu-img.c
+++ b/qemu-img.c
-@@ -4898,11 +4898,13 @@ static int img_bitmap(int argc, char **argv)
+@@ -4743,11 +4743,13 @@ static int img_bitmap(int argc, char **argv)
#define C_OF 010
#define C_SKIP 020
#define C_OSIZE 040
@@ -32,7 +32,7 @@ index 44cf942bd2..5ce60e8a45 100644
};
struct DdIo {
-@@ -4991,6 +4993,19 @@ static int img_dd_osize(const char *arg,
+@@ -4836,6 +4838,19 @@ static int img_dd_osize(const char *arg,
return 0;
}
@@ -52,7 +52,7 @@ index 44cf942bd2..5ce60e8a45 100644
static int img_dd(int argc, char **argv)
{
int ret = 0;
-@@ -5005,12 +5020,14 @@ static int img_dd(int argc, char **argv)
+@@ -4850,12 +4865,14 @@ static int img_dd(int argc, char **argv)
int c, i;
const char *out_fmt = "raw";
const char *fmt = NULL;
@@ -68,7 +68,7 @@ index 44cf942bd2..5ce60e8a45 100644
};
struct DdIo in = {
.bsz = 512, /* Block size is by default 512 bytes */
-@@ -5032,6 +5049,7 @@ static int img_dd(int argc, char **argv)
+@@ -4877,6 +4894,7 @@ static int img_dd(int argc, char **argv)
{ "of", img_dd_of, C_OF },
{ "skip", img_dd_skip, C_SKIP },
{ "osize", img_dd_osize, C_OSIZE },
@@ -76,7 +76,7 @@ index 44cf942bd2..5ce60e8a45 100644
{ NULL, NULL, 0 }
};
const struct option long_options[] = {
-@@ -5238,14 +5256,18 @@ static int img_dd(int argc, char **argv)
+@@ -5073,14 +5091,18 @@ static int img_dd(int argc, char **argv)
in.buf = g_new(uint8_t, in.bsz);
diff --git a/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-n-skip_create.patch b/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-n-skip_create.patch
index 3230c04..58fe39f 100644
--- a/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-n-skip_create.patch
+++ b/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-n-skip_create.patch
@@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
-index 5ce60e8a45..86bfd0288b 100644
+index fb1031223d..855d4fa7d3 100644
--- a/qemu-img.c
+++ b/qemu-img.c
-@@ -5022,7 +5022,7 @@ static int img_dd(int argc, char **argv)
+@@ -4867,7 +4867,7 @@ static int img_dd(int argc, char **argv)
const char *fmt = NULL;
int64_t size = 0, readsize = 0;
int64_t block_count = 0, out_pos, in_pos;
@@ -21,7 +21,7 @@ index 5ce60e8a45..86bfd0288b 100644
struct DdInfo dd = {
.flags = 0,
.count = 0,
-@@ -5060,7 +5060,7 @@ static int img_dd(int argc, char **argv)
+@@ -4905,7 +4905,7 @@ static int img_dd(int argc, char **argv)
{ 0, 0, 0, 0 }
};
@@ -30,7 +30,7 @@ index 5ce60e8a45..86bfd0288b 100644
if (c == EOF) {
break;
}
-@@ -5080,6 +5080,9 @@ static int img_dd(int argc, char **argv)
+@@ -4925,6 +4925,9 @@ static int img_dd(int argc, char **argv)
case 'h':
help();
break;
@@ -40,7 +40,7 @@ index 5ce60e8a45..86bfd0288b 100644
case 'U':
force_share = true;
break;
-@@ -5220,13 +5223,15 @@ static int img_dd(int argc, char **argv)
+@@ -5055,13 +5058,15 @@ static int img_dd(int argc, char **argv)
size - in.bsz * in.offset, &error_abort);
}
diff --git a/debian/patches/pve/0014-PVE-virtio-balloon-improve-query-balloon.patch b/debian/patches/pve/0014-PVE-virtio-balloon-improve-query-balloon.patch
index 4bd835f..27eefc8 100644
--- a/debian/patches/pve/0014-PVE-virtio-balloon-improve-query-balloon.patch
+++ b/debian/patches/pve/0014-PVE-virtio-balloon-improve-query-balloon.patch
@@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 files changed, 81 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
-index b22b5beda3..6e581439bf 100644
+index d120bf8f43..26077223ac 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
-@@ -805,8 +805,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f,
+@@ -809,8 +809,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f,
static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
{
VirtIOBalloon *dev = opaque;
@@ -58,10 +58,10 @@ index b22b5beda3..6e581439bf 100644
static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 65d8ff4849..705f08a8f1 100644
+index 0ad5b77477..1116767275 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
-@@ -695,7 +695,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
+@@ -698,7 +698,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
return;
}
@@ -99,10 +99,10 @@ index 65d8ff4849..705f08a8f1 100644
qapi_free_BalloonInfo(info);
}
diff --git a/qapi/machine.json b/qapi/machine.json
-index 7c9a263778..3e59199280 100644
+index 6e90d463fc..f8da4a0d98 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
-@@ -1205,10 +1205,30 @@
+@@ -1008,10 +1008,30 @@
# @actual: the logical size of the VM in bytes
# Formula used: logical_vm_size = vm_ram_size - balloon_size
#
@@ -122,7 +122,7 @@ index 7c9a263778..3e59199280 100644
+#
+# @max_mem: amount of memory (in bytes) assigned to the guest
+#
- # Since: 0.14.0
+ # Since: 0.14
#
##
-{ 'struct': 'BalloonInfo', 'data': {'actual': 'int' } }
diff --git a/debian/patches/pve/0015-PVE-qapi-modify-query-machines.patch b/debian/patches/pve/0015-PVE-qapi-modify-query-machines.patch
index 8b403fa..1f1b833 100644
--- a/debian/patches/pve/0015-PVE-qapi-modify-query-machines.patch
+++ b/debian/patches/pve/0015-PVE-qapi-modify-query-machines.patch
@@ -13,10 +13,10 @@ Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
-index 5362c80a18..3fcb82ce2f 100644
+index 68a942595a..76195de9e0 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
-@@ -234,6 +234,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
+@@ -100,6 +100,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
info->numa_mem_supported = mc->numa_mem_supported;
info->deprecated = !!mc->deprecation_reason;
@@ -30,19 +30,19 @@ index 5362c80a18..3fcb82ce2f 100644
info->default_cpu_type = g_strdup(mc->default_cpu_type);
info->has_default_cpu_type = true;
diff --git a/qapi/machine.json b/qapi/machine.json
-index 3e59199280..dfc1a49d3c 100644
+index f8da4a0d98..6e7e93d68f 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
-@@ -318,6 +318,8 @@
+@@ -141,6 +141,8 @@
#
# @is-default: whether the machine is default
#
+# @is-current: whether this machine is currently used
+#
# @cpu-max: maximum number of CPUs supported by the machine type
- # (since 1.5.0)
+ # (since 1.5)
#
-@@ -339,7 +341,7 @@
+@@ -162,7 +164,7 @@
##
{ 'struct': 'MachineInfo',
'data': { 'name': 'str', '*alias': 'str',
diff --git a/debian/patches/pve/0016-PVE-qapi-modify-spice-query.patch b/debian/patches/pve/0016-PVE-qapi-modify-spice-query.patch
index 437fc8e..02ed971 100644
--- a/debian/patches/pve/0016-PVE-qapi-modify-spice-query.patch
+++ b/debian/patches/pve/0016-PVE-qapi-modify-spice-query.patch
@@ -12,16 +12,16 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 files changed, 8 insertions(+)
diff --git a/qapi/ui.json b/qapi/ui.json
-index 6c7b33cb72..39ff301d1e 100644
+index 1052ca9c38..16bf03224f 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
-@@ -215,11 +215,14 @@
+@@ -216,11 +216,14 @@
#
# @channels: a list of @SpiceChannel for each active spice channel
#
+# @ticket: The last ticket set with set_password
+#
- # Since: 0.14.0
+ # Since: 0.14
##
{ 'struct': 'SpiceInfo',
'data': {'enabled': 'bool', 'migrated': 'bool', '*host': 'str', '*port': 'int',
@@ -31,10 +31,10 @@ index 6c7b33cb72..39ff301d1e 100644
'if': 'defined(CONFIG_SPICE)' }
diff --git a/ui/spice-core.c b/ui/spice-core.c
-index d09ee7f09e..da3d2644d1 100644
+index 9719214f19..982b1dc05f 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
-@@ -538,6 +538,11 @@ static SpiceInfo *qmp_query_spice_real(Error **errp)
+@@ -534,6 +534,11 @@ static SpiceInfo *qmp_query_spice_real(Error **errp)
micro = SPICE_SERVER_VERSION & 0xff;
info->compiled_version = g_strdup_printf("%d.%d.%d", major, minor, micro);
diff --git a/debian/patches/pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch b/debian/patches/pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch
index 3a58139..c078a11 100644
--- a/debian/patches/pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch
+++ b/debian/patches/pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch
@@ -26,7 +26,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
hmp-commands-info.hx | 13 +
hmp-commands.hx | 33 ++
- include/migration/snapshot.h | 1 +
+ include/migration/snapshot.h | 2 +
include/monitor/hmp.h | 5 +
migration/meson.build | 1 +
migration/savevm-async.c | 598 +++++++++++++++++++++++++++++++++++
@@ -35,15 +35,15 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
qapi/misc.json | 32 ++
qemu-options.hx | 12 +
softmmu/vl.c | 10 +
- 11 files changed, 796 insertions(+)
+ 11 files changed, 797 insertions(+)
create mode 100644 migration/savevm-async.c
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
-index 117ba25f91..b3b797ca28 100644
+index ab0c7aa5ee..c72db5f666 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
-@@ -580,6 +580,19 @@ SRST
- Show current migration xbzrle cache size.
+@@ -567,6 +567,19 @@ SRST
+ Show current migration parameters.
ERST
+ {
@@ -63,10 +63,10 @@ index 117ba25f91..b3b797ca28 100644
.name = "balloon",
.args_type = "",
diff --git a/hmp-commands.hx b/hmp-commands.hx
-index ff2d7aa8f3..d294c234a5 100644
+index 435c591a1c..0b9d526937 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
-@@ -1866,3 +1866,36 @@ ERST
+@@ -1725,3 +1725,36 @@ ERST
.flags = "p",
},
@@ -104,18 +104,18 @@ index ff2d7aa8f3..d294c234a5 100644
+ .coroutine = true,
+ },
diff --git a/include/migration/snapshot.h b/include/migration/snapshot.h
-index c85b6ec75b..4411b7121d 100644
+index e72083b117..c846d37806 100644
--- a/include/migration/snapshot.h
+++ b/include/migration/snapshot.h
-@@ -17,5 +17,6 @@
+@@ -61,4 +61,6 @@ bool delete_snapshot(const char *name,
+ bool has_devices, strList *devices,
+ Error **errp);
- int save_snapshot(const char *name, Error **errp);
- int load_snapshot(const char *name, Error **errp);
+int load_snapshot_from_blockdev(const char *filename, Error **errp);
-
++
#endif
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
-index ed2913fd18..4e06f89e8e 100644
+index 605d57287a..e287e071d8 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -25,6 +25,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
@@ -126,7 +126,7 @@ index ed2913fd18..4e06f89e8e 100644
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
-@@ -83,6 +84,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict);
+@@ -79,6 +80,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict);
void hmp_netdev_del(Monitor *mon, const QDict *qdict);
void hmp_getfd(Monitor *mon, const QDict *qdict);
void hmp_closefd(Monitor *mon, const QDict *qdict);
@@ -138,7 +138,7 @@ index ed2913fd18..4e06f89e8e 100644
void hmp_screendump(Monitor *mon, const QDict *qdict);
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
diff --git a/migration/meson.build b/migration/meson.build
-index 980e37865c..e62b79b60f 100644
+index 3ecedce94d..c8ae813a48 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -23,6 +23,7 @@ softmmu_ss.add(files(
@@ -148,7 +148,7 @@ index 980e37865c..e62b79b60f 100644
+ 'savevm-async.c',
'socket.c',
'tls.c',
- ))
+ ), gnutls)
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
new file mode 100644
index 0000000000..593a619088
@@ -754,10 +754,10 @@ index 0000000000..593a619088
+ return ret;
+}
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 705f08a8f1..77ab152aab 100644
+index 1116767275..948c9d9ff8 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
-@@ -1949,6 +1949,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
+@@ -1904,6 +1904,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, err);
}
@@ -822,10 +822,10 @@ index 705f08a8f1..77ab152aab 100644
{
IOThreadInfoList *info_list = qmp_query_iothreads(NULL);
diff --git a/qapi/migration.json b/qapi/migration.json
-index 3c75820527..cb3627884c 100644
+index 0b17cce46b..db80401817 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
-@@ -242,6 +242,40 @@
+@@ -253,6 +253,40 @@
'*compression': 'CompressionStats',
'*socket-address': ['SocketAddress'] } }
@@ -867,10 +867,10 @@ index 3c75820527..cb3627884c 100644
# @query-migrate:
#
diff --git a/qapi/misc.json b/qapi/misc.json
-index 40df513856..4f5333d960 100644
+index 156f98203e..ad6c7713e2 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
-@@ -476,6 +476,38 @@
+@@ -427,6 +427,38 @@
##
{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
@@ -910,10 +910,10 @@ index 40df513856..4f5333d960 100644
# @CommandLineParameterType:
#
diff --git a/qemu-options.hx b/qemu-options.hx
-index 104632ea34..c1352312c2 100644
+index fd21002bd6..83841e6703 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
-@@ -3903,6 +3903,18 @@ SRST
+@@ -4015,6 +4015,18 @@ SRST
Start right away with a saved state (``loadvm`` in monitor)
ERST
@@ -933,28 +933,18 @@ index 104632ea34..c1352312c2 100644
DEF("daemonize", 0, QEMU_OPTION_daemonize, \
"-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
diff --git a/softmmu/vl.c b/softmmu/vl.c
-index e6e0ad5a92..03152c816c 100644
+index aadb526138..721196281c 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
-@@ -2878,6 +2878,7 @@ void qemu_init(int argc, char **argv, char **envp)
- int optind;
- const char *optarg;
- const char *loadvm = NULL;
-+ const char *loadstate = NULL;
- MachineClass *machine_class;
- const char *cpu_option;
- const char *vga_model = NULL;
-@@ -3439,6 +3440,9 @@ void qemu_init(int argc, char **argv, char **envp)
- case QEMU_OPTION_loadvm:
- loadvm = optarg;
- break;
-+ case QEMU_OPTION_loadstate:
-+ loadstate = optarg;
-+ break;
- case QEMU_OPTION_full_screen:
- dpy.has_full_screen = true;
- dpy.full_screen = true;
-@@ -4478,6 +4482,12 @@ void qemu_init(int argc, char **argv, char **envp)
+@@ -145,6 +145,7 @@ static const char *cpu_option;
+ static const char *mem_path;
+ static const char *incoming;
+ static const char *loadvm;
++static const char *loadstate;
+ static QTAILQ_HEAD(, ObjectOption) object_opts = QTAILQ_HEAD_INITIALIZER(object_opts);
+ static ram_addr_t maxram_size;
+ static uint64_t ram_slots;
+@@ -2596,6 +2597,12 @@ void qmp_x_exit_preconfig(Error **errp)
autostart = 0;
exit(1);
}
@@ -967,3 +957,13 @@ index e6e0ad5a92..03152c816c 100644
}
if (replay_mode != REPLAY_MODE_NONE) {
replay_vmstate_init();
+@@ -3131,6 +3138,9 @@ void qemu_init(int argc, char **argv, char **envp)
+ case QEMU_OPTION_loadvm:
+ loadvm = optarg;
+ break;
++ case QEMU_OPTION_loadstate:
++ loadstate = optarg;
++ break;
+ case QEMU_OPTION_full_screen:
+ dpy.has_full_screen = true;
+ dpy.full_screen = true;
diff --git a/debian/patches/pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch b/debian/patches/pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch
index d730a72..81909c4 100644
--- a/debian/patches/pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch
+++ b/debian/patches/pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch
@@ -16,7 +16,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
-index be21518c57..1926b5202c 100644
+index d6e03dbc0e..1ac188c8e4 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -30,8 +30,8 @@
@@ -131,7 +131,7 @@ index be21518c57..1926b5202c 100644
- if (size < IO_BUF_SIZE) {
+ if (size < f->buf_allocated_size) {
size_t res;
- uint8_t *src;
+ uint8_t *src = NULL;
@@ -618,7 +630,7 @@ int qemu_peek_byte(QEMUFile *f, int offset)
int index = f->buf_index + offset;
diff --git a/debian/patches/pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch b/debian/patches/pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch
index ce302e8..58281a6 100644
--- a/debian/patches/pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch
+++ b/debian/patches/pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch
@@ -11,15 +11,15 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
create mode 100644 block/zeroinit.c
diff --git a/block/meson.build b/block/meson.build
-index 5dcc1e5cce..c10d544864 100644
+index d21990ec95..cf9b278fa2 100644
--- a/block/meson.build
+++ b/block/meson.build
-@@ -39,6 +39,7 @@ block_ss.add(files(
+@@ -40,6 +40,7 @@ block_ss.add(files(
'vmdk.c',
'vpc.c',
'write-threshold.c',
+ 'zeroinit.c',
- ), zstd, zlib)
+ ), zstd, zlib, gnutls)
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
diff --git a/block/zeroinit.c b/block/zeroinit.c
diff --git a/debian/patches/pve/0020-PVE-Add-dummy-id-command-line-parameter.patch b/debian/patches/pve/0020-PVE-Add-dummy-id-command-line-parameter.patch
index 73ded0c..56fb285 100644
--- a/debian/patches/pve/0020-PVE-Add-dummy-id-command-line-parameter.patch
+++ b/debian/patches/pve/0020-PVE-Add-dummy-id-command-line-parameter.patch
@@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 files changed, 11 insertions(+)
diff --git a/qemu-options.hx b/qemu-options.hx
-index c1352312c2..9a0cb6780e 100644
+index 83841e6703..e70dd295d6 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
-@@ -906,6 +906,9 @@ DEFHEADING()
+@@ -943,6 +943,9 @@ DEFHEADING()
DEFHEADING(Block device options:)
@@ -28,18 +28,18 @@ index c1352312c2..9a0cb6780e 100644
"-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
diff --git a/softmmu/vl.c b/softmmu/vl.c
-index 03152c816c..da204d24f0 100644
+index 721196281c..12ec053422 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
-@@ -2866,6 +2866,7 @@ static char *find_datadir(void)
- void qemu_init(int argc, char **argv, char **envp)
- {
- int i;
+@@ -2632,6 +2632,7 @@ void qemu_init(int argc, char **argv, char **envp)
+ MachineClass *machine_class;
+ bool userconfig = true;
+ FILE *vmstate_dump_file = NULL;
+ long vm_id;
- int snapshot, linux_boot;
- const char *initrd_filename;
- const char *kernel_filename, *kernel_cmdline;
-@@ -3557,6 +3558,13 @@ void qemu_init(int argc, char **argv, char **envp)
+
+ qemu_add_opts(&qemu_drive_opts);
+ qemu_add_drive_opts(&qemu_legacy_drive_opts);
+@@ -3253,6 +3254,13 @@ void qemu_init(int argc, char **argv, char **envp)
exit(1);
}
break;
@@ -51,5 +51,5 @@ index 03152c816c..da204d24f0 100644
+ }
+ break;
case QEMU_OPTION_vnc:
- vnc_parse(optarg, &error_fatal);
+ vnc_parse(optarg);
break;
diff --git a/debian/patches/pve/0021-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch b/debian/patches/pve/0021-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch
index bc3d98b..754d5ab 100644
--- a/debian/patches/pve/0021-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch
+++ b/debian/patches/pve/0021-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch
@@ -11,10 +11,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 9 insertions(+)
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
-index 502e94effc..590ef6ec8e 100644
+index 97dd96dffa..15e5acd238 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
-@@ -278,6 +278,15 @@ static void apic_reset_common(DeviceState *dev)
+@@ -279,6 +279,15 @@ static void apic_reset_common(DeviceState *dev)
info->vapic_base_update(s);
apic_init_reset(dev);
diff --git a/debian/patches/pve/0022-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch b/debian/patches/pve/0022-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch
index 8b3df50..1c2dc77 100644
--- a/debian/patches/pve/0022-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch
+++ b/debian/patches/pve/0022-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch
@@ -8,15 +8,15 @@ Otherwise creating images on nfs/cifs can be problematic.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
- block/file-posix.c | 61 +++++++++++++++++++++++++++++---------------
+ block/file-posix.c | 59 ++++++++++++++++++++++++++++++--------------
qapi/block-core.json | 3 ++-
- 2 files changed, 43 insertions(+), 21 deletions(-)
+ 2 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c
-index bda3e606dc..037839622e 100644
+index 9242b76c04..316c5e34bb 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
-@@ -2388,6 +2388,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
+@@ -2401,6 +2401,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
int fd;
uint64_t perm, shared;
int result = 0;
@@ -24,7 +24,7 @@ index bda3e606dc..037839622e 100644
/* Validate options and set default values */
assert(options->driver == BLOCKDEV_DRIVER_FILE);
-@@ -2428,19 +2429,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
+@@ -2441,19 +2442,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
perm = BLK_PERM_WRITE | BLK_PERM_RESIZE;
shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
@@ -59,7 +59,7 @@ index bda3e606dc..037839622e 100644
}
/* Clear the file by truncating it to 0 */
-@@ -2494,13 +2498,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
+@@ -2507,13 +2511,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
}
out_unlock:
@@ -82,7 +82,7 @@ index bda3e606dc..037839622e 100644
}
out_close:
-@@ -2525,6 +2531,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
+@@ -2538,6 +2544,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
PreallocMode prealloc;
char *buf = NULL;
Error *local_err = NULL;
@@ -90,7 +90,7 @@ index bda3e606dc..037839622e 100644
/* Skip file: protocol prefix */
strstart(filename, "file:", &filename);
-@@ -2547,6 +2554,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
+@@ -2560,6 +2567,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
return -EINVAL;
}
@@ -109,7 +109,7 @@ index bda3e606dc..037839622e 100644
options = (BlockdevCreateOptions) {
.driver = BLOCKDEV_DRIVER_FILE,
.u.file = {
-@@ -2558,6 +2577,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
+@@ -2571,6 +2590,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
.nocow = nocow,
.has_extent_size_hint = has_extent_size_hint,
.extent_size_hint = extent_size_hint,
@@ -118,20 +118,11 @@ index bda3e606dc..037839622e 100644
},
};
return raw_co_create(&options, errp);
-@@ -3104,7 +3125,7 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared,
- }
-
- /* Copy locks to the new fd */
-- if (s->perm_change_fd) {
-+ if (s->use_lock && s->perm_change_fd) {
- ret = raw_apply_lock_bytes(NULL, s->perm_change_fd, perm, ~shared,
- false, errp);
- if (ret < 0) {
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 9db3120716..d285622589 100644
+index 4b6fb6ca44..46b14cdf67 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -4224,7 +4224,8 @@
+@@ -4247,7 +4247,8 @@
'size': 'size',
'*preallocation': 'PreallocMode',
'*nocow': 'bool',
diff --git a/debian/patches/pve/0023-PVE-monitor-disable-oob-capability.patch b/debian/patches/pve/0023-PVE-monitor-disable-oob-capability.patch
index f51c112..5171992 100644
--- a/debian/patches/pve/0023-PVE-monitor-disable-oob-capability.patch
+++ b/debian/patches/pve/0023-PVE-monitor-disable-oob-capability.patch
@@ -18,10 +18,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/monitor/qmp.c b/monitor/qmp.c
-index b42f8c6af3..2e37d11bd3 100644
+index 092c527b6f..0ef7cebb78 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
-@@ -466,8 +466,7 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
+@@ -506,8 +506,7 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
qemu_chr_fe_set_echo(&mon->common.chr, true);
/* Note: we run QMP monitor in I/O thread when @chr supports that */
diff --git a/debian/patches/pve/0024-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch b/debian/patches/pve/0024-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch
index e183b57..8e75e78 100644
--- a/debian/patches/pve/0024-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch
+++ b/debian/patches/pve/0024-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch
@@ -26,10 +26,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
-index d0408049b5..5b38cf9356 100644
+index 40def78183..30c24331b4 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
-@@ -78,7 +78,8 @@ GlobalProperty hw_compat_4_0[] = {
+@@ -96,7 +96,8 @@ GlobalProperty hw_compat_4_0[] = {
{ "virtio-vga", "edid", "false" },
{ "virtio-gpu-device", "edid", "false" },
{ "virtio-device", "use-started", "false" },
diff --git a/debian/patches/pve/0025-PVE-Allow-version-code-in-machine-type.patch b/debian/patches/pve/0025-PVE-Allow-version-code-in-machine-type.patch
index d4b350b..4f8518b 100644
--- a/debian/patches/pve/0025-PVE-Allow-version-code-in-machine-type.patch
+++ b/debian/patches/pve/0025-PVE-Allow-version-code-in-machine-type.patch
@@ -18,10 +18,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
-index 3fcb82ce2f..7868241bd5 100644
+index 76195de9e0..e622f65bca 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
-@@ -238,6 +238,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
+@@ -104,6 +104,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
if (strcmp(mc->name, MACHINE_GET_CLASS(current_machine)->name) == 0) {
info->has_is_current = true;
info->is_current = true;
@@ -35,10 +35,10 @@ index 3fcb82ce2f..7868241bd5 100644
if (mc->default_cpu_type) {
diff --git a/include/hw/boards.h b/include/hw/boards.h
-index a49e3a6b44..8e0a8c5571 100644
+index ad6c8fd537..00ee74c5eb 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
-@@ -165,6 +165,8 @@ struct MachineClass {
+@@ -206,6 +206,8 @@ struct MachineClass {
const char *desc;
const char *deprecation_reason;
@@ -48,19 +48,19 @@ index a49e3a6b44..8e0a8c5571 100644
void (*reset)(MachineState *state);
void (*wakeup)(MachineState *state);
diff --git a/qapi/machine.json b/qapi/machine.json
-index dfc1a49d3c..32fc674042 100644
+index 6e7e93d68f..7f5ba02c95 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
-@@ -337,6 +337,8 @@
+@@ -160,6 +160,8 @@
#
# @default-ram-id: the default ID of initial RAM memory backend (since 5.2)
#
+# @pve-version: custom PVE version suffix specified as 'machine+pveN'
+#
- # Since: 1.2.0
+ # Since: 1.2
##
{ 'struct': 'MachineInfo',
-@@ -344,7 +346,7 @@
+@@ -167,7 +169,7 @@
'*is-default': 'bool', '*is-current': 'bool', 'cpu-max': 'int',
'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool',
'deprecated': 'bool', '*default-cpu-type': 'str',
@@ -70,10 +70,10 @@ index dfc1a49d3c..32fc674042 100644
##
# @query-machines:
diff --git a/softmmu/vl.c b/softmmu/vl.c
-index da204d24f0..5b5512128e 100644
+index 12ec053422..a3c7ef0ab4 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
-@@ -2325,6 +2325,8 @@ static MachineClass *machine_parse(const char *name, GSList *machines)
+@@ -1537,6 +1537,8 @@ static MachineClass *machine_parse(const char *name, GSList *machines)
{
MachineClass *mc;
GSList *el;
@@ -82,7 +82,7 @@ index da204d24f0..5b5512128e 100644
if (is_help_option(name)) {
printf("Supported machines are:\n");
-@@ -2341,12 +2343,23 @@ static MachineClass *machine_parse(const char *name, GSList *machines)
+@@ -1553,12 +1555,23 @@ static MachineClass *machine_parse(const char *name, GSList *machines)
exit(0);
}
diff --git a/debian/patches/pve/0026-PVE-Backup-add-vma-backup-format-code.patch b/debian/patches/pve/0026-PVE-Backup-add-vma-backup-format-code.patch
index 4271660..841380e 100644
--- a/debian/patches/pve/0026-PVE-Backup-add-vma-backup-format-code.patch
+++ b/debian/patches/pve/0026-PVE-Backup-add-vma-backup-format-code.patch
@@ -17,12 +17,12 @@ Subject: [PATCH] PVE-Backup: add vma backup format code
create mode 100644 vma.h
diff --git a/block/meson.build b/block/meson.build
-index c10d544864..feffbc8623 100644
+index cf9b278fa2..d0a8397edf 100644
--- a/block/meson.build
+++ b/block/meson.build
-@@ -42,6 +42,8 @@ block_ss.add(files(
+@@ -43,6 +43,8 @@ block_ss.add(files(
'zeroinit.c',
- ), zstd, zlib)
+ ), zstd, zlib, gnutls)
+block_ss.add(files('../vma-writer.c'), libuuid)
+
@@ -30,10 +30,10 @@ index c10d544864..feffbc8623 100644
block_ss.add(when: 'CONFIG_QCOW1', if_true: files('qcow.c'))
diff --git a/meson.build b/meson.build
-index e3386196ba..d5b660516b 100644
+index c6f4b0cf5e..7db08406bd 100644
--- a/meson.build
+++ b/meson.build
-@@ -725,6 +725,8 @@ keyutils = dependency('libkeyutils', required: false,
+@@ -945,6 +945,8 @@ keyutils = dependency('libkeyutils', required: false,
has_gettid = cc.has_function('gettid')
@@ -42,9 +42,9 @@ index e3386196ba..d5b660516b 100644
# Malloc tests
malloc = []
-@@ -1907,6 +1909,9 @@ if have_tools
+@@ -2344,6 +2346,9 @@ if have_tools
qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
- dependencies: [blockdev, qemuutil], install: true)
+ dependencies: [blockdev, qemuutil, gnutls], install: true)
+ vma = executable('vma', files('vma.c', 'vma-reader.c'),
+ dependencies: [authz, block, crypto, io, qom], install: true)
diff --git a/debian/patches/pve/0027-PVE-Backup-add-backup-dump-block-driver.patch b/debian/patches/pve/0027-PVE-Backup-add-backup-dump-block-driver.patch
index a81341f..134ba74 100644
--- a/debian/patches/pve/0027-PVE-Backup-add-backup-dump-block-driver.patch
+++ b/debian/patches/pve/0027-PVE-Backup-add-backup-dump-block-driver.patch
@@ -9,11 +9,11 @@ Subject: [PATCH] PVE-Backup: add backup-dump block driver
- job.c: make job_should_pause non-static
---
block/backup-dump.c | 168 ++++++++++++++++++++++++++++++++++++++
- block/backup.c | 23 ++----
+ block/backup.c | 32 +++-----
block/meson.build | 1 +
- include/block/block_int.h | 30 +++++++
+ include/block/block_int.h | 35 ++++++++
job.c | 3 +-
- 5 files changed, 206 insertions(+), 19 deletions(-)
+ 5 files changed, 216 insertions(+), 23 deletions(-)
create mode 100644 block/backup-dump.c
diff --git a/block/backup-dump.c b/block/backup-dump.c
@@ -191,10 +191,10 @@ index 0000000000..93d7f46950
+ return bs;
+}
diff --git a/block/backup.c b/block/backup.c
-index 9afa0bf3b4..3df3d532d5 100644
+index 6cf2f974aa..8c865a43a8 100644
--- a/block/backup.c
+++ b/block/backup.c
-@@ -32,24 +32,6 @@
+@@ -31,28 +31,6 @@
#define BACKUP_CLUSTER_SIZE_DEFAULT (1 << 16)
@@ -202,6 +202,7 @@ index 9afa0bf3b4..3df3d532d5 100644
- BlockJob common;
- BlockDriverState *backup_top;
- BlockDriverState *source_bs;
+- BlockDriverState *target_bs;
-
- BdrvDirtyBitmap *sync_bitmap;
-
@@ -210,19 +211,27 @@ index 9afa0bf3b4..3df3d532d5 100644
- BlockdevOnError on_source_error;
- BlockdevOnError on_target_error;
- uint64_t len;
-- uint64_t bytes_read;
- int64_t cluster_size;
+- BackupPerf perf;
-
- BlockCopyState *bcs;
+-
+- bool wait;
+- BlockCopyCallState *bg_bcs_call;
-} BackupBlockJob;
-
static const BlockJobDriver backup_job_driver;
- static void backup_progress_bytes_callback(int64_t bytes, void *opaque)
-@@ -423,6 +405,11 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
+ static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret)
+@@ -504,6 +482,16 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
goto error;
}
++ cluster_size = backup_calculate_cluster_size(target, errp);
++ if (cluster_size < 0) {
++ goto error;
++ }
++
+ BlockDriverInfo bdi;
+ if (bdrv_get_info(bs, &bdi) == 0) {
+ cluster_size = MAX(cluster_size, bdi.cluster_size);
@@ -232,7 +241,7 @@ index 9afa0bf3b4..3df3d532d5 100644
* If source is in backing chain of target assume that target is going to be
* used for "image fleecing", i.e. it should represent a kind of snapshot of
diff --git a/block/meson.build b/block/meson.build
-index feffbc8623..2507af1168 100644
+index d0a8397edf..12797a5ca3 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -4,6 +4,7 @@ block_ss.add(files(
@@ -244,10 +253,18 @@ index feffbc8623..2507af1168 100644
'blkdebug.c',
'blklogwrites.c',
diff --git a/include/block/block_int.h b/include/block/block_int.h
-index 6f8eda629a..5455102da8 100644
+index 1c399bdb16..bd88198792 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
-@@ -63,6 +63,36 @@
+@@ -26,6 +26,7 @@
+
+ #include "block/accounting.h"
+ #include "block/block.h"
++#include "block/block-copy.h"
+ #include "block/aio-wait.h"
+ #include "qemu/queue.h"
+ #include "qemu/coroutine.h"
+@@ -63,6 +64,40 @@
#define BLOCK_PROBE_BUF_SIZE 512
@@ -267,6 +284,7 @@ index 6f8eda629a..5455102da8 100644
+ BlockJob common;
+ BlockDriverState *backup_top;
+ BlockDriverState *source_bs;
++ BlockDriverState *target_bs;
+
+ BdrvDirtyBitmap *sync_bitmap;
+
@@ -275,17 +293,20 @@ index 6f8eda629a..5455102da8 100644
+ BlockdevOnError on_source_error;
+ BlockdevOnError on_target_error;
+ uint64_t len;
-+ uint64_t bytes_read;
+ int64_t cluster_size;
++ BackupPerf perf;
+
+ BlockCopyState *bcs;
++
++ bool wait;
++ BlockCopyCallState *bg_bcs_call;
+} BackupBlockJob;
+
enum BdrvTrackedRequestType {
BDRV_TRACKED_READ,
BDRV_TRACKED_WRITE,
diff --git a/job.c b/job.c
-index 8fecf38960..f9884e7d9d 100644
+index 4aff13d95a..3999b7728c 100644
--- a/job.c
+++ b/job.c
@@ -269,7 +269,8 @@ static bool job_started(Job *job)
diff --git a/debian/patches/pve/0028-PVE-Backup-proxmox-backup-patches-for-qemu.patch b/debian/patches/pve/0028-PVE-Backup-proxmox-backup-patches-for-qemu.patch
index e9ffa84..2484b56 100644
--- a/debian/patches/pve/0028-PVE-Backup-proxmox-backup-patches-for-qemu.patch
+++ b/debian/patches/pve/0028-PVE-Backup-proxmox-backup-patches-for-qemu.patch
@@ -18,21 +18,21 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
monitor/hmp-cmds.c | 44 ++
proxmox-backup-client.c | 176 ++++++
proxmox-backup-client.h | 59 ++
- pve-backup.c | 957 +++++++++++++++++++++++++++++++++
+ pve-backup.c | 959 +++++++++++++++++++++++++++++++++
qapi/block-core.json | 109 ++++
qapi/common.json | 13 +
qapi/machine.json | 15 +-
- 15 files changed, 1446 insertions(+), 14 deletions(-)
+ 15 files changed, 1448 insertions(+), 14 deletions(-)
create mode 100644 proxmox-backup-client.c
create mode 100644 proxmox-backup-client.h
create mode 100644 pve-backup.c
diff --git a/block/meson.build b/block/meson.build
-index 2507af1168..dfae565db3 100644
+index 12797a5ca3..500d2bf5b3 100644
--- a/block/meson.build
+++ b/block/meson.build
-@@ -44,6 +44,11 @@ block_ss.add(files(
- ), zstd, zlib)
+@@ -45,6 +45,11 @@ block_ss.add(files(
+ ), zstd, zlib, gnutls)
block_ss.add(files('../vma-writer.c'), libuuid)
+block_ss.add(files(
@@ -44,10 +44,10 @@ index 2507af1168..dfae565db3 100644
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index d15a2be827..9ba7c774a2 100644
+index ebf1033f31..fc71740026 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
-@@ -1012,3 +1012,36 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
+@@ -1004,3 +1004,36 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
g_free(sn_tab);
g_free(global_snapshots);
}
@@ -85,7 +85,7 @@ index d15a2be827..9ba7c774a2 100644
+ hmp_handle_error(mon, error);
+}
diff --git a/blockdev.c b/blockdev.c
-index a40c6fd0f6..e2f826ca62 100644
+index 9cab29e567..5c23744346 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -36,6 +36,7 @@
@@ -97,7 +97,7 @@ index a40c6fd0f6..e2f826ca62 100644
#include "monitor/monitor.h"
#include "qemu/error-report.h"
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
-index b3b797ca28..295e14e64f 100644
+index c72db5f666..be4d252b8e 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -513,6 +513,19 @@ SRST
@@ -121,10 +121,10 @@ index b3b797ca28..295e14e64f 100644
{
.name = "usernet",
diff --git a/hmp-commands.hx b/hmp-commands.hx
-index d294c234a5..0c6b944850 100644
+index 0b9d526937..a7bd174e5a 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
-@@ -98,6 +98,35 @@ ERST
+@@ -99,6 +99,35 @@ ERST
SRST
``block_stream``
Copy data from a backing file into a block device.
@@ -161,10 +161,10 @@ index d294c234a5..0c6b944850 100644
{
diff --git a/include/block/block_int.h b/include/block/block_int.h
-index 5455102da8..1bd4b64522 100644
+index bd88198792..03eec075e1 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
-@@ -65,7 +65,7 @@
+@@ -66,7 +66,7 @@
typedef int BackupDumpFunc(void *opaque, uint64_t offset, uint64_t bytes, const void *buf);
@@ -174,18 +174,18 @@ index 5455102da8..1bd4b64522 100644
uint64_t byte_size,
BackupDumpFunc *dump_cb,
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
-index 4e06f89e8e..10f52bd92a 100644
+index e287e071d8..1468530adf 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
-@@ -30,6 +30,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict);
+@@ -29,6 +29,7 @@ void hmp_info_savevm(Monitor *mon, const QDict *qdict);
+ void hmp_info_migrate(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
- void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict);
+void hmp_info_backup(Monitor *mon, const QDict *qdict);
void hmp_info_cpus(Monitor *mon, const QDict *qdict);
void hmp_info_vnc(Monitor *mon, const QDict *qdict);
void hmp_info_spice(Monitor *mon, const QDict *qdict);
-@@ -76,6 +77,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
+@@ -72,6 +73,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
void hmp_set_password(Monitor *mon, const QDict *qdict);
void hmp_expire_password(Monitor *mon, const QDict *qdict);
void hmp_change(Monitor *mon, const QDict *qdict);
@@ -195,10 +195,10 @@ index 4e06f89e8e..10f52bd92a 100644
void hmp_device_add(Monitor *mon, const QDict *qdict);
void hmp_device_del(Monitor *mon, const QDict *qdict);
diff --git a/meson.build b/meson.build
-index d5b660516b..3094f98c47 100644
+index 7db08406bd..b4a0f7d314 100644
--- a/meson.build
+++ b/meson.build
-@@ -726,6 +726,7 @@ keyutils = dependency('libkeyutils', required: false,
+@@ -946,6 +946,7 @@ keyutils = dependency('libkeyutils', required: false,
has_gettid = cc.has_function('gettid')
libuuid = cc.find_library('uuid', required: true)
@@ -207,7 +207,7 @@ index d5b660516b..3094f98c47 100644
# Malloc tests
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 77ab152aab..182e79c943 100644
+index 948c9d9ff8..65f9148118 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -195,6 +195,50 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
@@ -510,10 +510,10 @@ index 0000000000..1dda8b7d8f
+#endif /* PROXMOX_BACKUP_CLIENT_H */
diff --git a/pve-backup.c b/pve-backup.c
new file mode 100644
-index 0000000000..d40f3f2fd6
+index 0000000000..f9fe6adb55
--- /dev/null
+++ b/pve-backup.c
-@@ -0,0 +1,957 @@
+@@ -0,0 +1,959 @@
+#include "proxmox-backup-client.h"
+#include "vma.h"
+
@@ -978,6 +978,8 @@ index 0000000000..d40f3f2fd6
+
+ Error *local_err = NULL;
+
++ BackupPerf perf = { .max_workers = 16 };
++
+ /* create and start all jobs (paused state) */
+ GList *l = backup_state.di_list;
+ while (l) {
@@ -991,8 +993,8 @@ index 0000000000..d40f3f2fd6
+
+ BlockJob *job = backup_job_create(
+ NULL, di->bs, di->target, backup_state.speed, MIRROR_SYNC_MODE_FULL, NULL,
-+ BITMAP_SYNC_MODE_NEVER, false, NULL, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
-+ JOB_DEFAULT, pvebackup_complete_cb, di, 1, NULL, &local_err);
++ BITMAP_SYNC_MODE_NEVER, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
++ JOB_DEFAULT, pvebackup_complete_cb, di, NULL, &local_err);
+
+ aio_context_release(aio_context);
+
@@ -1472,10 +1474,10 @@ index 0000000000..d40f3f2fd6
+ return info;
+}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index d285622589..9054db608c 100644
+index 46b14cdf67..890fc9dede 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -745,6 +745,115 @@
+@@ -683,6 +683,115 @@
{ 'command': 'query-block', 'returns': ['BlockInfo'] }
@@ -1592,13 +1594,13 @@ index d285622589..9054db608c 100644
# @BlockDeviceTimedStats:
#
diff --git a/qapi/common.json b/qapi/common.json
-index 716712d4b3..556dab79e1 100644
+index 7c976296f0..0690b07903 100644
--- a/qapi/common.json
+++ b/qapi/common.json
-@@ -145,3 +145,16 @@
- ##
- { 'enum': 'PCIELinkWidth',
- 'data': [ '1', '2', '4', '8', '12', '16', '32' ] }
+@@ -197,3 +197,16 @@
+ { 'enum': 'GrabToggleKeys',
+ 'data': [ 'ctrl-ctrl', 'alt-alt', 'shift-shift','meta-meta', 'scrolllock',
+ 'ctrl-scrolllock' ] }
+
+##
+# @UuidInfo:
@@ -1613,7 +1615,7 @@ index 716712d4b3..556dab79e1 100644
+##
+{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} }
diff --git a/qapi/machine.json b/qapi/machine.json
-index 32fc674042..145f1a4fa2 100644
+index 7f5ba02c95..9923098e40 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -4,6 +4,8 @@
@@ -1625,7 +1627,7 @@ index 32fc674042..145f1a4fa2 100644
##
# = Machines
##
-@@ -406,19 +408,6 @@
+@@ -229,19 +231,6 @@
##
{ 'command': 'query-target', 'returns': 'TargetInfo' }
@@ -1636,7 +1638,7 @@ index 32fc674042..145f1a4fa2 100644
-#
-# @UUID: the UUID of the guest
-#
--# Since: 0.14.0
+-# Since: 0.14
-#
-# Notes: If no UUID was specified for the guest, a null UUID is returned.
-##
diff --git a/debian/patches/pve/0029-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch b/debian/patches/pve/0029-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch
index fcdbcea..b1a246c 100644
--- a/debian/patches/pve/0029-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch
+++ b/debian/patches/pve/0029-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch
@@ -12,10 +12,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
create mode 100644 pbs-restore.c
diff --git a/meson.build b/meson.build
-index 3094f98c47..6f1fafee14 100644
+index b4a0f7d314..3287cd8a6d 100644
--- a/meson.build
+++ b/meson.build
-@@ -1913,6 +1913,10 @@ if have_tools
+@@ -2350,6 +2350,10 @@ if have_tools
vma = executable('vma', files('vma.c', 'vma-reader.c'),
dependencies: [authz, block, crypto, io, qom], install: true)
diff --git a/debian/patches/pve/0030-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch b/debian/patches/pve/0030-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch
index 99322ce..3b728bb 100644
--- a/debian/patches/pve/0030-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch
+++ b/debian/patches/pve/0030-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch
@@ -29,10 +29,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 files changed, 142 insertions(+), 23 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index 9ba7c774a2..056d14deee 100644
+index fc71740026..da5043b973 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
-@@ -1039,6 +1039,7 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
+@@ -1031,6 +1031,7 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
false, NULL, // PBS fingerprint
false, NULL, // PBS backup-id
false, 0, // PBS backup-time
@@ -41,7 +41,7 @@ index 9ba7c774a2..056d14deee 100644
false, NULL, false, NULL, !!devlist,
devlist, qdict_haskey(qdict, "speed"), speed, &error);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 182e79c943..604026bb37 100644
+index 65f9148118..a6a289968f 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -221,19 +221,42 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
@@ -132,7 +132,7 @@ index 1dda8b7d8f..8cbf645b2c 100644
diff --git a/pve-backup.c b/pve-backup.c
-index d40f3f2fd6..1cd9d31d7c 100644
+index f9fe6adb55..98fd28a8f2 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -28,6 +28,8 @@
@@ -232,7 +232,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
g_free(di);
qemu_mutex_unlock(&backup_state.backup_mutex);
-@@ -470,12 +495,18 @@ static bool create_backup_jobs(void) {
+@@ -472,12 +497,18 @@ static bool create_backup_jobs(void) {
assert(di->target != NULL);
@@ -247,13 +247,13 @@ index d40f3f2fd6..1cd9d31d7c 100644
BlockJob *job = backup_job_create(
- NULL, di->bs, di->target, backup_state.speed, MIRROR_SYNC_MODE_FULL, NULL,
-- BITMAP_SYNC_MODE_NEVER, false, NULL, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
+- BITMAP_SYNC_MODE_NEVER, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
+ NULL, di->bs, di->target, backup_state.speed, sync_mode, di->bitmap,
-+ bitmap_mode, false, NULL, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
- JOB_DEFAULT, pvebackup_complete_cb, di, 1, NULL, &local_err);
++ bitmap_mode, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
+ JOB_DEFAULT, pvebackup_complete_cb, di, NULL, &local_err);
aio_context_release(aio_context);
-@@ -526,6 +557,8 @@ typedef struct QmpBackupTask {
+@@ -528,6 +559,8 @@ typedef struct QmpBackupTask {
const char *fingerprint;
bool has_fingerprint;
int64_t backup_time;
@@ -262,7 +262,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
bool has_format;
BackupFormat format;
bool has_config_file;
-@@ -617,6 +650,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -619,6 +652,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
}
size_t total = 0;
@@ -270,7 +270,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
l = di_list;
while (l) {
-@@ -654,6 +688,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -656,6 +690,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
int dump_cb_block_size = PROXMOX_BACKUP_DEFAULT_CHUNK_SIZE; // Hardcoded (4M)
firewall_name = "fw.conf";
@@ -279,7 +279,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
char *pbs_err = NULL;
pbs = proxmox_backup_new(
task->backup_file,
-@@ -673,7 +709,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -675,7 +711,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
goto err;
}
@@ -289,7 +289,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
goto err;
/* register all devices */
-@@ -684,9 +721,40 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -686,9 +723,40 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
const char *devname = bdrv_get_device_name(di->bs);
@@ -332,7 +332,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
if (!(di->target = bdrv_backup_dump_create(dump_cb_block_size, di->size, pvebackup_co_dump_pbs_cb, di, task->errp))) {
goto err;
-@@ -695,6 +763,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -697,6 +765,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
di->dev_id = dev_id;
}
} else if (format == BACKUP_FORMAT_VMA) {
@@ -341,7 +341,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
vmaw = vma_writer_create(task->backup_file, uuid, &local_err);
if (!vmaw) {
if (local_err) {
-@@ -722,6 +792,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -724,6 +794,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
}
}
} else if (format == BACKUP_FORMAT_DIR) {
@@ -350,7 +350,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
if (mkdir(task->backup_file, 0640) != 0) {
error_setg_errno(task->errp, errno, "can't create directory '%s'\n",
task->backup_file);
-@@ -794,8 +866,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -796,8 +868,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
char *uuid_str = g_strdup(backup_state.stat.uuid_str);
backup_state.stat.total = total;
@@ -361,7 +361,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
qemu_mutex_unlock(&backup_state.stat.lock);
-@@ -819,6 +893,10 @@ err:
+@@ -821,6 +895,10 @@ err:
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l);
@@ -372,7 +372,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
if (di->target) {
bdrv_unref(di->target);
}
-@@ -860,6 +938,7 @@ UuidInfo *qmp_backup(
+@@ -862,6 +940,7 @@ UuidInfo *qmp_backup(
bool has_fingerprint, const char *fingerprint,
bool has_backup_id, const char *backup_id,
bool has_backup_time, int64_t backup_time,
@@ -380,7 +380,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
bool has_format, BackupFormat format,
bool has_config_file, const char *config_file,
bool has_firewall_file, const char *firewall_file,
-@@ -878,6 +957,8 @@ UuidInfo *qmp_backup(
+@@ -880,6 +959,8 @@ UuidInfo *qmp_backup(
.backup_id = backup_id,
.has_backup_time = has_backup_time,
.backup_time = backup_time,
@@ -389,7 +389,7 @@ index d40f3f2fd6..1cd9d31d7c 100644
.has_format = has_format,
.format = format,
.has_config_file = has_config_file,
-@@ -946,10 +1027,14 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -948,10 +1029,14 @@ BackupStatus *qmp_query_backup(Error **errp)
info->has_total = true;
info->total = backup_state.stat.total;
@@ -405,10 +405,10 @@ index d40f3f2fd6..1cd9d31d7c 100644
qemu_mutex_unlock(&backup_state.stat.lock);
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 9054db608c..d4e1c98c50 100644
+index 890fc9dede..eb1e851606 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -758,8 +758,13 @@
+@@ -696,8 +696,13 @@
#
# @total: total amount of bytes involved in the backup process
#
@@ -422,7 +422,7 @@ index 9054db608c..d4e1c98c50 100644
# @zero-bytes: amount of 'zero' bytes detected.
#
# @start-time: time (epoch) when backup job started.
-@@ -772,8 +777,8 @@
+@@ -710,8 +715,8 @@
#
##
{ 'struct': 'BackupStatus',
@@ -433,7 +433,7 @@ index 9054db608c..d4e1c98c50 100644
'*start-time': 'int', '*end-time': 'int',
'*backup-file': 'str', '*uuid': 'str' } }
-@@ -816,6 +821,8 @@
+@@ -754,6 +759,8 @@
#
# @backup-time: backup timestamp (Unix epoch, required for format 'pbs')
#
@@ -442,7 +442,7 @@ index 9054db608c..d4e1c98c50 100644
# Returns: the uuid of the backup job
#
##
-@@ -826,6 +833,7 @@
+@@ -764,6 +771,7 @@
'*fingerprint': 'str',
'*backup-id': 'str',
'*backup-time': 'int',
diff --git a/debian/patches/pve/0031-PVE-various-PBS-fixes.patch b/debian/patches/pve/0031-PVE-various-PBS-fixes.patch
index 7ab4bfe..dec4a0b 100644
--- a/debian/patches/pve/0031-PVE-various-PBS-fixes.patch
+++ b/debian/patches/pve/0031-PVE-various-PBS-fixes.patch
@@ -18,10 +18,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 files changed, 54 insertions(+), 13 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index 056d14deee..46c63b1cf9 100644
+index da5043b973..f509959a32 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
-@@ -1039,7 +1039,9 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
+@@ -1031,7 +1031,9 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
false, NULL, // PBS fingerprint
false, NULL, // PBS backup-id
false, 0, // PBS backup-time
@@ -33,7 +33,7 @@ index 056d14deee..46c63b1cf9 100644
false, NULL, false, NULL, !!devlist,
devlist, qdict_haskey(qdict, "speed"), speed, &error);
diff --git a/pve-backup.c b/pve-backup.c
-index 1cd9d31d7c..b8182aaf89 100644
+index 98fd28a8f2..129ebd0eb4 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -8,6 +8,7 @@
@@ -123,7 +123,7 @@ index 1cd9d31d7c..b8182aaf89 100644
if (ret < 0) {
Error *local_err = NULL;
vma_writer_error_propagate(backup_state.vmaw, &local_err);
-@@ -567,6 +583,10 @@ typedef struct QmpBackupTask {
+@@ -569,6 +585,10 @@ typedef struct QmpBackupTask {
const char *firewall_file;
bool has_devlist;
const char *devlist;
@@ -134,7 +134,7 @@ index 1cd9d31d7c..b8182aaf89 100644
bool has_speed;
int64_t speed;
Error **errp;
-@@ -690,6 +710,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -692,6 +712,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
bool use_dirty_bitmap = task->has_use_dirty_bitmap && task->use_dirty_bitmap;
@@ -142,7 +142,7 @@ index 1cd9d31d7c..b8182aaf89 100644
char *pbs_err = NULL;
pbs = proxmox_backup_new(
task->backup_file,
-@@ -699,8 +720,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -701,8 +722,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
task->has_password ? task->password : NULL,
task->has_keyfile ? task->keyfile : NULL,
task->has_key_password ? task->key_password : NULL,
@@ -154,7 +154,7 @@ index 1cd9d31d7c..b8182aaf89 100644
if (!pbs) {
error_set(task->errp, ERROR_CLASS_GENERIC_ERROR,
-@@ -719,6 +742,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -721,6 +744,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l);
@@ -163,7 +163,7 @@ index 1cd9d31d7c..b8182aaf89 100644
const char *devname = bdrv_get_device_name(di->bs);
BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME);
-@@ -939,6 +964,8 @@ UuidInfo *qmp_backup(
+@@ -941,6 +966,8 @@ UuidInfo *qmp_backup(
bool has_backup_id, const char *backup_id,
bool has_backup_time, int64_t backup_time,
bool has_use_dirty_bitmap, bool use_dirty_bitmap,
@@ -172,7 +172,7 @@ index 1cd9d31d7c..b8182aaf89 100644
bool has_format, BackupFormat format,
bool has_config_file, const char *config_file,
bool has_firewall_file, const char *firewall_file,
-@@ -949,6 +976,8 @@ UuidInfo *qmp_backup(
+@@ -951,6 +978,8 @@ UuidInfo *qmp_backup(
.backup_file = backup_file,
.has_password = has_password,
.password = password,
@@ -181,7 +181,7 @@ index 1cd9d31d7c..b8182aaf89 100644
.has_key_password = has_key_password,
.key_password = key_password,
.has_fingerprint = has_fingerprint,
-@@ -959,6 +988,10 @@ UuidInfo *qmp_backup(
+@@ -961,6 +990,10 @@ UuidInfo *qmp_backup(
.backup_time = backup_time,
.has_use_dirty_bitmap = has_use_dirty_bitmap,
.use_dirty_bitmap = use_dirty_bitmap,
@@ -193,10 +193,10 @@ index 1cd9d31d7c..b8182aaf89 100644
.format = format,
.has_config_file = has_config_file,
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index d4e1c98c50..0fda1e3fd3 100644
+index eb1e851606..8845742870 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -823,6 +823,10 @@
+@@ -761,6 +761,10 @@
#
# @use-dirty-bitmap: use dirty bitmap to detect incremental changes since last job (optional for format 'pbs')
#
@@ -207,7 +207,7 @@ index d4e1c98c50..0fda1e3fd3 100644
# Returns: the uuid of the backup job
#
##
-@@ -834,6 +838,8 @@
+@@ -772,6 +776,8 @@
'*backup-id': 'str',
'*backup-time': 'int',
'*use-dirty-bitmap': 'bool',
diff --git a/debian/patches/pve/0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch b/debian/patches/pve/0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
index 9c7c66e..aa4eea8 100644
--- a/debian/patches/pve/0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
+++ b/debian/patches/pve/0032-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
@@ -16,10 +16,10 @@ Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
create mode 100644 block/pbs.c
diff --git a/block/meson.build b/block/meson.build
-index dfae565db3..a070060e53 100644
+index 500d2bf5b3..574165e577 100644
--- a/block/meson.build
+++ b/block/meson.build
-@@ -49,6 +49,9 @@ block_ss.add(files(
+@@ -50,6 +50,9 @@ block_ss.add(files(
'../pve-backup.c',
), libproxmox_backup_qemu)
@@ -31,7 +31,7 @@ index dfae565db3..a070060e53 100644
diff --git a/block/pbs.c b/block/pbs.c
new file mode 100644
-index 0000000000..1481a2bfd1
+index 0000000000..78dad0dcc4
--- /dev/null
+++ b/block/pbs.c
@@ -0,0 +1,271 @@
@@ -307,18 +307,18 @@ index 0000000000..1481a2bfd1
+
+block_init(bdrv_pbs_init);
diff --git a/configure b/configure
-index 18c26e0389..33d9933871 100755
+index 4f374b4889..0f44d77455 100755
--- a/configure
+++ b/configure
-@@ -436,6 +436,7 @@ vvfat="yes"
- qed="yes"
- parallels="yes"
+@@ -447,6 +447,7 @@ vvfat=${default_feature:-yes}
+ qed=${default_feature:-yes}
+ parallels=${default_feature:-yes}
sheepdog="no"
+pbs_bdrv="yes"
- libxml2=""
+ libxml2="$default_feature"
debug_mutex="no"
- libpmem=""
-@@ -1461,6 +1462,10 @@ for opt do
+ libpmem="$default_feature"
+@@ -1478,6 +1479,10 @@ for opt do
;;
--enable-sheepdog) sheepdog="yes"
;;
@@ -329,7 +329,7 @@ index 18c26e0389..33d9933871 100755
--disable-vhost-user) vhost_user="no"
;;
--enable-vhost-user) vhost_user="yes"
-@@ -1843,6 +1848,7 @@ disabled with --disable-FEATURE, default is enabled if available:
+@@ -1908,6 +1913,7 @@ disabled with --disable-FEATURE, default is enabled if available
qed qed image format support
parallels parallels image format support
sheepdog sheepdog block driver support (deprecated)
@@ -337,42 +337,42 @@ index 18c26e0389..33d9933871 100755
crypto-afalg Linux AF_ALG crypto backend driver
capstone capstone disassembler support
debug-mutex mutex debugging support
-@@ -6682,6 +6688,9 @@ if test "$sheepdog" = "yes" ; then
+@@ -6077,6 +6083,9 @@ if test "$sheepdog" = "yes" ; then
add_to deprecated_features "sheepdog"
echo "CONFIG_SHEEPDOG=y" >> $config_host_mak
fi
+if test "$pbs_bdrv" = "yes" ; then
+ echo "CONFIG_PBS_BDRV=y" >> $config_host_mak
+fi
- if test "$pty_h" = "yes" ; then
- echo "HAVE_PTY_H=y" >> $config_host_mak
+ if test "$have_mlockall" = "yes" ; then
+ echo "HAVE_MLOCKALL=y" >> $config_host_mak
fi
diff --git a/meson.build b/meson.build
-index 6f1fafee14..4d156d35ce 100644
+index 3287cd8a6d..b77b4cd017 100644
--- a/meson.build
+++ b/meson.build
-@@ -2199,6 +2199,7 @@ summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
- summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
- summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
- summary_info += {'sheepdog support': config_host.has_key('CONFIG_SHEEPDOG')}
+@@ -2719,6 +2719,7 @@ summary_info += {'lzfse support': liblzfse.found()}
+ summary_info += {'zstd support': zstd.found()}
+ summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
+ summary_info += {'libxml2': config_host.has_key('CONFIG_LIBXML2')}
+summary_info += {'PBS bdrv support': config_host.has_key('CONFIG_PBS_BDRV')}
summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt}
summary_info += {'libpmem support': config_host.has_key('CONFIG_LIBPMEM')}
summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 0fda1e3fd3..553112d998 100644
+index 8845742870..db11dd6aae 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -2975,7 +2975,7 @@
+@@ -2962,7 +2962,7 @@
'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
- 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
+ 'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
{ 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
- 'sheepdog',
+ 'sheepdog', 'pbs',
'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
##
-@@ -3039,6 +3039,17 @@
+@@ -3026,6 +3026,17 @@
{ 'struct': 'BlockdevOptionsNull',
'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
@@ -390,11 +390,11 @@ index 0fda1e3fd3..553112d998 100644
##
# @BlockdevOptionsNVMe:
#
-@@ -4148,6 +4159,7 @@
+@@ -4170,6 +4181,7 @@
'nfs': 'BlockdevOptionsNfs',
'null-aio': 'BlockdevOptionsNull',
'null-co': 'BlockdevOptionsNull',
+ 'pbs': 'BlockdevOptionsPbs',
'nvme': 'BlockdevOptionsNVMe',
'parallels': 'BlockdevOptionsGenericFormat',
- 'qcow2': 'BlockdevOptionsQcow2',
+ 'preallocate':'BlockdevOptionsPreallocate',
diff --git a/debian/patches/pve/0033-PVE-add-query_proxmox_support-QMP-command.patch b/debian/patches/pve/0033-PVE-add-query_proxmox_support-QMP-command.patch
index 18cc56e..7c634fc 100644
--- a/debian/patches/pve/0033-PVE-add-query_proxmox_support-QMP-command.patch
+++ b/debian/patches/pve/0033-PVE-add-query_proxmox_support-QMP-command.patch
@@ -16,10 +16,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 files changed, 38 insertions(+)
diff --git a/pve-backup.c b/pve-backup.c
-index b8182aaf89..98e79552ef 100644
+index 129ebd0eb4..96e3d731da 100644
--- a/pve-backup.c
+++ b/pve-backup.c
-@@ -1073,3 +1073,12 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -1075,3 +1075,12 @@ BackupStatus *qmp_query_backup(Error **errp)
return info;
}
@@ -33,10 +33,10 @@ index b8182aaf89..98e79552ef 100644
+ return ret;
+}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 553112d998..f3608390c4 100644
+index db11dd6aae..79aef65616 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -868,6 +868,35 @@
+@@ -806,6 +806,35 @@
##
{ 'command': 'backup-cancel' }
diff --git a/debian/patches/pve/0034-PVE-add-query-pbs-bitmap-info-QMP-call.patch b/debian/patches/pve/0034-PVE-add-query-pbs-bitmap-info-QMP-call.patch
index f0ca311..907a6bb 100644
--- a/debian/patches/pve/0034-PVE-add-query-pbs-bitmap-info-QMP-call.patch
+++ b/debian/patches/pve/0034-PVE-add-query-pbs-bitmap-info-QMP-call.patch
@@ -14,7 +14,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 files changed, 159 insertions(+), 42 deletions(-)
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 604026bb37..95f4e7f5c1 100644
+index a6a289968f..f7a211e5a4 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -198,6 +198,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
@@ -68,7 +68,7 @@ index 604026bb37..95f4e7f5c1 100644
info->zero_bytes, zero_per);
diff --git a/pve-backup.c b/pve-backup.c
-index 98e79552ef..8305105fd5 100644
+index 96e3d731da..032ecc2007 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -46,6 +46,7 @@ static struct PVEBackupState {
@@ -79,7 +79,7 @@ index 98e79552ef..8305105fd5 100644
} stat;
int64_t speed;
VmaWriter *vmaw;
-@@ -670,7 +671,6 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -672,7 +673,6 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
}
size_t total = 0;
@@ -87,7 +87,7 @@ index 98e79552ef..8305105fd5 100644
l = di_list;
while (l) {
-@@ -691,18 +691,33 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -693,18 +693,33 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
uuid_generate(uuid);
@@ -124,7 +124,7 @@ index 98e79552ef..8305105fd5 100644
}
int dump_cb_block_size = PROXMOX_BACKUP_DEFAULT_CHUNK_SIZE; // Hardcoded (4M)
-@@ -729,12 +744,12 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -731,12 +746,12 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
error_set(task->errp, ERROR_CLASS_GENERIC_ERROR,
"proxmox_backup_new failed: %s", pbs_err);
proxmox_backup_free_error(pbs_err);
@@ -139,7 +139,7 @@ index 98e79552ef..8305105fd5 100644
/* register all devices */
l = di_list;
-@@ -745,6 +760,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -747,6 +762,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
di->block_size = dump_cb_block_size;
const char *devname = bdrv_get_device_name(di->bs);
@@ -148,7 +148,7 @@ index 98e79552ef..8305105fd5 100644
BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME);
bool expect_only_dirty = false;
-@@ -753,49 +770,59 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -755,49 +772,59 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
if (bitmap == NULL) {
bitmap = bdrv_create_dirty_bitmap(di->bs, dump_cb_block_size, PBS_BITMAP_NAME, task->errp);
if (!bitmap) {
@@ -218,7 +218,7 @@ index 98e79552ef..8305105fd5 100644
}
/* register all devices for vma writer */
-@@ -805,7 +832,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -807,7 +834,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
l = g_list_next(l);
if (!(di->target = bdrv_backup_dump_create(VMA_CLUSTER_SIZE, di->size, pvebackup_co_dump_vma_cb, di, task->errp))) {
@@ -227,7 +227,7 @@ index 98e79552ef..8305105fd5 100644
}
const char *devname = bdrv_get_device_name(di->bs);
-@@ -813,16 +840,14 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -815,16 +842,14 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
if (di->dev_id <= 0) {
error_set(task->errp, ERROR_CLASS_GENERIC_ERROR,
"register_stream failed");
@@ -246,7 +246,7 @@ index 98e79552ef..8305105fd5 100644
}
backup_dir = task->backup_file;
-@@ -839,18 +864,18 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -841,18 +866,18 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
di->size, flags, false, &local_err);
if (local_err) {
error_propagate(task->errp, local_err);
@@ -268,7 +268,7 @@ index 98e79552ef..8305105fd5 100644
}
-@@ -858,7 +883,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -860,7 +885,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
if (task->has_config_file) {
if (pvebackup_co_add_config(task->config_file, config_name, format, backup_dir,
vmaw, pbs, task->errp) != 0) {
@@ -277,7 +277,7 @@ index 98e79552ef..8305105fd5 100644
}
}
-@@ -866,12 +891,11 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -868,12 +893,11 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
if (task->has_firewall_file) {
if (pvebackup_co_add_config(task->firewall_file, firewall_name, format, backup_dir,
vmaw, pbs, task->errp) != 0) {
@@ -292,7 +292,7 @@ index 98e79552ef..8305105fd5 100644
if (backup_state.stat.error) {
error_free(backup_state.stat.error);
-@@ -891,10 +915,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -893,10 +917,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
char *uuid_str = g_strdup(backup_state.stat.uuid_str);
backup_state.stat.total = total;
@@ -304,7 +304,7 @@ index 98e79552ef..8305105fd5 100644
qemu_mutex_unlock(&backup_state.stat.lock);
-@@ -911,6 +934,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -913,6 +936,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
task->result = uuid_info;
return;
@@ -314,7 +314,7 @@ index 98e79552ef..8305105fd5 100644
err:
l = di_list;
-@@ -1074,11 +1100,42 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -1076,11 +1102,42 @@ BackupStatus *qmp_query_backup(Error **errp)
return info;
}
@@ -358,10 +358,10 @@ index 98e79552ef..8305105fd5 100644
return ret;
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index f3608390c4..f57fda122c 100644
+index 79aef65616..808ec6027e 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -876,6 +876,8 @@
+@@ -814,6 +814,8 @@
# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are
# supported.
#
@@ -370,7 +370,7 @@ index f3608390c4..f57fda122c 100644
# @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can
# safely be set for savevm-async.
#
-@@ -884,6 +886,7 @@
+@@ -822,6 +824,7 @@
##
{ 'struct': 'ProxmoxSupportStatus',
'data': { 'pbs-dirty-bitmap': 'bool',
@@ -378,7 +378,7 @@ index f3608390c4..f57fda122c 100644
'pbs-dirty-bitmap-savevm': 'bool',
'pbs-library-version': 'str' } }
-@@ -897,6 +900,59 @@
+@@ -835,6 +838,59 @@
##
{ 'command': 'query-proxmox-support', 'returns': 'ProxmoxSupportStatus' }
diff --git a/debian/patches/pve/0035-PVE-redirect-stderr-to-journal-when-daemonized.patch b/debian/patches/pve/0035-PVE-redirect-stderr-to-journal-when-daemonized.patch
index 7fb3c4f..0300585 100644
--- a/debian/patches/pve/0035-PVE-redirect-stderr-to-journal-when-daemonized.patch
+++ b/debian/patches/pve/0035-PVE-redirect-stderr-to-journal-when-daemonized.patch
@@ -13,10 +13,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
-index 4d156d35ce..737ea9e5d7 100644
+index b77b4cd017..f2ecd82ad5 100644
--- a/meson.build
+++ b/meson.build
-@@ -726,6 +726,7 @@ keyutils = dependency('libkeyutils', required: false,
+@@ -946,6 +946,7 @@ keyutils = dependency('libkeyutils', required: false,
has_gettid = cc.has_function('gettid')
libuuid = cc.find_library('uuid', required: true)
@@ -24,16 +24,16 @@ index 4d156d35ce..737ea9e5d7 100644
libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true)
# Malloc tests
-@@ -1539,6 +1540,7 @@ blockdev_ss.add(files(
- # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
- # os-win32.c does not
- blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
-+blockdev_ss.add(when: 'CONFIG_POSIX', if_true: libsystemd)
- softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
+@@ -1927,6 +1928,7 @@ if have_block
+ # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
+ # os-win32.c does not
+ blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
++ blockdev_ss.add(when: 'CONFIG_POSIX', if_true: libsystemd)
+ softmmu_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
+ endif
- common_ss.add(files('cpus-common.c'))
diff --git a/os-posix.c b/os-posix.c
-index 1de2839554..ac4f652923 100644
+index a6846f51c1..5ce5eaf3a6 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -28,6 +28,8 @@
@@ -45,7 +45,7 @@ index 1de2839554..ac4f652923 100644
#include "qemu-common.h"
/* Needed early for CONFIG_BSD etc. */
-@@ -288,9 +290,10 @@ void os_setup_post(void)
+@@ -291,9 +293,10 @@ void os_setup_post(void)
dup2(fd, 0);
dup2(fd, 1);
diff --git a/debian/patches/pve/0036-PVE-Add-sequential-job-transaction-support.patch b/debian/patches/pve/0036-PVE-Add-sequential-job-transaction-support.patch
index 6be76d8..2619dc5 100644
--- a/debian/patches/pve/0036-PVE-Add-sequential-job-transaction-support.patch
+++ b/debian/patches/pve/0036-PVE-Add-sequential-job-transaction-support.patch
@@ -10,10 +10,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 files changed, 43 insertions(+)
diff --git a/include/qemu/job.h b/include/qemu/job.h
-index 32aabb1c60..f7a6a0926a 100644
+index efc6fa7544..942ee43bca 100644
--- a/include/qemu/job.h
+++ b/include/qemu/job.h
-@@ -280,6 +280,18 @@ typedef enum JobCreateFlags {
+@@ -285,6 +285,18 @@ typedef enum JobCreateFlags {
*/
JobTxn *job_txn_new(void);
@@ -33,7 +33,7 @@ index 32aabb1c60..f7a6a0926a 100644
* Release a reference that was previously acquired with job_txn_add_job or
* job_txn_new. If it's the last reference to the object, it will be freed.
diff --git a/job.c b/job.c
-index f9884e7d9d..05b7797e82 100644
+index 3999b7728c..3ae018cdad 100644
--- a/job.c
+++ b/job.c
@@ -72,6 +72,8 @@ struct JobTxn {
@@ -71,7 +71,7 @@ index f9884e7d9d..05b7797e82 100644
static void job_txn_ref(JobTxn *txn)
{
txn->refcnt++;
-@@ -841,6 +862,9 @@ static void job_completed_txn_success(Job *job)
+@@ -847,6 +868,9 @@ static void job_completed_txn_success(Job *job)
*/
QLIST_FOREACH(other_job, &txn->jobs, txn_list) {
if (!job_is_completed(other_job)) {
@@ -81,7 +81,7 @@ index f9884e7d9d..05b7797e82 100644
return;
}
assert(other_job->ret == 0);
-@@ -1011,6 +1035,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
+@@ -1017,6 +1041,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
return -EBUSY;
}
diff --git a/debian/patches/pve/0037-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch b/debian/patches/pve/0037-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch
index 29f8050..a626ea0 100644
--- a/debian/patches/pve/0037-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch
+++ b/debian/patches/pve/0037-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch
@@ -16,7 +16,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
1 file changed, 49 insertions(+), 118 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c
-index 8305105fd5..d7f2b2206f 100644
+index 032ecc2007..7d254cc1f6 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -52,6 +52,7 @@ static struct PVEBackupState {
@@ -228,19 +228,19 @@ index 8305105fd5..d7f2b2206f 100644
+ }
+ backup_state.txn = job_txn_new_seq();
+
+ BackupPerf perf = { .max_workers = 16 };
+
/* create and start all jobs (paused state) */
- GList *l = backup_state.di_list;
- while (l) {
-@@ -524,7 +448,7 @@ static bool create_backup_jobs(void) {
+@@ -526,7 +450,7 @@ static bool create_backup_jobs(void) {
BlockJob *job = backup_job_create(
NULL, di->bs, di->target, backup_state.speed, sync_mode, di->bitmap,
- bitmap_mode, false, NULL, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
-- JOB_DEFAULT, pvebackup_complete_cb, di, 1, NULL, &local_err);
+ bitmap_mode, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
+- JOB_DEFAULT, pvebackup_complete_cb, di, NULL, &local_err);
+ JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn, &local_err);
aio_context_release(aio_context);
-@@ -536,7 +460,8 @@ static bool create_backup_jobs(void) {
+@@ -538,7 +462,8 @@ static bool create_backup_jobs(void) {
pvebackup_propagate_error(create_job_err);
break;
}
@@ -250,7 +250,7 @@ index 8305105fd5..d7f2b2206f 100644
bdrv_unref(di->target);
di->target = NULL;
-@@ -554,6 +479,10 @@ static bool create_backup_jobs(void) {
+@@ -556,6 +481,10 @@ static bool create_backup_jobs(void) {
bdrv_unref(di->target);
di->target = NULL;
}
@@ -261,7 +261,7 @@ index 8305105fd5..d7f2b2206f 100644
}
}
-@@ -944,10 +873,6 @@ err:
+@@ -946,10 +875,6 @@ err:
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l);
@@ -272,7 +272,7 @@ index 8305105fd5..d7f2b2206f 100644
if (di->target) {
bdrv_unref(di->target);
}
-@@ -1036,9 +961,15 @@ UuidInfo *qmp_backup(
+@@ -1038,9 +963,15 @@ UuidInfo *qmp_backup(
block_on_coroutine_fn(pvebackup_co_prepare, &task);
if (*errp == NULL) {
diff --git a/debian/patches/pve/0038-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch b/debian/patches/pve/0038-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch
index 66023d6..7b11be7 100644
--- a/debian/patches/pve/0038-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch
+++ b/debian/patches/pve/0038-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch
@@ -54,7 +54,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2 files changed, 144 insertions(+), 78 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c
-index d7f2b2206f..e671ed8d48 100644
+index 7d254cc1f6..59b4034871 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -33,7 +33,9 @@ const char *PBS_BITMAP_NAME = "pbs-incremental-dirty-bitmap";
@@ -301,7 +301,7 @@ index d7f2b2206f..e671ed8d48 100644
Error *local_err = NULL;
/* create job transaction to synchronize bitmap commit and cancel all
-@@ -452,24 +494,19 @@ static bool create_backup_jobs(void) {
+@@ -454,24 +496,19 @@ static bool create_backup_jobs(void) {
aio_context_release(aio_context);
@@ -331,7 +331,7 @@ index d7f2b2206f..e671ed8d48 100644
l = backup_state.di_list;
while (l) {
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
-@@ -481,12 +518,17 @@ static bool create_backup_jobs(void) {
+@@ -483,12 +520,17 @@ static bool create_backup_jobs(void) {
}
if (di->job) {
@@ -350,7 +350,7 @@ index d7f2b2206f..e671ed8d48 100644
}
typedef struct QmpBackupTask {
-@@ -523,11 +565,12 @@ typedef struct QmpBackupTask {
+@@ -525,11 +567,12 @@ typedef struct QmpBackupTask {
UuidInfo *result;
} QmpBackupTask;
@@ -364,7 +364,7 @@ index d7f2b2206f..e671ed8d48 100644
QmpBackupTask *task = opaque;
task->result = NULL; // just to be sure
-@@ -548,8 +591,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -550,8 +593,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
const char *firewall_name = "qemu-server.fw";
if (backup_state.di_list) {
@@ -375,7 +375,7 @@ index d7f2b2206f..e671ed8d48 100644
return;
}
-@@ -616,6 +660,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -618,6 +662,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
}
di->size = size;
total += size;
@@ -384,7 +384,7 @@ index d7f2b2206f..e671ed8d48 100644
}
uuid_generate(uuid);
-@@ -847,6 +893,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -849,6 +895,8 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
backup_state.stat.dirty = total - backup_state.stat.reused;
backup_state.stat.transferred = 0;
backup_state.stat.zero_bytes = 0;
@@ -393,7 +393,7 @@ index d7f2b2206f..e671ed8d48 100644
qemu_mutex_unlock(&backup_state.stat.lock);
-@@ -861,6 +909,33 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -863,6 +911,33 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
uuid_info->UUID = uuid_str;
task->result = uuid_info;
@@ -427,7 +427,7 @@ index d7f2b2206f..e671ed8d48 100644
return;
err_mutex:
-@@ -883,6 +958,7 @@ err:
+@@ -885,6 +960,7 @@ err:
g_free(di);
}
g_list_free(di_list);
@@ -435,7 +435,7 @@ index d7f2b2206f..e671ed8d48 100644
if (devs) {
g_strfreev(devs);
-@@ -903,6 +979,8 @@ err:
+@@ -905,6 +981,8 @@ err:
}
task->result = NULL;
@@ -444,7 +444,7 @@ index d7f2b2206f..e671ed8d48 100644
return;
}
-@@ -956,24 +1034,8 @@ UuidInfo *qmp_backup(
+@@ -958,24 +1036,8 @@ UuidInfo *qmp_backup(
.errp = errp,
};
@@ -469,7 +469,7 @@ index d7f2b2206f..e671ed8d48 100644
return task.result;
}
-@@ -1025,6 +1087,7 @@ BackupStatus *qmp_query_backup(Error **errp)
+@@ -1027,6 +1089,7 @@ BackupStatus *qmp_query_backup(Error **errp)
info->transferred = backup_state.stat.transferred;
info->has_reused = true;
info->reused = backup_state.stat.reused;
@@ -478,10 +478,10 @@ index d7f2b2206f..e671ed8d48 100644
qemu_mutex_unlock(&backup_state.stat.lock);
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index f57fda122c..9b827cbe43 100644
+index 808ec6027e..710b8dfb2d 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -775,12 +775,15 @@
+@@ -713,12 +713,15 @@
#
# @uuid: uuid for this backup job
#
diff --git a/debian/patches/pve/0039-PVE-Migrate-dirty-bitmap-state-via-savevm.patch b/debian/patches/pve/0039-PVE-Migrate-dirty-bitmap-state-via-savevm.patch
index b4a7d5a..b1bbccf 100644
--- a/debian/patches/pve/0039-PVE-Migrate-dirty-bitmap-state-via-savevm.patch
+++ b/debian/patches/pve/0039-PVE-Migrate-dirty-bitmap-state-via-savevm.patch
@@ -15,18 +15,18 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
include/migration/misc.h | 3 ++
migration/meson.build | 2 +
+ migration/migration.c | 1 +
migration/pbs-state.c | 106 +++++++++++++++++++++++++++++++++++++++
pve-backup.c | 1 +
qapi/block-core.json | 6 +++
- softmmu/vl.c | 1 +
6 files changed, 119 insertions(+)
create mode 100644 migration/pbs-state.c
diff --git a/include/migration/misc.h b/include/migration/misc.h
-index 34e7d75713..f83816dd3c 100644
+index 738675ef52..2b89db4b8e 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
-@@ -75,4 +75,7 @@ bool migration_in_incoming_postcopy(void);
+@@ -76,4 +76,7 @@ bool migration_in_bg_snapshot(void);
/* migration/block-dirty-bitmap.c */
void dirty_bitmap_mig_init(void);
@@ -35,13 +35,13 @@ index 34e7d75713..f83816dd3c 100644
+
#endif
diff --git a/migration/meson.build b/migration/meson.build
-index e62b79b60f..b90a04aa75 100644
+index c8ae813a48..49108c79ef 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -7,8 +7,10 @@ migration_files = files(
'qemu-file-channel.c',
'qemu-file.c',
- 'qjson.c',
+ 'yank_functions.c',
+ 'pbs-state.c',
)
softmmu_ss.add(migration_files)
@@ -49,6 +49,18 @@ index e62b79b60f..b90a04aa75 100644
softmmu_ss.add(files(
'block-dirty-bitmap.c',
+diff --git a/migration/migration.c b/migration/migration.c
+index 8ca034136b..a5ce875685 100644
+--- a/migration/migration.c
++++ b/migration/migration.c
+@@ -221,6 +221,7 @@ void migration_object_init(void)
+ blk_mig_init();
+ ram_mig_init();
+ dirty_bitmap_mig_init();
++ pbs_state_mig_init();
+ }
+
+ void migration_shutdown(void)
diff --git a/migration/pbs-state.c b/migration/pbs-state.c
new file mode 100644
index 0000000000..29f2b3860d
@@ -162,10 +174,10 @@ index 0000000000..29f2b3860d
+ NULL);
+}
diff --git a/pve-backup.c b/pve-backup.c
-index e671ed8d48..bd2647e5f3 100644
+index 59b4034871..ecff792760 100644
--- a/pve-backup.c
+++ b/pve-backup.c
-@@ -1130,6 +1130,7 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
+@@ -1132,6 +1132,7 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
ret->pbs_library_version = g_strdup(proxmox_backup_qemu_version());
ret->pbs_dirty_bitmap = true;
ret->pbs_dirty_bitmap_savevm = true;
@@ -174,10 +186,10 @@ index e671ed8d48..bd2647e5f3 100644
return ret;
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 9b827cbe43..30eb1262ff 100644
+index 710b8dfb2d..cf3cbf2a56 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -884,6 +884,11 @@
+@@ -822,6 +822,11 @@
# @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can
# safely be set for savevm-async.
#
@@ -189,7 +201,7 @@ index 9b827cbe43..30eb1262ff 100644
# @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
#
##
-@@ -891,6 +896,7 @@
+@@ -829,6 +834,7 @@
'data': { 'pbs-dirty-bitmap': 'bool',
'query-bitmap-info': 'bool',
'pbs-dirty-bitmap-savevm': 'bool',
@@ -197,15 +209,3 @@ index 9b827cbe43..30eb1262ff 100644
'pbs-library-version': 'str' } }
##
-diff --git a/softmmu/vl.c b/softmmu/vl.c
-index 5b5512128e..6721889fee 100644
---- a/softmmu/vl.c
-+++ b/softmmu/vl.c
-@@ -4304,6 +4304,7 @@ void qemu_init(int argc, char **argv, char **envp)
- blk_mig_init();
- ram_mig_init();
- dirty_bitmap_mig_init();
-+ pbs_state_mig_init();
-
- qemu_opts_foreach(qemu_find_opts("mon"),
- mon_init_func, NULL, &error_fatal);
diff --git a/debian/patches/pve/0040-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch b/debian/patches/pve/0040-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch
index 775f992..a2f7c41 100644
--- a/debian/patches/pve/0040-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch
+++ b/debian/patches/pve/0040-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch
@@ -18,10 +18,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
-index c61d382be8..26e4e5c99c 100644
+index 35f5ef688d..c4640925e7 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
-@@ -534,7 +534,7 @@ static int add_bitmaps_to_list(DBMSaveState *s, BlockDriverState *bs,
+@@ -538,7 +538,7 @@ static int add_bitmaps_to_list(DBMSaveState *s, BlockDriverState *bs,
if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, &local_err)) {
error_report_err(local_err);
diff --git a/debian/patches/pve/0041-PVE-fall-back-to-open-iscsi-initiatorname.patch b/debian/patches/pve/0041-PVE-fall-back-to-open-iscsi-initiatorname.patch
index f4c4652..4bb5c39 100644
--- a/debian/patches/pve/0041-PVE-fall-back-to-open-iscsi-initiatorname.patch
+++ b/debian/patches/pve/0041-PVE-fall-back-to-open-iscsi-initiatorname.patch
@@ -20,10 +20,10 @@ Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
1 file changed, 30 insertions(+)
diff --git a/block/iscsi.c b/block/iscsi.c
-index e30a7e3606..6c70bbe351 100644
+index 4d2a416ce7..c345d30812 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
-@@ -1374,12 +1374,42 @@ static char *get_initiator_name(QemuOpts *opts)
+@@ -1372,12 +1372,42 @@ static char *get_initiator_name(QemuOpts *opts)
const char *name;
char *iscsi_name;
UuidInfo *uuid_info;
diff --git a/debian/patches/pve/0042-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch b/debian/patches/pve/0042-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch
index ad86b55..566ec06 100644
--- a/debian/patches/pve/0042-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch
+++ b/debian/patches/pve/0042-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch
@@ -31,10 +31,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
5 files changed, 77 insertions(+), 196 deletions(-)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index 46c63b1cf9..11c84d5508 100644
+index f509959a32..89336d93ef 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
-@@ -1013,7 +1013,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
+@@ -1005,7 +1005,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
g_free(global_snapshots);
}
@@ -43,7 +43,7 @@ index 46c63b1cf9..11c84d5508 100644
{
Error *error = NULL;
-@@ -1022,7 +1022,7 @@ void hmp_backup_cancel(Monitor *mon, const QDict *qdict)
+@@ -1014,7 +1014,7 @@ void hmp_backup_cancel(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, error);
}
@@ -53,10 +53,10 @@ index 46c63b1cf9..11c84d5508 100644
Error *error = NULL;
diff --git a/hmp-commands.hx b/hmp-commands.hx
-index 0c6b944850..54de3f80e6 100644
+index a7bd174e5a..e01ca13ca8 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
-@@ -108,6 +108,7 @@ ERST
+@@ -109,6 +109,7 @@ ERST
"\n\t\t\t Use -d to dump data into a directory instead"
"\n\t\t\t of using VMA format.",
.cmd = hmp_backup,
@@ -64,7 +64,7 @@ index 0c6b944850..54de3f80e6 100644
},
SRST
-@@ -121,6 +122,7 @@ ERST
+@@ -122,6 +123,7 @@ ERST
.params = "",
.help = "cancel the current VM backup",
.cmd = hmp_backup_cancel,
@@ -115,7 +115,7 @@ index 4ce7bc0b5e..0923037dec 100644
static void proxmox_backup_schedule_wake(void *data) {
CoCtxData *waker = (CoCtxData *)data;
diff --git a/pve-backup.c b/pve-backup.c
-index bd2647e5f3..dec9c0d188 100644
+index ecff792760..ed6cdc1b94 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -357,7 +357,7 @@ static void job_cancel_bh(void *opaque) {
@@ -139,7 +139,7 @@ index bd2647e5f3..dec9c0d188 100644
// assumes the caller holds backup_mutex
static int coroutine_fn pvebackup_co_add_config(
const char *file,
-@@ -531,50 +526,27 @@ static void create_backup_jobs_bh(void *opaque) {
+@@ -533,50 +528,27 @@ static void create_backup_jobs_bh(void *opaque) {
aio_co_enter(data->ctx, data->co);
}
@@ -206,7 +206,7 @@ index bd2647e5f3..dec9c0d188 100644
BlockBackend *blk;
BlockDriverState *bs = NULL;
const char *backup_dir = NULL;
-@@ -591,17 +563,17 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -593,17 +565,17 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
const char *firewall_name = "qemu-server.fw";
if (backup_state.di_list) {
@@ -229,7 +229,7 @@ index bd2647e5f3..dec9c0d188 100644
gchar **d = devs;
while (d && *d) {
-@@ -609,14 +581,14 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -611,14 +583,14 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
if (blk) {
bs = blk_bs(blk);
if (!bdrv_is_inserted(bs)) {
@@ -246,7 +246,7 @@ index bd2647e5f3..dec9c0d188 100644
"Device '%s' not found", *d);
goto err;
}
-@@ -639,7 +611,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -641,7 +613,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
}
if (!di_list) {
@@ -255,7 +255,7 @@ index bd2647e5f3..dec9c0d188 100644
goto err;
}
-@@ -649,13 +621,13 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -651,13 +623,13 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
while (l) {
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l);
@@ -271,7 +271,7 @@ index bd2647e5f3..dec9c0d188 100644
goto err;
}
di->size = size;
-@@ -682,47 +654,44 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -684,47 +656,44 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
}
if (format == BACKUP_FORMAT_PBS) {
@@ -336,7 +336,7 @@ index bd2647e5f3..dec9c0d188 100644
if (connect_result < 0)
goto err_mutex;
-@@ -741,9 +710,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -743,9 +712,9 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
BdrvDirtyBitmap *bitmap = bdrv_find_dirty_bitmap(di->bs, PBS_BITMAP_NAME);
bool expect_only_dirty = false;
@@ -348,7 +348,7 @@ index bd2647e5f3..dec9c0d188 100644
if (!bitmap) {
goto err_mutex;
}
-@@ -773,12 +742,12 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -775,12 +744,12 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
}
}
@@ -363,7 +363,7 @@ index bd2647e5f3..dec9c0d188 100644
goto err_mutex;
}
-@@ -792,10 +761,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -794,10 +763,10 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
backup_state.stat.bitmap_list = g_list_append(backup_state.stat.bitmap_list, info);
}
} else if (format == BACKUP_FORMAT_VMA) {
@@ -376,7 +376,7 @@ index bd2647e5f3..dec9c0d188 100644
}
goto err_mutex;
}
-@@ -806,25 +775,25 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -808,25 +777,25 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l);
@@ -408,7 +408,7 @@ index bd2647e5f3..dec9c0d188 100644
l = di_list;
while (l) {
-@@ -838,34 +807,34 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -840,34 +809,34 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
bdrv_img_create(di->targetfile, "raw", NULL, NULL, NULL,
di->size, flags, false, &local_err);
if (local_err) {
@@ -452,7 +452,7 @@ index bd2647e5f3..dec9c0d188 100644
goto err_mutex;
}
}
-@@ -883,7 +852,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -885,7 +854,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
if (backup_state.stat.backup_file) {
g_free(backup_state.stat.backup_file);
}
@@ -461,7 +461,7 @@ index bd2647e5f3..dec9c0d188 100644
uuid_copy(backup_state.stat.uuid, uuid);
uuid_unparse_lower(uuid, backup_state.stat.uuid_str);
-@@ -898,7 +867,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -900,7 +869,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
qemu_mutex_unlock(&backup_state.stat.lock);
@@ -470,7 +470,7 @@ index bd2647e5f3..dec9c0d188 100644
backup_state.vmaw = vmaw;
backup_state.pbs = pbs;
-@@ -908,8 +877,6 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -910,8 +879,6 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
uuid_info = g_malloc0(sizeof(*uuid_info));
uuid_info->UUID = uuid_str;
@@ -479,7 +479,7 @@ index bd2647e5f3..dec9c0d188 100644
/* Run create_backup_jobs_bh outside of coroutine (in BH) but keep
* backup_mutex locked. This is fine, a CoMutex can be held across yield
* points, and we'll release it as soon as the BH reschedules us.
-@@ -923,7 +890,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -925,7 +892,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
qemu_coroutine_yield();
if (local_err) {
@@ -488,7 +488,7 @@ index bd2647e5f3..dec9c0d188 100644
goto err;
}
-@@ -936,7 +903,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
+@@ -938,7 +905,7 @@ static void coroutine_fn pvebackup_co_prepare(void *opaque)
/* start the first job in the transaction */
job_txn_start_seq(backup_state.txn);
@@ -497,7 +497,7 @@ index bd2647e5f3..dec9c0d188 100644
err_mutex:
qemu_mutex_unlock(&backup_state.stat.lock);
-@@ -967,7 +934,7 @@ err:
+@@ -969,7 +936,7 @@ err:
if (vmaw) {
Error *err = NULL;
vma_writer_close(vmaw, &err);
@@ -506,7 +506,7 @@ index bd2647e5f3..dec9c0d188 100644
}
if (pbs) {
-@@ -978,65 +945,8 @@ err:
+@@ -980,65 +947,8 @@ err:
rmdir(backup_dir);
}
@@ -574,10 +574,10 @@ index bd2647e5f3..dec9c0d188 100644
BackupStatus *qmp_query_backup(Error **errp)
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 30eb1262ff..6ff5367383 100644
+index cf3cbf2a56..7b6e79df9f 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -847,7 +847,7 @@
+@@ -785,7 +785,7 @@
'*config-file': 'str',
'*firewall-file': 'str',
'*devlist': 'str', '*speed': 'int' },
@@ -586,7 +586,7 @@ index 30eb1262ff..6ff5367383 100644
##
# @query-backup:
-@@ -869,7 +869,7 @@
+@@ -807,7 +807,7 @@
# Notes: This command succeeds even if there is no backup process running.
#
##
diff --git a/debian/patches/pve/0043-PBS-add-master-key-support.patch b/debian/patches/pve/0043-PBS-add-master-key-support.patch
index c207ce5..460810f 100644
--- a/debian/patches/pve/0043-PBS-add-master-key-support.patch
+++ b/debian/patches/pve/0043-PBS-add-master-key-support.patch
@@ -18,10 +18,10 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 files changed, 11 insertions(+)
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index 11c84d5508..0932deb28c 100644
+index 89336d93ef..b9e659a0d2 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
-@@ -1036,6 +1036,7 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
+@@ -1028,6 +1028,7 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
false, NULL, // PBS password
false, NULL, // PBS keyfile
false, NULL, // PBS key_password
@@ -30,10 +30,10 @@ index 11c84d5508..0932deb28c 100644
false, NULL, // PBS backup-id
false, 0, // PBS backup-time
diff --git a/pve-backup.c b/pve-backup.c
-index dec9c0d188..076146cc1e 100644
+index ed6cdc1b94..8af161c8bf 100644
--- a/pve-backup.c
+++ b/pve-backup.c
-@@ -531,6 +531,7 @@ UuidInfo coroutine_fn *qmp_backup(
+@@ -533,6 +533,7 @@ UuidInfo coroutine_fn *qmp_backup(
bool has_password, const char *password,
bool has_keyfile, const char *keyfile,
bool has_key_password, const char *key_password,
@@ -41,7 +41,7 @@ index dec9c0d188..076146cc1e 100644
bool has_fingerprint, const char *fingerprint,
bool has_backup_id, const char *backup_id,
bool has_backup_time, int64_t backup_time,
-@@ -679,6 +680,7 @@ UuidInfo coroutine_fn *qmp_backup(
+@@ -681,6 +682,7 @@ UuidInfo coroutine_fn *qmp_backup(
has_password ? password : NULL,
has_keyfile ? keyfile : NULL,
has_key_password ? key_password : NULL,
@@ -49,7 +49,7 @@ index dec9c0d188..076146cc1e 100644
has_compress ? compress : true,
has_encrypt ? encrypt : has_keyfile,
has_fingerprint ? fingerprint : NULL,
-@@ -1042,5 +1044,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
+@@ -1044,5 +1046,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
ret->pbs_dirty_bitmap_savevm = true;
ret->pbs_dirty_bitmap_migration = true;
ret->query_bitmap_info = true;
@@ -57,10 +57,10 @@ index dec9c0d188..076146cc1e 100644
return ret;
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 6ff5367383..bef9b65fec 100644
+index 7b6e79df9f..6d3ea72706 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -818,6 +818,8 @@
+@@ -756,6 +756,8 @@
#
# @key-password: password for keyfile (optional for format 'pbs')
#
@@ -69,7 +69,7 @@ index 6ff5367383..bef9b65fec 100644
# @fingerprint: server cert fingerprint (optional for format 'pbs')
#
# @backup-id: backup ID (required for format 'pbs')
-@@ -837,6 +839,7 @@
+@@ -775,6 +777,7 @@
'*password': 'str',
'*keyfile': 'str',
'*key-password': 'str',
@@ -77,7 +77,7 @@ index 6ff5367383..bef9b65fec 100644
'*fingerprint': 'str',
'*backup-id': 'str',
'*backup-time': 'int',
-@@ -889,6 +892,9 @@
+@@ -827,6 +830,9 @@
# migration cap if this is false/unset may lead
# to crashes on migration!
#
@@ -87,7 +87,7 @@ index 6ff5367383..bef9b65fec 100644
# @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
#
##
-@@ -897,6 +903,7 @@
+@@ -835,6 +841,7 @@
'query-bitmap-info': 'bool',
'pbs-dirty-bitmap-savevm': 'bool',
'pbs-dirty-bitmap-migration': 'bool',
diff --git a/debian/patches/pve/0044-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch b/debian/patches/pve/0044-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch
index a85ebc2..9f2318a 100644
--- a/debian/patches/pve/0044-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch
+++ b/debian/patches/pve/0044-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch
@@ -16,7 +16,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/block/pbs.c b/block/pbs.c
-index 1481a2bfd1..fbf0d8d845 100644
+index 78dad0dcc4..ac54e816c0 100644
--- a/block/pbs.c
+++ b/block/pbs.c
@@ -200,7 +200,16 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs,
diff --git a/debian/patches/pve/0045-PVE-block-stream-increase-chunk-size.patch b/debian/patches/pve/0045-PVE-block-stream-increase-chunk-size.patch
index 601f8c7..680bc40 100644
--- a/debian/patches/pve/0045-PVE-block-stream-increase-chunk-size.patch
+++ b/debian/patches/pve/0045-PVE-block-stream-increase-chunk-size.patch
@@ -9,10 +9,10 @@ Ceph favors bigger chunks, so increase to 4M.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/stream.c b/block/stream.c
-index 236384f2f7..a5371420e3 100644
+index 97bee482dc..50093c9f57 100644
--- a/block/stream.c
+++ b/block/stream.c
-@@ -26,7 +26,7 @@ enum {
+@@ -28,7 +28,7 @@ enum {
* large enough to process multiple clusters in a single call, so
* that populating contiguous regions of the image is efficient.
*/
diff --git a/debian/patches/pve/0046-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch b/debian/patches/pve/0046-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
index e40fa2e..6020821 100644
--- a/debian/patches/pve/0046-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
+++ b/debian/patches/pve/0046-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
@@ -11,32 +11,21 @@ it wants to extend its passed vector.
Simply check for NULL and do nothing, there's no reason to pad the
target if it will be discarded anyway.
---
- block/io.c | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
+ block/io.c | 4 ++++
+ 1 file changed, 4 insertions(+)
diff --git a/block/io.c b/block/io.c
-index ec5e152bb7..08dee005ec 100644
+index ca2dca3007..a9e70a4f91 100644
--- a/block/io.c
+++ b/block/io.c
-@@ -1613,13 +1613,16 @@ static bool bdrv_pad_request(BlockDriverState *bs,
- return false;
- }
+@@ -1731,6 +1731,10 @@ static int bdrv_pad_request(BlockDriverState *bs,
+ {
+ int ret;
-- qemu_iovec_init_extended(&pad->local_qiov, pad->buf, pad->head,
-- *qiov, *qiov_offset, *bytes,
-- pad->buf + pad->buf_len - pad->tail, pad->tail);
-+ if (*qiov) {
-+ qemu_iovec_init_extended(&pad->local_qiov, pad->buf, pad->head,
-+ *qiov, *qiov_offset, *bytes,
-+ pad->buf + pad->buf_len - pad->tail, pad->tail);
-+ *qiov = &pad->local_qiov;
-+ *qiov_offset = 0;
++ if (!qiov) {
++ return 0;
+ }
+
- *bytes += pad->head + pad->tail;
- *offset -= pad->head;
-- *qiov = &pad->local_qiov;
-- *qiov_offset = 0;
+ bdrv_check_qiov_request(*offset, *bytes, *qiov, *qiov_offset, &error_abort);
- return true;
- }
+ if (!bdrv_init_padding(bs, *offset, *bytes, pad)) {
diff --git a/debian/patches/pve/0047-block-add-alloc-track-driver.patch b/debian/patches/pve/0047-block-add-alloc-track-driver.patch
index b8159f7..7f37701 100644
--- a/debian/patches/pve/0047-block-add-alloc-track-driver.patch
+++ b/debian/patches/pve/0047-block-add-alloc-track-driver.patch
@@ -24,14 +24,14 @@ once the backing image is removed. It will be replaced by 'file'.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
- block/alloc-track.c | 342 ++++++++++++++++++++++++++++++++++++++++++++
+ block/alloc-track.c | 345 ++++++++++++++++++++++++++++++++++++++++++++
block/meson.build | 1 +
- 2 files changed, 343 insertions(+)
+ 2 files changed, 346 insertions(+)
create mode 100644 block/alloc-track.c
diff --git a/block/alloc-track.c b/block/alloc-track.c
new file mode 100644
-index 0000000000..b579380279
+index 0000000000..35f2737c89
--- /dev/null
+++ b/block/alloc-track.c
@@ -0,0 +1,345 @@
@@ -381,7 +381,7 @@ index 0000000000..b579380279
+
+block_init(bdrv_alloc_track_init);
diff --git a/block/meson.build b/block/meson.build
-index a070060e53..e387990764 100644
+index 574165e577..f56ec7f6bf 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -2,6 +2,7 @@ block_ss.add(genh)
diff --git a/debian/patches/pve/0048-PVE-whitelist-invalid-QAPI-names-for-backwards-compa.patch b/debian/patches/pve/0048-PVE-whitelist-invalid-QAPI-names-for-backwards-compa.patch
new file mode 100644
index 0000000..19f4326
--- /dev/null
+++ b/debian/patches/pve/0048-PVE-whitelist-invalid-QAPI-names-for-backwards-compa.patch
@@ -0,0 +1,32 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Stefan Reiter <s.reiter@proxmox.com>
+Date: Wed, 26 May 2021 15:26:30 +0200
+Subject: [PATCH] PVE: whitelist 'invalid' QAPI names for backwards compat
+
+Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
+---
+ qapi/pragma.json | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/qapi/pragma.json b/qapi/pragma.json
+index 7c91ea3685..c3888d654c 100644
+--- a/qapi/pragma.json
++++ b/qapi/pragma.json
+@@ -12,6 +12,7 @@
+ 'device_add',
+ 'device_del',
+ 'expire_password',
++ 'get_link_status',
+ 'migrate_cancel',
+ 'netdev_add',
+ 'netdev_del',
+@@ -60,6 +61,8 @@
+ 'SysEmuTarget', # query-cpu-fast, query-target
+ 'UuidInfo', # query-uuid
+ 'VncClientInfo', # query-vnc, query-vnc-servers, ...
+- 'X86CPURegister32' # qom-get of x86 CPU properties
++ 'X86CPURegister32', # qom-get of x86 CPU properties
+ # feature-words, filtered-features
++ 'BlockdevOptionsPbs', # for PBS backwards compat
++ 'BalloonInfo'
+ ] } }
diff --git a/debian/patches/pve/0049-PVE-savevm-async-register-yank-before-migration_inco.patch b/debian/patches/pve/0049-PVE-savevm-async-register-yank-before-migration_inco.patch
new file mode 100644
index 0000000..90006d5
--- /dev/null
+++ b/debian/patches/pve/0049-PVE-savevm-async-register-yank-before-migration_inco.patch
@@ -0,0 +1,34 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Stefan Reiter <s.reiter@proxmox.com>
+Date: Wed, 26 May 2021 17:36:55 +0200
+Subject: [PATCH] PVE: savevm-async: register yank before
+ migration_incoming_state_destroy
+
+Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
+---
+ migration/savevm-async.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/migration/savevm-async.c b/migration/savevm-async.c
+index cc2552d977..f863411dea 100644
+--- a/migration/savevm-async.c
++++ b/migration/savevm-async.c
+@@ -19,6 +19,7 @@
+ #include "qemu/timer.h"
+ #include "qemu/main-loop.h"
+ #include "qemu/rcu.h"
++#include "qemu/yank.h"
+
+ /* #define DEBUG_SAVEVM_STATE */
+
+@@ -580,6 +581,10 @@ int load_snapshot_from_blockdev(const char *filename, Error **errp)
+ dirty_bitmap_mig_before_vm_start();
+
+ qemu_fclose(f);
++
++ /* state_destroy assumes a real migration which would have added a yank */
++ yank_register_instance(MIGRATION_YANK_INSTANCE, &error_abort);
++
+ migration_incoming_state_destroy();
+ if (ret < 0) {
+ error_setg_errno(errp, -ret, "Error while loading VM state");
diff --git a/debian/patches/series b/debian/patches/series
index 8d36e53..ada674b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,15 +1,4 @@
-extra/0001-Revert-qemu-img-convert-Don-t-pre-zero-images.patch
-extra/0002-docs-don-t-install-man-page-if-guest-agent-is-disabl.patch
-extra/0003-migration-only-check-page-size-match-if-RAM-postcopy.patch
-extra/0004-virtiofsd-extract-lo_do_open-from-lo_open.patch
-extra/0005-virtiofsd-optionally-return-inode-pointer-from-lo_do.patch
-extra/0006-virtiofsd-prevent-opening-of-special-files-CVE-2020-.patch
-extra/0007-virtiofsd-Add-_llseek-to-the-seccomp-whitelist.patch
-extra/0008-virtiofsd-Add-restart_syscall-to-the-seccomp-whiteli.patch
-extra/0009-i386-acpi-restore-device-paths-for-pre-5.1-vms.patch
-extra/0010-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch
-extra/0011-block-Fix-locking-in-qmp_block_resize.patch
-extra/0012-block-Fix-deadlock-in-bdrv_co_yield_to_drain.patch
+extra/0001-monitor-qmp-fix-race-on-CHR_EVENT_CLOSED-without-OOB.patch
bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
@@ -63,3 +52,5 @@ pve/0044-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch
pve/0045-PVE-block-stream-increase-chunk-size.patch
pve/0046-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
pve/0047-block-add-alloc-track-driver.patch
+pve/0048-PVE-whitelist-invalid-QAPI-names-for-backwards-compa.patch
+pve/0049-PVE-savevm-async-register-yank-before-migration_inco.patch
diff --git a/qemu b/qemu
index 553032d..609d759 160000
--- a/qemu
+++ b/qemu
@@ -1 +1 @@
-Subproject commit 553032db17440f8de011390e5a1cfddd13751b0b
+Subproject commit 609d7596524ab204ccd71ef42c9eee4c7c338ea4
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pve-devel] [PATCH pve-qemu 3/3] update keycodemapdb for 6.0
2021-05-27 10:43 [pve-devel] [PATCH 0/3] Upgrade to QEMU 6.0 Stefan Reiter
2021-05-27 10:43 ` [pve-devel] [PATCH pve-qemu 1/3] udpate and rebase to QEMU v6.0.0 Stefan Reiter
2021-05-27 10:43 ` [pve-devel] [PATCH pve-qemu 2/3] debian: ignore submodule checks in QEMU build Stefan Reiter
@ 2021-05-27 10:43 ` Stefan Reiter
2021-05-28 11:54 ` [pve-devel] applied-series: [PATCH 0/3] Upgrade to QEMU 6.0 Thomas Lamprecht
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Reiter @ 2021-05-27 10:43 UTC (permalink / raw)
To: pve-devel
QEMU 6.0 requires the updated version to build correctly, as the
keymap-gen tool gained some new parameters.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
keycodemapdb/data/keymaps.csv | 16 +-
keycodemapdb/meson.build | 1 +
keycodemapdb/tests/Makefile | 84 +++++++----
keycodemapdb/tools/keymap-gen | 267 ++++++++++++++++++++++++++++------
4 files changed, 288 insertions(+), 80 deletions(-)
create mode 100644 keycodemapdb/meson.build
diff --git a/keycodemapdb/data/keymaps.csv b/keycodemapdb/data/keymaps.csv
index bc2376c..6b1631e 100644
--- a/keycodemapdb/data/keymaps.csv
+++ b/keycodemapdb/data/keymaps.csv
@@ -145,12 +145,12 @@ KEY_KPDOT,83,ANSI_KeypadDecimal,0x41,0x53,0x71,0x71,99,VK_DECIMAL,0x6e,83,83,XK_
KEY_KPDOT,83,ANSI_KeypadDecimal,0x41,0x53,0x71,0x71,99,VK_DECIMAL,0x6e,83,83,XK_KP_Decimal,0xffae,NumpadDecimal,KPDC,kp_decimal,0x32,0x41
,84,,,0x54,,,,,,,,,,,,,,
KEY_ZENKAKUHANKAKU,85,,,0x76,0x5f,,148,,,,,,,Lang5,HZTG,,,
-KEY_102ND,86,,,0x56,0x61,0x13,100,VK_OEM_102,0xe1,86,86,,,IntlBackslash,LSGT,less,0x7c,
+KEY_102ND,86,,,0x56,0x61,0x13,100,VK_OEM_102,0xe2,86,86,,,IntlBackslash,LSGT,less,0x7c,
KEY_F11,87,F11,0x67,0x57,0x78,0x56,68,VK_F11,0x7a,87,87,XK_F11,0xffc8,F11,FK11,f11,0x09,0x67
KEY_F12,88,F12,0x6f,0x58,0x07,0x5e,69,VK_F12,0x7b,88,88,XK_F12,0xffc9,F12,FK12,f12,0x0b,0x6f
-KEY_RO,89,,,0x73,0x51,,135,,,,,,,IntlRo,AB11,ro,,
-KEY_KATAKANA,90,JIS_Kana,0x68,0x78,0x63,,146,VK_KANA,0x15,,,,,Katakana,KATA,,,
-KEY_KATAKANA,90,JIS_Kana,0x68,0x78,0x63,,146,VK_KANA,0x15,,,,,Lang3,KATA,,,
+KEY_RO,89,JIS_Underscore,0x5e,0x73,0x51,,135,,,,,,,IntlRo,AB11,ro,,
+KEY_KATAKANA,90,,,0x78,0x63,,146,VK_KANA,0x15,,,,,Katakana,KATA,,,
+KEY_KATAKANA,90,,,0x78,0x63,,146,VK_KANA,0x15,,,,,Lang3,KATA,,,
KEY_HIRAGANA,91,,,0x77,0x62,0x87,147,,,,,,,Hiragana,HIRA,hiragana,,
KEY_HIRAGANA,91,,,0x77,0x62,0x87,147,,,,,,,Lang4,HIRA,hiragana,,
KEY_HENKAN,92,,,0x79,0x64,0x86,138,,,,,,,Convert,HENK,henkan,,
@@ -192,8 +192,8 @@ KEY_PAUSE,119,,,0xe046,0xe077,0x62,72,VK_PAUSE,0x013,0x66,0x66,XK_Pause,0xff13,P
KEY_SCALE,120,,,0xe00b,,,,,,,,,,,I128,,,
KEY_KPCOMMA,121,,,0x7e,0x6d,,133,VK_SEPARATOR??,0x6c,,,,,NumpadComma,KPCO,kp_comma,,
KEY_KPCOMMA,121,,,0x7e,0x6d,,133,VK_SEPARATOR??,0x6c,,,,,NumpadComma,I129,,,
-KEY_HANGEUL,122,,,,,,144,VK_HANGEUL,0x15,,,,,,HNGL,,,
-KEY_HANJA,123,,,0xe00d,,,145,VK_HANJA,0x19,,,,,,HJCV,,,
+KEY_HANGEUL,122,JIS_Kana,0x68,0x72,,,144,VK_HANGEUL,0x15,,0x71,,,Lang1,HNGL,,,
+KEY_HANJA,123,JIS_Eisu,0x66,0x71,,,145,VK_HANJA,0x19,,0x72,,,Lang2,HJCV,,,
KEY_YEN,124,JIS_Yen,0x5d,0x7d,0x6a,0x5d,137,,,0x7d,0x7d,,,IntlYen,AE13,yen,,
KEY_LEFTMETA,125,Command,0x37,0xe05b,0xe01f,0x8b,227,VK_LWIN,0x5b,0x6b,0x6b,XK_Meta_L,0xffe7,MetaLeft,LMTA,meta_l,0x78,0x37
KEY_LEFTMETA,125,Command,0x37,0xe05b,0xe01f,0x8b,227,VK_LWIN,0x5b,0x6b,0x6b,XK_Meta_L,0xffe7,MetaLeft,LWIN,meta_l,0x78,0x37
@@ -250,8 +250,8 @@ KEY_ISO,170,ISO_Section,0xa,,,,,,,,,,,,I178,,,
KEY_CONFIG,171,,,0xe001,,,,,,,,,,,I179,,,
KEY_HOMEPAGE,172,,,0xe032,0xe03a,0x97,,VK_BROWSER_HOME,0xac,,,,,BrowserHome,I180,ac_home,,
KEY_REFRESH,173,,,0xe067,0xe020,,250,VK_BROWSER_REFRESH,0xa8,,,,,BrowserRefresh,I181,ac_refresh,,
-KEY_EXIT,174,,,0x71,,,,,,,,,,,I182,,,
-KEY_MOVE,175,,,0x72,,,,,,,,,,,I183,,,
+KEY_EXIT,174,,,,,,,,,,,,,,I182,,,
+KEY_MOVE,175,,,,,,,,,,,,,,I183,,,
KEY_EDIT,176,,,0xe008,,,247,,,,,,,,I184,,,
KEY_SCROLLUP,177,,,0x75,,,245,,,,,,,,I185,,,
KEY_SCROLLDOWN,178,,,0xe00f,,,246,,,,,,,,I186,,,
diff --git a/keycodemapdb/meson.build b/keycodemapdb/meson.build
new file mode 100644
index 0000000..eb9416b
--- /dev/null
+++ b/keycodemapdb/meson.build
@@ -0,0 +1 @@
+project('keycodemapdb')
diff --git a/keycodemapdb/tests/Makefile b/keycodemapdb/tests/Makefile
index b25c77c..e1b3875 100644
--- a/keycodemapdb/tests/Makefile
+++ b/keycodemapdb/tests/Makefile
@@ -13,49 +13,81 @@ SOURCES := $(GEN) $(DATA)
.DELETE_ON_ERROR:
-stdc: stdc.c osx2win32.h osx2win32_name.h \
- osx2xkb.h osx2xkb_name.h \
- html2win32.h html2win32_name.h \
- osx.h osx_name.h
- $(CC) -Wall -o $@ $^
-osx2win32.h: $(SOURCES)
+stdc: stdc.c osx2win32.h osx2win32.c osx2win32_name.h osx2win32_name.c \
+ osx2xkb.h osx2xkb.c osx2xkb_name.h osx2xkb_name.c \
+ html2win32.h html2win32.c html2win32_name.h html2win32_name.c \
+ osx.h osx.c osx_name.h osx_name.c
+ $(CC) -Wall -o $@ $(filter %.c, $^)
+osx2win32.c: $(SOURCES)
$(GEN) --lang stdc code-map $(DATA) osx win32 > $@
-osx2win32_name.h: $(SOURCES)
+osx2win32.h: $(SOURCES)
+ $(GEN) --lang stdc-header code-map $(DATA) osx win32 > $@
+osx2win32_name.c: $(SOURCES)
$(GEN) --lang stdc name-map $(DATA) osx win32 > $@
-osx2xkb.h: $(SOURCES)
+osx2win32_name.h: $(SOURCES)
+ $(GEN) --lang stdc-header name-map $(DATA) osx win32 > $@
+osx2xkb.c: $(SOURCES)
$(GEN) --lang stdc code-map $(DATA) osx xkb > $@
-osx2xkb_name.h: $(SOURCES)
+osx2xkb.h: $(SOURCES)
+ $(GEN) --lang stdc-header code-map $(DATA) osx xkb > $@
+osx2xkb_name.c: $(SOURCES)
$(GEN) --lang stdc name-map $(DATA) osx xkb > $@
-html2win32.h: $(SOURCES)
+osx2xkb_name.h: $(SOURCES)
+ $(GEN) --lang stdc-header name-map $(DATA) osx xkb > $@
+html2win32.c: $(SOURCES)
$(GEN) --lang stdc code-map $(DATA) html win32 > $@
-html2win32_name.h: $(SOURCES)
+html2win32.h: $(SOURCES)
+ $(GEN) --lang stdc-header code-map $(DATA) html win32 > $@
+html2win32_name.c: $(SOURCES)
$(GEN) --lang stdc name-map $(DATA) html win32 > $@
-osx.h: $(SOURCES)
+html2win32_name.h: $(SOURCES)
+ $(GEN) --lang stdc-header name-map $(DATA) html win32 > $@
+osx.c: $(SOURCES)
$(GEN) --lang stdc code-table $(DATA) osx > $@
-osx_name.h: $(SOURCES)
+osx.h: $(SOURCES)
+ $(GEN) --lang stdc-header code-table $(DATA) osx > $@
+osx_name.c: $(SOURCES)
$(GEN) --lang stdc name-table $(DATA) osx > $@
+osx_name.h: $(SOURCES)
+ $(GEN) --lang stdc-header name-table $(DATA) osx > $@
-stdc++: stdc++.cc osx2win32.hh osx2win32_name.hh \
- osx2xkb.hh osx2xkb_name.hh \
- html2win32.hh html2win32_name.hh \
- osx.hh osx_name.hh
- $(CXX) -Wall -std=c++11 -o $@ $^
-osx2win32.hh: $(SOURCES)
+stdc++: stdc++.cc osx2win32.hh osx2win32.cc osx2win32_name.hh osx2win32_name.cc \
+ osx2xkb.hh osx2xkb.cc osx2xkb_name.hh osx2xkb_name.cc \
+ html2win32.hh html2win32.cc html2win32_name.hh html2win32_name.cc \
+ osx.hh osx.cc osx_name.hh osx_name.cc
+ $(CXX) -Wall -std=c++11 -o $@ $(filter %.cc, $^)
+osx2win32.cc: $(SOURCES)
$(GEN) --lang stdc++ code-map $(DATA) osx win32 > $@
-osx2win32_name.hh: $(SOURCES)
+osx2win32.hh: $(SOURCES)
+ $(GEN) --lang stdc++-header code-map $(DATA) osx win32 > $@
+osx2win32_name.cc: $(SOURCES)
$(GEN) --lang stdc++ name-map $(DATA) osx win32 > $@
-osx2xkb.hh: $(SOURCES)
+osx2win32_name.hh: $(SOURCES)
+ $(GEN) --lang stdc++-header name-map $(DATA) osx win32 > $@
+osx2xkb.cc: $(SOURCES)
$(GEN) --lang stdc++ code-map $(DATA) osx xkb > $@
-osx2xkb_name.hh: $(SOURCES)
+osx2xkb.hh: $(SOURCES)
+ $(GEN) --lang stdc++-header code-map $(DATA) osx xkb > $@
+osx2xkb_name.cc: $(SOURCES)
$(GEN) --lang stdc++ name-map $(DATA) osx xkb > $@
-html2win32.hh: $(SOURCES)
+osx2xkb_name.hh: $(SOURCES)
+ $(GEN) --lang stdc++-header name-map $(DATA) osx xkb > $@
+html2win32.cc: $(SOURCES)
$(GEN) --lang stdc++ code-map $(DATA) html win32 > $@
-html2win32_name.hh: $(SOURCES)
+html2win32.hh: $(SOURCES)
+ $(GEN) --lang stdc++-header code-map $(DATA) html win32 > $@
+html2win32_name.cc: $(SOURCES)
$(GEN) --lang stdc++ name-map $(DATA) html win32 > $@
-osx.hh: $(SOURCES)
+html2win32_name.hh: $(SOURCES)
+ $(GEN) --lang stdc++-header name-map $(DATA) html win32 > $@
+osx.cc: $(SOURCES)
$(GEN) --lang stdc++ code-table $(DATA) osx > $@
-osx_name.hh: $(SOURCES)
+osx.hh: $(SOURCES)
+ $(GEN) --lang stdc++-header code-table $(DATA) osx > $@
+osx_name.cc: $(SOURCES)
$(GEN) --lang stdc++ name-table $(DATA) osx > $@
+osx_name.hh: $(SOURCES)
+ $(GEN) --lang stdc++-header name-table $(DATA) osx > $@
python2: osx2win32.py osx2win32_name.py \
osx2xkb.py osx2xkb_name.py \
diff --git a/keycodemapdb/tools/keymap-gen b/keycodemapdb/tools/keymap-gen
index f0269e3..22b4f71 100755
--- a/keycodemapdb/tools/keymap-gen
+++ b/keycodemapdb/tools/keymap-gen
@@ -317,9 +317,8 @@ class LanguageGenerator(object):
raise NotImplementedError()
def generate_header(self, database, args):
- today = time.strftime("%Y-%m-%d %H:%M")
self._boilerplate([
- "This file is auto-generated from keymaps.csv on %s" % today,
+ "This file is auto-generated from keymaps.csv",
"Database checksum sha256(%s)" % database.mapchecksum,
"To re-generate, run:",
" %s" % args,
@@ -509,7 +508,7 @@ class LanguageDocGenerator(LanguageGenerator):
def _array_code_entry(self, value, name):
raise NotImplementedError()
- def generate_name_docs(self, varname, database, mapname):
+ def generate_name_docs(self, title, subtitle, database, mapname):
if mapname not in database.mapname:
raise Exception("Unknown map %s, expected one of %s" % (
mapname, ", ".join(database.mapname.keys())))
@@ -518,10 +517,12 @@ class LanguageDocGenerator(LanguageGenerator):
keys.sort()
names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for key in keys]
- if varname is None:
- varname = mapname
+ if title is None:
+ title = mapname
+ if subtitle is None:
+ subtitle = "Docs for %s" % mapname
- self._array_start_name_doc(varname, mapname)
+ self._array_start_name_doc(title, subtitle, mapname)
for i in range(len(keys)):
key = keys[i]
@@ -531,7 +532,7 @@ class LanguageDocGenerator(LanguageGenerator):
self._array_end()
- def generate_code_docs(self, varname, database, mapname):
+ def generate_code_docs(self, title, subtitle, database, mapname):
if mapname not in database.mapfrom:
raise Exception("Unknown map %s, expected one of %s" % (
mapname, ", ".join(database.mapfrom.keys())))
@@ -546,10 +547,12 @@ class LanguageDocGenerator(LanguageGenerator):
names = database.mapname[Database.MAP_LINUX]
namemap = Database.MAP_LINUX
- if varname is None:
- varname = mapname
+ if title is None:
+ title = mapname
+ if subtitle is None:
+ subtitle = "Docs for %s" % mapname
- self._array_start_code_doc(varname, mapname, namemap)
+ self._array_start_code_doc(title, subtitle, mapname, namemap)
for i in range(len(keys)):
key = keys[i]
@@ -623,6 +626,68 @@ class CLanguageGenerator(LanguageSrcGenerator):
else:
print((" {" + indexfmt + ", " + valuefmt + "}, /* %s */") % (index, value, comment))
+class StdCLanguageGenerator(CLanguageGenerator):
+
+ def __init__(self):
+ super(StdCLanguageGenerator, self).__init__("unsigned short", "char *", "unsigned int")
+
+class GLib2LanguageGenerator(CLanguageGenerator):
+
+ def __init__(self):
+ super(GLib2LanguageGenerator, self).__init__("guint16", "gchar *", "guint")
+
+class CHeaderLanguageGenerator(LanguageSrcGenerator):
+
+ def __init__(self, inttypename, strtypename, lentypename):
+ self.inttypename = inttypename
+ self.strtypename = strtypename
+ self.lentypename = lentypename
+
+ def _boilerplate(self, lines):
+ print("/*")
+ for line in lines:
+ print(" * %s" % line)
+ print("*/")
+
+ def _array_start(self, varname, length, defvalue, fromtype, totype):
+ self._varname = varname
+ if fromtype == self.TYPE_STRING:
+ self._length = 0
+ else:
+ self._length = length
+
+ def _array_end(self, fromtype, totype):
+ totypename = self.strtypename if totype == self.TYPE_STRING else self.inttypename
+ if fromtype == self.TYPE_STRING:
+ vartypename = "struct _%s" % self._varname
+ print("%s {" % vartypename)
+ print(" const %s from;" % self.strtypename)
+ print(" const %s to;" % totypename)
+ print("};")
+ else:
+ vartypename = totypename
+ if type(self._length) == str:
+ print("extern const %s %s[%s];" % (vartypename, self._varname, self._length))
+ else:
+ print("extern const %s %s[%d];" % (vartypename, self._varname, self._length))
+ print("extern const %s %s_len;" % (self.lentypename, self._varname))
+
+ def _array_entry(self, index, value, comment, fromtype, totype):
+ if value is None:
+ return
+ if fromtype == self.TYPE_STRING:
+ self._length += 1
+
+class StdCHeaderLanguageGenerator(CHeaderLanguageGenerator):
+
+ def __init__(self):
+ super(StdCHeaderLanguageGenerator, self).__init__("unsigned short", "char *", "unsigned int")
+
+class GLib2HeaderLanguageGenerator(CHeaderLanguageGenerator):
+
+ def __init__(self):
+ super(GLib2HeaderLanguageGenerator, self).__init__("guint16", "gchar *", "guint")
+
class CppLanguageGenerator(CLanguageGenerator):
def _array_start(self, varname, length, defvalue, fromtype, totype):
@@ -631,10 +696,12 @@ class CppLanguageGenerator(CLanguageGenerator):
totypename = "const " + self.strtypename if totype == self.TYPE_STRING else self.inttypename
if fromtype == self.TYPE_INT:
print("#include <vector>")
+ print("extern const std::vector<%s> %s;" % (totypename, varname));
print("const std::vector<%s> %s = {" % (totypename, varname))
else:
print("#include <map>")
print("#include <string>")
+ print("extern const std::map<const std::string, %s> %s;" % (totypename, varname))
print("const std::map<const std::string, %s> %s = {" % (totypename, varname))
def _array_end(self, fromtype, totype):
@@ -654,20 +721,36 @@ class CppLanguageGenerator(CLanguageGenerator):
else:
print(" \"%s\", /* %s */" % (value, comment))
-class StdCLanguageGenerator(CLanguageGenerator):
-
- def __init__(self):
- super(StdCLanguageGenerator, self).__init__("unsigned short", "char *", "unsigned int")
-
class StdCppLanguageGenerator(CppLanguageGenerator):
def __init__(self):
super(StdCppLanguageGenerator, self).__init__("unsigned short", "char *", "unsigned int")
-class GLib2LanguageGenerator(CLanguageGenerator):
+class CppHeaderLanguageGenerator(CHeaderLanguageGenerator):
+
+ def _array_start(self, varname, length, defvalue, fromtype, totype):
+ if fromtype == self.TYPE_ENUM:
+ raise NotImplementedError("Enums not supported as source in C++ generator")
+ totypename = "const " + self.strtypename if totype == self.TYPE_STRING else self.inttypename
+ if fromtype == self.TYPE_INT:
+ print("#include <vector>")
+ print("extern const std::vector<%s> %s;" % (totypename, varname));
+ else:
+ print("#include <map>")
+ print("#include <string>")
+ print("extern const std::map<const std::string, %s> %s;" % (totypename, varname))
+
+ def _array_end(self, fromtype, totype):
+ pass
+
+ # designated initializers not available in C++
+ def _array_entry(self, index, value, comment, fromtype, totype):
+ pass
+
+class StdCppHeaderLanguageGenerator(CppHeaderLanguageGenerator):
def __init__(self):
- super(GLib2LanguageGenerator, self).__init__("guint16", "gchar *", "guint")
+ super(StdCppHeaderLanguageGenerator, self).__init__("unsigned short", "char *", "unsigned int")
class PythonLanguageGenerator(LanguageSrcGenerator):
@@ -793,16 +876,24 @@ class PodLanguageGenerator(LanguageDocGenerator):
print("# %s" % line)
print("#")
- def _array_start_name_doc(self, varname, namemap):
- print("=head1 %s" % varname)
+ def _array_start_name_doc(self, title, subtitle, namemap):
+ print("=head1 NAME")
+ print("")
+ print("%s - %s" % (title, subtitle))
+ print("")
+ print("=head1 DESCRIPTION")
print("")
print("List of %s key code names, with corresponding key code values" % namemap)
print("")
print("=over 4")
print("")
- def _array_start_code_doc(self, varname, codemap, namemap):
- print("=head1 %s" % varname)
+ def _array_start_code_doc(self, title, subtitle, codemap, namemap):
+ print("=head1 NAME")
+ print("")
+ print("%s - %s" % (title, subtitle))
+ print("")
+ print("=head1 DESCRIPTION")
print("")
print("List of %s key code values, with corresponding %s key code names" % (codemap, namemap))
print("")
@@ -825,10 +916,70 @@ class PodLanguageGenerator(LanguageDocGenerator):
print("Key name %s" % name)
print("")
+class RSTLanguageGenerator(LanguageDocGenerator):
+
+ def _boilerplate(self, lines):
+ print("..")
+ for line in lines:
+ print(" %s" % line)
+ print("")
+
+ def _array_start_name_doc(self, title, subtitle, namemap):
+ print("=" * len(title))
+ print(title)
+ print("=" * len(title))
+ print("")
+ print("-" * len(subtitle))
+ print(subtitle)
+ print("-" * len(subtitle))
+ print("")
+ print(":Manual section: 7")
+ print(":Manual group: Virtualization Support")
+ print("")
+ print("DESCRIPTION")
+ print("===========")
+ print("List of %s key code names, with corresponding key code values" % namemap)
+ print("")
+
+ def _array_start_code_doc(self, title, subtitle, codemap, namemap):
+ print("=" * len(title))
+ print(title)
+ print("=" * len(title))
+ print("")
+ print("-" * len(subtitle))
+ print(subtitle)
+ print("-" * len(subtitle))
+ print("")
+ print(":Manual section: 7")
+ print(":Manual group: Virtualization Support")
+ print("")
+ print("DESCRIPTION")
+ print("===========")
+ print("List of %s key code values, with corresponding %s key code names" % (codemap, namemap))
+ print("")
+
+ def _array_end(self):
+ print("")
+
+ def _array_name_entry(self, value, name):
+ print("* %s" % name)
+ print("")
+ print(" Key value %d (0x%x)" % (value, value))
+ print("")
+
+ def _array_code_entry(self, value, name):
+ print("* %d (0x%x)" % (value, value))
+ print("")
+ print(" Key name %s" % name)
+ print("")
+
SRC_GENERATORS = {
"stdc": StdCLanguageGenerator(),
+ "stdc-header": StdCHeaderLanguageGenerator(),
"stdc++": StdCppLanguageGenerator(),
+ "stdc++-header": StdCppHeaderLanguageGenerator(),
"glib2": GLib2LanguageGenerator(),
+ "glib2-header": GLib2HeaderLanguageGenerator(),
"python2": PythonLanguageGenerator(),
"python3": PythonLanguageGenerator(),
"perl": PerlLanguageGenerator(),
@@ -836,16 +987,17 @@ SRC_GENERATORS = {
}
DOC_GENERATORS = {
"pod": PodLanguageGenerator(),
+ "rst": RSTLanguageGenerator(),
}
def code_map(args):
database = Database()
database.load(args.keymaps)
- cliargs = ["keymap-gen", "--lang=%s" % args.lang]
+ cliargs = ["keymap-gen", "code-map", "--lang=%s" % args.lang]
if args.varname is not None:
cliargs.append("--varname=%s" % args.varname)
- cliargs.extend(["code-map", "keymaps.csv", args.frommapname, args.tomapname])
+ cliargs.extend(["keymaps.csv", args.frommapname, args.tomapname])
SRC_GENERATORS[args.lang].generate_header(database, " ".join(cliargs))
SRC_GENERATORS[args.lang].generate_code_map(args.varname, database, args.frommapname, args.tomapname)
@@ -854,10 +1006,10 @@ def code_table(args):
database = Database()
database.load(args.keymaps)
- cliargs = ["keymap-gen", "--lang=%s" % args.lang]
+ cliargs = ["keymap-gen", "code-table", "--lang=%s" % args.lang]
if args.varname is not None:
cliargs.append("--varname=%s" % args.varname)
- cliargs.extend(["code-table", "keymaps.csv", args.mapname])
+ cliargs.extend(["keymaps.csv", args.mapname])
SRC_GENERATORS[args.lang].generate_header(database, " ".join(cliargs))
SRC_GENERATORS[args.lang].generate_code_table(args.varname, database, args.mapname)
@@ -866,10 +1018,10 @@ def name_map(args):
database = Database()
database.load(args.keymaps)
- cliargs = ["keymap-gen", "--lang=%s" % args.lang]
+ cliargs = ["keymap-gen", "name-map", "--lang=%s" % args.lang]
if args.varname is not None:
cliargs.append("--varname=%s" % args.varname)
- cliargs.extend(["name-map", "keymaps.csv", args.frommapname, args.tomapname])
+ cliargs.extend(["keymaps.csv", args.frommapname, args.tomapname])
SRC_GENERATORS[args.lang].generate_header(database, " ".join(cliargs))
SRC_GENERATORS[args.lang].generate_name_map(args.varname, database, args.frommapname, args.tomapname)
@@ -879,10 +1031,10 @@ def name_table(args):
database.load(args.keymaps)
- cliargs = ["keymap-gen", "--lang=%s" % args.lang]
+ cliargs = ["keymap-gen", "name-table", "--lang=%s" % args.lang]
if args.varname is not None:
cliargs.append("--varname=%s" % args.varname)
- cliargs.extend(["name-table", "keymaps.csv", args.mapname])
+ cliargs.extend(["keymaps.csv", args.mapname])
SRC_GENERATORS[args.lang].generate_header(database, " ".join(cliargs))
SRC_GENERATORS[args.lang].generate_name_table(args.varname, database, args.mapname)
@@ -892,26 +1044,30 @@ def code_docs(args):
database.load(args.keymaps)
- cliargs = ["keymap-gen", "--lang=%s" % args.lang]
- if args.varname is not None:
- cliargs.append("--varname=%s" % args.varname)
- cliargs.extend(["code-docs", "keymaps.csv", args.mapname])
+ cliargs = ["keymap-gen", "code-docs", "--lang=%s" % args.lang]
+ if args.title is not None:
+ cliargs.append("--title=%s" % args.title)
+ if args.subtitle is not None:
+ cliargs.append("--subtitle=%s" % args.subtitle)
+ cliargs.extend(["keymaps.csv", args.mapname])
DOC_GENERATORS[args.lang].generate_header(database, " ".join(cliargs))
- DOC_GENERATORS[args.lang].generate_code_docs(args.varname, database, args.mapname)
+ DOC_GENERATORS[args.lang].generate_code_docs(args.title, args.subtitle, database, args.mapname)
def name_docs(args):
database = Database()
database.load(args.keymaps)
- cliargs = ["keymap-gen", "--lang=%s" % args.lang]
- if args.varname is not None:
- cliargs.append("--varname=%s" % args.varname)
- cliargs.extend(["name-docs", "keymaps.csv", args.mapname])
+ cliargs = ["keymap-gen", "name-docs", "--lang=%s" % args.lang]
+ if args.title is not None:
+ cliargs.append("--title=%s" % args.title)
+ if args.subtitle is not None:
+ cliargs.append("--subtitle=%s" % args.subtitle)
+ cliargs.extend(["keymaps.csv", args.mapname])
DOC_GENERATORS[args.lang].generate_header(database, " ".join(cliargs))
- DOC_GENERATORS[args.lang].generate_name_docs(args.varname, database, args.mapname)
+ DOC_GENERATORS[args.lang].generate_name_docs(args.title, args.subtitle, database, args.mapname)
def usage():
print ("Please select a command:")
@@ -921,43 +1077,62 @@ def usage():
def main():
parser = argparse.ArgumentParser()
- parser.add_argument("--lang", default="stdc",
- help="Output language, (src=%s, doc=%s)" % (
- ",".join(SRC_GENERATORS.keys()),
- ",".join(DOC_GENERATORS.keys())))
- parser.add_argument("--varname", default=None,
- help="Data variable name")
-
subparsers = parser.add_subparsers(help="sub-command help")
codemapparser = subparsers.add_parser("code-map", help="Generate a mapping between code tables")
+ codemapparser.add_argument("--varname", default=None, help="Data variable name")
+ codemapparser.add_argument("--lang", default="stdc",
+ help="Output language (%s)" % (
+ ",".join(SRC_GENERATORS.keys())))
codemapparser.add_argument("keymaps", help="Path to keymap CSV data file")
codemapparser.add_argument("frommapname", help="Source code table name")
codemapparser.add_argument("tomapname", help="Target code table name")
codemapparser.set_defaults(func=code_map)
codetableparser = subparsers.add_parser("code-table", help="Generate a flat code table")
+ codetableparser.add_argument("--lang", default="stdc",
+ help="Output language (%s)" % (
+ ",".join(SRC_GENERATORS.keys())))
+ codetableparser.add_argument("--varname", default=None, help="Data variable name")
codetableparser.add_argument("keymaps", help="Path to keymap CSV data file")
codetableparser.add_argument("mapname", help="Code table name")
codetableparser.set_defaults(func=code_table)
namemapparser = subparsers.add_parser("name-map", help="Generate a mapping to names")
+ namemapparser.add_argument("--lang", default="stdc",
+ help="Output language (%s)" % (
+ ",".join(SRC_GENERATORS.keys())))
+ namemapparser.add_argument("--varname", default=None, help="Data variable name")
namemapparser.add_argument("keymaps", help="Path to keymap CSV data file")
namemapparser.add_argument("frommapname", help="Source code table name")
namemapparser.add_argument("tomapname", help="Target name table name")
namemapparser.set_defaults(func=name_map)
nametableparser = subparsers.add_parser("name-table", help="Generate a flat name table")
+ nametableparser.add_argument("--lang", default="stdc",
+ help="Output language, (%s)" % (
+ ",".join(SRC_GENERATORS.keys())))
+ nametableparser.add_argument("--varname", default=None, help="Data variable name")
nametableparser.add_argument("keymaps", help="Path to keymap CSV data file")
nametableparser.add_argument("mapname", help="Name table name")
nametableparser.set_defaults(func=name_table)
codedocsparser = subparsers.add_parser("code-docs", help="Generate code documentation")
+ codedocsparser.add_argument("--lang", default="pod",
+ help="Output language (%s)" % (
+ ",".join(DOC_GENERATORS.keys())))
+ codedocsparser.add_argument("--title", default=None, help="Document title")
+ codedocsparser.add_argument("--subtitle", default=None, help="Document subtitle")
codedocsparser.add_argument("keymaps", help="Path to keymap CSV data file")
codedocsparser.add_argument("mapname", help="Code table name")
codedocsparser.set_defaults(func=code_docs)
namedocsparser = subparsers.add_parser("name-docs", help="Generate name documentation")
+ namedocsparser.add_argument("--lang", default="pod",
+ help="Output language (%s)" % (
+ ",".join(DOC_GENERATORS.keys())))
+ namedocsparser.add_argument("--title", default=None, help="Document title")
+ namedocsparser.add_argument("--subtitle", default=None, help="Document subtitle")
namedocsparser.add_argument("keymaps", help="Path to keymap CSV data file")
namedocsparser.add_argument("mapname", help="Name table name")
namedocsparser.set_defaults(func=name_docs)
--
2.20.1
^ permalink raw reply [flat|nested] 5+ messages in thread