From 53e83913af9e99bcef3501055f65b797d34bdc7b Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 30 Aug 2018 15:00:07 +0200 Subject: [PATCH] bump version to 3.0.0-1 Signed-off-by: Wolfgang Bumiller --- Makefile | 4 +- debian/changelog | 6 + ...YS-signal-instead-of-killing-the-thr.patch | 47 ++ ...it-don-t-align-wait-time-with-slices.patch | 47 -- ...r-SCMP_ACT_KILL_PROCESS-if-available.patch | 90 +++ ...3-configure-require-libseccomp-2.2.0.patch | 53 ++ ...et-the-seccomp-filter-to-all-threads.patch | 57 ++ ...or-create-iothread-after-daemonizing.patch | 73 ++ ...-file-change-locking-default-to-off.patch} | 8 +- ...just-network-script-path-to-etc-kvm.patch} | 6 +- ... 0003-PVE-Config-use-kvm-by-default.patch} | 6 +- ...e-CPU-model-to-kvm64-32-instead-of-.patch} | 9 +- ...i-spice-default-to-pve-certificates.patch} | 6 +- ...0006-PVE-Config-smm_available-false.patch} | 6 +- ...rfs-no-default-logfile-if-daemonize.patch} | 10 +- ...ock-rbd-disable-rbd_cache_writethro.patch} | 24 +- ...0009-PVE-Up-qmp-add-get_link_status.patch} | 27 +- ...VE-Up-glusterfs-allow-partial-reads.patch} | 16 +- ...eturn-success-on-info-without-snaps.patch} | 6 +- ...d-add-osize-and-read-from-to-stdin-.patch} | 23 +- ...-Up-qemu-img-dd-add-isize-parameter.patch} | 14 +- ...VE-Up-qemu-img-dd-add-n-skip_create.patch} | 12 +- ...space-between-VERSION-and-PKGVERSION.patch | 27 - ...irtio-balloon-improve-query-balloon.patch} | 22 +- .../pve/0015-vnc-altgr-emulation.patch | 65 -- ...0016-PVE-qapi-modify-query-machines.patch} | 22 +- .../0016-vnc-make-x509-imply-tls-again.patch | 28 - ...=> 0017-PVE-qapi-modify-spice-query.patch} | 14 +- .../pve/0017-vnc-PVE-VNC-authentication.patch | 682 ------------------ ...=> 0018-PVE-internal-snapshot-async.patch} | 162 ++--- ...e-rbd_cache_writethrough_until_flush.patch | 29 - ...PVE-convert-savevm-async-to-threads.patch} | 38 +- ...t-qmp_snapshot_drive-add-aiocontext.patch} | 10 +- ...t-qmp_delete_drive_snapshot-add-aio.patch} | 9 +- ...dd-the-zeroinit-block-driver-filter.patch} | 31 +- ...h => 0023-PVE-backup-modify-job-api.patch} | 70 +- ...backup-introduce-vma-archive-format.patch} | 192 +++-- ...PVE-Deprecated-adding-old-vma-files.patch} | 331 +++++---- ...tling-options-to-drive-mapping-fifo.patch} | 32 +- ...-vma-add-cache-option-to-device-map.patch} | 34 +- ...E-vma-remove-forced-NO_FLUSH-option.patch} | 6 +- ...-Add-dummy-id-command-line-parameter.patch | 57 ++ ...-target-i386-disable-LINT0-after-re.patch} | 2 +- debian/patches/series | 70 +- keycodemapdb/data/keymaps.csv | 8 +- keycodemapdb/tools/keymap-gen | 18 +- qemu | 2 +- 47 files changed, 1041 insertions(+), 1470 deletions(-) create mode 100644 debian/patches/extra/0001-seccomp-use-SIGSYS-signal-instead-of-killing-the-thr.patch delete mode 100644 debian/patches/extra/0002-ratelimit-don-t-align-wait-time-with-slices.patch create mode 100644 debian/patches/extra/0002-seccomp-prefer-SCMP_ACT_KILL_PROCESS-if-available.patch create mode 100644 debian/patches/extra/0003-configure-require-libseccomp-2.2.0.patch create mode 100644 debian/patches/extra/0004-seccomp-set-the-seccomp-filter-to-all-threads.patch create mode 100644 debian/patches/extra/0005-monitor-create-iothread-after-daemonizing.patch rename debian/patches/pve/{0001-block-file-change-locking-default-to-off.patch => 0001-PVE-Config-block-file-change-locking-default-to-off.patch} (82%) rename debian/patches/pve/{0002-Adjust-network-script-path-to-etc-kvm.patch => 0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch} (82%) rename debian/patches/pve/{0004-use-kvm-by-default.patch => 0003-PVE-Config-use-kvm-by-default.patch} (83%) rename debian/patches/pve/{0006-set-the-CPU-model-to-kvm64-32-instead-of-qemu64-32.patch => 0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch} (75%) rename debian/patches/pve/{0009-ui-spice-default-to-pve-certs-unless-otherwise-speci.patch => 0005-PVE-Config-ui-spice-default-to-pve-certificates.patch} (91%) rename debian/patches/pve/{0013-smm_available-false.patch => 0006-PVE-Config-smm_available-false.patch} (79%) rename debian/patches/pve/{0021-glusterfs-no-default-logfile-if-daemonized.patch => 0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch} (83%) rename debian/patches/pve/{0032-rbd-fix-cache-mode-behavior.patch => 0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch} (53%) rename debian/patches/pve/{0012-qmp-add-get_link_status.patch => 0009-PVE-Up-qmp-add-get_link_status.patch} (68%) rename debian/patches/pve/{0022-glusterfs-allow-partial-reads.patch => 0010-PVE-Up-glusterfs-allow-partial-reads.patch} (84%) rename debian/patches/pve/{0003-qemu-img-return-success-on-info-without-snapshots.patch => 0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch} (76%) rename debian/patches/pve/{0024-qemu-img-dd-add-osize-and-read-from-to-stdin-stdout.patch => 0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch} (94%) rename debian/patches/pve/{0029-qemu-img-dd-add-isize-parameter.patch => 0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch} (87%) rename debian/patches/pve/{0030-qemu-img-dd-add-n-skip_create.patch => 0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch} (84%) delete mode 100644 debian/patches/pve/0014-use-whitespace-between-VERSION-and-PKGVERSION.patch rename debian/patches/pve/{0005-virtio-balloon-fix-query.patch => 0015-PVE-virtio-balloon-improve-query-balloon.patch} (90%) delete mode 100644 debian/patches/pve/0015-vnc-altgr-emulation.patch rename debian/patches/pve/{0007-qapi-modify-query-machines.patch => 0016-PVE-qapi-modify-query-machines.patch} (76%) delete mode 100644 debian/patches/pve/0016-vnc-make-x509-imply-tls-again.patch rename debian/patches/pve/{0008-qapi-modify-spice-query.patch => 0017-PVE-qapi-modify-spice-query.patch} (82%) delete mode 100644 debian/patches/pve/0017-vnc-PVE-VNC-authentication.patch rename debian/patches/pve/{0010-internal-snapshot-async.patch => 0018-PVE-internal-snapshot-async.patch} (93%) delete mode 100644 debian/patches/pve/0018-block-rbd-disable-rbd_cache_writethrough_until_flush.patch rename debian/patches/pve/{0011-convert-savevm-async-to-threads.patch => 0019-PVE-convert-savevm-async-to-threads.patch} (85%) rename debian/patches/pve/{0019-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch => 0020-PVE-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch} (83%) rename debian/patches/pve/{0020-block-snapshot-qmp_delete_drive_snapshot-add-aiocont.patch => 0021-PVE-block-snapshot-qmp_delete_drive_snapshot-add-aio.patch} (85%) rename debian/patches/pve/{0023-block-add-the-zeroinit-block-driver-filter.patch => 0022-PVE-block-add-the-zeroinit-block-driver-filter.patch} (88%) rename debian/patches/pve/{0025-backup-modify-job-api.patch => 0023-PVE-backup-modify-job-api.patch} (63%) rename debian/patches/pve/{0026-backup-introduce-vma-archive-format.patch => 0024-PVE-backup-introduce-vma-archive-format.patch} (90%) rename debian/patches/pve/{0027-adding-old-vma-files.patch => 0025-PVE-Deprecated-adding-old-vma-files.patch} (91%) rename debian/patches/pve/{0028-vma-add-throttling-options-to-drive-mapping-fifo-pro.patch => 0026-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch} (84%) rename debian/patches/pve/{0031-vma-add-cache-option-to-device-map.patch => 0027-PVE-vma-add-cache-option-to-device-map.patch} (75%) rename debian/patches/pve/{0033-vma-remove-forced-NO_FLUSH-option.patch => 0028-PVE-vma-remove-forced-NO_FLUSH-option.patch} (83%) create mode 100644 debian/patches/pve/0029-PVE-Add-dummy-id-command-line-parameter.patch rename debian/patches/{extra/0001-Revert-target-i386-disable-LINT0-after-reset.patch => pve/0030-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch} (92%) diff --git a/Makefile b/Makefile index 385a64d..73d9ddd 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # also update debian/changelog -KVMVER=2.11.2 -KVMPKGREL=1 +KVMVER=3.0.0 +KVMPKGREL=1~pvetest2 KVMPACKAGE = pve-qemu-kvm KVMSRC = qemu diff --git a/debian/changelog b/debian/changelog index 1da893b..5da43ab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +pve-qemu-kvm (3.0.0-1~pvetest2) unstable; urgency=medium + + * update to 3.0.0 + + -- Proxmox Support Team Thu, 30 Aug 2018 14:59:49 +0200 + pve-qemu-kvm (2.11.2-1) stable; urgency=medium * update to 2.11.2 diff --git a/debian/patches/extra/0001-seccomp-use-SIGSYS-signal-instead-of-killing-the-thr.patch b/debian/patches/extra/0001-seccomp-use-SIGSYS-signal-instead-of-killing-the-thr.patch new file mode 100644 index 0000000..5bdc035 --- /dev/null +++ b/debian/patches/extra/0001-seccomp-use-SIGSYS-signal-instead-of-killing-the-thr.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Wed, 22 Aug 2018 19:02:47 +0200 +Subject: [PATCH] seccomp: use SIGSYS signal instead of killing the thread +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The seccomp action SCMP_ACT_KILL results in immediate termination of +the thread that made the bad system call. However, qemu being +multi-threaded, it keeps running. There is no easy way for parent +process / management layer (libvirt) to know about that situation. + +Instead, the default SIGSYS handler when invoked with SCMP_ACT_TRAP +will terminate the program and core dump. + +This may not be the most secure solution, but probably better than +just killing the offending thread. SCMP_ACT_KILL_PROCESS has been +added in Linux 4.14 to improve the situation, which I propose to use +by default if available in the next patch. + +Related to: +https://bugzilla.redhat.com/show_bug.cgi?id=1594456 + +Signed-off-by: Marc-André Lureau +Reviewed-by: Daniel P. Berrangé +Acked-by: Eduardo Otubo +--- + qemu-seccomp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/qemu-seccomp.c b/qemu-seccomp.c +index 9cd8eb9499..b117a92559 100644 +--- a/qemu-seccomp.c ++++ b/qemu-seccomp.c +@@ -125,7 +125,7 @@ static int seccomp_start(uint32_t seccomp_opts) + continue; + } + +- rc = seccomp_rule_add_array(ctx, SCMP_ACT_KILL, blacklist[i].num, ++ rc = seccomp_rule_add_array(ctx, SCMP_ACT_TRAP, blacklist[i].num, + blacklist[i].narg, blacklist[i].arg_cmp); + if (rc < 0) { + goto seccomp_return; +-- +2.11.0 + diff --git a/debian/patches/extra/0002-ratelimit-don-t-align-wait-time-with-slices.patch b/debian/patches/extra/0002-ratelimit-don-t-align-wait-time-with-slices.patch deleted file mode 100644 index 9502552..0000000 --- a/debian/patches/extra/0002-ratelimit-don-t-align-wait-time-with-slices.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Wolfgang Bumiller -Date: Tue, 6 Feb 2018 11:34:34 +0100 -Subject: [PATCH] ratelimit: don't align wait time with slices - -It is possible for rate limited writes to keep overshooting a slice's -quota by a tiny amount causing the slice-aligned waiting period to -effectively halve the rate. - -Signed-off-by: Wolfgang Bumiller ---- - include/qemu/ratelimit.h | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/include/qemu/ratelimit.h b/include/qemu/ratelimit.h -index 8dece483f5..1b38291823 100644 ---- a/include/qemu/ratelimit.h -+++ b/include/qemu/ratelimit.h -@@ -36,7 +36,7 @@ typedef struct { - static inline int64_t ratelimit_calculate_delay(RateLimit *limit, uint64_t n) - { - int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); -- uint64_t delay_slices; -+ double delay_slices; - - assert(limit->slice_quota && limit->slice_ns); - -@@ -55,12 +55,11 @@ static inline int64_t ratelimit_calculate_delay(RateLimit *limit, uint64_t n) - return 0; - } - -- /* Quota exceeded. Calculate the next time slice we may start -- * sending data again. */ -- delay_slices = (limit->dispatched + limit->slice_quota - 1) / -- limit->slice_quota; -+ /* Quota exceeded. Wait based on the excess amount and then start a new -+ * slice. */ -+ delay_slices = (double)limit->dispatched / limit->slice_quota; - limit->slice_end_time = limit->slice_start_time + -- delay_slices * limit->slice_ns; -+ (uint64_t)(delay_slices * limit->slice_ns); - return limit->slice_end_time - now; - } - --- -2.11.0 - diff --git a/debian/patches/extra/0002-seccomp-prefer-SCMP_ACT_KILL_PROCESS-if-available.patch b/debian/patches/extra/0002-seccomp-prefer-SCMP_ACT_KILL_PROCESS-if-available.patch new file mode 100644 index 0000000..7f8ce25 --- /dev/null +++ b/debian/patches/extra/0002-seccomp-prefer-SCMP_ACT_KILL_PROCESS-if-available.patch @@ -0,0 +1,90 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Wed, 22 Aug 2018 19:02:48 +0200 +Subject: [PATCH] seccomp: prefer SCMP_ACT_KILL_PROCESS if available +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The upcoming libseccomp release should have SCMP_ACT_KILL_PROCESS +action (https://github.com/seccomp/libseccomp/issues/96). + +SCMP_ACT_KILL_PROCESS is preferable to immediately terminate the +offending process, rather than having the SIGSYS handler running. + +Use SECCOMP_GET_ACTION_AVAIL to check availability of kernel support, +as libseccomp will fallback on SCMP_ACT_KILL otherwise, and we still +prefer SCMP_ACT_TRAP. + +Signed-off-by: Marc-André Lureau +Reviewed-by: Daniel P. Berrangé +Acked-by: Eduardo Otubo +--- + qemu-seccomp.c | 31 ++++++++++++++++++++++++++++++- + 1 file changed, 30 insertions(+), 1 deletion(-) + +diff --git a/qemu-seccomp.c b/qemu-seccomp.c +index b117a92559..f0c833f3ca 100644 +--- a/qemu-seccomp.c ++++ b/qemu-seccomp.c +@@ -20,6 +20,7 @@ + #include + #include + #include "sysemu/seccomp.h" ++#include + + /* For some architectures (notably ARM) cacheflush is not supported until + * libseccomp 2.2.3, but configure enforces that we are using a more recent +@@ -107,12 +108,40 @@ static const struct QemuSeccompSyscall blacklist[] = { + { SCMP_SYS(sched_get_priority_min), QEMU_SECCOMP_SET_RESOURCECTL }, + }; + ++static inline __attribute__((unused)) int ++qemu_seccomp(unsigned int operation, unsigned int flags, void *args) ++{ ++#ifdef __NR_seccomp ++ return syscall(__NR_seccomp, operation, flags, args); ++#else ++ errno = ENOSYS; ++ return -1; ++#endif ++} ++ ++static uint32_t qemu_seccomp_get_kill_action(void) ++{ ++#if defined(SECCOMP_GET_ACTION_AVAIL) && defined(SCMP_ACT_KILL_PROCESS) && \ ++ defined(SECCOMP_RET_KILL_PROCESS) ++ { ++ uint32_t action = SECCOMP_RET_KILL_PROCESS; ++ ++ if (qemu_seccomp(SECCOMP_GET_ACTION_AVAIL, 0, &action) == 0) { ++ return SCMP_ACT_KILL_PROCESS; ++ } ++ } ++#endif ++ ++ return SCMP_ACT_TRAP; ++} ++ + + static int seccomp_start(uint32_t seccomp_opts) + { + int rc = 0; + unsigned int i = 0; + scmp_filter_ctx ctx; ++ uint32_t action = qemu_seccomp_get_kill_action(); + + ctx = seccomp_init(SCMP_ACT_ALLOW); + if (ctx == NULL) { +@@ -125,7 +154,7 @@ static int seccomp_start(uint32_t seccomp_opts) + continue; + } + +- rc = seccomp_rule_add_array(ctx, SCMP_ACT_TRAP, blacklist[i].num, ++ rc = seccomp_rule_add_array(ctx, action, blacklist[i].num, + blacklist[i].narg, blacklist[i].arg_cmp); + if (rc < 0) { + goto seccomp_return; +-- +2.11.0 + diff --git a/debian/patches/extra/0003-configure-require-libseccomp-2.2.0.patch b/debian/patches/extra/0003-configure-require-libseccomp-2.2.0.patch new file mode 100644 index 0000000..34ec05b --- /dev/null +++ b/debian/patches/extra/0003-configure-require-libseccomp-2.2.0.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Wed, 22 Aug 2018 19:02:49 +0200 +Subject: [PATCH] configure: require libseccomp 2.2.0 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The following patch is going to require TSYNC, which is only available +since libseccomp 2.2.0. + +libseccomp 2.2.0 was released February 12, 2015. + +According to repology, libseccomp version in different distros: + + RHEL-7: 2.3.1 + Debian (Stretch): 2.3.1 + OpenSUSE Leap 15: 2.3.2 + Ubuntu (Xenial): 2.3.1 + +This will drop support for -sandbox on: + + Debian (Jessie): 2.1.1 (but 2.2.3 in backports) + +Signed-off-by: Marc-André Lureau +Acked-by: Eduardo Otubo +--- + configure | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/configure b/configure +index 601c1f44f9..d2cc11cdbb 100755 +--- a/configure ++++ b/configure +@@ -2222,13 +2222,10 @@ fi + ########################################## + # libseccomp check + ++libseccomp_minver="2.2.0" + if test "$seccomp" != "no" ; then + case "$cpu" in +- i386|x86_64) +- libseccomp_minver="2.1.0" +- ;; +- mips) +- libseccomp_minver="2.2.0" ++ i386|x86_64|mips) + ;; + arm|aarch64) + libseccomp_minver="2.2.3" +-- +2.11.0 + diff --git a/debian/patches/extra/0004-seccomp-set-the-seccomp-filter-to-all-threads.patch b/debian/patches/extra/0004-seccomp-set-the-seccomp-filter-to-all-threads.patch new file mode 100644 index 0000000..2363cb7 --- /dev/null +++ b/debian/patches/extra/0004-seccomp-set-the-seccomp-filter-to-all-threads.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Wed, 22 Aug 2018 19:02:50 +0200 +Subject: [PATCH] seccomp: set the seccomp filter to all threads +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When using "-seccomp on", the seccomp policy is only applied to the +main thread, the vcpu worker thread and other worker threads created +after seccomp policy is applied; the seccomp policy is not applied to +e.g. the RCU thread because it is created before the seccomp policy is +applied and SECCOMP_FILTER_FLAG_TSYNC isn't used. + +This can be verified with +for task in /proc/`pidof qemu`/task/*; do cat $task/status | grep Secc ; done +Seccomp: 2 +Seccomp: 0 +Seccomp: 0 +Seccomp: 2 +Seccomp: 2 +Seccomp: 2 + +Starting with libseccomp 2.2.0 and kernel >= 3.17, we can use +seccomp_attr_set(ctx, > SCMP_FLTATR_CTL_TSYNC, 1) to update the policy +on all threads. + +libseccomp requirement was bumped to 2.2.0 in previous patch. +libseccomp should fail to set the filter if it can't honour +SCMP_FLTATR_CTL_TSYNC (untested), and thus -sandbox will now fail on +kernel < 3.17. + +Signed-off-by: Marc-André Lureau +Acked-by: Eduardo Otubo +--- + qemu-seccomp.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/qemu-seccomp.c b/qemu-seccomp.c +index f0c833f3ca..4729eb107f 100644 +--- a/qemu-seccomp.c ++++ b/qemu-seccomp.c +@@ -149,6 +149,11 @@ static int seccomp_start(uint32_t seccomp_opts) + goto seccomp_return; + } + ++ rc = seccomp_attr_set(ctx, SCMP_FLTATR_CTL_TSYNC, 1); ++ if (rc != 0) { ++ goto seccomp_return; ++ } ++ + for (i = 0; i < ARRAY_SIZE(blacklist); i++) { + if (!(seccomp_opts & blacklist[i].set)) { + continue; +-- +2.11.0 + diff --git a/debian/patches/extra/0005-monitor-create-iothread-after-daemonizing.patch b/debian/patches/extra/0005-monitor-create-iothread-after-daemonizing.patch new file mode 100644 index 0000000..df2159a --- /dev/null +++ b/debian/patches/extra/0005-monitor-create-iothread-after-daemonizing.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Wolfgang Bumiller +Date: Fri, 7 Sep 2018 14:45:51 +0200 +Subject: [PATCH] monitor: create iothread after daemonizing + +Commit d32749deb615 moved the call to monitor_init_globals() +to before os_daemonize() in order to initialize locks used +when parsing arguments and instantiating monitors. +This function also creates an iothread which is now lost +when fork()ing in os_daemonize(), causing its final join to +fail. +Fix this by exposing monitor_iothread_init() to be used in +vl.c after the os_daemonize() call. + +FIXME: verify nothing between the new init() place and +iothread spawning actually already depends on the iothread. + +Signed-off-by: Wolfgang Bumiller +Fixes: d32749deb615 ("monitor: move init global earlier") +--- + include/monitor/monitor.h | 1 + + monitor.c | 3 +-- + vl.c | 1 + + 3 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h +index 2ef5e04b37..119c4a393e 100644 +--- a/include/monitor/monitor.h ++++ b/include/monitor/monitor.h +@@ -18,6 +18,7 @@ extern __thread Monitor *cur_mon; + bool monitor_cur_is_qmp(void); + + void monitor_init_globals(void); ++void monitor_iothread_init(void); + void monitor_init(Chardev *chr, int flags); + void monitor_cleanup(void); + +diff --git a/monitor.c b/monitor.c +index 77861e96af..24bfa0266b 100644 +--- a/monitor.c ++++ b/monitor.c +@@ -4539,7 +4539,7 @@ static AioContext *monitor_get_aio_context(void) + return iothread_get_aio_context(mon_iothread); + } + +-static void monitor_iothread_init(void) ++void monitor_iothread_init(void) + { + mon_iothread = iothread_create("mon_iothread", &error_abort); + +@@ -4569,7 +4569,6 @@ void monitor_init_globals(void) + sortcmdlist(); + qemu_mutex_init(&monitor_lock); + qemu_mutex_init(&mon_fdsets_lock); +- monitor_iothread_init(); + } + + /* These functions just adapt the readline interface in a typesafe way. We +diff --git a/vl.c b/vl.c +index a03e4c2867..d96f4d0d2a 100644 +--- a/vl.c ++++ b/vl.c +@@ -4008,6 +4008,7 @@ int main(int argc, char **argv, char **envp) + + os_daemonize(); + rcu_disable_atfork(); ++ monitor_iothread_init(); + + if (pid_file && qemu_create_pidfile(pid_file) != 0) { + error_report("could not acquire pid file: %s", strerror(errno)); +-- +2.11.0 + diff --git a/debian/patches/pve/0001-block-file-change-locking-default-to-off.patch b/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch similarity index 82% rename from debian/patches/pve/0001-block-file-change-locking-default-to-off.patch rename to debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch index 2b68846..cdae871 100644 --- a/debian/patches/pve/0001-block-file-change-locking-default-to-off.patch +++ b/debian/patches/pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 29 Nov 2017 11:11:46 +0100 -Subject: [PATCH] block/file: change locking default to off +Subject: [PATCH] PVE: [Config] block/file: change locking default to off 'auto' only checks whether the system generally supports OFD locks but not whether the storage the file resides on @@ -13,10 +13,10 @@ Signed-off-by: Wolfgang Bumiller 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c -index 275953fdc6..b639206879 100644 +index fe83cbf0eb..431a9dddc6 100644 --- a/block/file-posix.c +++ b/block/file-posix.c -@@ -405,7 +405,7 @@ static QemuOptsList raw_runtime_opts = { +@@ -421,7 +421,7 @@ static QemuOptsList raw_runtime_opts = { { .name = "locking", .type = QEMU_OPT_STRING, @@ -25,7 +25,7 @@ index 275953fdc6..b639206879 100644 }, { .name = "pr-manager", -@@ -481,7 +481,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options, +@@ -503,7 +503,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-Adjust-network-script-path-to-etc-kvm.patch b/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch similarity index 82% rename from debian/patches/pve/0002-Adjust-network-script-path-to-etc-kvm.patch rename to debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch index 77556e4..52dda54 100644 --- a/debian/patches/pve/0002-Adjust-network-script-path-to-etc-kvm.patch +++ b/debian/patches/pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch @@ -1,17 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:16:49 +0100 -Subject: [PATCH] Adjust network script path to /etc/kvm/ +Subject: [PATCH] PVE: [Config] Adjust network script path to /etc/kvm/ --- include/net/net.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/net/net.h b/include/net/net.h -index ab87d426e1..3cb866a359 100644 +index 1425960f76..fdf0957642 100644 --- a/include/net/net.h +++ b/include/net/net.h -@@ -221,8 +221,9 @@ void qmp_netdev_add(QDict *qdict, QObject **ret, Error **errp); +@@ -216,8 +216,9 @@ void qmp_netdev_add(QDict *qdict, QObject **ret, 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/0004-use-kvm-by-default.patch b/debian/patches/pve/0003-PVE-Config-use-kvm-by-default.patch similarity index 83% rename from debian/patches/pve/0004-use-kvm-by-default.patch rename to debian/patches/pve/0003-PVE-Config-use-kvm-by-default.patch index 3b859c9..add1c72 100644 --- a/debian/patches/pve/0004-use-kvm-by-default.patch +++ b/debian/patches/pve/0003-PVE-Config-use-kvm-by-default.patch @@ -1,14 +1,14 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:27:05 +0100 -Subject: [PATCH] use kvm by default +Subject: [PATCH] PVE: [Config] use kvm by default --- accel/accel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accel/accel.c b/accel/accel.c -index 8ae40e1e13..df21981026 100644 +index 966b2d8f53..08aeadaef2 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -79,8 +79,8 @@ void configure_accelerator(MachineState *ms) @@ -21,7 +21,7 @@ index 8ae40e1e13..df21981026 100644 + accel = "kvm"; } - p = accel; + accel_list = g_strsplit(accel, ":", 0); -- 2.11.0 diff --git a/debian/patches/pve/0006-set-the-CPU-model-to-kvm64-32-instead-of-qemu64-32.patch b/debian/patches/pve/0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch similarity index 75% rename from debian/patches/pve/0006-set-the-CPU-model-to-kvm64-32-instead-of-qemu64-32.patch rename to debian/patches/pve/0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch index 13524ca..3d40d16 100644 --- a/debian/patches/pve/0006-set-the-CPU-model-to-kvm64-32-instead-of-qemu64-32.patch +++ b/debian/patches/pve/0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch @@ -1,18 +1,19 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:30:21 +0100 -Subject: [PATCH] set the CPU model to kvm64/32 instead of qemu64/32 +Subject: [PATCH] PVE: [Config] set the CPU model to kvm64/32 instead of + qemu64/32 --- target/i386/cpu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h -index 3cc1136535..922a4b8edd 100644 +index c18863ec7a..93ede116d1 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h -@@ -1524,9 +1524,9 @@ uint64_t cpu_get_tsc(CPUX86State *env); - #define X86_CPU_TYPE_NAME(name) (name X86_CPU_TYPE_SUFFIX) +@@ -1687,9 +1687,9 @@ uint64_t cpu_get_tsc(CPUX86State *env); + #define CPU_RESOLVING_TYPE TYPE_X86_CPU #ifdef TARGET_X86_64 -#define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("qemu64") diff --git a/debian/patches/pve/0009-ui-spice-default-to-pve-certs-unless-otherwise-speci.patch b/debian/patches/pve/0005-PVE-Config-ui-spice-default-to-pve-certificates.patch similarity index 91% rename from debian/patches/pve/0009-ui-spice-default-to-pve-certs-unless-otherwise-speci.patch rename to debian/patches/pve/0005-PVE-Config-ui-spice-default-to-pve-certificates.patch index 25b66dd..b6d1781 100644 --- a/debian/patches/pve/0009-ui-spice-default-to-pve-certs-unless-otherwise-speci.patch +++ b/debian/patches/pve/0005-PVE-Config-ui-spice-default-to-pve-certificates.patch @@ -1,17 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:33:34 +0100 -Subject: [PATCH] ui/spice: default to pve certs unless otherwise specified +Subject: [PATCH] PVE: [Config] ui/spice: default to pve certificates --- ui/spice-core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/spice-core.c b/ui/spice-core.c -index 05f5958b14..6e1a46d1e5 100644 +index f8c0878529..d327533c8f 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c -@@ -684,32 +684,35 @@ void qemu_spice_init(void) +@@ -667,32 +667,35 @@ void qemu_spice_init(void) if (tls_port) { x509_dir = qemu_opt_get(opts, "x509-dir"); diff --git a/debian/patches/pve/0013-smm_available-false.patch b/debian/patches/pve/0006-PVE-Config-smm_available-false.patch similarity index 79% rename from debian/patches/pve/0013-smm_available-false.patch rename to debian/patches/pve/0006-PVE-Config-smm_available-false.patch index bd356e1..222cf59 100644 --- a/debian/patches/pve/0013-smm_available-false.patch +++ b/debian/patches/pve/0006-PVE-Config-smm_available-false.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Tue, 29 Sep 2015 15:37:44 +0200 -Subject: [PATCH] smm_available = false +Subject: [PATCH] PVE: [Config] smm_available = false Signed-off-by: Alexandre Derumier --- @@ -9,10 +9,10 @@ Signed-off-by: Alexandre Derumier 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c -index 186545d2a4..603a7ce6bf 100644 +index 83a444472b..f6fd5e15ff 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c -@@ -2135,7 +2135,7 @@ bool pc_machine_is_smm_enabled(PCMachineState *pcms) +@@ -2145,7 +2145,7 @@ bool pc_machine_is_smm_enabled(PCMachineState *pcms) if (tcg_enabled() || qtest_enabled()) { smm_available = true; } else if (kvm_enabled()) { diff --git a/debian/patches/pve/0021-glusterfs-no-default-logfile-if-daemonized.patch b/debian/patches/pve/0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch similarity index 83% rename from debian/patches/pve/0021-glusterfs-no-default-logfile-if-daemonized.patch rename to debian/patches/pve/0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch index a7524a5..9e27a02 100644 --- a/debian/patches/pve/0021-glusterfs-no-default-logfile-if-daemonized.patch +++ b/debian/patches/pve/0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch @@ -1,17 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 24 Oct 2016 09:32:36 +0200 -Subject: [PATCH] glusterfs: no default logfile if daemonized +Subject: [PATCH] PVE: [Config] glusterfs: no default logfile if daemonized --- block/gluster.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/block/gluster.c b/block/gluster.c -index d09f4f2283..4e398af5c1 100644 +index 4fd55a9cc5..20d99aa1c3 100644 --- a/block/gluster.c +++ b/block/gluster.c -@@ -32,7 +32,7 @@ +@@ -36,7 +36,7 @@ #define GLUSTER_DEBUG_DEFAULT 4 #define GLUSTER_DEBUG_MAX 9 #define GLUSTER_OPT_LOGFILE "logfile" @@ -20,7 +20,7 @@ index d09f4f2283..4e398af5c1 100644 #define GERR_INDEX_HINT "hint: check in 'server' array index '%d'\n" -@@ -401,6 +401,7 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, +@@ -405,6 +405,7 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, int old_errno; SocketAddressList *server; unsigned long long port; @@ -28,7 +28,7 @@ index d09f4f2283..4e398af5c1 100644 glfs = glfs_find_preopened(gconf->volume); if (glfs) { -@@ -443,9 +444,15 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, +@@ -447,9 +448,15 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf, } } diff --git a/debian/patches/pve/0032-rbd-fix-cache-mode-behavior.patch b/debian/patches/pve/0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch similarity index 53% rename from debian/patches/pve/0032-rbd-fix-cache-mode-behavior.patch rename to debian/patches/pve/0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch index 92a189c..1df5d1e 100644 --- a/debian/patches/pve/0032-rbd-fix-cache-mode-behavior.patch +++ b/debian/patches/pve/0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch @@ -1,7 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller -Date: Mon, 26 Mar 2018 14:20:31 +0200 -Subject: [PATCH] rbd: fix cache mode behavior +Date: Fri, 31 Aug 2018 09:32:55 +0200 +Subject: [PATCH] PVE: [Config] rbd: block: rbd: disable + rbd_cache_writethrough_until_flush Either the cache mode asks for a cache or not. There's no point in having a "temporary" cache mode. This option AFAIK @@ -12,23 +13,22 @@ explicitly choose writethrough. Signed-off-by: Wolfgang Bumiller --- - block/rbd.c | 2 -- - 1 file changed, 2 deletions(-) + block/rbd.c | 2 ++ + 1 file changed, 2 insertions(+) diff --git a/block/rbd.c b/block/rbd.c -index c4732a4b12..0374f3db27 100644 +index ca8e5bbace..34ae730711 100644 --- a/block/rbd.c +++ b/block/rbd.c -@@ -643,9 +643,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, - rados_conf_set(s->cluster, "rbd_cache", "true"); +@@ -634,6 +634,8 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx, + rados_conf_set(*cluster, "rbd_cache", "false"); } -- if (flags & BDRV_O_NO_FLUSH) { - rados_conf_set(s->cluster, "rbd_cache_writethrough_until_flush", "false"); -- } - - r = rados_connect(s->cluster); ++ rados_conf_set(*cluster, "rbd_cache_writethrough_until_flush", "false"); ++ + r = rados_connect(*cluster); if (r < 0) { + error_setg_errno(errp, -r, "error connecting"); -- 2.11.0 diff --git a/debian/patches/pve/0012-qmp-add-get_link_status.patch b/debian/patches/pve/0009-PVE-Up-qmp-add-get_link_status.patch similarity index 68% rename from debian/patches/pve/0012-qmp-add-get_link_status.patch rename to debian/patches/pve/0009-PVE-Up-qmp-add-get_link_status.patch index ed266cf..e210da2 100644 --- a/debian/patches/pve/0012-qmp-add-get_link_status.patch +++ b/debian/patches/pve/0009-PVE-Up-qmp-add-get_link_status.patch @@ -1,18 +1,19 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 16:34:41 +0100 -Subject: [PATCH] qmp: add get_link_status +Subject: [PATCH] PVE: [Up] qmp: add get_link_status --- - net/net.c | 27 +++++++++++++++++++++++++++ - qapi/net.json | 15 +++++++++++++++ - 2 files changed, 42 insertions(+) + net/net.c | 27 +++++++++++++++++++++++++++ + qapi/net.json | 15 +++++++++++++++ + qapi/qapi-schema.json | 1 + + 3 files changed, 43 insertions(+) diff --git a/net/net.c b/net/net.c -index 0719358d03..10186dfe61 100644 +index 2a3133990c..cd9178d6c9 100644 --- a/net/net.c +++ b/net/net.c -@@ -1398,6 +1398,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict) +@@ -1331,6 +1331,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict) } } @@ -47,7 +48,7 @@ index 0719358d03..10186dfe61 100644 { NetClientState *ncs[MAX_QUEUE_NUM]; diff --git a/qapi/net.json b/qapi/net.json -index 4beff5d582..73334c8f3c 100644 +index c86f351161..9a69a3b0f7 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -35,6 +35,21 @@ @@ -72,6 +73,18 @@ index 4beff5d582..73334c8f3c 100644 # @netdev_add: # # Add a network backend. +diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json +index 65b6dc2f6f..4bc906bc7c 100644 +--- a/qapi/qapi-schema.json ++++ b/qapi/qapi-schema.json +@@ -61,6 +61,7 @@ + 'query-migrate-cache-size', + 'query-tpm-models', + 'query-tpm-types', ++ 'get_link_status', + 'ringbuf-read' ], + 'name-case-whitelist': [ + 'ACPISlotType', # DIMM, visible through query-acpi-ospm-status -- 2.11.0 diff --git a/debian/patches/pve/0022-glusterfs-allow-partial-reads.patch b/debian/patches/pve/0010-PVE-Up-glusterfs-allow-partial-reads.patch similarity index 84% rename from debian/patches/pve/0022-glusterfs-allow-partial-reads.patch rename to debian/patches/pve/0010-PVE-Up-glusterfs-allow-partial-reads.patch index 1f0e54a..8ee5698 100644 --- a/debian/patches/pve/0022-glusterfs-allow-partial-reads.patch +++ b/debian/patches/pve/0010-PVE-Up-glusterfs-allow-partial-reads.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 30 Nov 2016 10:27:47 +0100 -Subject: [PATCH] glusterfs: allow partial reads +Subject: [PATCH] PVE: [Up] glusterfs: allow partial reads This should deal with qemu bug #1644754 until upstream decides which way to go. The general direction seems to be @@ -14,10 +14,10 @@ sense. 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/block/gluster.c b/block/gluster.c -index 4e398af5c1..453c5824ce 100644 +index 20d99aa1c3..569866421b 100644 --- a/block/gluster.c +++ b/block/gluster.c -@@ -41,6 +41,7 @@ typedef struct GlusterAIOCB { +@@ -45,6 +45,7 @@ typedef struct GlusterAIOCB { int ret; Coroutine *coroutine; AioContext *aio_context; @@ -25,7 +25,7 @@ index 4e398af5c1..453c5824ce 100644 } GlusterAIOCB; typedef struct BDRVGlusterState { -@@ -722,8 +723,10 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg) +@@ -740,8 +741,10 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg) acb->ret = 0; /* Success */ } else if (ret < 0) { acb->ret = -errno; /* Read/Write failed */ @@ -37,7 +37,7 @@ index 4e398af5c1..453c5824ce 100644 } aio_co_schedule(acb->aio_context, acb->coroutine); -@@ -971,6 +974,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs, +@@ -989,6 +992,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); @@ -45,7 +45,7 @@ index 4e398af5c1..453c5824ce 100644 ret = glfs_zerofill_async(s->fd, offset, size, gluster_finish_aiocb, &acb); if (ret < 0) { -@@ -1096,9 +1100,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs, +@@ -1169,9 +1173,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs, acb.aio_context = bdrv_get_aio_context(bs); if (write) { @@ -57,7 +57,7 @@ index 4e398af5c1..453c5824ce 100644 ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0, gluster_finish_aiocb, &acb); } -@@ -1171,6 +1177,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs) +@@ -1233,6 +1239,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); @@ -65,7 +65,7 @@ index 4e398af5c1..453c5824ce 100644 ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb); if (ret < 0) { -@@ -1217,6 +1224,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs, +@@ -1279,6 +1286,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/0003-qemu-img-return-success-on-info-without-snapshots.patch b/debian/patches/pve/0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch similarity index 76% rename from debian/patches/pve/0003-qemu-img-return-success-on-info-without-snapshots.patch rename to debian/patches/pve/0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch index e6c82ba..26cc868 100644 --- a/debian/patches/pve/0003-qemu-img-return-success-on-info-without-snapshots.patch +++ b/debian/patches/pve/0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch @@ -1,17 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:18:46 +0100 -Subject: [PATCH] qemu-img: return success on info without snapshots +Subject: [PATCH] PVE: [Up] qemu-img: return success on info without snapshots --- qemu-img.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c -index bf9de27893..812129ff16 100644 +index 1acddf693c..4438e0c2c9 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -2594,7 +2594,8 @@ static int img_info(int argc, char **argv) +@@ -2720,7 +2720,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/0024-qemu-img-dd-add-osize-and-read-from-to-stdin-stdout.patch b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch similarity index 94% rename from debian/patches/pve/0024-qemu-img-dd-add-osize-and-read-from-to-stdin-stdout.patch rename to debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch index 078eb9c..d545253 100644 --- a/debian/patches/pve/0024-qemu-img-dd-add-osize-and-read-from-to-stdin-stdout.patch +++ b/debian/patches/pve/0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch @@ -1,7 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 23 Jun 2017 12:01:43 +0200 -Subject: [PATCH] qemu-img dd: add osize and read from/to stdin/stdout +Subject: [PATCH] PVE: [Up] qemu-img dd: add osize and read from/to + stdin/stdout Neither convert nor dd were previously able to write to or read from a pipe. Particularly serializing an image file @@ -35,10 +36,10 @@ Signed-off-by: Wolfgang Bumiller 2 files changed, 122 insertions(+), 74 deletions(-) diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx -index 2fe31893cf..52042f2773 100644 +index 1526f327a5..0ea4b6ffb2 100644 --- a/qemu-img-cmds.hx +++ b/qemu-img-cmds.hx -@@ -53,9 +53,9 @@ STEXI +@@ -56,9 +56,9 @@ STEXI ETEXI DEF("dd", img_dd, @@ -51,10 +52,10 @@ index 2fe31893cf..52042f2773 100644 DEF("info", img_info, diff --git a/qemu-img.c b/qemu-img.c -index 812129ff16..879e7f4502 100644 +index 4438e0c2c9..f46eefce4f 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -4109,10 +4109,12 @@ out: +@@ -4302,10 +4302,12 @@ out: #define C_IF 04 #define C_OF 010 #define C_SKIP 020 @@ -67,7 +68,7 @@ index 812129ff16..879e7f4502 100644 }; struct DdIo { -@@ -4191,6 +4193,20 @@ static int img_dd_skip(const char *arg, +@@ -4384,6 +4386,20 @@ static int img_dd_skip(const char *arg, return 0; } @@ -88,7 +89,7 @@ index 812129ff16..879e7f4502 100644 static int img_dd(int argc, char **argv) { int ret = 0; -@@ -4231,6 +4247,7 @@ static int img_dd(int argc, char **argv) +@@ -4424,6 +4440,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 }, @@ -96,7 +97,7 @@ index 812129ff16..879e7f4502 100644 { NULL, NULL, 0 } }; const struct option long_options[] = { -@@ -4309,8 +4326,13 @@ static int img_dd(int argc, char **argv) +@@ -4502,8 +4519,13 @@ static int img_dd(int argc, char **argv) arg = NULL; } @@ -112,7 +113,7 @@ index 812129ff16..879e7f4502 100644 ret = -1; goto out; } -@@ -4322,85 +4344,101 @@ static int img_dd(int argc, char **argv) +@@ -4515,85 +4537,101 @@ static int img_dd(int argc, char **argv) goto out; } @@ -278,7 +279,7 @@ index 812129ff16..879e7f4502 100644 } if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz || -@@ -4418,11 +4456,17 @@ static int img_dd(int argc, char **argv) +@@ -4611,11 +4649,17 @@ static int img_dd(int argc, char **argv) for (out_pos = 0; in_pos < size; block_count++) { int in_ret, out_ret; @@ -300,7 +301,7 @@ index 812129ff16..879e7f4502 100644 } if (in_ret < 0) { error_report("error while reading from input image file: %s", -@@ -4432,9 +4476,13 @@ static int img_dd(int argc, char **argv) +@@ -4625,9 +4669,13 @@ static int img_dd(int argc, char **argv) } in_pos += in_ret; diff --git a/debian/patches/pve/0029-qemu-img-dd-add-isize-parameter.patch b/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch similarity index 87% rename from debian/patches/pve/0029-qemu-img-dd-add-isize-parameter.patch rename to debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch index 0b2136c..ec46951 100644 --- a/debian/patches/pve/0029-qemu-img-dd-add-isize-parameter.patch +++ b/debian/patches/pve/0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 23 Feb 2018 08:43:18 +0100 -Subject: [PATCH] qemu-img dd: add isize parameter +Subject: [PATCH] PVE: [Up] qemu-img dd: add isize parameter for writing small images from stdin to bigger ones @@ -14,10 +14,10 @@ Signed-off-by: Wolfgang Bumiller 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/qemu-img.c b/qemu-img.c -index 879e7f4502..e23285d7d4 100644 +index f46eefce4f..ec546846c6 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -4110,11 +4110,13 @@ out: +@@ -4303,11 +4303,13 @@ out: #define C_OF 010 #define C_SKIP 020 #define C_OSIZE 040 @@ -31,7 +31,7 @@ index 879e7f4502..e23285d7d4 100644 }; struct DdIo { -@@ -4207,6 +4209,20 @@ static int img_dd_osize(const char *arg, +@@ -4400,6 +4402,20 @@ static int img_dd_osize(const char *arg, return 0; } @@ -52,7 +52,7 @@ index 879e7f4502..e23285d7d4 100644 static int img_dd(int argc, char **argv) { int ret = 0; -@@ -4221,12 +4237,14 @@ static int img_dd(int argc, char **argv) +@@ -4414,12 +4430,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 879e7f4502..e23285d7d4 100644 }; struct DdIo in = { .bsz = 512, /* Block size is by default 512 bytes */ -@@ -4248,6 +4266,7 @@ static int img_dd(int argc, char **argv) +@@ -4441,6 +4459,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 879e7f4502..e23285d7d4 100644 { NULL, NULL, 0 } }; const struct option long_options[] = { -@@ -4454,14 +4473,18 @@ static int img_dd(int argc, char **argv) +@@ -4647,14 +4666,18 @@ static int img_dd(int argc, char **argv) in.buf = g_new(uint8_t, in.bsz); diff --git a/debian/patches/pve/0030-qemu-img-dd-add-n-skip_create.patch b/debian/patches/pve/0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch similarity index 84% rename from debian/patches/pve/0030-qemu-img-dd-add-n-skip_create.patch rename to debian/patches/pve/0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch index 1aa817f..d03c64b 100644 --- a/debian/patches/pve/0030-qemu-img-dd-add-n-skip_create.patch +++ b/debian/patches/pve/0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch @@ -1,17 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Wed, 21 Mar 2018 08:51:34 +0100 -Subject: [PATCH] qemu-img dd : add -n skip_create +Subject: [PATCH] PVE: [Up] qemu-img dd : add -n skip_create --- qemu-img.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/qemu-img.c b/qemu-img.c -index e23285d7d4..b3f17184ac 100644 +index ec546846c6..afa6e26ccf 100644 --- a/qemu-img.c +++ b/qemu-img.c -@@ -4239,7 +4239,7 @@ static int img_dd(int argc, char **argv) +@@ -4432,7 +4432,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; @@ -20,7 +20,7 @@ index e23285d7d4..b3f17184ac 100644 struct DdInfo dd = { .flags = 0, .count = 0, -@@ -4277,7 +4277,7 @@ static int img_dd(int argc, char **argv) +@@ -4470,7 +4470,7 @@ static int img_dd(int argc, char **argv) { 0, 0, 0, 0 } }; @@ -29,7 +29,7 @@ index e23285d7d4..b3f17184ac 100644 if (c == EOF) { break; } -@@ -4297,6 +4297,9 @@ static int img_dd(int argc, char **argv) +@@ -4490,6 +4490,9 @@ static int img_dd(int argc, char **argv) case 'h': help(); break; @@ -39,7 +39,7 @@ index e23285d7d4..b3f17184ac 100644 case 'U': force_share = true; break; -@@ -4437,13 +4440,15 @@ static int img_dd(int argc, char **argv) +@@ -4630,13 +4633,15 @@ static int img_dd(int argc, char **argv) size - in.bsz * in.offset, &error_abort); } diff --git a/debian/patches/pve/0014-use-whitespace-between-VERSION-and-PKGVERSION.patch b/debian/patches/pve/0014-use-whitespace-between-VERSION-and-PKGVERSION.patch deleted file mode 100644 index 4b3a63f..0000000 --- a/debian/patches/pve/0014-use-whitespace-between-VERSION-and-PKGVERSION.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Wolfgang Bumiller -Date: Wed, 9 Dec 2015 16:50:05 +0100 -Subject: [PATCH] use whitespace between VERSION and PKGVERSION - -Our kvm version parser expects a white space or comma after -the version string, see PVE::QemuServer::kvm_user_version() ---- - vl.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/vl.c b/vl.c -index 1bfbe95b22..75fde82180 100644 ---- a/vl.c -+++ b/vl.c -@@ -2006,7 +2006,7 @@ static void main_loop(void) - - static void version(void) - { -- printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION "\n" -+ printf("QEMU emulator version " QEMU_VERSION " " QEMU_PKGVERSION "\n" - QEMU_COPYRIGHT "\n"); - } - --- -2.11.0 - diff --git a/debian/patches/pve/0005-virtio-balloon-fix-query.patch b/debian/patches/pve/0015-PVE-virtio-balloon-improve-query-balloon.patch similarity index 90% rename from debian/patches/pve/0005-virtio-balloon-fix-query.patch rename to debian/patches/pve/0015-PVE-virtio-balloon-improve-query-balloon.patch index 8b36372..4ea4e22 100644 --- a/debian/patches/pve/0005-virtio-balloon-fix-query.patch +++ b/debian/patches/pve/0015-PVE-virtio-balloon-improve-query-balloon.patch @@ -1,21 +1,21 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:27:49 +0100 -Subject: [PATCH] virtio-balloon: fix query +Subject: [PATCH] PVE: virtio-balloon: improve query-balloon Actually provide memory information via the query-balloon command. --- hmp.c | 30 +++++++++++++++++++++++++++++- hw/virtio/virtio-balloon.c | 33 +++++++++++++++++++++++++++++++-- - qapi-schema.json | 22 +++++++++++++++++++++- + qapi/misc.json | 22 +++++++++++++++++++++- 3 files changed, 81 insertions(+), 4 deletions(-) diff --git a/hmp.c b/hmp.c -index 35a7041824..4e1d571003 100644 +index 2aafb50e8e..4d60782f56 100644 --- a/hmp.c +++ b/hmp.c -@@ -789,7 +789,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict) +@@ -794,7 +794,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict) return; } @@ -53,10 +53,10 @@ index 35a7041824..4e1d571003 100644 qapi_free_BalloonInfo(info); } diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c -index 651fa70ca6..51585dc7e7 100644 +index 1f7a87f094..6295be2f49 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c -@@ -381,8 +381,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f, +@@ -385,8 +385,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; @@ -96,11 +96,11 @@ index 651fa70ca6..51585dc7e7 100644 } static void virtio_balloon_to_target(void *opaque, ram_addr_t target) -diff --git a/qapi-schema.json b/qapi-schema.json -index 18457954a8..ebc22fe5a6 100644 ---- a/qapi-schema.json -+++ b/qapi-schema.json -@@ -623,10 +623,30 @@ +diff --git a/qapi/misc.json b/qapi/misc.json +index d450cfef21..a7d890c076 100644 +--- a/qapi/misc.json ++++ b/qapi/misc.json +@@ -679,10 +679,30 @@ # # @actual: the number of bytes the balloon currently contains # diff --git a/debian/patches/pve/0015-vnc-altgr-emulation.patch b/debian/patches/pve/0015-vnc-altgr-emulation.patch deleted file mode 100644 index 5e3115b..0000000 --- a/debian/patches/pve/0015-vnc-altgr-emulation.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Wolfgang Bumiller -Date: Wed, 9 Dec 2015 14:17:38 +0100 -Subject: [PATCH] vnc: altgr emulation - ---- - ui/vnc.c | 26 +++++++++++++++++++++++++- - 1 file changed, 25 insertions(+), 1 deletion(-) - -diff --git a/ui/vnc.c b/ui/vnc.c -index 06abe7360e..03f8f61b2e 100644 ---- a/ui/vnc.c -+++ b/ui/vnc.c -@@ -1775,6 +1775,10 @@ static void kbd_leds(void *opaque, int ledstate) - - static void do_key_event(VncState *vs, int down, int keycode, int sym) - { -+ int mods = keycode & 0xf00; -+ -+ keycode &= SCANCODE_KEYMASK; -+ - /* QEMU console switch */ - switch(keycode) { - case 0x2a: /* Left Shift */ -@@ -1855,8 +1859,27 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) - } - - if (qemu_console_is_graphic(NULL)) { -+ -+ /* our java vnc client never sends ALTGR, so we create -+ an artificial up/down event */ -+ -+ int emul_altgr = (mods & SCANCODE_ALTGR) && -+ !vs->modifiers_state[0xb8]; -+ -+ if (emul_altgr) { -+ reset_keys(vs); -+ qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, true); -+ qemu_input_event_send_key_delay(vs->vd->key_delay_ms); -+ } -+ - qemu_input_event_send_key_number(vs->vd->dcl.con, keycode, down); - qemu_input_event_send_key_delay(vs->vd->key_delay_ms); -+ -+ if (emul_altgr) { -+ qemu_input_event_send_key_number(vs->vd->dcl.con, 0xb8, false); -+ qemu_input_event_send_key_delay(vs->vd->key_delay_ms); -+ } -+ - } else { - bool numlock = vs->modifiers_state[0x45]; - bool control = (vs->modifiers_state[0x1d] || -@@ -1996,7 +2019,8 @@ static void key_event(VncState *vs, int down, uint32_t sym) - lsym = lsym - 'A' + 'a'; - } - -- keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF) & SCANCODE_KEYMASK; -+ keycode = keysym2scancode(vs->vd->kbd_layout, lsym & 0xFFFF); -+ - trace_vnc_key_event_map(down, sym, keycode, code2name(keycode)); - do_key_event(vs, down, keycode, sym); - } --- -2.11.0 - diff --git a/debian/patches/pve/0007-qapi-modify-query-machines.patch b/debian/patches/pve/0016-PVE-qapi-modify-query-machines.patch similarity index 76% rename from debian/patches/pve/0007-qapi-modify-query-machines.patch rename to debian/patches/pve/0016-PVE-qapi-modify-query-machines.patch index 7f38023..e0f7f6a 100644 --- a/debian/patches/pve/0007-qapi-modify-query-machines.patch +++ b/debian/patches/pve/0016-PVE-qapi-modify-query-machines.patch @@ -1,19 +1,19 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:31:18 +0100 -Subject: [PATCH] qapi: modify query machines +Subject: [PATCH] PVE: qapi: modify query machines provide '*is-current' in MachineInfo struct --- - qapi-schema.json | 4 +++- - vl.c | 5 +++++ + qapi/misc.json | 4 +++- + vl.c | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) -diff --git a/qapi-schema.json b/qapi-schema.json -index ebc22fe5a6..8f436ba1f3 100644 ---- a/qapi-schema.json -+++ b/qapi-schema.json -@@ -1914,6 +1914,8 @@ +diff --git a/qapi/misc.json b/qapi/misc.json +index a7d890c076..4e8ebf9adc 100644 +--- a/qapi/misc.json ++++ b/qapi/misc.json +@@ -2000,6 +2000,8 @@ # # @is-default: whether the machine is default # @@ -22,7 +22,7 @@ index ebc22fe5a6..8f436ba1f3 100644 # @cpu-max: maximum number of CPUs supported by the machine type # (since 1.5.0) # -@@ -1923,7 +1925,7 @@ +@@ -2009,7 +2011,7 @@ ## { 'struct': 'MachineInfo', 'data': { 'name': 'str', '*alias': 'str', @@ -32,10 +32,10 @@ index ebc22fe5a6..8f436ba1f3 100644 ## diff --git a/vl.c b/vl.c -index 1ad1c04637..2e0fe15978 100644 +index 16b913f9d5..c750b7c18e 100644 --- a/vl.c +++ b/vl.c -@@ -1604,6 +1604,11 @@ MachineInfoList *qmp_query_machines(Error **errp) +@@ -1455,6 +1455,11 @@ MachineInfoList *qmp_query_machines(Error **errp) info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus; info->hotpluggable_cpus = mc->has_hotpluggable_cpus; diff --git a/debian/patches/pve/0016-vnc-make-x509-imply-tls-again.patch b/debian/patches/pve/0016-vnc-make-x509-imply-tls-again.patch deleted file mode 100644 index f7f213e..0000000 --- a/debian/patches/pve/0016-vnc-make-x509-imply-tls-again.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Wolfgang Bumiller -Date: Tue, 12 Jan 2016 09:09:49 +0100 -Subject: [PATCH] vnc: make x509 imply tls again - ---- - ui/vnc.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/ui/vnc.c b/ui/vnc.c -index 03f8f61b2e..4494cb1dd4 100644 ---- a/ui/vnc.c -+++ b/ui/vnc.c -@@ -4034,9 +4034,8 @@ void vnc_display_open(const char *id, Error **errp) - const char *path; - bool tls = false, x509 = false, x509verify = false; - tls = qemu_opt_get_bool(opts, "tls", false); -- if (tls) { -- path = qemu_opt_get(opts, "x509"); -- -+ path = qemu_opt_get(opts, "x509"); -+ if (tls || path) { - if (path) { - x509 = true; - } else { --- -2.11.0 - diff --git a/debian/patches/pve/0008-qapi-modify-spice-query.patch b/debian/patches/pve/0017-PVE-qapi-modify-spice-query.patch similarity index 82% rename from debian/patches/pve/0008-qapi-modify-spice-query.patch rename to debian/patches/pve/0017-PVE-qapi-modify-spice-query.patch index fd0b66c..d1eb3a1 100644 --- a/debian/patches/pve/0008-qapi-modify-spice-query.patch +++ b/debian/patches/pve/0017-PVE-qapi-modify-spice-query.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 14:32:11 +0100 -Subject: [PATCH] qapi: modify spice query +Subject: [PATCH] PVE: qapi: modify spice query Provide the last ticket in the SpiceInfo struct optionally. --- @@ -10,10 +10,10 @@ Provide the last ticket in the SpiceInfo struct optionally. 2 files changed, 8 insertions(+) diff --git a/qapi/ui.json b/qapi/ui.json -index 07b468f625..78c906ddcf 100644 +index 4ca91bb45a..636256dacc 100644 --- a/qapi/ui.json +++ b/qapi/ui.json -@@ -199,11 +199,14 @@ +@@ -211,11 +211,14 @@ # # @channels: a list of @SpiceChannel for each active spice channel # @@ -25,14 +25,14 @@ index 07b468f625..78c906ddcf 100644 'data': {'enabled': 'bool', 'migrated': 'bool', '*host': 'str', '*port': 'int', '*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str', + '*ticket': 'str', - 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']} } + 'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']}, + 'if': 'defined(CONFIG_SPICE)' } - ## diff --git a/ui/spice-core.c b/ui/spice-core.c -index ea04dc69b5..05f5958b14 100644 +index d327533c8f..74bd443462 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c -@@ -551,6 +551,11 @@ SpiceInfo *qmp_query_spice(Error **errp) +@@ -539,6 +539,11 @@ SpiceInfo *qmp_query_spice(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-vnc-PVE-VNC-authentication.patch b/debian/patches/pve/0017-vnc-PVE-VNC-authentication.patch deleted file mode 100644 index ae2b3ce..0000000 --- a/debian/patches/pve/0017-vnc-PVE-VNC-authentication.patch +++ /dev/null @@ -1,682 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Wolfgang Bumiller -Date: Mon, 11 Jan 2016 10:40:31 +0100 -Subject: [PATCH] vnc: PVE VNC authentication - ---- - crypto/tlscreds.c | 47 ++++++++++++ - crypto/tlscredspriv.h | 2 + - crypto/tlscredsx509.c | 13 ++-- - crypto/tlssession.c | 1 + - include/crypto/tlscreds.h | 1 + - include/ui/console.h | 1 + - qapi-schema.json | 1 + - qemu-options.hx | 3 + - ui/vnc-auth-vencrypt.c | 182 ++++++++++++++++++++++++++++++++++++++-------- - ui/vnc.c | 140 ++++++++++++++++++++++++++++++++++- - ui/vnc.h | 4 + - vl.c | 9 +++ - 12 files changed, 364 insertions(+), 40 deletions(-) - -diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c -index 3cd41035bb..e982da3451 100644 ---- a/crypto/tlscreds.c -+++ b/crypto/tlscreds.c -@@ -158,6 +158,33 @@ qcrypto_tls_creds_prop_get_verify(Object *obj, - - - static void -+qcrypto_tls_creds_prop_set_pve(Object *obj, -+ bool value, -+ Error **errp G_GNUC_UNUSED) -+{ -+ QCryptoTLSCreds *creds = QCRYPTO_TLS_CREDS(obj); -+ -+ creds->pve = value; -+} -+ -+ -+static bool -+qcrypto_tls_creds_prop_get_pve(Object *obj, -+ Error **errp G_GNUC_UNUSED) -+{ -+ QCryptoTLSCreds *creds = QCRYPTO_TLS_CREDS(obj); -+ -+ return creds->pve; -+} -+ -+bool qcrypto_tls_creds_is_pve(QCryptoTLSCreds *creds) -+{ -+ Error *errp = NULL; -+ return qcrypto_tls_creds_prop_get_pve((Object*)creds, &errp); -+} -+ -+ -+static void - qcrypto_tls_creds_prop_set_dir(Object *obj, - const char *value, - Error **errp G_GNUC_UNUSED) -@@ -250,6 +277,26 @@ qcrypto_tls_creds_init(Object *obj) - QCryptoTLSCreds *creds = QCRYPTO_TLS_CREDS(obj); - - creds->verifyPeer = true; -+ creds->pve = false; -+ -+ object_property_add_bool(obj, "verify-peer", -+ qcrypto_tls_creds_prop_get_verify, -+ qcrypto_tls_creds_prop_set_verify, -+ NULL); -+ object_property_add_bool(obj, "pve", -+ qcrypto_tls_creds_prop_get_pve, -+ qcrypto_tls_creds_prop_set_pve, -+ NULL); -+ object_property_add_str(obj, "dir", -+ qcrypto_tls_creds_prop_get_dir, -+ qcrypto_tls_creds_prop_set_dir, -+ NULL); -+ object_property_add_enum(obj, "endpoint", -+ "QCryptoTLSCredsEndpoint", -+ &QCryptoTLSCredsEndpoint_lookup, -+ qcrypto_tls_creds_prop_get_endpoint, -+ qcrypto_tls_creds_prop_set_endpoint, -+ NULL); - } - - -diff --git a/crypto/tlscredspriv.h b/crypto/tlscredspriv.h -index 13e9b6c0b2..0356acc2c9 100644 ---- a/crypto/tlscredspriv.h -+++ b/crypto/tlscredspriv.h -@@ -36,6 +36,8 @@ int qcrypto_tls_creds_get_dh_params_file(QCryptoTLSCreds *creds, - gnutls_dh_params_t *dh_params, - Error **errp); - -+bool qcrypto_tls_creds_is_pve(QCryptoTLSCreds *creds); -+ - #endif - - #endif /* QCRYPTO_TLSCREDSPRIV_H */ -diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c -index 50eb54f6bb..09f7364001 100644 ---- a/crypto/tlscredsx509.c -+++ b/crypto/tlscredsx509.c -@@ -555,22 +555,23 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds, - *key = NULL, *dhparams = NULL; - int ret; - int rv = -1; -+ bool pve = qcrypto_tls_creds_is_pve(&creds->parent_obj); - - trace_qcrypto_tls_creds_x509_load(creds, - creds->parent_obj.dir ? creds->parent_obj.dir : ""); - - if (creds->parent_obj.endpoint == QCRYPTO_TLS_CREDS_ENDPOINT_SERVER) { - if (qcrypto_tls_creds_get_path(&creds->parent_obj, -- QCRYPTO_TLS_CREDS_X509_CA_CERT, -+ pve ? "pve-root-ca.pem" : QCRYPTO_TLS_CREDS_X509_CA_CERT, - true, &cacert, errp) < 0 || - qcrypto_tls_creds_get_path(&creds->parent_obj, - QCRYPTO_TLS_CREDS_X509_CA_CRL, - false, &cacrl, errp) < 0 || - qcrypto_tls_creds_get_path(&creds->parent_obj, -- QCRYPTO_TLS_CREDS_X509_SERVER_CERT, -+ pve ? "local/pve-ssl.pem" : QCRYPTO_TLS_CREDS_X509_SERVER_CERT, - true, &cert, errp) < 0 || - qcrypto_tls_creds_get_path(&creds->parent_obj, -- QCRYPTO_TLS_CREDS_X509_SERVER_KEY, -+ pve ? "local/pve-ssl.key" : QCRYPTO_TLS_CREDS_X509_SERVER_KEY, - true, &key, errp) < 0 || - qcrypto_tls_creds_get_path(&creds->parent_obj, - QCRYPTO_TLS_CREDS_DH_PARAMS, -@@ -579,13 +580,13 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds, - } - } else { - if (qcrypto_tls_creds_get_path(&creds->parent_obj, -- QCRYPTO_TLS_CREDS_X509_CA_CERT, -+ pve ? "pve-root-ca.pem" : QCRYPTO_TLS_CREDS_X509_CA_CERT, - true, &cacert, errp) < 0 || - qcrypto_tls_creds_get_path(&creds->parent_obj, -- QCRYPTO_TLS_CREDS_X509_CLIENT_CERT, -+ pve ? "local/pve-ssl.pem" : QCRYPTO_TLS_CREDS_X509_CLIENT_CERT, - false, &cert, errp) < 0 || - qcrypto_tls_creds_get_path(&creds->parent_obj, -- QCRYPTO_TLS_CREDS_X509_CLIENT_KEY, -+ pve ? "local/pve-ssl.key" : QCRYPTO_TLS_CREDS_X509_CLIENT_KEY, - false, &key, errp) < 0) { - goto cleanup; - } -diff --git a/crypto/tlssession.c b/crypto/tlssession.c -index 96a02deb69..c453e29cad 100644 ---- a/crypto/tlssession.c -+++ b/crypto/tlssession.c -@@ -23,6 +23,7 @@ - #include "crypto/tlscredsanon.h" - #include "crypto/tlscredsx509.h" - #include "qapi/error.h" -+#include "crypto/tlscredspriv.h" - #include "qemu/acl.h" - #include "trace.h" - -diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h -index ad47d88be7..f86d379f26 100644 ---- a/include/crypto/tlscreds.h -+++ b/include/crypto/tlscreds.h -@@ -55,6 +55,7 @@ struct QCryptoTLSCreds { - #endif - bool verifyPeer; - char *priority; -+ bool pve; - }; - - -diff --git a/include/ui/console.h b/include/ui/console.h -index 580dfc57ee..383e5c88bd 100644 ---- a/include/ui/console.h -+++ b/include/ui/console.h -@@ -466,6 +466,7 @@ static inline void cocoa_display_init(DisplayState *ds, int full_screen) - #endif - - /* vnc.c */ -+void pve_auth_setup(int vmid); - void vnc_display_init(const char *id); - void vnc_display_open(const char *id, Error **errp); - void vnc_display_add_client(const char *id, int csock, bool skipauth); -diff --git a/qapi-schema.json b/qapi-schema.json -index 348b527681..d2155cb00f 100644 ---- a/qapi-schema.json -+++ b/qapi-schema.json -@@ -56,6 +56,7 @@ - { 'pragma': { - # Commands allowed to return a non-dictionary: - 'returns-whitelist': [ -+ 'get_link_status', - 'human-monitor-command', - 'qom-get', - 'query-migrate-cache-size', -diff --git a/qemu-options.hx b/qemu-options.hx -index 7c054af8f9..07129d55bc 100644 ---- a/qemu-options.hx -+++ b/qemu-options.hx -@@ -583,6 +583,9 @@ STEXI - @table @option - ETEXI - -+DEF("id", HAS_ARG, QEMU_OPTION_id, -+ "-id n set the VMID\n", QEMU_ARCH_ALL) -+ - DEF("fda", HAS_ARG, QEMU_OPTION_fda, - "-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/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c -index 7833631275..c42acd3714 100644 ---- a/ui/vnc-auth-vencrypt.c -+++ b/ui/vnc-auth-vencrypt.c -@@ -29,6 +29,108 @@ - #include "qapi/error.h" - #include "qemu/main-loop.h" - #include "trace.h" -+#include "io/channel-socket.h" -+ -+static int protocol_client_auth_plain(VncState *vs, uint8_t *data, size_t len) -+{ -+ Error *err = NULL; -+ char username[256]; -+ char passwd[512]; -+ -+ SocketAddress *clientip = qio_channel_socket_get_remote_address(vs->sioc, &err); -+ if (err) { -+ goto err; -+ } -+ -+ if ((len != (vs->username_len + vs->password_len)) || -+ (vs->username_len >= (sizeof(username)-1)) || -+ (vs->password_len >= (sizeof(passwd)-1)) ) { -+ error_setg(&err, "Got unexpected data length"); -+ goto err; -+ } -+ -+ strncpy(username, (char *)data, vs->username_len); -+ username[vs->username_len] = 0; -+ strncpy(passwd, (char *)data + vs->username_len, vs->password_len); -+ passwd[vs->password_len] = 0; -+ -+ VNC_DEBUG("AUTH PLAIN username: %s pw: %s\n", username, passwd); -+ -+ if (pve_auth_verify(clientip->u.inet.host, username, passwd) == 0) { -+ vnc_write_u32(vs, 0); /* Accept auth completion */ -+ start_client_init(vs); -+ qapi_free_SocketAddress(clientip); -+ return 0; -+ } -+ -+ error_setg(&err, "Authentication failed"); -+err: -+ if (err) { -+ const char *err_msg = error_get_pretty(err); -+ VNC_DEBUG("AUTH PLAIN ERROR: %s\n", err_msg); -+ vnc_write_u32(vs, 1); /* Reject auth */ -+ if (vs->minor >= 8) { -+ int elen = strlen(err_msg); -+ vnc_write_u32(vs, elen); -+ vnc_write(vs, err_msg, elen); -+ } -+ error_free(err); -+ } -+ vnc_flush(vs); -+ vnc_client_error(vs); -+ -+ qapi_free_SocketAddress(clientip); -+ -+ return 0; -+ -+} -+ -+static int protocol_client_auth_plain_start(VncState *vs, uint8_t *data, size_t len) -+{ -+ uint32_t ulen = read_u32(data, 0); -+ uint32_t pwlen = read_u32(data, 4); -+ const char *err = NULL; -+ -+ VNC_DEBUG("AUTH PLAIN START %u %u\n", ulen, pwlen); -+ -+ if (!ulen) { -+ err = "No User name."; -+ goto err; -+ } -+ if (ulen >= 255) { -+ err = "User name too long."; -+ goto err; -+ } -+ if (!pwlen) { -+ err = "Password too short"; -+ goto err; -+ } -+ if (pwlen >= 511) { -+ err = "Password too long."; -+ goto err; -+ } -+ -+ vs->username_len = ulen; -+ vs->password_len = pwlen; -+ -+ vnc_read_when(vs, protocol_client_auth_plain, ulen + pwlen); -+ -+ return 0; -+err: -+ if (err) { -+ VNC_DEBUG("AUTH PLAIN ERROR: %s\n", err); -+ vnc_write_u32(vs, 1); /* Reject auth */ -+ if (vs->minor >= 8) { -+ int elen = strlen(err); -+ vnc_write_u32(vs, elen); -+ vnc_write(vs, err, elen); -+ } -+ } -+ vnc_flush(vs); -+ vnc_client_error(vs); -+ -+ return 0; -+} - - static void start_auth_vencrypt_subauth(VncState *vs) - { -@@ -39,6 +141,17 @@ static void start_auth_vencrypt_subauth(VncState *vs) - start_client_init(vs); - break; - -+ case VNC_AUTH_VENCRYPT_TLSPLAIN: -+ case VNC_AUTH_VENCRYPT_X509PLAIN: -+ VNC_DEBUG("Start TLS auth PLAIN\n"); -+ vnc_read_when(vs, protocol_client_auth_plain_start, 8); -+ break; -+ -+ case VNC_AUTH_VENCRYPT_PLAIN: -+ VNC_DEBUG("Start auth PLAIN\n"); -+ vnc_read_when(vs, protocol_client_auth_plain_start, 8); -+ break; -+ - case VNC_AUTH_VENCRYPT_TLSVNC: - case VNC_AUTH_VENCRYPT_X509VNC: - start_auth_vnc(vs); -@@ -90,45 +203,51 @@ static int protocol_client_vencrypt_auth(VncState *vs, uint8_t *data, size_t len - int auth = read_u32(data, 0); - - trace_vnc_auth_vencrypt_subauth(vs, auth); -- if (auth != vs->subauth) { -+ if (auth != vs->subauth && auth != VNC_AUTH_VENCRYPT_PLAIN) { - trace_vnc_auth_fail(vs, vs->auth, "Unsupported sub-auth version", ""); - vnc_write_u8(vs, 0); /* Reject auth */ - vnc_flush(vs); - vnc_client_error(vs); - } else { -- Error *err = NULL; -- QIOChannelTLS *tls; -- vnc_write_u8(vs, 1); /* Accept auth */ -- vnc_flush(vs); -- -- if (vs->ioc_tag) { -- g_source_remove(vs->ioc_tag); -- vs->ioc_tag = 0; -+ if (auth == VNC_AUTH_VENCRYPT_PLAIN) { -+ vs->subauth = auth; -+ start_auth_vencrypt_subauth(vs); - } -+ else -+ { -+ Error *err = NULL; -+ QIOChannelTLS *tls; -+ vnc_write_u8(vs, 1); /* Accept auth */ -+ vnc_flush(vs); - -- tls = qio_channel_tls_new_server( -- vs->ioc, -- vs->vd->tlscreds, -- vs->vd->tlsaclname, -- &err); -- if (!tls) { -- trace_vnc_auth_fail(vs, vs->auth, "TLS setup failed", -- error_get_pretty(err)); -- error_free(err); -- vnc_client_error(vs); -- return 0; -- } -+ if (vs->ioc_tag) { -+ g_source_remove(vs->ioc_tag); -+ vs->ioc_tag = 0; -+ } -+ tls = qio_channel_tls_new_server( -+ vs->ioc, -+ vs->vd->tlscreds, -+ vs->vd->tlsaclname, -+ &err); -+ if (!tls) { -+ trace_vnc_auth_fail(vs, vs->auth, "TLS setup failed", -+ error_get_pretty(err)); -+ error_free(err); -+ vnc_client_error(vs); -+ return 0; -+ } - -- qio_channel_set_name(QIO_CHANNEL(tls), "vnc-server-tls"); -- object_unref(OBJECT(vs->ioc)); -- vs->ioc = QIO_CHANNEL(tls); -- trace_vnc_client_io_wrap(vs, vs->ioc, "tls"); -- vs->tls = qio_channel_tls_get_session(tls); -+ qio_channel_set_name(QIO_CHANNEL(tls), "vnc-server-tls"); -+ object_unref(OBJECT(vs->ioc)); -+ vs->ioc = QIO_CHANNEL(tls); -+ trace_vnc_client_io_wrap(vs, vs->ioc, "tls"); -+ vs->tls = qio_channel_tls_get_session(tls); - -- qio_channel_tls_handshake(tls, -- vnc_tls_handshake_done, -- vs, -- NULL); -+ qio_channel_tls_handshake(tls, -+ vnc_tls_handshake_done, -+ vs, -+ NULL); -+ } - } - return 0; - } -@@ -144,8 +263,9 @@ static int protocol_client_vencrypt_init(VncState *vs, uint8_t *data, size_t len - vnc_client_error(vs); - } else { - vnc_write_u8(vs, 0); /* Accept version */ -- vnc_write_u8(vs, 1); /* Number of sub-auths */ -+ vnc_write_u8(vs, 2); /* Number of sub-auths */ - vnc_write_u32(vs, vs->subauth); /* The supported auth */ -+ vnc_write_u32(vs, VNC_AUTH_VENCRYPT_PLAIN); /* Alternative supported auth */ - vnc_flush(vs); - vnc_read_when(vs, protocol_client_vencrypt_auth, 4); - } -diff --git a/ui/vnc.c b/ui/vnc.c -index 4494cb1dd4..1589cbe1b3 100644 ---- a/ui/vnc.c -+++ b/ui/vnc.c -@@ -55,6 +55,125 @@ static const struct timeval VNC_REFRESH_LOSSY = { 2, 0 }; - #include "vnc_keysym.h" - #include "crypto/cipher.h" - -+static int pve_vmid = 0; -+ -+void pve_auth_setup(int vmid) { -+ pve_vmid = vmid; -+} -+ -+static char * -+urlencode(char *buf, const char *value) -+{ -+ static const char *hexchar = "0123456789abcdef"; -+ char *p = buf; -+ int i; -+ int l = strlen(value); -+ for (i = 0; i < l; i++) { -+ char c = value[i]; -+ if (('a' <= c && c <= 'z') || -+ ('A' <= c && c <= 'Z') || -+ ('0' <= c && c <= '9')) { -+ *p++ = c; -+ } else if (c == 32) { -+ *p++ = '+'; -+ } else { -+ *p++ = '%'; -+ *p++ = hexchar[c >> 4]; -+ *p++ = hexchar[c & 15]; -+ } -+ } -+ *p = 0; -+ -+ return p; -+} -+ -+int -+pve_auth_verify(const char *clientip, const char *username, const char *passwd) -+{ -+ struct sockaddr_in server; -+ -+ int sfd = socket(AF_INET, SOCK_STREAM, 0); -+ if (sfd == -1) { -+ perror("pve_auth_verify: socket failed"); -+ return -1; -+ } -+ -+ struct hostent *he; -+ if ((he = gethostbyname("localhost")) == NULL) { -+ fprintf(stderr, "pve_auth_verify: error resolving hostname\n"); -+ goto err; -+ } -+ -+ memcpy(&server.sin_addr, he->h_addr_list[0], he->h_length); -+ server.sin_family = AF_INET; -+ server.sin_port = htons(85); -+ -+ if (connect(sfd, (struct sockaddr *)&server, sizeof(server))) { -+ perror("pve_auth_verify: error connecting to server"); -+ goto err; -+ } -+ -+ char buf[8192]; -+ char form[8192]; -+ -+ char *p = form; -+ p = urlencode(p, "username"); -+ *p++ = '='; -+ p = urlencode(p, username); -+ -+ *p++ = '&'; -+ p = urlencode(p, "password"); -+ *p++ = '='; -+ p = urlencode(p, passwd); -+ -+ *p++ = '&'; -+ p = urlencode(p, "path"); -+ *p++ = '='; -+ char authpath[256]; -+ sprintf(authpath, "/vms/%d", pve_vmid); -+ p = urlencode(p, authpath); -+ -+ *p++ = '&'; -+ p = urlencode(p, "privs"); -+ *p++ = '='; -+ p = urlencode(p, "VM.Console"); -+ -+ sprintf(buf, "POST /api2/json/access/ticket HTTP/1.1\n" -+ "Host: localhost:85\n" -+ "Connection: close\n" -+ "PVEClientIP: %s\n" -+ "Content-Type: application/x-www-form-urlencoded\n" -+ "Content-Length: %zd\n\n%s\n", clientip, strlen(form), form); -+ ssize_t len = strlen(buf); -+ ssize_t sb = send(sfd, buf, len, 0); -+ if (sb < 0) { -+ perror("pve_auth_verify: send failed"); -+ goto err; -+ } -+ if (sb != len) { -+ fprintf(stderr, "pve_auth_verify: partial send error\n"); -+ goto err; -+ } -+ -+ len = recv(sfd, buf, sizeof(buf) - 1, 0); -+ if (len < 0) { -+ perror("pve_auth_verify: recv failed"); -+ goto err; -+ } -+ -+ buf[len] = 0; -+ -+ //printf("DATA:%s\n", buf); -+ -+ shutdown(sfd, SHUT_RDWR); -+ -+ return strncmp(buf, "HTTP/1.1 200 OK", 15); -+ -+err: -+ shutdown(sfd, SHUT_RDWR); -+ return -1; -+} -+ - static QTAILQ_HEAD(, VncDisplay) vnc_displays = - QTAILQ_HEAD_INITIALIZER(vnc_displays); - -@@ -3507,10 +3626,16 @@ vnc_display_setup_auth(int *auth, - if (password) { - if (is_x509) { - VNC_DEBUG("Initializing VNC server with x509 password auth\n"); -- *subauth = VNC_AUTH_VENCRYPT_X509VNC; -+ if (tlscreds->pve) -+ *subauth = VNC_AUTH_VENCRYPT_X509PLAIN; -+ else -+ *subauth = VNC_AUTH_VENCRYPT_X509VNC; - } else { - VNC_DEBUG("Initializing VNC server with TLS password auth\n"); -- *subauth = VNC_AUTH_VENCRYPT_TLSVNC; -+ if (tlscreds->pve) -+ *subauth = VNC_AUTH_VENCRYPT_TLSPLAIN; -+ else -+ *subauth = VNC_AUTH_VENCRYPT_TLSVNC; - } - - } else if (sasl) { -@@ -3544,6 +3669,7 @@ vnc_display_create_creds(bool x509, - bool x509verify, - const char *dir, - const char *id, -+ bool pve, - Error **errp) - { - gchar *credsid = g_strdup_printf("tlsvnc%s", id); -@@ -3559,6 +3685,7 @@ vnc_display_create_creds(bool x509, - "endpoint", "server", - "dir", dir, - "verify-peer", x509verify ? "yes" : "no", -+ "pve", pve ? "yes" : "no", - NULL); - } else { - creds = object_new_with_props(TYPE_QCRYPTO_TLS_CREDS_ANON, -@@ -3566,6 +3693,7 @@ vnc_display_create_creds(bool x509, - credsid, - &err, - "endpoint", "server", -+ "pve", pve ? "yes" : "no", - NULL); - } - -@@ -4032,12 +4160,17 @@ void vnc_display_open(const char *id, Error **errp) - } - } else { - const char *path; -- bool tls = false, x509 = false, x509verify = false; -+ bool tls = false, x509 = false, x509verify = false, pve = false; - tls = qemu_opt_get_bool(opts, "tls", false); - path = qemu_opt_get(opts, "x509"); - if (tls || path) { - if (path) { - x509 = true; -+ if (!strcmp(path, "on")) { -+ /* magic to default to /etc/pve */ -+ path = "/etc/pve"; -+ pve = true; -+ } - } else { - path = qemu_opt_get(opts, "x509verify"); - if (path) { -@@ -4049,6 +4182,7 @@ void vnc_display_open(const char *id, Error **errp) - x509verify, - path, - vd->id, -+ pve, - errp); - if (!vd->tlscreds) { - goto fail; -diff --git a/ui/vnc.h b/ui/vnc.h -index bbda0540a7..8cc6367ed3 100644 ---- a/ui/vnc.h -+++ b/ui/vnc.h -@@ -290,6 +290,8 @@ struct VncState - int auth; - int subauth; /* Used by VeNCrypt */ - char challenge[VNC_AUTH_CHALLENGE_SIZE]; -+ int username_len; -+ int password_len; - QCryptoTLSSession *tls; /* Borrowed pointer from channel, don't free */ - #ifdef CONFIG_VNC_SASL - VncStateSASL sasl; -@@ -595,4 +597,6 @@ int vnc_zrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h); - int vnc_zywrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h); - void vnc_zrle_clear(VncState *vs); - -+int pve_auth_verify(const char *clientip, const char *username, const char *passwd); -+ - #endif /* QEMU_VNC_H */ -diff --git a/vl.c b/vl.c -index 75fde82180..255d989009 100644 ---- a/vl.c -+++ b/vl.c -@@ -3096,6 +3096,7 @@ static void register_global_properties(MachineState *ms) - int main(int argc, char **argv, char **envp) - { - int i; -+ long int vm_id_long = 0; - int snapshot, linux_boot; - const char *initrd_filename; - const char *kernel_filename, *kernel_cmdline; -@@ -3922,6 +3923,14 @@ int main(int argc, char **argv, char **envp) - exit(1); - } - break; -+ case QEMU_OPTION_id: -+ vm_id_long = strtol(optarg, (char **) &optarg, 10); -+ if (*optarg != 0 || vm_id_long < 100 || vm_id_long > INT_MAX) { -+ fprintf(stderr, "Invalid ID\n"); -+ exit(1); -+ } -+ pve_auth_setup(vm_id_long); -+ break; - case QEMU_OPTION_vnc: - vnc_parse(optarg, &error_fatal); - break; --- -2.11.0 - diff --git a/debian/patches/pve/0010-internal-snapshot-async.patch b/debian/patches/pve/0018-PVE-internal-snapshot-async.patch similarity index 93% rename from debian/patches/pve/0010-internal-snapshot-async.patch rename to debian/patches/pve/0018-PVE-internal-snapshot-async.patch index 4244b68..987ee25 100644 --- a/debian/patches/pve/0010-internal-snapshot-async.patch +++ b/debian/patches/pve/0018-PVE-internal-snapshot-async.patch @@ -1,48 +1,40 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 16:04:32 +0100 -Subject: [PATCH] internal snapshot async +Subject: [PATCH] PVE: internal snapshot async --- - Makefile.objs | 2 +- + Makefile.objs | 1 + hmp-commands-info.hx | 13 ++ hmp-commands.hx | 32 +++ hmp.c | 57 +++++ hmp.h | 5 + include/migration/snapshot.h | 1 + - qapi-schema.json | 32 +++ qapi/migration.json | 34 +++ + qapi/misc.json | 32 +++ qemu-options.hx | 13 ++ - savevm-async.c | 524 +++++++++++++++++++++++++++++++++++++++++++ + savevm-async.c | 528 +++++++++++++++++++++++++++++++++++++++++++ vl.c | 10 + - 11 files changed, 722 insertions(+), 1 deletion(-) + 11 files changed, 726 insertions(+) create mode 100644 savevm-async.c diff --git a/Makefile.objs b/Makefile.objs -index 285c6f3c15..686247b556 100644 +index 7a9828da28..a836ee87d7 100644 --- a/Makefile.objs +++ b/Makefile.objs -@@ -41,6 +41,7 @@ io-obj-y = io/ - ifeq ($(CONFIG_SOFTMMU),y) +@@ -98,6 +98,7 @@ ifeq ($(CONFIG_SOFTMMU),y) common-obj-y = blockdev.o blockdev-nbd.o block/ common-obj-y += bootdevice.o iothread.o + common-obj-y += job-qmp.o +common-obj-y += savevm-async.o common-obj-y += net/ common-obj-y += qdev-monitor.o device-hotplug.o common-obj-$(CONFIG_WIN32) += os-win32.o -@@ -49,7 +50,6 @@ common-obj-$(CONFIG_POSIX) += os-posix.o - common-obj-$(CONFIG_LINUX) += fsdev/ - - common-obj-y += migration/ -- - common-obj-y += audio/ - common-obj-y += hw/ - diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx -index 54c3e5eac6..3bf69a193c 100644 +index 70639f656a..42c148fdc9 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx -@@ -566,6 +566,19 @@ Show current migration xbzrle cache size. +@@ -575,6 +575,19 @@ Show current migration xbzrle cache size. ETEXI { @@ -63,10 +55,10 @@ index 54c3e5eac6..3bf69a193c 100644 .args_type = "", .params = "", diff --git a/hmp-commands.hx b/hmp-commands.hx -index 4afd57cf5f..b35bc6ab6c 100644 +index 91dfe51c37..a6f0720442 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx -@@ -1873,3 +1873,35 @@ ETEXI +@@ -1886,3 +1886,35 @@ ETEXI STEXI @end table ETEXI @@ -103,10 +95,10 @@ index 4afd57cf5f..b35bc6ab6c 100644 + .cmd = hmp_savevm_end, + }, diff --git a/hmp.c b/hmp.c -index 4e1d571003..b9ade681f0 100644 +index 4d60782f56..7c975f3ead 100644 --- a/hmp.c +++ b/hmp.c -@@ -2486,6 +2486,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) +@@ -2558,6 +2558,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &err); } @@ -171,10 +163,10 @@ index 4e1d571003..b9ade681f0 100644 { IOThreadInfoList *info_list = qmp_query_iothreads(NULL); diff --git a/hmp.h b/hmp.h -index a6f56b1f29..45ada581b6 100644 +index 33354f1bdd..98bb7a44db 100644 --- a/hmp.h +++ b/hmp.h -@@ -26,6 +26,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict); +@@ -24,6 +24,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict); void hmp_info_uuid(Monitor *mon, const QDict *qdict); void hmp_info_chardev(Monitor *mon, const QDict *qdict); void hmp_info_mice(Monitor *mon, const QDict *qdict); @@ -182,7 +174,7 @@ index a6f56b1f29..45ada581b6 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); -@@ -97,6 +98,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict); +@@ -98,6 +99,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); @@ -204,55 +196,12 @@ index c85b6ec75b..4411b7121d 100644 +int load_snapshot_from_blockdev(const char *filename, Error **errp); #endif -diff --git a/qapi-schema.json b/qapi-schema.json -index 8f436ba1f3..348b527681 100644 ---- a/qapi-schema.json -+++ b/qapi-schema.json -@@ -2439,6 +2439,38 @@ - { 'command': 'query-target', 'returns': 'TargetInfo' } - - ## -+# @savevm-start: -+# -+# Prepare for snapshot and halt VM. Save VM state to statefile. -+# -+## -+{ 'command': 'savevm-start', 'data': { '*statefile': 'str' } } -+ -+## -+# @snapshot-drive: -+# -+# Create an internal drive snapshot. -+# -+## -+{ 'command': 'snapshot-drive', 'data': { 'device': 'str', 'name': 'str' } } -+ -+## -+# @delete-drive-snapshot: -+# -+# Delete a drive snapshot. -+# -+## -+{ 'command': 'delete-drive-snapshot', 'data': { 'device': 'str', 'name': 'str' } } -+ -+## -+# @savevm-end: -+# -+# Resume VM after a snapshot. -+# -+## -+{ 'command': 'savevm-end' } -+ -+## - # @AcpiTableOptions: - # - # Specify an ACPI table on the command line to load. diff --git a/qapi/migration.json b/qapi/migration.json -index 03f57c9616..9ae55b81a2 100644 +index 186e8a7303..8d2626f6ad 100644 --- a/qapi/migration.json +++ b/qapi/migration.json -@@ -170,6 +170,40 @@ - '*error-desc': 'str'} } +@@ -189,6 +189,40 @@ + '*postcopy-vcpu-blocktime': ['uint32']} } ## +# @SaveVMInfo: @@ -292,11 +241,54 @@ index 03f57c9616..9ae55b81a2 100644 # @query-migrate: # # Returns information about current migration process. If migration +diff --git a/qapi/misc.json b/qapi/misc.json +index 4e8ebf9adc..b6ad5f028d 100644 +--- a/qapi/misc.json ++++ b/qapi/misc.json +@@ -2525,6 +2525,38 @@ + { 'command': 'query-target', 'returns': 'TargetInfo' } + + ## ++# @savevm-start: ++# ++# Prepare for snapshot and halt VM. Save VM state to statefile. ++# ++## ++{ 'command': 'savevm-start', 'data': { '*statefile': 'str' } } ++ ++## ++# @snapshot-drive: ++# ++# Create an internal drive snapshot. ++# ++## ++{ 'command': 'snapshot-drive', 'data': { 'device': 'str', 'name': 'str' } } ++ ++## ++# @delete-drive-snapshot: ++# ++# Delete a drive snapshot. ++# ++## ++{ 'command': 'delete-drive-snapshot', 'data': { 'device': 'str', 'name': 'str' } } ++ ++## ++# @savevm-end: ++# ++# Resume VM after a snapshot. ++# ++## ++{ 'command': 'savevm-end' } ++ ++## + # @AcpiTableOptions: + # + # Specify an ACPI table on the command line to load. diff --git a/qemu-options.hx b/qemu-options.hx -index 57f2c6a75f..7c054af8f9 100644 +index b1bf0f485f..31329e26e2 100644 --- a/qemu-options.hx +++ b/qemu-options.hx -@@ -3698,6 +3698,19 @@ STEXI +@@ -3520,6 +3520,19 @@ STEXI Start right away with a saved state (@code{loadvm} in monitor) ETEXI @@ -318,10 +310,10 @@ index 57f2c6a75f..7c054af8f9 100644 "-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL) diff --git a/savevm-async.c b/savevm-async.c new file mode 100644 -index 0000000000..897134ab5a +index 0000000000..0bf830c906 --- /dev/null +++ b/savevm-async.c -@@ -0,0 +1,524 @@ +@@ -0,0 +1,528 @@ +#include "qemu/osdep.h" +#include "migration/migration.h" +#include "migration/savevm.h" @@ -334,7 +326,11 @@ index 0000000000..897134ab5a +#include "qmp-commands.h" +#include "block/block.h" +#include "sysemu/block-backend.h" -+#include "qapi/qmp/qstring.h" ++#include "qapi/error.h" ++#include "qapi/qmp/qerror.h" ++#include "qapi/qmp/qdict.h" ++#include "qapi/qapi-commands-migration.h" ++#include "qapi/qapi-commands-misc.h" +#include "qemu/cutils.h" + +/* #define DEBUG_SAVEVM_STATE */ @@ -613,7 +609,7 @@ index 0000000000..897134ab5a + /* Open the image */ + QDict *options = NULL; + options = qdict_new(); -+ qdict_put(options, "driver", qstring_from_str("raw")); ++ qdict_put_str(options, "driver", "raw"); + snap_state.target = blk_new_open(statefile, NULL, options, bdrv_oflags, &local_err); + if (!snap_state.target) { + error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile); @@ -847,10 +843,10 @@ index 0000000000..897134ab5a + return ret; +} diff --git a/vl.c b/vl.c -index 2e0fe15978..1bfbe95b22 100644 +index c750b7c18e..b2e3e23724 100644 --- a/vl.c +++ b/vl.c -@@ -3109,6 +3109,7 @@ int main(int argc, char **argv, char **envp) +@@ -2927,6 +2927,7 @@ int main(int argc, char **argv, char **envp) int optind; const char *optarg; const char *loadvm = NULL; @@ -858,7 +854,7 @@ index 2e0fe15978..1bfbe95b22 100644 MachineClass *machine_class; const char *cpu_model; const char *vga_model = NULL; -@@ -3785,6 +3786,9 @@ int main(int argc, char **argv, char **envp) +@@ -3528,6 +3529,9 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_loadvm: loadvm = optarg; break; @@ -866,9 +862,9 @@ index 2e0fe15978..1bfbe95b22 100644 + loadstate = optarg; + break; case QEMU_OPTION_full_screen: - full_screen = 1; - break; -@@ -4891,6 +4895,12 @@ int main(int argc, char **argv, char **envp) + dpy.has_full_screen = true; + dpy.full_screen = true; +@@ -4623,6 +4627,12 @@ int main(int argc, char **argv, char **envp) error_report_err(local_err); autostart = 0; } diff --git a/debian/patches/pve/0018-block-rbd-disable-rbd_cache_writethrough_until_flush.patch b/debian/patches/pve/0018-block-rbd-disable-rbd_cache_writethrough_until_flush.patch deleted file mode 100644 index bfc105f..0000000 --- a/debian/patches/pve/0018-block-rbd-disable-rbd_cache_writethrough_until_flush.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alexandre Derumier -Date: Tue, 26 Jul 2016 16:51:00 +0200 -Subject: [PATCH] block: rbd: disable rbd_cache_writethrough_until_flush with - cache=unsafe - -Signed-off-by: Alexandre Derumier ---- - block/rbd.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/block/rbd.c b/block/rbd.c -index 2de434dfdd..c4732a4b12 100644 ---- a/block/rbd.c -+++ b/block/rbd.c -@@ -643,6 +643,10 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, - rados_conf_set(s->cluster, "rbd_cache", "true"); - } - -+ if (flags & BDRV_O_NO_FLUSH) { -+ rados_conf_set(s->cluster, "rbd_cache_writethrough_until_flush", "false"); -+ } -+ - r = rados_connect(s->cluster); - if (r < 0) { - error_setg_errno(errp, -r, "error connecting"); --- -2.11.0 - diff --git a/debian/patches/pve/0011-convert-savevm-async-to-threads.patch b/debian/patches/pve/0019-PVE-convert-savevm-async-to-threads.patch similarity index 85% rename from debian/patches/pve/0011-convert-savevm-async-to-threads.patch rename to debian/patches/pve/0019-PVE-convert-savevm-async-to-threads.patch index bacbd91..d4701a2 100644 --- a/debian/patches/pve/0011-convert-savevm-async-to-threads.patch +++ b/debian/patches/pve/0019-PVE-convert-savevm-async-to-threads.patch @@ -1,17 +1,27 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 8 Nov 2016 11:13:06 +0100 -Subject: [PATCH] convert savevm-async to threads +Subject: [PATCH] PVE: convert savevm-async to threads --- - savevm-async.c | 143 +++++++++++++++++++++++++++++++++++---------------------- - 1 file changed, 87 insertions(+), 56 deletions(-) + savevm-async.c | 151 ++++++++++++++++++++++++++++++++++----------------------- + 1 file changed, 90 insertions(+), 61 deletions(-) diff --git a/savevm-async.c b/savevm-async.c -index 897134ab5a..96523c88ae 100644 +index 0bf830c906..157eb7a50d 100644 --- a/savevm-async.c +++ b/savevm-async.c -@@ -43,6 +43,8 @@ static struct SnapshotState { +@@ -5,9 +5,7 @@ + #include "migration/global_state.h" + #include "migration/ram.h" + #include "migration/qemu-file.h" +-#include "qapi/qmp/qerror.h" + #include "sysemu/sysemu.h" +-#include "qmp-commands.h" + #include "block/block.h" + #include "sysemu/block-backend.h" + #include "qapi/error.h" +@@ -47,6 +45,8 @@ static struct SnapshotState { int saved_vm_running; QEMUFile *file; int64_t total_time; @@ -20,7 +30,7 @@ index 897134ab5a..96523c88ae 100644 } snap_state; SaveVMInfo *qmp_query_savevm(Error **errp) -@@ -130,19 +132,6 @@ static void save_snapshot_error(const char *fmt, ...) +@@ -134,19 +134,6 @@ static void save_snapshot_error(const char *fmt, ...) g_free (msg); snap_state.state = SAVE_STATE_ERROR; @@ -40,7 +50,7 @@ index 897134ab5a..96523c88ae 100644 } static int block_state_close(void *opaque) -@@ -151,48 +140,86 @@ static int block_state_close(void *opaque) +@@ -155,67 +142,118 @@ static int block_state_close(void *opaque) return blk_flush(snap_state.target); } @@ -143,9 +153,13 @@ index 897134ab5a..96523c88ae 100644 } while (snap_state.state == SAVE_STATE_ACTIVE) { -@@ -201,17 +228,30 @@ static void process_savevm_co(void *opaque) - qemu_savevm_state_pending(snap_state.file, 0, &pend_nonpost, &pend_post); - pending_size = pend_post + pend_nonpost; +- uint64_t pending_size, pend_post, pend_nonpost; ++ uint64_t pending_size, pend_precopy, pend_compatible, pend_postcopy; + +- qemu_savevm_state_pending(snap_state.file, 0, &pend_nonpost, &pend_post); +- pending_size = pend_post + pend_nonpost; ++ qemu_savevm_state_pending(snap_state.file, 0, &pend_precopy, &pend_compatible, &pend_postcopy); ++ pending_size = pend_precopy + pend_compatible + pend_postcopy; - if (pending_size) { - ret = qemu_savevm_state_iterate(snap_state.file, false); @@ -183,7 +197,7 @@ index 897134ab5a..96523c88ae 100644 DPRINTF("savevm inerate finished\n"); /* upstream made the return value here inconsistent * (-1 instead of 'ret' in one case and 0 after flush which can -@@ -223,28 +263,17 @@ static void process_savevm_co(void *opaque) +@@ -227,28 +265,17 @@ static void process_savevm_co(void *opaque) save_snapshot_error("qemu_savevm_state_iterate error %d", ret); break; } @@ -217,7 +231,7 @@ index 897134ab5a..96523c88ae 100644 } static const QEMUFileOps block_file_ops = { -@@ -307,8 +336,10 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp) +@@ -311,8 +338,10 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp) error_setg(&snap_state.blocker, "block device is in use by savevm"); blk_op_block_all(snap_state.target, snap_state.blocker); diff --git a/debian/patches/pve/0019-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch b/debian/patches/pve/0020-PVE-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch similarity index 83% rename from debian/patches/pve/0019-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch rename to debian/patches/pve/0020-PVE-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch index a3a5828..003fcc7 100644 --- a/debian/patches/pve/0019-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch +++ b/debian/patches/pve/0020-PVE-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Tue, 13 Sep 2016 01:57:56 +0200 -Subject: [PATCH] block: snapshot: qmp_snapshot_drive: add aiocontext +Subject: [PATCH] PVE: block: snapshot: qmp_snapshot_drive: add aiocontext Signed-off-by: Alexandre Derumier --- @@ -9,10 +9,10 @@ Signed-off-by: Alexandre Derumier 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/savevm-async.c b/savevm-async.c -index 96523c88ae..06dcd29fc7 100644 +index 157eb7a50d..87d5460a26 100644 --- a/savevm-async.c +++ b/savevm-async.c -@@ -377,6 +377,7 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp) +@@ -379,6 +379,7 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp) BlockBackend *blk; BlockDriverState *bs; QEMUSnapshotInfo sn1, *sn = &sn1; @@ -20,7 +20,7 @@ index 96523c88ae..06dcd29fc7 100644 int ret; #ifdef _WIN32 struct _timeb tb; -@@ -403,20 +404,23 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp) +@@ -405,20 +406,23 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp) return; } @@ -47,7 +47,7 @@ index 96523c88ae..06dcd29fc7 100644 } sn = &sn1; -@@ -441,8 +445,11 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp) +@@ -443,8 +447,11 @@ void qmp_snapshot_drive(const char *device, const char *name, Error **errp) if (ret < 0) { error_set(errp, ERROR_CLASS_GENERIC_ERROR, "Error while creating snapshot on '%s'\n", device); diff --git a/debian/patches/pve/0020-block-snapshot-qmp_delete_drive_snapshot-add-aiocont.patch b/debian/patches/pve/0021-PVE-block-snapshot-qmp_delete_drive_snapshot-add-aio.patch similarity index 85% rename from debian/patches/pve/0020-block-snapshot-qmp_delete_drive_snapshot-add-aiocont.patch rename to debian/patches/pve/0021-PVE-block-snapshot-qmp_delete_drive_snapshot-add-aio.patch index 8cbef36..def2307 100644 --- a/debian/patches/pve/0020-block-snapshot-qmp_delete_drive_snapshot-add-aiocont.patch +++ b/debian/patches/pve/0021-PVE-block-snapshot-qmp_delete_drive_snapshot-add-aio.patch @@ -1,7 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Mon, 7 Nov 2016 11:47:50 +0100 -Subject: [PATCH] block: snapshot: qmp_delete_drive_snapshot : add aiocontext +Subject: [PATCH] PVE: block: snapshot: qmp_delete_drive_snapshot : add + aiocontext this fix snapshot delete of qcow2 with iothread enabled @@ -11,10 +12,10 @@ Signed-off-by: Alexandre Derumier 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/savevm-async.c b/savevm-async.c -index 06dcd29fc7..e6f86ef865 100644 +index 87d5460a26..aa578c4a49 100644 --- a/savevm-async.c +++ b/savevm-async.c -@@ -459,6 +459,7 @@ void qmp_delete_drive_snapshot(const char *device, const char *name, +@@ -461,6 +461,7 @@ void qmp_delete_drive_snapshot(const char *device, const char *name, BlockDriverState *bs; QEMUSnapshotInfo sn1, *sn = &sn1; Error *local_err = NULL; @@ -22,7 +23,7 @@ index 06dcd29fc7..e6f86ef865 100644 int ret; -@@ -475,22 +476,28 @@ void qmp_delete_drive_snapshot(const char *device, const char *name, +@@ -477,22 +478,28 @@ void qmp_delete_drive_snapshot(const char *device, const char *name, return; } diff --git a/debian/patches/pve/0023-block-add-the-zeroinit-block-driver-filter.patch b/debian/patches/pve/0022-PVE-block-add-the-zeroinit-block-driver-filter.patch similarity index 88% rename from debian/patches/pve/0023-block-add-the-zeroinit-block-driver-filter.patch rename to debian/patches/pve/0022-PVE-block-add-the-zeroinit-block-driver-filter.patch index 1a0847d..dd2fc49 100644 --- a/debian/patches/pve/0023-block-add-the-zeroinit-block-driver-filter.patch +++ b/debian/patches/pve/0022-PVE-block-add-the-zeroinit-block-driver-filter.patch @@ -1,16 +1,16 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 17 Mar 2016 11:33:37 +0100 -Subject: [PATCH] block: add the zeroinit block driver filter +Subject: [PATCH] PVE: block: add the zeroinit block driver filter --- block/Makefile.objs | 1 + - block/zeroinit.c | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 203 insertions(+) + block/zeroinit.c | 203 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 204 insertions(+) create mode 100644 block/zeroinit.c diff --git a/block/Makefile.objs b/block/Makefile.objs -index 6eaf78a046..823e60cda6 100644 +index c8337bf186..c00f0b32d6 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -4,6 +4,7 @@ block-obj-y += qed.o qed-l2-cache.o qed-table.o qed-cluster.o @@ -19,14 +19,14 @@ index 6eaf78a046..823e60cda6 100644 block-obj-y += quorum.o +block-obj-y += zeroinit.o block-obj-y += parallels.o blkdebug.o blkverify.o blkreplay.o + block-obj-y += blklogwrites.o block-obj-y += block-backend.o snapshot.o qapi.o - block-obj-$(CONFIG_WIN32) += file-win32.o win32-aio.o diff --git a/block/zeroinit.c b/block/zeroinit.c new file mode 100644 -index 0000000000..37f588f75c +index 0000000000..64c49ad0e0 --- /dev/null +++ b/block/zeroinit.c -@@ -0,0 +1,202 @@ +@@ -0,0 +1,203 @@ +/* + * Filter to fake a zero-initialized block device. + * @@ -43,6 +43,7 @@ index 0000000000..37f588f75c +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qstring.h" +#include "qemu/cutils.h" ++#include "qemu/option.h" + +typedef struct { + bool has_zero_init; @@ -179,13 +180,13 @@ index 0000000000..37f588f75c +static int coroutine_fn zeroinit_co_pdiscard(BlockDriverState *bs, + int64_t offset, int count) +{ -+ return bdrv_co_pdiscard(bs->file->bs, offset, count); ++ return bdrv_co_pdiscard(bs->file, offset, count); +} + -+static int zeroinit_truncate(BlockDriverState *bs, int64_t offset, ++static int zeroinit_co_truncate(BlockDriverState *bs, int64_t offset, + PreallocMode prealloc, Error **errp) +{ -+ return bdrv_truncate(bs->file, offset, prealloc, errp); ++ return bdrv_co_truncate(bs->file, offset, prealloc, errp); +} + +static int zeroinit_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) @@ -213,14 +214,14 @@ index 0000000000..37f588f75c + .is_filter = true, + .bdrv_recurse_is_first_non_filter = zeroinit_recurse_is_first_non_filter, + -+ .bdrv_has_zero_init = zeroinit_has_zero_init, ++ .bdrv_has_zero_init = zeroinit_has_zero_init, + -+ .bdrv_co_get_block_status = bdrv_co_get_block_status_from_file, ++ .bdrv_co_block_status = bdrv_co_block_status_from_file, + -+ .bdrv_co_pdiscard = zeroinit_co_pdiscard, ++ .bdrv_co_pdiscard = zeroinit_co_pdiscard, + -+ .bdrv_truncate = zeroinit_truncate, -+ .bdrv_get_info = zeroinit_get_info, ++ .bdrv_co_truncate = zeroinit_co_truncate, ++ .bdrv_get_info = zeroinit_get_info, +}; + +static void bdrv_zeroinit_init(void) diff --git a/debian/patches/pve/0025-backup-modify-job-api.patch b/debian/patches/pve/0023-PVE-backup-modify-job-api.patch similarity index 63% rename from debian/patches/pve/0025-backup-modify-job-api.patch rename to debian/patches/pve/0023-PVE-backup-modify-job-api.patch index bb03935..f89c6cd 100644 --- a/debian/patches/pve/0025-backup-modify-job-api.patch +++ b/debian/patches/pve/0023-PVE-backup-modify-job-api.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 9 Dec 2015 15:04:57 +0100 -Subject: [PATCH] backup: modify job api +Subject: [PATCH] PVE: backup: modify job api Introduce a pause_count parameter to start a backup in paused mode. This way backups of multiple drives can be @@ -11,90 +11,90 @@ having been started at the same point in time. block/backup.c | 2 ++ block/replication.c | 2 +- blockdev.c | 4 ++-- - blockjob.c | 2 +- include/block/block_int.h | 1 + + job.c | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/block/backup.c b/block/backup.c -index 99e6bcc748..8c2967a8cb 100644 +index 8630d32926..7f970842d7 100644 --- a/block/backup.c +++ b/block/backup.c -@@ -539,6 +539,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -613,6 +613,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, BlockdevOnError on_target_error, int creation_flags, BlockCompletionFunc *cb, void *opaque, + int pause_count, - BlockJobTxn *txn, Error **errp) + JobTxn *txn, Error **errp) { int64_t len; -@@ -663,6 +664,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -746,6 +747,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, &error_abort); - job->common.len = len; -+ job->common.pause_count = pause_count; - block_job_txn_add_job(txn, &job->common); + job->len = len; ++ job->common.job.pause_count = pause_count; return &job->common; + diff --git a/block/replication.c b/block/replication.c -index e41e293d2b..1b08b242eb 100644 +index 6349d6958e..84e07cc4d4 100644 --- a/block/replication.c +++ b/block/replication.c -@@ -561,7 +561,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, +@@ -571,7 +571,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, 0, MIRROR_SYNC_MODE_NONE, NULL, false, BLOCKDEV_ON_ERROR_REPORT, - BLOCKDEV_ON_ERROR_REPORT, BLOCK_JOB_INTERNAL, + BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL, - backup_job_completed, bs, NULL, &local_err); + backup_job_completed, bs, 0, NULL, &local_err); if (local_err) { error_propagate(errp, local_err); backup_job_cleanup(bs); diff --git a/blockdev.c b/blockdev.c -index 56a6b24a0b..a9ed9034b5 100644 +index dcf8c8d2ab..d5eb6b62ca 100644 --- a/blockdev.c +++ b/blockdev.c -@@ -3293,7 +3293,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, BlockJobTxn *txn, +@@ -3568,7 +3568,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn, job = backup_job_create(backup->job_id, bs, target_bs, backup->speed, backup->sync, bmap, backup->compress, backup->on_source_error, backup->on_target_error, -- BLOCK_JOB_DEFAULT, NULL, NULL, txn, &local_err); -+ BLOCK_JOB_DEFAULT, NULL, NULL, 0, txn, &local_err); +- job_flags, NULL, NULL, txn, &local_err); ++ job_flags, NULL, NULL, 0, txn, &local_err); bdrv_unref(target_bs); if (local_err != NULL) { error_propagate(errp, local_err); -@@ -3372,7 +3372,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, BlockJobTxn *txn, +@@ -3660,7 +3660,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn, job = backup_job_create(backup->job_id, bs, target_bs, backup->speed, backup->sync, NULL, backup->compress, backup->on_source_error, backup->on_target_error, -- BLOCK_JOB_DEFAULT, NULL, NULL, txn, &local_err); -+ BLOCK_JOB_DEFAULT, NULL, NULL, 0, txn, &local_err); +- job_flags, NULL, NULL, txn, &local_err); ++ job_flags, NULL, NULL, 0, txn, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); } -diff --git a/blockjob.c b/blockjob.c -index 715c2c2680..c1b6b6a810 100644 ---- a/blockjob.c -+++ b/blockjob.c -@@ -322,7 +322,7 @@ void block_job_start(BlockJob *job) - job->co = qemu_coroutine_create(block_job_co_entry, job); - job->pause_count--; - job->busy = true; -- job->paused = false; -+ job->paused = job->pause_count > 0; - bdrv_coroutine_enter(blk_bs(job->blk), job->co); - } - diff --git a/include/block/block_int.h b/include/block/block_int.h -index a5482775ec..1dbbdafd31 100644 +index 903b9c1034..0b2516c3cf 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h -@@ -985,6 +985,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -1083,6 +1083,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, BlockdevOnError on_target_error, int creation_flags, BlockCompletionFunc *cb, void *opaque, + int pause_count, - BlockJobTxn *txn, Error **errp); + JobTxn *txn, Error **errp); void hmp_drive_add_node(Monitor *mon, const char *optstr); +diff --git a/job.c b/job.c +index fa671b431a..72c50ee18e 100644 +--- a/job.c ++++ b/job.c +@@ -557,7 +557,7 @@ void job_start(Job *job) + job->co = qemu_coroutine_create(job_co_entry, job); + job->pause_count--; + job->busy = true; +- job->paused = false; ++ job->paused = job->pause_count > 0; + job_state_transition(job, JOB_STATUS_RUNNING); + aio_co_enter(job->aio_context, job->co); + } -- 2.11.0 diff --git a/debian/patches/pve/0026-backup-introduce-vma-archive-format.patch b/debian/patches/pve/0024-PVE-backup-introduce-vma-archive-format.patch similarity index 90% rename from debian/patches/pve/0026-backup-introduce-vma-archive-format.patch rename to debian/patches/pve/0024-PVE-backup-introduce-vma-archive-format.patch index e988f6e..ab8b00c 100644 --- a/debian/patches/pve/0026-backup-introduce-vma-archive-format.patch +++ b/debian/patches/pve/0024-PVE-backup-introduce-vma-archive-format.patch @@ -1,28 +1,30 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 2 Aug 2017 13:51:02 +0200 -Subject: [PATCH] backup: introduce vma archive format +Subject: [PATCH] PVE: backup: introduce vma archive format +TODO: Move to a libvma block backend. --- MAINTAINERS | 6 + block/Makefile.objs | 3 + block/vma.c | 424 ++++++++++++++++++++++++++++++++++++++++ blockdev.c | 536 +++++++++++++++++++++++++++++++++++++++++++++++++++ - blockjob.c | 3 +- - configure | 30 +++ + configure | 29 +++ hmp-commands-info.hx | 13 ++ hmp-commands.hx | 31 +++ hmp.c | 63 ++++++ hmp.h | 3 + qapi/block-core.json | 109 ++++++++++- - 11 files changed, 1219 insertions(+), 2 deletions(-) + qapi/common.json | 13 ++ + qapi/misc.json | 13 -- + 12 files changed, 1229 insertions(+), 14 deletions(-) create mode 100644 block/vma.c diff --git a/MAINTAINERS b/MAINTAINERS -index a8e01de523..f688556e0d 100644 +index 666e936812..299a73cd86 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -1956,6 +1956,12 @@ L: qemu-block@nongnu.org +@@ -2140,6 +2140,12 @@ L: qemu-block@nongnu.org S: Supported F: block/vvfat.c @@ -36,10 +38,10 @@ index a8e01de523..f688556e0d 100644 M: Stefan Hajnoczi L: qemu-block@nongnu.org diff --git a/block/Makefile.objs b/block/Makefile.objs -index 823e60cda6..d74140e413 100644 +index c00f0b32d6..abfd0f69d7 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs -@@ -22,6 +22,7 @@ block-obj-$(CONFIG_RBD) += rbd.o +@@ -24,6 +24,7 @@ block-obj-$(CONFIG_RBD) += rbd.o block-obj-$(CONFIG_GLUSTERFS) += gluster.o block-obj-$(CONFIG_VXHS) += vxhs.o block-obj-$(CONFIG_LIBSSH2) += ssh.o @@ -47,10 +49,10 @@ index 823e60cda6..d74140e413 100644 block-obj-y += accounting.o dirty-bitmap.o block-obj-y += write-threshold.o block-obj-y += backup.o -@@ -48,3 +49,5 @@ block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o - dmg-bz2.o-libs := $(BZIP2_LIBS) - qcow.o-libs := -lz +@@ -52,3 +53,5 @@ qcow.o-libs := -lz linux-aio.o-libs := -laio + parallels.o-cflags := $(LIBXML2_CFLAGS) + parallels.o-libs := $(LIBXML2_LIBS) +vma.o-cflags := $(VMA_CFLAGS) +vma.o-libs := $(VMA_LIBS) diff --git a/block/vma.c b/block/vma.c @@ -484,10 +486,10 @@ index 0000000000..7151514f94 + +block_init(bdrv_vma_init); diff --git a/blockdev.c b/blockdev.c -index a9ed9034b5..3ffd064c48 100644 +index d5eb6b62ca..4f18d3c3d7 100644 --- a/blockdev.c +++ b/blockdev.c -@@ -31,10 +31,12 @@ +@@ -31,11 +31,13 @@ */ #include "qemu/osdep.h" @@ -496,11 +498,20 @@ index a9ed9034b5..3ffd064c48 100644 #include "sysemu/blockdev.h" #include "hw/block/block.h" #include "block/blockjob.h" + #include "block/qdict.h" +#include "block/blockjob_int.h" #include "block/throttle-groups.h" #include "monitor/monitor.h" #include "qemu/error-report.h" -@@ -2963,6 +2965,540 @@ out: +@@ -44,6 +46,7 @@ + #include "qapi/qapi-commands-block.h" + #include "qapi/qapi-commands-transaction.h" + #include "qapi/qapi-visit-block-core.h" ++#include "qapi/qapi-types-misc.h" + #include "qapi/qmp/qdict.h" + #include "qapi/qmp/qnum.h" + #include "qapi/qmp/qstring.h" +@@ -3220,6 +3223,539 @@ out: aio_context_release(aio_context); } @@ -623,7 +634,7 @@ index a9ed9034b5..3ffd064c48 100644 + AioContext *aio_context = blk_get_aio_context(job->blk); + aio_context_acquire(aio_context); + if (!di->completed) { -+ block_job_cancel(job); ++ job_cancel(&job->job, false); + } + aio_context_release(aio_context); + } @@ -683,7 +694,6 @@ index a9ed9034b5..3ffd064c48 100644 + return 0; +} + -+void block_job_resume(BlockJob *job); +static void pvebackup_run_next_job(void) +{ + qemu_mutex_lock(&backup_state.backup_mutex); @@ -698,9 +708,9 @@ index a9ed9034b5..3ffd064c48 100644 + aio_context_acquire(aio_context); + qemu_mutex_unlock(&backup_state.backup_mutex); + if (backup_state.error || backup_state.cancel) { -+ block_job_cancel_sync(job); ++ job_cancel_sync(job); + } else { -+ block_job_resume(job); ++ job_resume(job); + } + aio_context_release(aio_context); + return; @@ -934,7 +944,7 @@ index a9ed9034b5..3ffd064c48 100644 + + job = backup_job_create(NULL, di->bs, di->target, speed, MIRROR_SYNC_MODE_FULL, NULL, + false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT, -+ BLOCK_JOB_DEFAULT, ++ JOB_DEFAULT, + pvebackup_complete_cb, di, 2, NULL, &local_err); + if (di->target) { + bdrv_unref(di->target); @@ -944,7 +954,7 @@ index a9ed9034b5..3ffd064c48 100644 + error_setg(&backup_state.error, "backup_job_create failed"); + pvebackup_cancel(NULL); + } else { -+ block_job_start(job); ++ job_start(&job->job); + } + } + @@ -1041,52 +1051,38 @@ index a9ed9034b5..3ffd064c48 100644 void qmp_block_stream(bool has_job_id, const char *job_id, const char *device, bool has_base, const char *base, bool has_base_node, const char *base_node, -diff --git a/blockjob.c b/blockjob.c -index c1b6b6a810..2de9f8f4dd 100644 ---- a/blockjob.c -+++ b/blockjob.c -@@ -149,7 +149,8 @@ static void block_job_pause(BlockJob *job) - job->pause_count++; - } - --static void block_job_resume(BlockJob *job) -+void block_job_resume(BlockJob *job); -+void block_job_resume(BlockJob *job) - { - assert(job->pause_count > 0); - job->pause_count--; diff --git a/configure b/configure -index ceec276693..387fb5ad6d 100755 +index 2a7796ea80..601c1f44f9 100755 --- a/configure +++ b/configure -@@ -422,6 +422,7 @@ tcmalloc="no" - jemalloc="no" - replication="yes" - vxhs="" +@@ -475,6 +475,7 @@ vxhs="" + libxml2="" + docker="no" + debug_mutex="no" +vma="" - supported_cpu="no" - supported_os="no" -@@ -1315,6 +1316,10 @@ for opt do + # cross compilers defaults, can be overridden with --cross-cc-ARCH + cross_cc_aarch64="aarch64-linux-gnu-gcc" +@@ -1435,6 +1436,10 @@ for opt do ;; - --disable-git-update) git_update=no + --disable-debug-mutex) debug_mutex=no ;; -+ --disable-vma) vma="no" ++ --enable-vma) vma=yes + ;; -+ --enable-vma) vma="yes" ++ --disable-vma) vma=no + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" -@@ -1563,6 +1568,7 @@ disabled with --disable-FEATURE, default is enabled if available: - crypto-afalg Linux AF_ALG crypto backend driver +@@ -1710,6 +1715,7 @@ disabled with --disable-FEATURE, default is enabled if available: vhost-user vhost-user support capstone capstone disassembler support + debug-mutex mutex debugging support + vma VMA archive backend NOTE: The object files are built at the place where configure is launched EOF -@@ -3893,6 +3899,23 @@ EOF +@@ -4124,6 +4130,22 @@ EOF fi ########################################## @@ -1105,21 +1101,20 @@ index ceec276693..387fb5ad6d 100755 + fi +fi + -+ +########################################## # signalfd probe signalfd="no" cat > $TMPC << EOF -@@ -5558,6 +5581,7 @@ echo "avx2 optimization $avx2_opt" - echo "replication support $replication" +@@ -6010,6 +6032,7 @@ echo "replication support $replication" echo "VxHS block device $vxhs" echo "capstone $capstone" + echo "docker $docker" +echo "VMA support $vma" if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" -@@ -6001,6 +6025,12 @@ if test "$libusb" = "yes" ; then - echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak +@@ -6496,6 +6519,12 @@ if test "$usb_redir" = "yes" ; then + echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak fi +if test "$vma" = "yes" ; then @@ -1128,14 +1123,14 @@ index ceec276693..387fb5ad6d 100755 + echo "VMA_LIBS=$vma_libs" >> $config_host_mak +fi + - if test "$usb_redir" = "yes" ; then - echo "CONFIG_USB_REDIR=y" >> $config_host_mak - echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak + if test "$opengl" = "yes" ; then + echo "CONFIG_OPENGL=y" >> $config_host_mak + echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx -index 3bf69a193c..7beeb29e99 100644 +index 42c148fdc9..277e140092 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx -@@ -493,6 +493,19 @@ STEXI +@@ -502,6 +502,19 @@ STEXI Show CPU statistics. ETEXI @@ -1156,10 +1151,10 @@ index 3bf69a193c..7beeb29e99 100644 { .name = "usernet", diff --git a/hmp-commands.hx b/hmp-commands.hx -index b35bc6ab6c..9e50947845 100644 +index a6f0720442..956cbf04b9 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx -@@ -87,6 +87,37 @@ STEXI +@@ -107,6 +107,37 @@ STEXI Copy data from a backing file into a block device. ETEXI @@ -1198,10 +1193,10 @@ index b35bc6ab6c..9e50947845 100644 .name = "block_job_set_speed", .args_type = "device:B,speed:o", diff --git a/hmp.c b/hmp.c -index b9ade681f0..241c2543ec 100644 +index 7c975f3ead..8d659e20f6 100644 --- a/hmp.c +++ b/hmp.c -@@ -156,6 +156,44 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict) +@@ -166,6 +166,44 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict) qapi_free_MouseInfoList(mice_list); } @@ -1246,7 +1241,7 @@ index b9ade681f0..241c2543ec 100644 void hmp_info_migrate(Monitor *mon, const QDict *qdict) { MigrationInfo *info; -@@ -1848,6 +1886,31 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) +@@ -1899,6 +1937,31 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict) hmp_handle_error(mon, &error); } @@ -1279,10 +1274,10 @@ index b9ade681f0..241c2543ec 100644 { Error *error = NULL; diff --git a/hmp.h b/hmp.h -index 45ada581b6..635b9b4218 100644 +index 98bb7a44db..853f233195 100644 --- a/hmp.h +++ b/hmp.h -@@ -31,6 +31,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict); +@@ -29,6 +29,7 @@ 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); @@ -1290,7 +1285,7 @@ index 45ada581b6..635b9b4218 100644 void hmp_info_cpus(Monitor *mon, const QDict *qdict); void hmp_info_block(Monitor *mon, const QDict *qdict); void hmp_info_blockstats(Monitor *mon, const QDict *qdict); -@@ -85,6 +86,8 @@ void hmp_eject(Monitor *mon, const QDict *qdict); +@@ -86,6 +87,8 @@ void hmp_eject(Monitor *mon, const QDict *qdict); void hmp_change(Monitor *mon, const QDict *qdict); void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict); void hmp_block_stream(Monitor *mon, const QDict *qdict); @@ -1300,10 +1295,10 @@ index 45ada581b6..635b9b4218 100644 void hmp_block_job_cancel(Monitor *mon, const QDict *qdict); void hmp_block_job_pause(Monitor *mon, const QDict *qdict); diff --git a/qapi/block-core.json b/qapi/block-core.json -index dd763dcf87..461fca9a3d 100644 +index 5b9084a394..9c3c2d4917 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json -@@ -615,6 +615,97 @@ +@@ -718,6 +718,97 @@ ## @@ -1401,16 +1396,16 @@ index dd763dcf87..461fca9a3d 100644 # @BlockDeviceTimedStats: # # Statistics of a block device during a given interval of time. -@@ -2239,7 +2330,7 @@ - 'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs', - 'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed', - 'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh', -- 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] } -+ 'throttle', 'vdi', 'vhdx', 'vma-drive', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] } +@@ -2549,7 +2640,7 @@ + 'host_cdrom', 'host_device', 'http', 'https', 'iscsi', 'luks', + 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels', 'qcow', + 'qcow2', 'qed', 'quorum', 'raw', 'rbd', 'replication', 'sheepdog', +- 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] } ++ 'ssh', 'throttle', 'vdi', 'vhdx', 'vma-drive', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] } ## # @BlockdevOptionsFile: -@@ -3116,6 +3207,21 @@ +@@ -3550,6 +3641,21 @@ '*tls-creds': 'str' } } ## @@ -1432,7 +1427,7 @@ index dd763dcf87..461fca9a3d 100644 # @BlockdevOptionsThrottle: # # Driver specific block device options for the throttle driver -@@ -3196,6 +3302,7 @@ +@@ -3633,6 +3739,7 @@ 'throttle': 'BlockdevOptionsThrottle', 'vdi': 'BlockdevOptionsGenericFormat', 'vhdx': 'BlockdevOptionsGenericFormat', @@ -1440,6 +1435,51 @@ index dd763dcf87..461fca9a3d 100644 'vmdk': 'BlockdevOptionsGenericCOWFormat', 'vpc': 'BlockdevOptionsGenericFormat', 'vvfat': 'BlockdevOptionsVVFAT', +diff --git a/qapi/common.json b/qapi/common.json +index c367adc4b6..070b7b52c8 100644 +--- a/qapi/common.json ++++ b/qapi/common.json +@@ -149,3 +149,16 @@ + 'ppc64', 'ppcemb', 'riscv32', 'riscv64', 's390x', 'sh4', + 'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32', + 'x86_64', 'xtensa', 'xtensaeb' ] } ++ ++## ++# @UuidInfo: ++# ++# Guest UUID information (Universally Unique Identifier). ++# ++# @UUID: the UUID of the guest ++# ++# Since: 0.14.0 ++# ++# Notes: If no UUID was specified for the guest, a null UUID is returned. ++## ++{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} } +diff --git a/qapi/misc.json b/qapi/misc.json +index b6ad5f028d..3dd5117fc3 100644 +--- a/qapi/misc.json ++++ b/qapi/misc.json +@@ -275,19 +275,6 @@ + { 'command': 'query-kvm', 'returns': 'KvmInfo' } + + ## +-# @UuidInfo: +-# +-# Guest UUID information (Universally Unique Identifier). +-# +-# @UUID: the UUID of the guest +-# +-# Since: 0.14.0 +-# +-# Notes: If no UUID was specified for the guest, a null UUID is returned. +-## +-{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} } +- +-## + # @query-uuid: + # + # Query the guest UUID information. -- 2.11.0 diff --git a/debian/patches/pve/0027-adding-old-vma-files.patch b/debian/patches/pve/0025-PVE-Deprecated-adding-old-vma-files.patch similarity index 91% rename from debian/patches/pve/0027-adding-old-vma-files.patch rename to debian/patches/pve/0025-PVE-Deprecated-adding-old-vma-files.patch index fab0ea9..ae1dd0b 100644 --- a/debian/patches/pve/0027-adding-old-vma-files.patch +++ b/debian/patches/pve/0025-PVE-Deprecated-adding-old-vma-files.patch @@ -1,31 +1,32 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 7 Aug 2017 08:51:16 +0200 -Subject: [PATCH] adding old vma files +Subject: [PATCH] PVE: [Deprecated] adding old vma files +TODO: Move to using a libvma block backend --- Makefile | 3 +- Makefile.objs | 1 + - block/backup.c | 130 ++++--- + block/backup.c | 107 ++++-- block/replication.c | 1 + - blockdev.c | 207 +++++++---- - blockjob.c | 3 +- + blockdev.c | 208 +++++++---- include/block/block_int.h | 4 + + job.c | 3 +- vma-reader.c | 857 ++++++++++++++++++++++++++++++++++++++++++++++ vma-writer.c | 771 +++++++++++++++++++++++++++++++++++++++++ vma.c | 756 ++++++++++++++++++++++++++++++++++++++++ vma.h | 150 ++++++++ - 11 files changed, 2760 insertions(+), 123 deletions(-) + 11 files changed, 2754 insertions(+), 107 deletions(-) create mode 100644 vma-reader.c create mode 100644 vma-writer.c create mode 100644 vma.c create mode 100644 vma.h diff --git a/Makefile b/Makefile -index ab0354c153..ad28227b6c 100644 +index 2da686be33..5a0aad2004 100644 --- a/Makefile +++ b/Makefile -@@ -340,7 +340,7 @@ dummy := $(call unnest-vars,, \ +@@ -436,7 +436,7 @@ dummy := $(call unnest-vars,, \ include $(SRC_PATH)/tests/Makefile.include @@ -34,7 +35,7 @@ index ab0354c153..ad28227b6c 100644 qemu-version.h: FORCE $(call quiet-command, \ -@@ -439,6 +439,7 @@ qemu-img.o: qemu-img-cmds.h +@@ -537,6 +537,7 @@ qemu-img.o: qemu-img-cmds.h qemu-img$(EXESUF): qemu-img.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) qemu-io$(EXESUF): qemu-io.o $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS) @@ -43,10 +44,10 @@ index ab0354c153..ad28227b6c 100644 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS) diff --git a/Makefile.objs b/Makefile.objs -index 686247b556..34e62547d8 100644 +index a836ee87d7..92c7886dee 100644 --- a/Makefile.objs +++ b/Makefile.objs -@@ -14,6 +14,7 @@ block-obj-y += block.o blockjob.o +@@ -70,6 +70,7 @@ block-obj-y += block.o blockjob.o job.o block-obj-y += block/ scsi/ block-obj-y += qemu-io-cmds.o block-obj-$(CONFIG_REPLICATION) += replication.o @@ -55,51 +56,60 @@ index 686247b556..34e62547d8 100644 block-obj-m = block/ diff --git a/block/backup.c b/block/backup.c -index 8c2967a8cb..0870acdae7 100644 +index 7f970842d7..5f53163a77 100644 --- a/block/backup.c +++ b/block/backup.c -@@ -36,6 +36,7 @@ typedef struct BackupBlockJob { +@@ -34,6 +34,7 @@ typedef struct BackupBlockJob { + /* bitmap for sync=incremental */ BdrvDirtyBitmap *sync_bitmap; MirrorSyncMode sync_mode; - RateLimit limit; + BackupDumpFunc *dump_cb; BlockdevOnError on_source_error; BlockdevOnError on_target_error; CoRwlock flush_rwlock; -@@ -135,13 +136,24 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *job, - goto out; - } +@@ -126,12 +127,20 @@ static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, + } -+ - if (buffer_is_zero(iov.iov_base, iov.iov_len)) { -- ret = blk_co_pwrite_zeroes(job->target, start, -- bounce_qiov.size, BDRV_REQ_MAY_UNMAP); + if (qemu_iovec_is_zero(&qiov)) { +- ret = blk_co_pwrite_zeroes(job->target, start, +- qiov.size, write_flags | BDRV_REQ_MAY_UNMAP); ++ if (job->dump_cb) { ++ ret = job->dump_cb(job->common.job.opaque, job->target, start, qiov.size, NULL); ++ } else { ++ ret = blk_co_pwrite_zeroes(job->target, start, ++ qiov.size, write_flags | BDRV_REQ_MAY_UNMAP); ++ } + } else { +- ret = blk_co_pwritev(job->target, start, +- qiov.size, &qiov, write_flags | +- (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0)); ++ if (job->dump_cb) { ++ ret = job->dump_cb(job->common.job.opaque, job->target, start, qiov.size, *bounce_buffer); ++ } else { ++ ret = blk_co_pwritev(job->target, start, ++ qiov.size, &qiov, write_flags | ++ (job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0)); ++ } + } + if (ret < 0) { + trace_backup_do_cow_write_fail(job, start, ret); +@@ -209,7 +218,11 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *job, + trace_backup_do_cow_process(job, start); + + if (job->use_copy_range) { +- ret = backup_cow_with_offload(job, start, end, is_write_notifier); + if (job->dump_cb) { -+ ret = job->dump_cb(job->common.opaque, job->target, start, bounce_qiov.size, NULL); ++ ret = - 1; ++ } else { ++ ret = backup_cow_with_offload(job, start, end, is_write_notifier); + } -+ if (job->target) { -+ ret = blk_co_pwrite_zeroes(job->target, start, -+ bounce_qiov.size, BDRV_REQ_MAY_UNMAP); -+ } - } else { -- ret = blk_co_pwritev(job->target, start, -- bounce_qiov.size, &bounce_qiov, -- job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0); -+ if (job->dump_cb) { -+ ret = job->dump_cb(job->common.opaque, job->target, start, bounce_qiov.size, bounce_buffer); -+ } -+ if (job->target) { -+ ret = blk_co_pwritev(job->target, start, -+ bounce_qiov.size, &bounce_qiov, -+ job->compress ? BDRV_REQ_WRITE_COMPRESSED : 0); -+ } - } - if (ret < 0) { - trace_backup_do_cow_write_fail(job, start, ret); -@@ -234,7 +246,9 @@ static void backup_abort(BlockJob *job) - static void backup_clean(BlockJob *job) + if (ret < 0) { + job->use_copy_range = false; + } +@@ -293,7 +306,9 @@ static void backup_abort(Job *job) + static void backup_clean(Job *job) { - BackupBlockJob *s = container_of(job, BackupBlockJob, common); + BackupBlockJob *s = container_of(job, BackupBlockJob, common.job); - assert(s->target); + if (!s->target) { + return; @@ -107,7 +117,7 @@ index 8c2967a8cb..0870acdae7 100644 blk_unref(s->target); s->target = NULL; } -@@ -243,7 +257,9 @@ static void backup_attached_aio_context(BlockJob *job, AioContext *aio_context) +@@ -302,7 +317,9 @@ static void backup_attached_aio_context(BlockJob *job, AioContext *aio_context) { BackupBlockJob *s = container_of(job, BackupBlockJob, common); @@ -118,7 +128,7 @@ index 8c2967a8cb..0870acdae7 100644 } void backup_do_checkpoint(BlockJob *job, Error **errp) -@@ -315,9 +331,11 @@ static BlockErrorAction backup_error_action(BackupBlockJob *job, +@@ -374,9 +391,11 @@ static BlockErrorAction backup_error_action(BackupBlockJob *job, if (read) { return block_job_error_action(&job->common, job->on_source_error, true, error); @@ -131,15 +141,15 @@ index 8c2967a8cb..0870acdae7 100644 } } -@@ -538,6 +556,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -612,6 +631,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, BlockdevOnError on_source_error, BlockdevOnError on_target_error, int creation_flags, + BackupDumpFunc *dump_cb, BlockCompletionFunc *cb, void *opaque, int pause_count, - BlockJobTxn *txn, Error **errp) -@@ -548,7 +567,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, + JobTxn *txn, Error **errp) +@@ -622,7 +642,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, int ret; assert(bs); @@ -148,7 +158,7 @@ index 8c2967a8cb..0870acdae7 100644 if (bs == target) { error_setg(errp, "Source and target cannot be the same"); -@@ -561,13 +580,13 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -635,13 +655,13 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, return NULL; } @@ -164,7 +174,7 @@ index 8c2967a8cb..0870acdae7 100644 error_setg(errp, "Compression is not supported for this drive %s", bdrv_get_device_name(target)); return NULL; -@@ -577,7 +596,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -651,7 +671,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, return NULL; } @@ -173,7 +183,7 @@ index 8c2967a8cb..0870acdae7 100644 return NULL; } -@@ -617,15 +636,18 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -691,15 +711,18 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, goto error; } @@ -199,62 +209,33 @@ index 8c2967a8cb..0870acdae7 100644 job->on_source_error = on_source_error; job->on_target_error = on_target_error; job->sync_mode = sync_mode; -@@ -633,36 +655,52 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, - sync_bitmap : NULL; - job->compress = compress; +@@ -710,6 +733,9 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, + /* Detect image-fleecing (and similar) schemes */ + job->serialize_target_writes = bdrv_chain_contains(target, bs); -- /* If there is no backing file on the target, we cannot rely on COW if our -- * backup cluster size is smaller than the target cluster size. Even for -- * targets with a backing file, try to avoid COW if possible. */ -- ret = bdrv_get_info(target, &bdi); -- if (ret == -ENOTSUP && !target->backing) { -- /* Cluster size is not defined */ -- warn_report("The target block device doesn't provide " -- "information about the block size and it doesn't have a " -- "backing file. The default block size of %u bytes is " -- "used. If the actual block size of the target exceeds " -- "this default, the backup may be unusable", -- BACKUP_CLUSTER_SIZE_DEFAULT); -- job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; -- } else if (ret < 0 && !target->backing) { -- error_setg_errno(errp, -ret, -- "Couldn't determine the cluster size of the target image, " -- "which has no backing file"); -- error_append_hint(errp, -- "Aborting, since this may create an unusable destination image\n"); -- goto error; -- } else if (ret < 0 && target->backing) { -- /* Not fatal; just trudge on ahead. */ -- job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; -+ if (target) { -+ /* If there is no backing file on the target, we cannot rely on COW if our -+ * backup cluster size is smaller than the target cluster size. Even for -+ * targets with a backing file, try to avoid COW if possible. */ -+ ret = bdrv_get_info(target, &bdi); -+ if (ret == -ENOTSUP && !target->backing) { -+ /* Cluster size is not defined */ -+ warn_report("The target block device doesn't provide " -+ "information about the block size and it doesn't have a " -+ "backing file. The default block size of %u bytes is " -+ "used. If the actual block size of the target exceeds " -+ "this default, the backup may be unusable", -+ BACKUP_CLUSTER_SIZE_DEFAULT); -+ job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; -+ } else if (ret < 0 && !target->backing) { -+ error_setg_errno(errp, -ret, -+ "Couldn't determine the cluster size of the target image, " -+ "which has no backing file"); -+ error_append_hint(errp, -+ "Aborting, since this may create an unusable destination image\n"); -+ goto error; -+ } else if (ret < 0 && target->backing) { -+ /* Not fatal; just trudge on ahead. */ -+ job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; -+ } else { -+ job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size); -+ } ++ if (!target) { ++ goto use_default_cluster_size; ++ } + /* If there is no backing file on the target, we cannot rely on COW if our + * backup cluster size is smaller than the target cluster size. Even for + * targets with a backing file, try to avoid COW if possible. */ +@@ -734,18 +760,35 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, + /* Not fatal; just trudge on ahead. */ + job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; } else { - job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size); +- } +- job->use_copy_range = true; +- job->copy_range_size = MIN_NON_ZERO(blk_get_max_transfer(job->common.blk), +- blk_get_max_transfer(job->target)); +- job->copy_range_size = MAX(job->cluster_size, +- QEMU_ALIGN_UP(job->copy_range_size, +- job->cluster_size)); +- +- /* Required permissions are already taken with target's blk_new() */ +- block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, +- &error_abort); ++ use_default_cluster_size: + ret = bdrv_get_info(bs, &bdi); + if (ret < 0) { + job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; @@ -266,33 +247,40 @@ index 8c2967a8cb..0870acdae7 100644 + job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT; + } + } - } - -- /* Required permissions are already taken with target's blk_new() */ -- block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, -- &error_abort); ++ } ++ if (target) { ++ job->use_copy_range = true; ++ job->copy_range_size = MIN_NON_ZERO(blk_get_max_transfer(job->common.blk), ++ blk_get_max_transfer(job->target)); ++ job->copy_range_size = MAX(job->cluster_size, ++ QEMU_ALIGN_UP(job->copy_range_size, ++ job->cluster_size)); ++ } else { ++ job->use_copy_range = false; ++ } ++ + if (target) { + /* Required permissions are already taken with target's blk_new() */ + block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, + &error_abort); + } - job->common.len = len; - job->common.pause_count = pause_count; - block_job_txn_add_job(txn, &job->common); + job->len = len; + job->common.job.pause_count = pause_count; + diff --git a/block/replication.c b/block/replication.c -index 1b08b242eb..3d101ce6e6 100644 +index 84e07cc4d4..04fa448a5b 100644 --- a/block/replication.c +++ b/block/replication.c -@@ -561,6 +561,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, +@@ -571,6 +571,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode, 0, MIRROR_SYNC_MODE_NONE, NULL, false, BLOCKDEV_ON_ERROR_REPORT, - BLOCKDEV_ON_ERROR_REPORT, BLOCK_JOB_INTERNAL, + BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL, + NULL, backup_job_completed, bs, 0, NULL, &local_err); if (local_err) { error_propagate(errp, local_err); diff --git a/blockdev.c b/blockdev.c -index 3ffd064c48..4b6091afc6 100644 +index 4f18d3c3d7..d5458f044e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -31,7 +31,6 @@ @@ -303,7 +291,7 @@ index 3ffd064c48..4b6091afc6 100644 #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/block/block.h" -@@ -55,6 +54,7 @@ +@@ -63,6 +62,7 @@ #include "qemu/cutils.h" #include "qemu/help_option.h" #include "qemu/throttle-options.h" @@ -311,7 +299,7 @@ index 3ffd064c48..4b6091afc6 100644 static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states = QTAILQ_HEAD_INITIALIZER(monitor_bdrv_states); -@@ -2970,15 +2970,14 @@ out: +@@ -3228,15 +3228,14 @@ out: static struct PVEBackupState { Error *error; bool cancel; @@ -329,7 +317,7 @@ index 3ffd064c48..4b6091afc6 100644 size_t total; size_t transferred; size_t zero_bytes; -@@ -2997,6 +2996,71 @@ typedef struct PVEBackupDevInfo { +@@ -3255,6 +3254,71 @@ typedef struct PVEBackupDevInfo { static void pvebackup_run_next_job(void); @@ -372,7 +360,7 @@ index 3ffd064c48..4b6091afc6 100644 + vma_writer_error_propagate(backup_state.vmaw, &backup_state.error); + } + if (di->bs && di->bs->job) { -+ block_job_cancel(di->bs->job); ++ job_cancel(&di->bs->job->job, true); + } + break; + } else { @@ -401,7 +389,7 @@ index 3ffd064c48..4b6091afc6 100644 static void pvebackup_cleanup(void) { qemu_mutex_lock(&backup_state.backup_mutex); -@@ -3008,9 +3072,11 @@ static void pvebackup_cleanup(void) +@@ -3266,9 +3330,11 @@ static void pvebackup_cleanup(void) backup_state.end_time = time(NULL); @@ -416,7 +404,7 @@ index 3ffd064c48..4b6091afc6 100644 } g_list_free(backup_state.di_list); -@@ -3018,6 +3084,13 @@ static void pvebackup_cleanup(void) +@@ -3276,6 +3342,13 @@ static void pvebackup_cleanup(void) qemu_mutex_unlock(&backup_state.backup_mutex); } @@ -430,7 +418,7 @@ index 3ffd064c48..4b6091afc6 100644 static void pvebackup_complete_cb(void *opaque, int ret) { // This always runs in the main loop -@@ -3034,9 +3107,9 @@ static void pvebackup_complete_cb(void *opaque, int ret) +@@ -3292,9 +3365,9 @@ static void pvebackup_complete_cb(void *opaque, int ret) di->bs = NULL; di->target = NULL; @@ -443,7 +431,7 @@ index 3ffd064c48..4b6091afc6 100644 } // remove self from job queue -@@ -3064,14 +3137,9 @@ static void pvebackup_cancel(void *opaque) +@@ -3322,14 +3395,9 @@ static void pvebackup_cancel(void *opaque) error_setg(&backup_state.error, "backup cancelled"); } @@ -460,7 +448,7 @@ index 3ffd064c48..4b6091afc6 100644 } GList *l = backup_state.di_list; -@@ -3102,18 +3170,14 @@ void qmp_backup_cancel(Error **errp) +@@ -3360,18 +3428,14 @@ void qmp_backup_cancel(Error **errp) Coroutine *co = qemu_coroutine_create(pvebackup_cancel, NULL); qemu_coroutine_enter(co); @@ -482,7 +470,7 @@ index 3ffd064c48..4b6091afc6 100644 Error **errp) { char *cdata = NULL; -@@ -3127,7 +3191,12 @@ static int config_to_vma(const char *file, BackupFormat format, +@@ -3385,7 +3449,12 @@ static int config_to_vma(const char *file, BackupFormat format, char *basename = g_path_get_basename(file); if (format == BACKUP_FORMAT_VMA) { @@ -496,11 +484,11 @@ index 3ffd064c48..4b6091afc6 100644 } else if (format == BACKUP_FORMAT_DIR) { char config_path[PATH_MAX]; snprintf(config_path, PATH_MAX, "%s/%s", backup_dir, basename); -@@ -3145,28 +3214,30 @@ static int config_to_vma(const char *file, BackupFormat format, +@@ -3402,28 +3471,30 @@ static int config_to_vma(const char *file, BackupFormat format, + return 0; } - void block_job_resume(BlockJob *job); -+bool block_job_should_pause(BlockJob *job); ++bool job_should_pause(Job *job); static void pvebackup_run_next_job(void) { qemu_mutex_lock(&backup_state.backup_mutex); @@ -519,14 +507,14 @@ index 3ffd064c48..4b6091afc6 100644 aio_context_acquire(aio_context); qemu_mutex_unlock(&backup_state.backup_mutex); - if (backup_state.error || backup_state.cancel) { -- block_job_cancel_sync(job); +- job_cancel_sync(job); - } else { -- block_job_resume(job); -+ if (block_job_should_pause(job)) { +- job_resume(job); ++ if (job_should_pause(&job->job)) { + if (backup_state.error || backup_state.cancel) { -+ block_job_cancel_sync(job); ++ job_cancel_sync(&job->job); + } else { -+ block_job_resume(job); ++ job_resume(&job->job); + } } aio_context_release(aio_context); @@ -536,7 +524,7 @@ index 3ffd064c48..4b6091afc6 100644 } qemu_mutex_unlock(&backup_state.backup_mutex); -@@ -3177,7 +3248,7 @@ static void pvebackup_run_next_job(void) +@@ -3434,7 +3505,7 @@ static void pvebackup_run_next_job(void) UuidInfo *qmp_backup(const char *backup_file, bool has_format, BackupFormat format, bool has_config_file, const char *config_file, @@ -545,7 +533,7 @@ index 3ffd064c48..4b6091afc6 100644 bool has_devlist, const char *devlist, bool has_speed, int64_t speed, Error **errp) { -@@ -3185,7 +3256,8 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3442,7 +3513,8 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, BlockDriverState *bs = NULL; const char *backup_dir = NULL; Error *local_err = NULL; @@ -555,7 +543,7 @@ index 3ffd064c48..4b6091afc6 100644 gchar **devs = NULL; GList *di_list = NULL; GList *l; -@@ -3197,7 +3269,7 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3454,7 +3526,7 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, backup_state.backup_mutex_initialized = true; } @@ -564,7 +552,7 @@ index 3ffd064c48..4b6091afc6 100644 error_set(errp, ERROR_CLASS_GENERIC_ERROR, "previous backup not finished"); return NULL; -@@ -3272,40 +3344,28 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3529,40 +3601,28 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, total += size; } @@ -613,7 +601,7 @@ index 3ffd064c48..4b6091afc6 100644 goto err; } } -@@ -3346,14 +3406,14 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3603,14 +3663,14 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, /* add configuration file to archive */ if (has_config_file) { @@ -630,7 +618,7 @@ index 3ffd064c48..4b6091afc6 100644 goto err; } } -@@ -3376,12 +3436,13 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3633,12 +3693,13 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, } backup_state.backup_file = g_strdup(backup_file); @@ -647,14 +635,14 @@ index 3ffd064c48..4b6091afc6 100644 backup_state.total = total; backup_state.transferred = 0; -@@ -3392,21 +3453,16 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, +@@ -3649,21 +3710,21 @@ UuidInfo *qmp_backup(const char *backup_file, bool has_format, while (l) { PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data; l = g_list_next(l); - job = backup_job_create(NULL, di->bs, di->target, speed, MIRROR_SYNC_MODE_FULL, NULL, false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT, - BLOCK_JOB_DEFAULT, + JOB_DEFAULT, - pvebackup_complete_cb, di, 2, NULL, &local_err); - if (di->target) { - bdrv_unref(di->target); @@ -665,14 +653,17 @@ index 3ffd064c48..4b6091afc6 100644 if (!job || local_err != NULL) { error_setg(&backup_state.error, "backup_job_create failed"); pvebackup_cancel(NULL); -- } else { -- block_job_start(job); + } else { + job_start(&job->job); } -+ block_job_start(job); ++ if (di->target) { ++ bdrv_unref(di->target); ++ di->target = NULL; ++ } } qemu_mutex_unlock(&backup_state.backup_mutex); -@@ -3442,9 +3498,10 @@ err: +@@ -3699,9 +3760,10 @@ err: g_strfreev(devs); } @@ -686,43 +677,29 @@ index 3ffd064c48..4b6091afc6 100644 } if (backup_dir) { -@@ -3829,7 +3886,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, BlockJobTxn *txn, +@@ -4104,7 +4166,7 @@ static BlockJob *do_drive_backup(DriveBackup *backup, JobTxn *txn, job = backup_job_create(backup->job_id, bs, target_bs, backup->speed, backup->sync, bmap, backup->compress, backup->on_source_error, backup->on_target_error, -- BLOCK_JOB_DEFAULT, NULL, NULL, 0, txn, &local_err); -+ BLOCK_JOB_DEFAULT, NULL, NULL, NULL, 0, txn, &local_err); +- job_flags, NULL, NULL, 0, txn, &local_err); ++ job_flags, NULL, NULL, NULL, 0, txn, &local_err); bdrv_unref(target_bs); if (local_err != NULL) { error_propagate(errp, local_err); -@@ -3908,7 +3965,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, BlockJobTxn *txn, +@@ -4196,7 +4258,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, JobTxn *txn, job = backup_job_create(backup->job_id, bs, target_bs, backup->speed, backup->sync, NULL, backup->compress, backup->on_source_error, backup->on_target_error, -- BLOCK_JOB_DEFAULT, NULL, NULL, 0, txn, &local_err); -+ BLOCK_JOB_DEFAULT, NULL, NULL, NULL, 0, txn, &local_err); +- job_flags, NULL, NULL, 0, txn, &local_err); ++ job_flags, NULL, NULL, NULL, 0, txn, &local_err); if (local_err != NULL) { error_propagate(errp, local_err); } -diff --git a/blockjob.c b/blockjob.c -index 2de9f8f4dd..1df33bd194 100644 ---- a/blockjob.c -+++ b/blockjob.c -@@ -757,7 +757,8 @@ void block_job_completed(BlockJob *job, int ret) - } - } - --static bool block_job_should_pause(BlockJob *job) -+bool block_job_should_pause(BlockJob *job); -+bool block_job_should_pause(BlockJob *job) - { - return job->pause_count > 0; - } diff --git a/include/block/block_int.h b/include/block/block_int.h -index 1dbbdafd31..2ed3e41437 100644 +index 0b2516c3cf..ecd6243440 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h -@@ -60,6 +60,9 @@ +@@ -59,6 +59,9 @@ #define BLOCK_PROBE_BUF_SIZE 512 @@ -732,14 +709,28 @@ index 1dbbdafd31..2ed3e41437 100644 enum BdrvTrackedRequestType { BDRV_TRACKED_READ, BDRV_TRACKED_WRITE, -@@ -984,6 +987,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, +@@ -1082,6 +1085,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, BlockdevOnError on_source_error, BlockdevOnError on_target_error, int creation_flags, + BackupDumpFunc *dump_cb, BlockCompletionFunc *cb, void *opaque, int pause_count, - BlockJobTxn *txn, Error **errp); + JobTxn *txn, Error **errp); +diff --git a/job.c b/job.c +index 72c50ee18e..1b3bda275d 100644 +--- a/job.c ++++ b/job.c +@@ -256,7 +256,8 @@ static bool job_started(Job *job) + return job->co; + } + +-static bool job_should_pause(Job *job) ++bool job_should_pause(Job *job); ++bool job_should_pause(Job *job) + { + return job->pause_count > 0; + } diff --git a/vma-reader.c b/vma-reader.c new file mode 100644 index 0000000000..2b1d1cdab3 diff --git a/debian/patches/pve/0028-vma-add-throttling-options-to-drive-mapping-fifo-pro.patch b/debian/patches/pve/0026-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch similarity index 84% rename from debian/patches/pve/0028-vma-add-throttling-options-to-drive-mapping-fifo-pro.patch rename to debian/patches/pve/0026-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch index 4755355..2c14854 100644 --- a/debian/patches/pve/0028-vma-add-throttling-options-to-drive-mapping-fifo-pro.patch +++ b/debian/patches/pve/0026-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch @@ -1,27 +1,30 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 15 Feb 2018 11:07:56 +0100 -Subject: [PATCH] vma: add throttling options to drive mapping fifo protocol +Subject: [PATCH] PVE: vma: add throttling options to drive mapping fifo + protocol We now need to call initialize the qom module as well. Signed-off-by: Wolfgang Bumiller --- - vma.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 73 insertions(+), 9 deletions(-) + vma.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 76 insertions(+), 12 deletions(-) diff --git a/vma.c b/vma.c -index 1b59fd1555..71be120cfc 100644 +index 1b59fd1555..f9f5c308fe 100644 --- a/vma.c +++ b/vma.c -@@ -18,6 +18,7 @@ +@@ -18,7 +18,8 @@ #include "qemu-common.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" +-#include "qapi/qmp/qstring.h" +#include "qemu/cutils.h" - #include "qapi/qmp/qstring.h" ++#include "qapi/qmp/qdict.h" #include "sysemu/block-backend.h" + static void help(void) @@ -132,9 +133,39 @@ typedef struct RestoreMap { char *devname; char *path; @@ -127,8 +130,21 @@ index 1b59fd1555..71be120cfc 100644 write_zero = map->write_zero; } else { devfn = g_strdup_printf("%s/tmp-disk-%s.raw", -@@ -327,12 +371,31 @@ static int extract_content(int argc, char **argv) - qdict_put(options, "driver", qstring_from_str("raw")); +@@ -315,7 +359,7 @@ static int extract_content(int argc, char **argv) + if (format) { + /* explicit format from commandline */ + options = qdict_new(); +- qdict_put(options, "driver", qstring_from_str(format)); ++ qdict_put_str(options, "driver", format); + } else if ((devlen > 4 && strcmp(devfn+devlen-4, ".raw") == 0) || + strncmp(devfn, "/dev/", 5) == 0) + { +@@ -324,15 +368,34 @@ static int extract_content(int argc, char **argv) + */ + /* explicit raw format */ + options = qdict_new(); +- qdict_put(options, "driver", qstring_from_str("raw")); ++ qdict_put_str(options, "driver", "raw"); } - diff --git a/debian/patches/pve/0031-vma-add-cache-option-to-device-map.patch b/debian/patches/pve/0027-PVE-vma-add-cache-option-to-device-map.patch similarity index 75% rename from debian/patches/pve/0031-vma-add-cache-option-to-device-map.patch rename to debian/patches/pve/0027-PVE-vma-add-cache-option-to-device-map.patch index a84d519..15e0deb 100644 --- a/debian/patches/pve/0031-vma-add-cache-option-to-device-map.patch +++ b/debian/patches/pve/0027-PVE-vma-add-cache-option-to-device-map.patch @@ -1,26 +1,18 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 22 Mar 2018 15:32:04 +0100 -Subject: [PATCH] vma: add cache option to device map +Subject: [PATCH] PVE: vma: add cache option to device map Signed-off-by: Wolfgang Bumiller --- - vma.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) + vma.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/vma.c b/vma.c -index 71be120cfc..e0271060af 100644 +index f9f5c308fe..476b7bee00 100644 --- a/vma.c +++ b/vma.c -@@ -20,6 +20,7 @@ - #include "qemu/main-loop.h" - #include "qemu/cutils.h" - #include "qapi/qmp/qstring.h" -+#include "qapi/qmp/qbool.h" - #include "sysemu/block-backend.h" - - static void help(void) -@@ -135,6 +136,7 @@ typedef struct RestoreMap { +@@ -135,6 +135,7 @@ typedef struct RestoreMap { char *format; uint64_t throttling_bps; char *throttling_group; @@ -28,7 +20,7 @@ index 71be120cfc..e0271060af 100644 bool write_zero; } RestoreMap; -@@ -242,6 +244,7 @@ static int extract_content(int argc, char **argv) +@@ -242,6 +243,7 @@ static int extract_content(int argc, char **argv) char *format = NULL; char *bps = NULL; char *group = NULL; @@ -36,7 +28,7 @@ index 71be120cfc..e0271060af 100644 if (!line || line[0] == '\0' || !strcmp(line, "done\n")) { break; } -@@ -256,7 +259,8 @@ static int extract_content(int argc, char **argv) +@@ -256,7 +258,8 @@ static int extract_content(int argc, char **argv) while (1) { if (!try_parse_option(&line, "format", &format, inbuf) && !try_parse_option(&line, "throttling.bps", &bps, inbuf) && @@ -46,7 +38,7 @@ index 71be120cfc..e0271060af 100644 { break; } -@@ -293,6 +297,7 @@ static int extract_content(int argc, char **argv) +@@ -293,6 +296,7 @@ static int extract_content(int argc, char **argv) map->format = format; map->throttling_bps = bps_value; map->throttling_group = group; @@ -54,7 +46,7 @@ index 71be120cfc..e0271060af 100644 map->write_zero = write_zero; g_hash_table_insert(devmap, map->devname, map); -@@ -322,6 +327,7 @@ static int extract_content(int argc, char **argv) +@@ -322,6 +326,7 @@ static int extract_content(int argc, char **argv) const char *format = NULL; uint64_t throttling_bps = 0; const char *throttling_group = NULL; @@ -62,7 +54,7 @@ index 71be120cfc..e0271060af 100644 int flags = BDRV_O_RDWR | BDRV_O_NO_FLUSH; bool write_zero = true; -@@ -335,6 +341,7 @@ static int extract_content(int argc, char **argv) +@@ -335,6 +340,7 @@ static int extract_content(int argc, char **argv) format = map->format; throttling_bps = map->throttling_bps; throttling_group = map->throttling_group; @@ -70,7 +62,7 @@ index 71be120cfc..e0271060af 100644 write_zero = map->write_zero; } else { devfn = g_strdup_printf("%s/tmp-disk-%s.raw", -@@ -356,6 +363,7 @@ static int extract_content(int argc, char **argv) +@@ -356,6 +362,7 @@ static int extract_content(int argc, char **argv) size_t devlen = strlen(devfn); QDict *options = NULL; @@ -78,9 +70,9 @@ index 71be120cfc..e0271060af 100644 if (format) { /* explicit format from commandline */ options = qdict_new(); -@@ -370,12 +378,19 @@ static int extract_content(int argc, char **argv) +@@ -370,12 +377,19 @@ static int extract_content(int argc, char **argv) options = qdict_new(); - qdict_put(options, "driver", qstring_from_str("raw")); + qdict_put_str(options, "driver", "raw"); } + if (cache && bdrv_parse_cache_mode(cache, &flags, &writethrough)) { + g_error("invalid cache option: %s\n", cache); diff --git a/debian/patches/pve/0033-vma-remove-forced-NO_FLUSH-option.patch b/debian/patches/pve/0028-PVE-vma-remove-forced-NO_FLUSH-option.patch similarity index 83% rename from debian/patches/pve/0033-vma-remove-forced-NO_FLUSH-option.patch rename to debian/patches/pve/0028-PVE-vma-remove-forced-NO_FLUSH-option.patch index 6eb7d99..6b814b6 100644 --- a/debian/patches/pve/0033-vma-remove-forced-NO_FLUSH-option.patch +++ b/debian/patches/pve/0028-PVE-vma-remove-forced-NO_FLUSH-option.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 27 Mar 2018 10:49:03 +0200 -Subject: [PATCH] vma: remove forced NO_FLUSH option +Subject: [PATCH] PVE: vma: remove forced NO_FLUSH option This one's rbd specific and in no way a sane choice for all types storages. Instead, we want to honor the cache option @@ -13,10 +13,10 @@ Signed-off-by: Wolfgang Bumiller 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vma.c b/vma.c -index e0271060af..463d9f5412 100644 +index 476b7bee00..3289fd722f 100644 --- a/vma.c +++ b/vma.c -@@ -328,7 +328,7 @@ static int extract_content(int argc, char **argv) +@@ -327,7 +327,7 @@ static int extract_content(int argc, char **argv) uint64_t throttling_bps = 0; const char *throttling_group = NULL; const char *cache = NULL; diff --git a/debian/patches/pve/0029-PVE-Add-dummy-id-command-line-parameter.patch b/debian/patches/pve/0029-PVE-Add-dummy-id-command-line-parameter.patch new file mode 100644 index 0000000..3ae539d --- /dev/null +++ b/debian/patches/pve/0029-PVE-Add-dummy-id-command-line-parameter.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Wolfgang Bumiller +Date: Thu, 30 Aug 2018 14:52:56 +0200 +Subject: [PATCH] PVE: Add dummy -id command line parameter + +This used to be part of the qemu-side PVE authentication for +VNC. Now this does nothing. + +Signed-off-by: Wolfgang Bumiller +--- + qemu-options.hx | 3 +++ + vl.c | 8 ++++++++ + 2 files changed, 11 insertions(+) + +diff --git a/qemu-options.hx b/qemu-options.hx +index 31329e26e2..15df7e4fab 100644 +--- a/qemu-options.hx ++++ b/qemu-options.hx +@@ -591,6 +591,9 @@ STEXI + @table @option + ETEXI + ++DEF("id", HAS_ARG, QEMU_OPTION_id, ++ "-id n set the VMID", QEMU_ARCH_ALL) ++ + DEF("fda", HAS_ARG, QEMU_OPTION_fda, + "-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/vl.c b/vl.c +index b2e3e23724..a03e4c2867 100644 +--- a/vl.c ++++ b/vl.c +@@ -2915,6 +2915,7 @@ static void register_global_properties(MachineState *ms) + int main(int argc, char **argv, char **envp) + { + int i; ++ long vm_id; + int snapshot, linux_boot; + const char *initrd_filename; + const char *kernel_filename, *kernel_cmdline; +@@ -3659,6 +3660,13 @@ int main(int argc, char **argv, char **envp) + exit(1); + } + break; ++ case QEMU_OPTION_id: ++ vm_id = strtol(optarg, (char **)&optarg, 10); ++ if (*optarg != 0 || vm_id < 100 || vm_id > INT_MAX) { ++ error_report("invalid -id argument %s", optarg); ++ exit(1); ++ } ++ break; + case QEMU_OPTION_vnc: + vnc_parse(optarg, &error_fatal); + break; +-- +2.11.0 + diff --git a/debian/patches/extra/0001-Revert-target-i386-disable-LINT0-after-reset.patch b/debian/patches/pve/0030-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch similarity index 92% rename from debian/patches/extra/0001-Revert-target-i386-disable-LINT0-after-reset.patch rename to debian/patches/pve/0030-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch index 1b43e71..abbfaf6 100644 --- a/debian/patches/extra/0001-Revert-target-i386-disable-LINT0-after-reset.patch +++ b/debian/patches/pve/0030-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 4 Jul 2016 15:02:26 +0200 -Subject: [PATCH] Revert "target-i386: disable LINT0 after reset" +Subject: [PATCH] PVE: [Config] Revert "target-i386: disable LINT0 after reset" This reverts commit b8eb5512fd8a115f164edbbe897cdf8884920ccb. --- diff --git a/debian/patches/series b/debian/patches/series index 058abd7..c41d7da 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,35 +1,35 @@ -pve/0001-block-file-change-locking-default-to-off.patch -pve/0002-Adjust-network-script-path-to-etc-kvm.patch -pve/0003-qemu-img-return-success-on-info-without-snapshots.patch -pve/0004-use-kvm-by-default.patch -pve/0005-virtio-balloon-fix-query.patch -pve/0006-set-the-CPU-model-to-kvm64-32-instead-of-qemu64-32.patch -pve/0007-qapi-modify-query-machines.patch -pve/0008-qapi-modify-spice-query.patch -pve/0009-ui-spice-default-to-pve-certs-unless-otherwise-speci.patch -pve/0010-internal-snapshot-async.patch -pve/0011-convert-savevm-async-to-threads.patch -pve/0012-qmp-add-get_link_status.patch -pve/0013-smm_available-false.patch -pve/0014-use-whitespace-between-VERSION-and-PKGVERSION.patch -pve/0015-vnc-altgr-emulation.patch -pve/0016-vnc-make-x509-imply-tls-again.patch -pve/0017-vnc-PVE-VNC-authentication.patch -pve/0018-block-rbd-disable-rbd_cache_writethrough_until_flush.patch -pve/0019-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch -pve/0020-block-snapshot-qmp_delete_drive_snapshot-add-aiocont.patch -pve/0021-glusterfs-no-default-logfile-if-daemonized.patch -pve/0022-glusterfs-allow-partial-reads.patch -pve/0023-block-add-the-zeroinit-block-driver-filter.patch -pve/0024-qemu-img-dd-add-osize-and-read-from-to-stdin-stdout.patch -pve/0025-backup-modify-job-api.patch -pve/0026-backup-introduce-vma-archive-format.patch -pve/0027-adding-old-vma-files.patch -pve/0028-vma-add-throttling-options-to-drive-mapping-fifo-pro.patch -pve/0029-qemu-img-dd-add-isize-parameter.patch -pve/0030-qemu-img-dd-add-n-skip_create.patch -pve/0031-vma-add-cache-option-to-device-map.patch -pve/0032-rbd-fix-cache-mode-behavior.patch -pve/0033-vma-remove-forced-NO_FLUSH-option.patch -extra/0001-Revert-target-i386-disable-LINT0-after-reset.patch -extra/0002-ratelimit-don-t-align-wait-time-with-slices.patch +pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch +pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch +pve/0003-PVE-Config-use-kvm-by-default.patch +pve/0004-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch +pve/0005-PVE-Config-ui-spice-default-to-pve-certificates.patch +pve/0006-PVE-Config-smm_available-false.patch +pve/0007-PVE-Config-glusterfs-no-default-logfile-if-daemonize.patch +pve/0008-PVE-Config-rbd-block-rbd-disable-rbd_cache_writethro.patch +pve/0009-PVE-Up-qmp-add-get_link_status.patch +pve/0010-PVE-Up-glusterfs-allow-partial-reads.patch +pve/0011-PVE-Up-qemu-img-return-success-on-info-without-snaps.patch +pve/0012-PVE-Up-qemu-img-dd-add-osize-and-read-from-to-stdin-.patch +pve/0013-PVE-Up-qemu-img-dd-add-isize-parameter.patch +pve/0014-PVE-Up-qemu-img-dd-add-n-skip_create.patch +pve/0015-PVE-virtio-balloon-improve-query-balloon.patch +pve/0016-PVE-qapi-modify-query-machines.patch +pve/0017-PVE-qapi-modify-spice-query.patch +pve/0018-PVE-internal-snapshot-async.patch +pve/0019-PVE-convert-savevm-async-to-threads.patch +pve/0020-PVE-block-snapshot-qmp_snapshot_drive-add-aiocontext.patch +pve/0021-PVE-block-snapshot-qmp_delete_drive_snapshot-add-aio.patch +pve/0022-PVE-block-add-the-zeroinit-block-driver-filter.patch +pve/0023-PVE-backup-modify-job-api.patch +pve/0024-PVE-backup-introduce-vma-archive-format.patch +pve/0025-PVE-Deprecated-adding-old-vma-files.patch +pve/0026-PVE-vma-add-throttling-options-to-drive-mapping-fifo.patch +pve/0027-PVE-vma-add-cache-option-to-device-map.patch +pve/0028-PVE-vma-remove-forced-NO_FLUSH-option.patch +pve/0029-PVE-Add-dummy-id-command-line-parameter.patch +pve/0030-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch +extra/0001-seccomp-use-SIGSYS-signal-instead-of-killing-the-thr.patch +extra/0002-seccomp-prefer-SCMP_ACT_KILL_PROCESS-if-available.patch +extra/0003-configure-require-libseccomp-2.2.0.patch +extra/0004-seccomp-set-the-seccomp-filter-to-all-threads.patch +extra/0005-monitor-create-iothread-after-daemonizing.patch diff --git a/keycodemapdb/data/keymaps.csv b/keycodemapdb/data/keymaps.csv index 0ef2ec1..bc2376c 100644 --- a/keycodemapdb/data/keymaps.csv +++ b/keycodemapdb/data/keymaps.csv @@ -154,9 +154,9 @@ KEY_KATAKANA,90,JIS_Kana,0x68,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,, -KEY_KATAKANAHIRAGANA,93,,,0x70,0x13,0x87,136,,,0xc8,0xc8,,,KanaMode,HKTG,,, -KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,NFER,,, -KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,MUHE,,, +KEY_KATAKANAHIRAGANA,93,,,0x70,0x13,0x87,136,,,0xc8,0xc8,,,KanaMode,HKTG,katakanahiragana,, +KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,NFER,muhenkan,, +KEY_MUHENKAN,94,,,0x7b,0x67,0x85,139,,,,,,,NonConvert,MUHE,muhenkan,, KEY_KPJPCOMMA,95,JIS_KeypadComma,0x5f,0x5c,0x27,,140,,,,,XK_KP_Separator,0xffac,,KPSP,,, KEY_KPJPCOMMA,95,JIS_KeypadComma,0x5f,0x5c,0x27,,140,,,,,XK_KP_Separator,0xffac,,JPCM,,, KEY_KPENTER,96,ANSI_KeypadEnter,0x4c,0xe01c,0xe05a,0x79,88,,,0x64,0x64,XK_KP_Enter,0xff8d,NumpadEnter,KPEN,kp_enter,0x5a,0x4c @@ -246,7 +246,7 @@ KEY_STOPCD,166,,,0xe024,0xe03b,0x98,233,VK_MEDIA_STOP,0xb2,,,,,MediaStop,I174,au KEY_RECORD,167,,,0xe031,,0x9e,,,,,,,,,I175,,, KEY_REWIND,168,,,0xe018,,0x9f,,,,,,,,,I176,,, KEY_PHONE,169,,,0x63,,,,,,,,,,,I177,,, -KEY_ISO,170,ISO_Section,0xa,0x70,,,,,,,,,,,I178,,, +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,, diff --git a/keycodemapdb/tools/keymap-gen b/keycodemapdb/tools/keymap-gen index d4594b4..f0269e3 100755 --- a/keycodemapdb/tools/keymap-gen +++ b/keycodemapdb/tools/keymap-gen @@ -356,19 +356,19 @@ class LanguageSrcGenerator(LanguageGenerator): if frommapname in database.ENUM_COLUMNS: fromtype = self.TYPE_ENUM - elif type(tolinux.keys()[0]) == str: + elif type(list(tolinux.keys())[0]) == str: fromtype = self.TYPE_STRING else: fromtype = self.TYPE_INT if tomapname in database.ENUM_COLUMNS: totype = self.TYPE_ENUM - elif type(fromlinux.values()[0]) == str: + elif type(list(fromlinux.values())[0]) == str: totype = self.TYPE_STRING else: totype = self.TYPE_INT - keys = tolinux.keys() + keys = list(tolinux.keys()) keys.sort() if fromtype == self.TYPE_INT: keys = range(keys[-1] + 1) @@ -402,7 +402,7 @@ class LanguageSrcGenerator(LanguageGenerator): raise Exception("Unknown map %s, expected one of %s" % ( mapname, ", ".join(database.mapto.keys()))) - keys = database.mapto[Database.MAP_LINUX].keys() + keys = list(database.mapto[Database.MAP_LINUX].keys()) keys.sort() names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for key in keys] @@ -411,7 +411,7 @@ class LanguageSrcGenerator(LanguageGenerator): if mapname in database.ENUM_COLUMNS: totype = self.TYPE_ENUM - elif type(database.mapto[mapname].values()[0]) == str: + elif type(list(database.mapto[mapname].values())[0]) == str: totype = self.TYPE_STRING else: totype = self.TYPE_INT @@ -440,7 +440,7 @@ class LanguageSrcGenerator(LanguageGenerator): if varname is None: varname = "name_map_%s_to_%s" % (frommapname, tomapname) - keys = tolinux.keys() + keys = list(tolinux.keys()) keys.sort() if type(keys[0]) == int: keys = range(keys[-1] + 1) @@ -470,7 +470,7 @@ class LanguageSrcGenerator(LanguageGenerator): raise Exception("Unknown map %s, expected one of %s" % ( mapname, ", ".join(database.mapname.keys()))) - keys = database.mapto[Database.MAP_LINUX].keys() + keys = list(database.mapto[Database.MAP_LINUX].keys()) keys.sort() names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for key in keys] @@ -514,7 +514,7 @@ class LanguageDocGenerator(LanguageGenerator): raise Exception("Unknown map %s, expected one of %s" % ( mapname, ", ".join(database.mapname.keys()))) - keys = database.mapto[Database.MAP_LINUX].keys() + keys = list(database.mapto[Database.MAP_LINUX].keys()) keys.sort() names = [database.mapname[Database.MAP_LINUX].get(key, "unnamed") for key in keys] @@ -537,7 +537,7 @@ class LanguageDocGenerator(LanguageGenerator): mapname, ", ".join(database.mapfrom.keys()))) tolinux = database.mapfrom[mapname] - keys = tolinux.keys() + keys = list(tolinux.keys()) keys.sort() if mapname in database.mapname: names = database.mapname[mapname] diff --git a/qemu b/qemu index 0982a56..3844175 160000 --- a/qemu +++ b/qemu @@ -1 +1 @@ -Subproject commit 0982a56a551556c704dc15752dabf57b4be1c640 +Subproject commit 38441756b70eec5807b5f60dad11a93a91199866