Compare commits
67 Commits
v6.1.1-2-v
...
v7.1.0-4-v
Author | SHA1 | Date | |
---|---|---|---|
a3b2ef93ab | |||
0fa004b912 | |||
78a75914b3 | |||
![]() |
55e33a045e | ||
![]() |
8a38e1da9e | ||
![]() |
3b3d5516ee | ||
![]() |
509409fb64 | ||
![]() |
bf03cd367f | ||
![]() |
0af826b448 | ||
![]() |
ed23707ed7 | ||
![]() |
4e1935c2c9 | ||
![]() |
a262e9642b | ||
![]() |
73912aee39 | ||
![]() |
5b15e2ecaf | ||
![]() |
2775b2e378 | ||
![]() |
ed01236593 | ||
![]() |
2b259b70ec | ||
![]() |
a186335be5 | ||
![]() |
1976ca4607 | ||
![]() |
563c592898 | ||
![]() |
1de53d8a45 | ||
![]() |
0e88ec19db | ||
![]() |
9ee866b2e9 | ||
![]() |
14ed554660 | ||
![]() |
eba403aafc | ||
![]() |
b2685aee04 | ||
![]() |
dc9827a6a4 | ||
![]() |
4e4b9ab13f | ||
![]() |
39e84ba82d | ||
![]() |
4fd0fa7fb3 | ||
![]() |
539e333eaa | ||
![]() |
68569ea2ff | ||
![]() |
41aedfb6db | ||
![]() |
7bd4d8645a | ||
![]() |
ed3b5b8ab8 | ||
![]() |
7f4326d1dc | ||
![]() |
53bff441c5 | ||
![]() |
f9a4b1cea7 | ||
![]() |
dc265df350 | ||
![]() |
e0076597c6 | ||
![]() |
ee99c1f813 | ||
![]() |
58a5492e9c | ||
![]() |
e67b8b5bd9 | ||
![]() |
309b5c1694 | ||
![]() |
4ce5937f89 | ||
![]() |
f87d0523df | ||
![]() |
2fd4ea2813 | ||
![]() |
2653a5f029 | ||
![]() |
664ecf59a9 | ||
![]() |
4de9440f87 | ||
![]() |
9b348f8c6d | ||
![]() |
799cf8c5a3 | ||
![]() |
b02e62dba0 | ||
![]() |
fc03e1b6bf | ||
![]() |
c8ba14bed0 | ||
![]() |
daea534caa | ||
![]() |
27199bd753 | ||
![]() |
e050683663 | ||
![]() |
13184117e4 | ||
![]() |
aa4b14ea10 | ||
![]() |
3aa5b7598d | ||
![]() |
13d3e10aa6 | ||
![]() |
58c3533a58 | ||
![]() |
fe0542bed9 | ||
![]() |
f6d40bfdf4 | ||
![]() |
107132becc | ||
![]() |
4567474e95 |
2
Makefile
2
Makefile
@@ -33,7 +33,7 @@ $(BUILDDIR): keycodemapdb | submodule
|
|||||||
deb kvm: $(DEBS)
|
deb kvm: $(DEBS)
|
||||||
$(DEB_DBG): $(DEB)
|
$(DEB_DBG): $(DEB)
|
||||||
$(DEB): $(BUILDDIR)
|
$(DEB): $(BUILDDIR)
|
||||||
cd $(BUILDDIR); dpkg-buildpackage -b -us -uc -j
|
cd $(BUILDDIR); dpkg-buildpackage -b -us -uc -j8
|
||||||
lintian $(DEBS)
|
lintian $(DEBS)
|
||||||
|
|
||||||
.PHONY: update
|
.PHONY: update
|
||||||
|
177
debian/changelog
vendored
177
debian/changelog
vendored
@@ -1,3 +1,180 @@
|
|||||||
|
pve-qemu-kvm (7.1.0-4+vitastor4) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* Improve performance by adding io_uring support
|
||||||
|
* Fix compatibility with iothread
|
||||||
|
|
||||||
|
-- Vitaliy Filippov <vitalif@yourcmc.ru> Tue, 18 Jul 2023 02:22:28 +0300
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.1.0-4+vitastor3) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* Add bdrv_co_block_status implementation for QCOW2 export support
|
||||||
|
|
||||||
|
-- Vitaliy Filippov <vitalif@yourcmc.ru> Thu, 12 Jan 2023 02:31:18 +0300
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.1.0-4+vitastor2) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* Add Vitastor support
|
||||||
|
|
||||||
|
-- Vitaliy Filippov <vitalif@yourcmc.ru> Thu, 15 Dec 2022 19:32:28 +0300
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.1.0-4) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* cherry-pick "block/block-backend: blk_set_enable_write_cache is IO_CODE"
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Tue, 22 Nov 2022 09:21:06 +0100
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.1.0-3) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* init: daemonize: defuse PID file resolve error to a warning at max, fixing
|
||||||
|
some usecases that regressed with 7.1, like tracking start up in our
|
||||||
|
file-restore VM.
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Fri, 28 Oct 2022 10:27:49 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.1.0-2) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* fix an issue with error handling in async backup code
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Tue, 18 Oct 2022 15:33:44 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.1.0-1) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* update to QEMU stable release 7.1.0
|
||||||
|
|
||||||
|
* add fix for io_uring_register_ring_fd from upstream
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Fri, 14 Oct 2022 14:54:09 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.0.0-4) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* add revision to version output
|
||||||
|
|
||||||
|
* PVE Backup: allow passing max-workers performance setting
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Mon, 10 Oct 2022 11:55:37 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.0.0-3) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* savevm-async: avoid segfault when aborting snapshot creation task
|
||||||
|
|
||||||
|
* savevm-async: set SAVE_STATE_DONE when closing state file was successful
|
||||||
|
allowing one to start a new snapshot task after aborting one.
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Tue, 30 Aug 2022 12:54:03 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.0.0-2) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* backport "io_uring: fix short read slow path"
|
||||||
|
|
||||||
|
* backport "e1000: set RX descriptor status in a separate operation"
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Wed, 20 Jul 2022 09:17:07 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (7.0.0-1) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* update to QEMU stable release 7.0.0
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Thu, 30 Jun 2022 11:07:37 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-11) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* add 'namespace' to BlockdevOptionsPbs for live-restore support
|
||||||
|
|
||||||
|
* vma: create: support 64KiB-unaligned input images like to improve backing
|
||||||
|
up some VM templates
|
||||||
|
|
||||||
|
* block: alloc-track: avoid unlikely, but possible premature break
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Wed, 22 Jun 2022 15:54:54 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-10) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* fix #4101: fix backup cancellation bug with iothreads
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Thu, 9 Jun 2022 16:35:51 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-9) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* fix possible race conditions during cancellation of a PBS backup
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Wed, 08 Jun 2022 14:03:22 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-8) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* revert "block/rbd: implement bdrv_co_block_status" to work around
|
||||||
|
performance regression when backing up large RBD disk
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Thu, 19 May 2022 09:24:45 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-7) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* Proxmox Backup Server namespace support
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Thu, 12 May 2022 16:05:56 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-6) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* block/gluster: correctly set max_pdiscard which is int64_t to avoid
|
||||||
|
triggering assertion
|
||||||
|
|
||||||
|
* ui/vnc.c: Fixed a deadlock bug
|
||||||
|
|
||||||
|
* display/qxl-render: fix race condition in qxl_cursor (CVE-2021-4207) and
|
||||||
|
integer overflow in cursor_alloc (CVE-2021-4206)
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Wed, 11 May 2022 10:42:53 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-5) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* vma: allow partial restore by skipping some disk
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Mon, 25 Apr 2022 10:13:46 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-4) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* d/control: add libgbm to build dependencies
|
||||||
|
|
||||||
|
* d/control: add suggest dependency-hint for libgl1
|
||||||
|
|
||||||
|
* various stable backports:
|
||||||
|
+ virtio-net: fix map leaking on error during receive
|
||||||
|
+ memory: Fix incorrect calls of log_global_start/stop
|
||||||
|
+ acpi: fix OEM ID/OEM Table ID padding
|
||||||
|
+ vhost-vsock: detach the virqueue element in case of error
|
||||||
|
+ vhost-user: remove VirtQ notifier restore
|
||||||
|
+ vhost-user: fix VirtQ notifier cleanup
|
||||||
|
+ virtio: fix the condition for iommu_platform not supported
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Fri, 22 Apr 2022 11:52:30 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-3) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* cherry-pick fix for some manually added ACPI table SLIC entries via the
|
||||||
|
custom args flag.
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Fri, 15 Apr 2022 09:09:37 +0200
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-2) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* compile in virgl support
|
||||||
|
|
||||||
|
* enable zstd support
|
||||||
|
|
||||||
|
* drop sdl dependency (it was disabled at compile time already)
|
||||||
|
|
||||||
|
* recommend 'numactl'
|
||||||
|
|
||||||
|
* fix an issue with multi-disk backups where chunks would be written
|
||||||
|
multiple times
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Thu, 03 Mar 2022 12:03:44 +0100
|
||||||
|
|
||||||
|
pve-qemu-kvm (6.2.0-1) bullseye; urgency=medium
|
||||||
|
|
||||||
|
* update to QEMU stable release 6.2.0
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Thu, 17 Feb 2022 06:23:14 +0100
|
||||||
|
|
||||||
pve-qemu-kvm (6.1.1-2) bullseye; urgency=medium
|
pve-qemu-kvm (6.1.1-2) bullseye; urgency=medium
|
||||||
|
|
||||||
* vma: create: register all streams before entering coroutines to avoid that
|
* vma: create: register all streams before entering coroutines to avoid that
|
||||||
|
12
debian/control
vendored
12
debian/control
vendored
@@ -10,7 +10,9 @@ Build-Depends: autotools-dev,
|
|||||||
libattr1-dev,
|
libattr1-dev,
|
||||||
libcap-ng-dev,
|
libcap-ng-dev,
|
||||||
libcurl4-gnutls-dev,
|
libcurl4-gnutls-dev,
|
||||||
|
libepoxy-dev,
|
||||||
libfdt-dev,
|
libfdt-dev,
|
||||||
|
libgbm-dev,
|
||||||
libglusterfs-dev (>= 5.2-2),
|
libglusterfs-dev (>= 5.2-2),
|
||||||
libgnutls28-dev,
|
libgnutls28-dev,
|
||||||
libiscsi-dev (>= 1.12.0),
|
libiscsi-dev (>= 1.12.0),
|
||||||
@@ -20,7 +22,7 @@ Build-Depends: autotools-dev,
|
|||||||
libnuma-dev,
|
libnuma-dev,
|
||||||
libpci-dev,
|
libpci-dev,
|
||||||
libpixman-1-dev,
|
libpixman-1-dev,
|
||||||
libproxmox-backup-qemu0-dev (>= 1.0.3-1),
|
libproxmox-backup-qemu0-dev (>= 1.3.0-1),
|
||||||
librbd-dev (>= 0.48),
|
librbd-dev (>= 0.48),
|
||||||
libsdl1.2-dev,
|
libsdl1.2-dev,
|
||||||
libseccomp-dev,
|
libseccomp-dev,
|
||||||
@@ -30,6 +32,8 @@ Build-Depends: autotools-dev,
|
|||||||
liburing-dev,
|
liburing-dev,
|
||||||
libusb-1.0-0-dev (>= 1.0.17-1),
|
libusb-1.0-0-dev (>= 1.0.17-1),
|
||||||
libusbredirparser-dev (>= 0.6-2),
|
libusbredirparser-dev (>= 0.6-2),
|
||||||
|
libvirglrenderer-dev,
|
||||||
|
libzstd-dev,
|
||||||
meson,
|
meson,
|
||||||
python3-minimal,
|
python3-minimal,
|
||||||
python3-sphinx,
|
python3-sphinx,
|
||||||
@@ -45,7 +49,6 @@ Package: pve-qemu-kvm
|
|||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ceph-common (>= 0.48),
|
Depends: ceph-common (>= 0.48),
|
||||||
iproute2,
|
iproute2,
|
||||||
libaio1,
|
|
||||||
libgfapi0 | glusterfs-common (>= 5.6),
|
libgfapi0 | glusterfs-common (>= 5.6),
|
||||||
libgfchangelog0 | glusterfs-common (>= 5.6),
|
libgfchangelog0 | glusterfs-common (>= 5.6),
|
||||||
libgfdb0 | glusterfs-common (>= 5.6),
|
libgfdb0 | glusterfs-common (>= 5.6),
|
||||||
@@ -56,14 +59,15 @@ Depends: ceph-common (>= 0.48),
|
|||||||
libiscsi4 (>= 1.12.0) | libiscsi7,
|
libiscsi4 (>= 1.12.0) | libiscsi7,
|
||||||
libjemalloc2,
|
libjemalloc2,
|
||||||
libjpeg62-turbo,
|
libjpeg62-turbo,
|
||||||
libsdl1.2debian,
|
|
||||||
libspice-server1 (>= 0.14.0~),
|
libspice-server1 (>= 0.14.0~),
|
||||||
libusb-1.0-0 (>= 1.0.17-1),
|
libusb-1.0-0 (>= 1.0.17-1),
|
||||||
libusbredirparser1 (>= 0.6-2),
|
libusbredirparser1 (>= 0.6-2),
|
||||||
|
vitastor-client (>= 0.9.4),
|
||||||
libuuid1,
|
libuuid1,
|
||||||
numactl,
|
|
||||||
${misc:Depends},
|
${misc:Depends},
|
||||||
${shlibs:Depends},
|
${shlibs:Depends},
|
||||||
|
Recommends: numactl
|
||||||
|
Suggests: libgl1
|
||||||
Conflicts: kvm,
|
Conflicts: kvm,
|
||||||
pve-kvm,
|
pve-kvm,
|
||||||
pve-qemu-kvm-2.6.18,
|
pve-qemu-kvm-2.6.18,
|
||||||
|
2
debian/copyright
vendored
2
debian/copyright
vendored
@@ -25,7 +25,7 @@ License:
|
|||||||
|
|
||||||
In particular, the QEMU virtual CPU core library (libqemu.a) is
|
In particular, the QEMU virtual CPU core library (libqemu.a) is
|
||||||
released under the GNU Lesser General Public License version 2 or later.
|
released under the GNU Lesser General Public License version 2 or later.
|
||||||
On Debian systems, the complete text of the GNU Lesser General Public
|
On Debian systems, the complete text of the GNU Lesser General Public
|
||||||
License can be found in the file /usr/share/common-licenses/LGPL.
|
License can be found in the file /usr/share/common-licenses/LGPL.
|
||||||
|
|
||||||
Some hardware device emulation sources and other QEMU functionality are
|
Some hardware device emulation sources and other QEMU functionality are
|
||||||
|
@@ -28,18 +28,18 @@ Signed-off-by: John Snow <jsnow@redhat.com>
|
|||||||
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
---
|
---
|
||||||
block/mirror.c | 98 +++++++++++++++++++++++++-------
|
block/mirror.c | 98 +++++++++++++++++++++-----
|
||||||
blockdev.c | 39 ++++++++++++-
|
blockdev.c | 39 +++++++++-
|
||||||
include/block/block_int.h | 4 +-
|
include/block/block_int-global-state.h | 4 +-
|
||||||
qapi/block-core.json | 29 ++++++++--
|
qapi/block-core.json | 29 ++++++--
|
||||||
tests/unit/test-block-iothread.c | 4 +-
|
tests/unit/test-block-iothread.c | 4 +-
|
||||||
5 files changed, 145 insertions(+), 29 deletions(-)
|
5 files changed, 145 insertions(+), 29 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/mirror.c b/block/mirror.c
|
diff --git a/block/mirror.c b/block/mirror.c
|
||||||
index 85b781bc21..0821214138 100644
|
index 3c4ab1159d..f2eca983f1 100644
|
||||||
--- a/block/mirror.c
|
--- a/block/mirror.c
|
||||||
+++ b/block/mirror.c
|
+++ b/block/mirror.c
|
||||||
@@ -50,7 +50,7 @@ typedef struct MirrorBlockJob {
|
@@ -51,7 +51,7 @@ typedef struct MirrorBlockJob {
|
||||||
BlockDriverState *to_replace;
|
BlockDriverState *to_replace;
|
||||||
/* Used to block operations on the drive-mirror-replace target */
|
/* Used to block operations on the drive-mirror-replace target */
|
||||||
Error *replace_blocker;
|
Error *replace_blocker;
|
||||||
@@ -57,7 +57,7 @@ index 85b781bc21..0821214138 100644
|
|||||||
BdrvDirtyBitmap *dirty_bitmap;
|
BdrvDirtyBitmap *dirty_bitmap;
|
||||||
BdrvDirtyBitmapIter *dbi;
|
BdrvDirtyBitmapIter *dbi;
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
@@ -697,7 +699,8 @@ static int mirror_exit_common(Job *job)
|
@@ -696,7 +698,8 @@ static int mirror_exit_common(Job *job)
|
||||||
bdrv_child_refresh_perms(mirror_top_bs, mirror_top_bs->backing,
|
bdrv_child_refresh_perms(mirror_top_bs, mirror_top_bs->backing,
|
||||||
&error_abort);
|
&error_abort);
|
||||||
if (!abort && s->backing_mode == MIRROR_SOURCE_BACKING_CHAIN) {
|
if (!abort && s->backing_mode == MIRROR_SOURCE_BACKING_CHAIN) {
|
||||||
@@ -67,7 +67,7 @@ index 85b781bc21..0821214138 100644
|
|||||||
BlockDriverState *unfiltered_target = bdrv_skip_filters(target_bs);
|
BlockDriverState *unfiltered_target = bdrv_skip_filters(target_bs);
|
||||||
|
|
||||||
if (bdrv_cow_bs(unfiltered_target) != backing) {
|
if (bdrv_cow_bs(unfiltered_target) != backing) {
|
||||||
@@ -802,6 +805,16 @@ static void mirror_abort(Job *job)
|
@@ -794,6 +797,16 @@ static void mirror_abort(Job *job)
|
||||||
assert(ret == 0);
|
assert(ret == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ index 85b781bc21..0821214138 100644
|
|||||||
static void coroutine_fn mirror_throttle(MirrorBlockJob *s)
|
static void coroutine_fn mirror_throttle(MirrorBlockJob *s)
|
||||||
{
|
{
|
||||||
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
||||||
@@ -983,7 +996,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
|
@@ -973,7 +986,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
|
||||||
mirror_free_init(s);
|
mirror_free_init(s);
|
||||||
|
|
||||||
s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
||||||
@@ -94,7 +94,7 @@ index 85b781bc21..0821214138 100644
|
|||||||
ret = mirror_dirty_init(s);
|
ret = mirror_dirty_init(s);
|
||||||
if (ret < 0 || job_is_cancelled(&s->common.job)) {
|
if (ret < 0 || job_is_cancelled(&s->common.job)) {
|
||||||
goto immediate_exit;
|
goto immediate_exit;
|
||||||
@@ -1216,6 +1230,7 @@ static const BlockJobDriver mirror_job_driver = {
|
@@ -1212,6 +1226,7 @@ static const BlockJobDriver mirror_job_driver = {
|
||||||
.run = mirror_run,
|
.run = mirror_run,
|
||||||
.prepare = mirror_prepare,
|
.prepare = mirror_prepare,
|
||||||
.abort = mirror_abort,
|
.abort = mirror_abort,
|
||||||
@@ -102,15 +102,15 @@ index 85b781bc21..0821214138 100644
|
|||||||
.pause = mirror_pause,
|
.pause = mirror_pause,
|
||||||
.complete = mirror_complete,
|
.complete = mirror_complete,
|
||||||
.cancel = mirror_cancel,
|
.cancel = mirror_cancel,
|
||||||
@@ -1232,6 +1247,7 @@ static const BlockJobDriver commit_active_job_driver = {
|
@@ -1228,6 +1243,7 @@ static const BlockJobDriver commit_active_job_driver = {
|
||||||
.run = mirror_run,
|
.run = mirror_run,
|
||||||
.prepare = mirror_prepare,
|
.prepare = mirror_prepare,
|
||||||
.abort = mirror_abort,
|
.abort = mirror_abort,
|
||||||
+ .clean = mirror_clean,
|
+ .clean = mirror_clean,
|
||||||
.pause = mirror_pause,
|
.pause = mirror_pause,
|
||||||
.complete = mirror_complete,
|
.complete = mirror_complete,
|
||||||
},
|
.cancel = commit_active_cancel,
|
||||||
@@ -1594,7 +1610,10 @@ static BlockJob *mirror_start_job(
|
@@ -1593,7 +1609,10 @@ static BlockJob *mirror_start_job(
|
||||||
BlockCompletionFunc *cb,
|
BlockCompletionFunc *cb,
|
||||||
void *opaque,
|
void *opaque,
|
||||||
const BlockJobDriver *driver,
|
const BlockJobDriver *driver,
|
||||||
@@ -122,11 +122,12 @@ index 85b781bc21..0821214138 100644
|
|||||||
bool auto_complete, const char *filter_node_name,
|
bool auto_complete, const char *filter_node_name,
|
||||||
bool is_mirror, MirrorCopyMode copy_mode,
|
bool is_mirror, MirrorCopyMode copy_mode,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
@@ -1606,10 +1625,39 @@ static BlockJob *mirror_start_job(
|
@@ -1605,10 +1624,39 @@ static BlockJob *mirror_start_job(
|
||||||
uint64_t target_perms, target_shared_perms;
|
uint64_t target_perms, target_shared_perms;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
- if (granularity == 0) {
|
- if (granularity == 0) {
|
||||||
|
- granularity = bdrv_get_default_bitmap_granularity(target);
|
||||||
+ if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
|
+ if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
|
||||||
+ error_setg(errp, "Sync mode '%s' not supported",
|
+ error_setg(errp, "Sync mode '%s' not supported",
|
||||||
+ MirrorSyncMode_str(sync_mode));
|
+ MirrorSyncMode_str(sync_mode));
|
||||||
@@ -147,8 +148,8 @@ index 85b781bc21..0821214138 100644
|
|||||||
+ "sync mode '%s' is not compatible with bitmaps",
|
+ "sync mode '%s' is not compatible with bitmaps",
|
||||||
+ MirrorSyncMode_str(sync_mode));
|
+ MirrorSyncMode_str(sync_mode));
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ if (bitmap) {
|
+ if (bitmap) {
|
||||||
+ if (granularity) {
|
+ if (granularity) {
|
||||||
+ error_setg(errp, "granularity (%d)"
|
+ error_setg(errp, "granularity (%d)"
|
||||||
@@ -158,13 +159,12 @@ index 85b781bc21..0821214138 100644
|
|||||||
+ }
|
+ }
|
||||||
+ granularity = bdrv_dirty_bitmap_granularity(bitmap);
|
+ granularity = bdrv_dirty_bitmap_granularity(bitmap);
|
||||||
+ } else if (granularity == 0) {
|
+ } else if (granularity == 0) {
|
||||||
granularity = bdrv_get_default_bitmap_granularity(target);
|
+ granularity = bdrv_get_default_bitmap_granularity(target);
|
||||||
}
|
+ }
|
||||||
-
|
|
||||||
assert(is_power_of_2(granularity));
|
assert(is_power_of_2(granularity));
|
||||||
|
|
||||||
if (buf_size < 0) {
|
if (buf_size < 0) {
|
||||||
@@ -1747,7 +1795,9 @@ static BlockJob *mirror_start_job(
|
@@ -1740,7 +1788,9 @@ static BlockJob *mirror_start_job(
|
||||||
s->replaces = g_strdup(replaces);
|
s->replaces = g_strdup(replaces);
|
||||||
s->on_source_error = on_source_error;
|
s->on_source_error = on_source_error;
|
||||||
s->on_target_error = on_target_error;
|
s->on_target_error = on_target_error;
|
||||||
@@ -175,7 +175,7 @@ index 85b781bc21..0821214138 100644
|
|||||||
s->backing_mode = backing_mode;
|
s->backing_mode = backing_mode;
|
||||||
s->zero_target = zero_target;
|
s->zero_target = zero_target;
|
||||||
s->copy_mode = copy_mode;
|
s->copy_mode = copy_mode;
|
||||||
@@ -1768,6 +1818,18 @@ static BlockJob *mirror_start_job(
|
@@ -1761,6 +1811,18 @@ static BlockJob *mirror_start_job(
|
||||||
bdrv_disable_dirty_bitmap(s->dirty_bitmap);
|
bdrv_disable_dirty_bitmap(s->dirty_bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ index 85b781bc21..0821214138 100644
|
|||||||
ret = block_job_add_bdrv(&s->common, "source", bs, 0,
|
ret = block_job_add_bdrv(&s->common, "source", bs, 0,
|
||||||
BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
|
BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
|
||||||
BLK_PERM_CONSISTENT_READ,
|
BLK_PERM_CONSISTENT_READ,
|
||||||
@@ -1845,6 +1907,9 @@ fail:
|
@@ -1838,6 +1900,9 @@ fail:
|
||||||
if (s->dirty_bitmap) {
|
if (s->dirty_bitmap) {
|
||||||
bdrv_release_dirty_bitmap(s->dirty_bitmap);
|
bdrv_release_dirty_bitmap(s->dirty_bitmap);
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ index 85b781bc21..0821214138 100644
|
|||||||
job_early_fail(&s->common.job);
|
job_early_fail(&s->common.job);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1862,29 +1927,23 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
|
@@ -1855,31 +1920,25 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
|
||||||
BlockDriverState *target, const char *replaces,
|
BlockDriverState *target, const char *replaces,
|
||||||
int creation_flags, int64_t speed,
|
int creation_flags, int64_t speed,
|
||||||
uint32_t granularity, int64_t buf_size,
|
uint32_t granularity, int64_t buf_size,
|
||||||
@@ -221,6 +221,8 @@ index 85b781bc21..0821214138 100644
|
|||||||
- bool is_none_mode;
|
- bool is_none_mode;
|
||||||
BlockDriverState *base;
|
BlockDriverState *base;
|
||||||
|
|
||||||
|
GLOBAL_STATE_CODE();
|
||||||
|
|
||||||
- if ((mode == MIRROR_SYNC_MODE_INCREMENTAL) ||
|
- if ((mode == MIRROR_SYNC_MODE_INCREMENTAL) ||
|
||||||
- (mode == MIRROR_SYNC_MODE_BITMAP)) {
|
- (mode == MIRROR_SYNC_MODE_BITMAP)) {
|
||||||
- error_setg(errp, "Sync mode '%s' not supported",
|
- error_setg(errp, "Sync mode '%s' not supported",
|
||||||
@@ -239,7 +241,7 @@ index 85b781bc21..0821214138 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
|
BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
|
||||||
@@ -1909,7 +1968,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
|
@@ -1906,7 +1965,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
|
||||||
job_id, bs, creation_flags, base, NULL, speed, 0, 0,
|
job_id, bs, creation_flags, base, NULL, speed, 0, 0,
|
||||||
MIRROR_LEAVE_BACKING_CHAIN, false,
|
MIRROR_LEAVE_BACKING_CHAIN, false,
|
||||||
on_error, on_error, true, cb, opaque,
|
on_error, on_error, true, cb, opaque,
|
||||||
@@ -250,10 +252,10 @@ index 85b781bc21..0821214138 100644
|
|||||||
errp);
|
errp);
|
||||||
if (!job) {
|
if (!job) {
|
||||||
diff --git a/blockdev.c b/blockdev.c
|
diff --git a/blockdev.c b/blockdev.c
|
||||||
index 3d8ac368a1..03e99264dc 100644
|
index 9230888e34..9a1a3118ed 100644
|
||||||
--- a/blockdev.c
|
--- a/blockdev.c
|
||||||
+++ b/blockdev.c
|
+++ b/blockdev.c
|
||||||
@@ -2957,6 +2957,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
@@ -2951,6 +2951,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
||||||
BlockDriverState *target,
|
BlockDriverState *target,
|
||||||
bool has_replaces, const char *replaces,
|
bool has_replaces, const char *replaces,
|
||||||
enum MirrorSyncMode sync,
|
enum MirrorSyncMode sync,
|
||||||
@@ -264,7 +266,7 @@ index 3d8ac368a1..03e99264dc 100644
|
|||||||
BlockMirrorBackingMode backing_mode,
|
BlockMirrorBackingMode backing_mode,
|
||||||
bool zero_target,
|
bool zero_target,
|
||||||
bool has_speed, int64_t speed,
|
bool has_speed, int64_t speed,
|
||||||
@@ -2976,6 +2980,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
@@ -2970,6 +2974,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
||||||
{
|
{
|
||||||
BlockDriverState *unfiltered_bs;
|
BlockDriverState *unfiltered_bs;
|
||||||
int job_flags = JOB_DEFAULT;
|
int job_flags = JOB_DEFAULT;
|
||||||
@@ -272,7 +274,7 @@ index 3d8ac368a1..03e99264dc 100644
|
|||||||
|
|
||||||
if (!has_speed) {
|
if (!has_speed) {
|
||||||
speed = 0;
|
speed = 0;
|
||||||
@@ -3030,6 +3035,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
@@ -3024,6 +3029,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
||||||
sync = MIRROR_SYNC_MODE_FULL;
|
sync = MIRROR_SYNC_MODE_FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +304,7 @@ index 3d8ac368a1..03e99264dc 100644
|
|||||||
if (!has_replaces) {
|
if (!has_replaces) {
|
||||||
/* We want to mirror from @bs, but keep implicit filters on top */
|
/* We want to mirror from @bs, but keep implicit filters on top */
|
||||||
unfiltered_bs = bdrv_skip_implicit_filters(bs);
|
unfiltered_bs = bdrv_skip_implicit_filters(bs);
|
||||||
@@ -3076,8 +3104,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
@@ -3070,8 +3098,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
||||||
* and will allow to check whether the node still exist at mirror completion
|
* and will allow to check whether the node still exist at mirror completion
|
||||||
*/
|
*/
|
||||||
mirror_start(job_id, bs, target,
|
mirror_start(job_id, bs, target,
|
||||||
@@ -313,7 +315,7 @@ index 3d8ac368a1..03e99264dc 100644
|
|||||||
on_source_error, on_target_error, unmap, filter_node_name,
|
on_source_error, on_target_error, unmap, filter_node_name,
|
||||||
copy_mode, errp);
|
copy_mode, errp);
|
||||||
}
|
}
|
||||||
@@ -3222,6 +3250,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
|
@@ -3216,6 +3244,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
|
||||||
|
|
||||||
blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs,
|
blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs,
|
||||||
arg->has_replaces, arg->replaces, arg->sync,
|
arg->has_replaces, arg->replaces, arg->sync,
|
||||||
@@ -322,7 +324,7 @@ index 3d8ac368a1..03e99264dc 100644
|
|||||||
backing_mode, zero_target,
|
backing_mode, zero_target,
|
||||||
arg->has_speed, arg->speed,
|
arg->has_speed, arg->speed,
|
||||||
arg->has_granularity, arg->granularity,
|
arg->has_granularity, arg->granularity,
|
||||||
@@ -3243,6 +3273,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
|
@@ -3237,6 +3267,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
|
||||||
const char *device, const char *target,
|
const char *device, const char *target,
|
||||||
bool has_replaces, const char *replaces,
|
bool has_replaces, const char *replaces,
|
||||||
MirrorSyncMode sync,
|
MirrorSyncMode sync,
|
||||||
@@ -331,7 +333,7 @@ index 3d8ac368a1..03e99264dc 100644
|
|||||||
bool has_speed, int64_t speed,
|
bool has_speed, int64_t speed,
|
||||||
bool has_granularity, uint32_t granularity,
|
bool has_granularity, uint32_t granularity,
|
||||||
bool has_buf_size, int64_t buf_size,
|
bool has_buf_size, int64_t buf_size,
|
||||||
@@ -3292,7 +3324,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
|
@@ -3286,7 +3318,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
blockdev_mirror_common(has_job_id ? job_id : NULL, bs, target_bs,
|
blockdev_mirror_common(has_job_id ? job_id : NULL, bs, target_bs,
|
||||||
@@ -341,11 +343,11 @@ index 3d8ac368a1..03e99264dc 100644
|
|||||||
zero_target, has_speed, speed,
|
zero_target, has_speed, speed,
|
||||||
has_granularity, granularity,
|
has_granularity, granularity,
|
||||||
has_buf_size, buf_size,
|
has_buf_size, buf_size,
|
||||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
diff --git a/include/block/block_int-global-state.h b/include/block/block_int-global-state.h
|
||||||
index c31cbd034a..11442893d0 100644
|
index b49f4eb35b..9d744db618 100644
|
||||||
--- a/include/block/block_int.h
|
--- a/include/block/block_int-global-state.h
|
||||||
+++ b/include/block/block_int.h
|
+++ b/include/block/block_int-global-state.h
|
||||||
@@ -1254,7 +1254,9 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
|
@@ -149,7 +149,9 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
|
||||||
BlockDriverState *target, const char *replaces,
|
BlockDriverState *target, const char *replaces,
|
||||||
int creation_flags, int64_t speed,
|
int creation_flags, int64_t speed,
|
||||||
uint32_t granularity, int64_t buf_size,
|
uint32_t granularity, int64_t buf_size,
|
||||||
@@ -357,10 +359,10 @@ index c31cbd034a..11442893d0 100644
|
|||||||
BlockdevOnError on_source_error,
|
BlockdevOnError on_source_error,
|
||||||
BlockdevOnError on_target_error,
|
BlockdevOnError on_target_error,
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index 675d8265eb..6356a63695 100644
|
index 2173e7734a..e1857e7094 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -1938,10 +1938,19 @@
|
@@ -2000,10 +2000,19 @@
|
||||||
# (all the disk, only the sectors allocated in the topmost image, or
|
# (all the disk, only the sectors allocated in the topmost image, or
|
||||||
# only new I/O).
|
# only new I/O).
|
||||||
#
|
#
|
||||||
@@ -381,7 +383,7 @@ index 675d8265eb..6356a63695 100644
|
|||||||
#
|
#
|
||||||
# @buf-size: maximum amount of data in flight from source to
|
# @buf-size: maximum amount of data in flight from source to
|
||||||
# target (since 1.4).
|
# target (since 1.4).
|
||||||
@@ -1979,7 +1988,9 @@
|
@@ -2043,7 +2052,9 @@
|
||||||
{ 'struct': 'DriveMirror',
|
{ 'struct': 'DriveMirror',
|
||||||
'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
|
'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
|
||||||
'*format': 'str', '*node-name': 'str', '*replaces': 'str',
|
'*format': 'str', '*node-name': 'str', '*replaces': 'str',
|
||||||
@@ -392,7 +394,7 @@ index 675d8265eb..6356a63695 100644
|
|||||||
'*speed': 'int', '*granularity': 'uint32',
|
'*speed': 'int', '*granularity': 'uint32',
|
||||||
'*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
|
'*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
|
||||||
'*on-target-error': 'BlockdevOnError',
|
'*on-target-error': 'BlockdevOnError',
|
||||||
@@ -2247,10 +2258,19 @@
|
@@ -2322,10 +2333,19 @@
|
||||||
# (all the disk, only the sectors allocated in the topmost image, or
|
# (all the disk, only the sectors allocated in the topmost image, or
|
||||||
# only new I/O).
|
# only new I/O).
|
||||||
#
|
#
|
||||||
@@ -413,7 +415,7 @@ index 675d8265eb..6356a63695 100644
|
|||||||
#
|
#
|
||||||
# @buf-size: maximum amount of data in flight from source to
|
# @buf-size: maximum amount of data in flight from source to
|
||||||
# target
|
# target
|
||||||
@@ -2299,7 +2319,8 @@
|
@@ -2375,7 +2395,8 @@
|
||||||
{ 'command': 'blockdev-mirror',
|
{ 'command': 'blockdev-mirror',
|
||||||
'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
|
'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
|
||||||
'*replaces': 'str',
|
'*replaces': 'str',
|
||||||
@@ -424,10 +426,10 @@ index 675d8265eb..6356a63695 100644
|
|||||||
'*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
|
'*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
|
||||||
'*on-target-error': 'BlockdevOnError',
|
'*on-target-error': 'BlockdevOnError',
|
||||||
diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
|
diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
|
||||||
index c39e70b2f5..470ef79ae0 100644
|
index 8b55eccc89..f4650be8e5 100644
|
||||||
--- a/tests/unit/test-block-iothread.c
|
--- a/tests/unit/test-block-iothread.c
|
||||||
+++ b/tests/unit/test-block-iothread.c
|
+++ b/tests/unit/test-block-iothread.c
|
||||||
@@ -617,8 +617,8 @@ static void test_propagate_mirror(void)
|
@@ -753,8 +753,8 @@ static void test_propagate_mirror(void)
|
||||||
|
|
||||||
/* Start a mirror job */
|
/* Start a mirror job */
|
||||||
mirror_start("job0", src, target, NULL, JOB_DEFAULT, 0, 0, 0,
|
mirror_start("job0", src, target, NULL, JOB_DEFAULT, 0, 0, 0,
|
||||||
|
@@ -24,10 +24,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 18 insertions(+), 6 deletions(-)
|
1 file changed, 18 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/mirror.c b/block/mirror.c
|
diff --git a/block/mirror.c b/block/mirror.c
|
||||||
index 0821214138..c688726fae 100644
|
index f2eca983f1..b6475d50ad 100644
|
||||||
--- a/block/mirror.c
|
--- a/block/mirror.c
|
||||||
+++ b/block/mirror.c
|
+++ b/block/mirror.c
|
||||||
@@ -674,8 +674,6 @@ static int mirror_exit_common(Job *job)
|
@@ -673,8 +673,6 @@ static int mirror_exit_common(Job *job)
|
||||||
bdrv_unfreeze_backing_chain(mirror_top_bs, target_bs);
|
bdrv_unfreeze_backing_chain(mirror_top_bs, target_bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,9 +36,9 @@ index 0821214138..c688726fae 100644
|
|||||||
/* Make sure that the source BDS doesn't go away during bdrv_replace_node,
|
/* Make sure that the source BDS doesn't go away during bdrv_replace_node,
|
||||||
* before we can call bdrv_drained_end */
|
* before we can call bdrv_drained_end */
|
||||||
bdrv_ref(src);
|
bdrv_ref(src);
|
||||||
@@ -783,6 +781,18 @@ static int mirror_exit_common(Job *job)
|
@@ -775,6 +773,18 @@ static int mirror_exit_common(Job *job)
|
||||||
blk_set_perm(bjob->blk, 0, BLK_PERM_ALL, &error_abort);
|
block_job_remove_all_bdrv(bjob);
|
||||||
blk_insert_bs(bjob->blk, mirror_top_bs, &error_abort);
|
bdrv_replace_node(mirror_top_bs, mirror_top_bs->backing->bs, &error_abort);
|
||||||
|
|
||||||
+ if (s->sync_bitmap) {
|
+ if (s->sync_bitmap) {
|
||||||
+ if (s->bitmap_mode == BITMAP_SYNC_MODE_ALWAYS ||
|
+ if (s->bitmap_mode == BITMAP_SYNC_MODE_ALWAYS ||
|
||||||
@@ -55,7 +55,7 @@ index 0821214138..c688726fae 100644
|
|||||||
bs_opaque->job = NULL;
|
bs_opaque->job = NULL;
|
||||||
|
|
||||||
bdrv_drained_end(src);
|
bdrv_drained_end(src);
|
||||||
@@ -1635,10 +1645,6 @@ static BlockJob *mirror_start_job(
|
@@ -1634,10 +1644,6 @@ static BlockJob *mirror_start_job(
|
||||||
" sync mode",
|
" sync mode",
|
||||||
MirrorSyncMode_str(sync_mode));
|
MirrorSyncMode_str(sync_mode));
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -66,7 +66,7 @@ index 0821214138..c688726fae 100644
|
|||||||
}
|
}
|
||||||
} else if (bitmap) {
|
} else if (bitmap) {
|
||||||
error_setg(errp,
|
error_setg(errp,
|
||||||
@@ -1655,6 +1661,12 @@ static BlockJob *mirror_start_job(
|
@@ -1654,6 +1660,12 @@ static BlockJob *mirror_start_job(
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
granularity = bdrv_dirty_bitmap_granularity(bitmap);
|
granularity = bdrv_dirty_bitmap_granularity(bitmap);
|
||||||
|
@@ -16,10 +16,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 3 insertions(+)
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
diff --git a/blockdev.c b/blockdev.c
|
diff --git a/blockdev.c b/blockdev.c
|
||||||
index 03e99264dc..9e14feec87 100644
|
index 9a1a3118ed..a57b0af2e7 100644
|
||||||
--- a/blockdev.c
|
--- a/blockdev.c
|
||||||
+++ b/blockdev.c
|
+++ b/blockdev.c
|
||||||
@@ -3056,6 +3056,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
@@ -3050,6 +3050,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
||||||
if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
|
if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -16,10 +16,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 4 insertions(+), 7 deletions(-)
|
1 file changed, 4 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/mirror.c b/block/mirror.c
|
diff --git a/block/mirror.c b/block/mirror.c
|
||||||
index c688726fae..a7f829f766 100644
|
index b6475d50ad..8b3342f9ec 100644
|
||||||
--- a/block/mirror.c
|
--- a/block/mirror.c
|
||||||
+++ b/block/mirror.c
|
+++ b/block/mirror.c
|
||||||
@@ -787,8 +787,8 @@ static int mirror_exit_common(Job *job)
|
@@ -779,8 +779,8 @@ static int mirror_exit_common(Job *job)
|
||||||
job->ret == 0 && ret == 0)) {
|
job->ret == 0 && ret == 0)) {
|
||||||
/* Success; synchronize copy back to sync. */
|
/* Success; synchronize copy back to sync. */
|
||||||
bdrv_clear_dirty_bitmap(s->sync_bitmap, NULL);
|
bdrv_clear_dirty_bitmap(s->sync_bitmap, NULL);
|
||||||
@@ -30,7 +30,7 @@ index c688726fae..a7f829f766 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bdrv_release_dirty_bitmap(s->dirty_bitmap);
|
bdrv_release_dirty_bitmap(s->dirty_bitmap);
|
||||||
@@ -1835,11 +1835,8 @@ static BlockJob *mirror_start_job(
|
@@ -1828,11 +1828,8 @@ static BlockJob *mirror_start_job(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->sync_mode == MIRROR_SYNC_MODE_BITMAP) {
|
if (s->sync_mode == MIRROR_SYNC_MODE_BITMAP) {
|
||||||
|
@@ -19,10 +19,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
3 files changed, 70 insertions(+), 59 deletions(-)
|
3 files changed, 70 insertions(+), 59 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/mirror.c b/block/mirror.c
|
diff --git a/block/mirror.c b/block/mirror.c
|
||||||
index a7f829f766..6a126d18c8 100644
|
index 8b3342f9ec..1d4ff0efad 100644
|
||||||
--- a/block/mirror.c
|
--- a/block/mirror.c
|
||||||
+++ b/block/mirror.c
|
+++ b/block/mirror.c
|
||||||
@@ -1635,31 +1635,13 @@ static BlockJob *mirror_start_job(
|
@@ -1634,31 +1634,13 @@ static BlockJob *mirror_start_job(
|
||||||
uint64_t target_perms, target_shared_perms;
|
uint64_t target_perms, target_shared_perms;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -60,10 +60,10 @@ index a7f829f766..6a126d18c8 100644
|
|||||||
|
|
||||||
if (bitmap_mode != BITMAP_SYNC_MODE_NEVER) {
|
if (bitmap_mode != BITMAP_SYNC_MODE_NEVER) {
|
||||||
diff --git a/blockdev.c b/blockdev.c
|
diff --git a/blockdev.c b/blockdev.c
|
||||||
index 9e14feec87..b6f797b41f 100644
|
index a57b0af2e7..ce62a9b439 100644
|
||||||
--- a/blockdev.c
|
--- a/blockdev.c
|
||||||
+++ b/blockdev.c
|
+++ b/blockdev.c
|
||||||
@@ -3035,7 +3035,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
@@ -3029,7 +3029,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
|
||||||
sync = MIRROR_SYNC_MODE_FULL;
|
sync = MIRROR_SYNC_MODE_FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
6 files changed, 59 insertions(+), 5 deletions(-)
|
6 files changed, 59 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
|
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
|
||||||
index 1a8a369b50..2c8a558c67 100644
|
index a4b40e8391..d64ae8f34e 100644
|
||||||
--- a/include/monitor/monitor.h
|
--- a/include/monitor/monitor.h
|
||||||
+++ b/include/monitor/monitor.h
|
+++ b/include/monitor/monitor.h
|
||||||
@@ -16,6 +16,7 @@ extern QemuOptsList qemu_mon_opts;
|
@@ -16,6 +16,7 @@ extern QemuOptsList qemu_mon_opts;
|
||||||
@@ -60,10 +60,10 @@ index 1a8a369b50..2c8a558c67 100644
|
|||||||
void monitor_init_globals(void);
|
void monitor_init_globals(void);
|
||||||
void monitor_init_globals_core(void);
|
void monitor_init_globals_core(void);
|
||||||
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
|
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
|
||||||
index 9c3a09cb01..a92be8c3f7 100644
|
index caa2e90ef2..e1596f79ab 100644
|
||||||
--- a/monitor/monitor-internal.h
|
--- a/monitor/monitor-internal.h
|
||||||
+++ b/monitor/monitor-internal.h
|
+++ b/monitor/monitor-internal.h
|
||||||
@@ -144,6 +144,13 @@ typedef struct {
|
@@ -152,6 +152,13 @@ typedef struct {
|
||||||
QemuMutex qmp_queue_lock;
|
QemuMutex qmp_queue_lock;
|
||||||
/* Input queue that holds all the parsed QMP requests */
|
/* Input queue that holds all the parsed QMP requests */
|
||||||
GQueue *qmp_requests;
|
GQueue *qmp_requests;
|
||||||
@@ -78,7 +78,7 @@ index 9c3a09cb01..a92be8c3f7 100644
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
diff --git a/monitor/monitor.c b/monitor/monitor.c
|
diff --git a/monitor/monitor.c b/monitor/monitor.c
|
||||||
index 46a171bca6..5ccdd2424b 100644
|
index 86949024f6..c306cadcf4 100644
|
||||||
--- a/monitor/monitor.c
|
--- a/monitor/monitor.c
|
||||||
+++ b/monitor/monitor.c
|
+++ b/monitor/monitor.c
|
||||||
@@ -135,6 +135,21 @@ bool monitor_cur_is_qmp(void)
|
@@ -135,6 +135,21 @@ bool monitor_cur_is_qmp(void)
|
||||||
@@ -144,10 +144,10 @@ index 092c527b6f..6b8cfcf6d8 100644
|
|||||||
monitor_qmp_caps_reset(mon);
|
monitor_qmp_caps_reset(mon);
|
||||||
data = qmp_greeting(mon);
|
data = qmp_greeting(mon);
|
||||||
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
|
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
|
||||||
index 59600210ce..95602446eb 100644
|
index 0990873ec8..e605003771 100644
|
||||||
--- a/qapi/qmp-dispatch.c
|
--- a/qapi/qmp-dispatch.c
|
||||||
+++ b/qapi/qmp-dispatch.c
|
+++ b/qapi/qmp-dispatch.c
|
||||||
@@ -120,16 +120,28 @@ typedef struct QmpDispatchBH {
|
@@ -117,16 +117,28 @@ typedef struct QmpDispatchBH {
|
||||||
QObject **ret;
|
QObject **ret;
|
||||||
Error **errp;
|
Error **errp;
|
||||||
Coroutine *co;
|
Coroutine *co;
|
||||||
@@ -180,7 +180,7 @@ index 59600210ce..95602446eb 100644
|
|||||||
aio_co_wake(data->co);
|
aio_co_wake(data->co);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,6 +255,7 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request,
|
@@ -231,6 +243,7 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request,
|
||||||
.ret = &ret,
|
.ret = &ret,
|
||||||
.errp = &err,
|
.errp = &err,
|
||||||
.co = qemu_coroutine_self(),
|
.co = qemu_coroutine_self(),
|
||||||
@@ -189,10 +189,10 @@ index 59600210ce..95602446eb 100644
|
|||||||
aio_bh_schedule_oneshot(qemu_get_aio_context(), do_qmp_dispatch_bh,
|
aio_bh_schedule_oneshot(qemu_get_aio_context(), do_qmp_dispatch_bh,
|
||||||
&data);
|
&data);
|
||||||
diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c
|
diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c
|
||||||
index d058a2a00d..3290b58120 100644
|
index afa477aae6..d3ff124bf3 100644
|
||||||
--- a/stubs/monitor-core.c
|
--- a/stubs/monitor-core.c
|
||||||
+++ b/stubs/monitor-core.c
|
+++ b/stubs/monitor-core.c
|
||||||
@@ -13,6 +13,11 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
|
@@ -12,6 +12,11 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
76
debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch
vendored
Normal file
76
debian/patches/extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sam Li <faithilikerun@gmail.com>
|
||||||
|
Date: Sat, 24 Sep 2022 22:48:15 +0800
|
||||||
|
Subject: [PATCH] block/io_uring: revert "Use io_uring_register_ring_fd() to
|
||||||
|
skip fd operations"
|
||||||
|
|
||||||
|
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1193
|
||||||
|
|
||||||
|
The commit "Use io_uring_register_ring_fd() to skip fd operations" broke
|
||||||
|
when booting a guest with iothread and io_uring. That is because the
|
||||||
|
io_uring_register_ring_fd() call is made from the main thread instead of
|
||||||
|
IOThread where io_uring_submit() is called. It can not be guaranteed
|
||||||
|
to register the ring fd in the correct thread or unregister the same ring
|
||||||
|
fd if the IOThread is disabled. This optimization is not critical so we
|
||||||
|
will revert previous commit.
|
||||||
|
|
||||||
|
This reverts commit e2848bc574fe2715c694bf8fe9a1ba7f78a1125a
|
||||||
|
and 77e3f038af1764983087e3551a0fde9951952c4d.
|
||||||
|
|
||||||
|
Signed-off-by: Sam Li <faithilikerun@gmail.com>
|
||||||
|
---
|
||||||
|
block/io_uring.c | 13 +------------
|
||||||
|
meson.build | 1 -
|
||||||
|
2 files changed, 1 insertion(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/block/io_uring.c b/block/io_uring.c
|
||||||
|
index a1760152e0..973e15d876 100644
|
||||||
|
--- a/block/io_uring.c
|
||||||
|
+++ b/block/io_uring.c
|
||||||
|
@@ -11,7 +11,6 @@
|
||||||
|
#include "qemu/osdep.h"
|
||||||
|
#include <liburing.h>
|
||||||
|
#include "block/aio.h"
|
||||||
|
-#include "qemu/error-report.h"
|
||||||
|
#include "qemu/queue.h"
|
||||||
|
#include "block/block.h"
|
||||||
|
#include "block/raw-aio.h"
|
||||||
|
@@ -19,7 +18,6 @@
|
||||||
|
#include "qapi/error.h"
|
||||||
|
#include "trace.h"
|
||||||
|
|
||||||
|
-
|
||||||
|
/* io_uring ring size */
|
||||||
|
#define MAX_ENTRIES 128
|
||||||
|
|
||||||
|
@@ -432,17 +430,8 @@ LuringState *luring_init(Error **errp)
|
||||||
|
}
|
||||||
|
|
||||||
|
ioq_init(&s->io_q);
|
||||||
|
-#ifdef CONFIG_LIBURING_REGISTER_RING_FD
|
||||||
|
- if (io_uring_register_ring_fd(&s->ring) < 0) {
|
||||||
|
- /*
|
||||||
|
- * Only warn about this error: we will fallback to the non-optimized
|
||||||
|
- * io_uring operations.
|
||||||
|
- */
|
||||||
|
- warn_report("failed to register linux io_uring ring file descriptor");
|
||||||
|
- }
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
return s;
|
||||||
|
+
|
||||||
|
}
|
||||||
|
|
||||||
|
void luring_cleanup(LuringState *s)
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index 20fddbd707..d5230eadd6 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -1793,7 +1793,6 @@ config_host_data.set('CONFIG_LIBNFS', libnfs.found())
|
||||||
|
config_host_data.set('CONFIG_LIBSSH', libssh.found())
|
||||||
|
config_host_data.set('CONFIG_LINUX_AIO', libaio.found())
|
||||||
|
config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
|
||||||
|
-config_host_data.set('CONFIG_LIBURING_REGISTER_RING_FD', cc.has_function('io_uring_register_ring_fd', prefix: '#include <liburing.h>', dependencies:linux_io_uring))
|
||||||
|
config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
|
||||||
|
config_host_data.set('CONFIG_NUMA', numa.found())
|
||||||
|
config_host_data.set('CONFIG_OPENGL', opengl.found())
|
@@ -1,55 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stefan Reiter <s.reiter@proxmox.com>
|
|
||||||
Date: Wed, 1 Sep 2021 16:51:04 +0200
|
|
||||||
Subject: [PATCH] monitor/hmp: add support for flag argument with value
|
|
||||||
|
|
||||||
Adds support for the "-xS" parameter type, where "-x" denotes a flag
|
|
||||||
name and the "S" suffix indicates that this flag is supposed to take an
|
|
||||||
arbitrary string parameter.
|
|
||||||
|
|
||||||
These parameters are always optional, the entry in the qdict will be
|
|
||||||
omitted if the flag is not given.
|
|
||||||
|
|
||||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
||||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|
||||||
---
|
|
||||||
monitor/hmp.c | 17 ++++++++++++++++-
|
|
||||||
1 file changed, 16 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/monitor/hmp.c b/monitor/hmp.c
|
|
||||||
index d50c3124e1..a32dce7a35 100644
|
|
||||||
--- a/monitor/hmp.c
|
|
||||||
+++ b/monitor/hmp.c
|
|
||||||
@@ -980,6 +980,7 @@ static QDict *monitor_parse_arguments(Monitor *mon,
|
|
||||||
{
|
|
||||||
const char *tmp = p;
|
|
||||||
int skip_key = 0;
|
|
||||||
+ int ret;
|
|
||||||
/* option */
|
|
||||||
|
|
||||||
c = *typestr++;
|
|
||||||
@@ -1002,8 +1003,22 @@ static QDict *monitor_parse_arguments(Monitor *mon,
|
|
||||||
}
|
|
||||||
if (skip_key) {
|
|
||||||
p = tmp;
|
|
||||||
+ } else if (*typestr == 'S') {
|
|
||||||
+ /* has option with string value */
|
|
||||||
+ typestr++;
|
|
||||||
+ tmp = p++;
|
|
||||||
+ while (qemu_isspace(*p)) {
|
|
||||||
+ p++;
|
|
||||||
+ }
|
|
||||||
+ ret = get_str(buf, sizeof(buf), &p);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
+ monitor_printf(mon, "%s: value expected for -%c\n",
|
|
||||||
+ cmd->name, *tmp);
|
|
||||||
+ goto fail;
|
|
||||||
+ }
|
|
||||||
+ qdict_put_str(qdict, key, buf);
|
|
||||||
} else {
|
|
||||||
- /* has option */
|
|
||||||
+ /* has boolean option */
|
|
||||||
p++;
|
|
||||||
qdict_put_bool(qdict, key, true);
|
|
||||||
}
|
|
@@ -1,479 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stefan Reiter <s.reiter@proxmox.com>
|
|
||||||
Date: Wed, 25 Aug 2021 11:14:13 +0200
|
|
||||||
Subject: [PATCH] monitor: refactor set/expire_password and allow VNC display
|
|
||||||
id
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
It is possible to specify more than one VNC server on the command line,
|
|
||||||
either with an explicit ID or the auto-generated ones à la "default",
|
|
||||||
"vnc2", "vnc3", ...
|
|
||||||
|
|
||||||
It is not possible to change the password on one of these extra VNC
|
|
||||||
displays though. Fix this by adding a "display" parameter to the
|
|
||||||
"set_password" and "expire_password" QMP and HMP commands.
|
|
||||||
|
|
||||||
For HMP, the display is specified using the "-d" value flag.
|
|
||||||
|
|
||||||
For QMP, the schema is updated to explicitly express the supported
|
|
||||||
variants of the commands with protocol-discriminated unions.
|
|
||||||
|
|
||||||
Suggested-by: Eric Blake <eblake@redhat.com>
|
|
||||||
Suggested-by: Markus Armbruster <armbru@redhat.com>
|
|
||||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|
||||||
---
|
|
||||||
hmp-commands.hx | 29 ++++----
|
|
||||||
monitor/hmp-cmds.c | 57 +++++++++++++++-
|
|
||||||
monitor/qmp-cmds.c | 62 ++++++-----------
|
|
||||||
qapi/ui.json | 165 ++++++++++++++++++++++++++++++++++++++-------
|
|
||||||
4 files changed, 233 insertions(+), 80 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
|
||||||
index 8e45bce2cd..d78e4cfc47 100644
|
|
||||||
--- a/hmp-commands.hx
|
|
||||||
+++ b/hmp-commands.hx
|
|
||||||
@@ -1514,34 +1514,35 @@ ERST
|
|
||||||
|
|
||||||
{
|
|
||||||
.name = "set_password",
|
|
||||||
- .args_type = "protocol:s,password:s,connected:s?",
|
|
||||||
- .params = "protocol password action-if-connected",
|
|
||||||
+ .args_type = "protocol:s,password:s,display:-dS,connected:s?",
|
|
||||||
+ .params = "protocol password [-d display] [action-if-connected]",
|
|
||||||
.help = "set spice/vnc password",
|
|
||||||
.cmd = hmp_set_password,
|
|
||||||
},
|
|
||||||
|
|
||||||
SRST
|
|
||||||
-``set_password [ vnc | spice ] password [ action-if-connected ]``
|
|
||||||
- Change spice/vnc password. Use zero to make the password stay valid
|
|
||||||
- forever. *action-if-connected* specifies what should happen in
|
|
||||||
- case a connection is established: *fail* makes the password change
|
|
||||||
- fail. *disconnect* changes the password and disconnects the
|
|
||||||
- client. *keep* changes the password and keeps the connection up.
|
|
||||||
- *keep* is the default.
|
|
||||||
+``set_password [ vnc | spice ] password [ -d display ] [ action-if-connected ]``
|
|
||||||
+ Change spice/vnc password. *display* can be used with 'vnc' to specify
|
|
||||||
+ which display to set the password on. *action-if-connected* specifies
|
|
||||||
+ what should happen in case a connection is established: *fail* makes
|
|
||||||
+ the password change fail. *disconnect* changes the password and
|
|
||||||
+ disconnects the client. *keep* changes the password and keeps the
|
|
||||||
+ connection up. *keep* is the default.
|
|
||||||
ERST
|
|
||||||
|
|
||||||
{
|
|
||||||
.name = "expire_password",
|
|
||||||
- .args_type = "protocol:s,time:s",
|
|
||||||
- .params = "protocol time",
|
|
||||||
+ .args_type = "protocol:s,time:s,display:-dS",
|
|
||||||
+ .params = "protocol time [-d display]",
|
|
||||||
.help = "set spice/vnc password expire-time",
|
|
||||||
.cmd = hmp_expire_password,
|
|
||||||
},
|
|
||||||
|
|
||||||
SRST
|
|
||||||
-``expire_password [ vnc | spice ]`` *expire-time*
|
|
||||||
- Specify when a password for spice/vnc becomes
|
|
||||||
- invalid. *expire-time* accepts:
|
|
||||||
+``expire_password [ vnc | spice ] expire-time [ -d display ]``
|
|
||||||
+ Specify when a password for spice/vnc becomes invalid.
|
|
||||||
+ *display* behaves the same as in ``set_password``.
|
|
||||||
+ *expire-time* accepts:
|
|
||||||
|
|
||||||
``now``
|
|
||||||
Invalidate password instantly.
|
|
||||||
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
|
||||||
index a7e197a90b..f4ef58d257 100644
|
|
||||||
--- a/monitor/hmp-cmds.c
|
|
||||||
+++ b/monitor/hmp-cmds.c
|
|
||||||
@@ -1451,10 +1451,41 @@ void hmp_set_password(Monitor *mon, const QDict *qdict)
|
|
||||||
{
|
|
||||||
const char *protocol = qdict_get_str(qdict, "protocol");
|
|
||||||
const char *password = qdict_get_str(qdict, "password");
|
|
||||||
+ const char *display = qdict_get_try_str(qdict, "display");
|
|
||||||
const char *connected = qdict_get_try_str(qdict, "connected");
|
|
||||||
Error *err = NULL;
|
|
||||||
+ DisplayProtocol proto;
|
|
||||||
|
|
||||||
- qmp_set_password(protocol, password, !!connected, connected, &err);
|
|
||||||
+ SetPasswordOptions opts = {
|
|
||||||
+ .password = g_strdup(password),
|
|
||||||
+ .u.vnc.display = NULL,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ proto = qapi_enum_parse(&DisplayProtocol_lookup, protocol,
|
|
||||||
+ DISPLAY_PROTOCOL_VNC, &err);
|
|
||||||
+ if (err) {
|
|
||||||
+ hmp_handle_error(mon, err);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ opts.protocol = proto;
|
|
||||||
+
|
|
||||||
+ if (proto == DISPLAY_PROTOCOL_VNC) {
|
|
||||||
+ opts.u.vnc.has_display = !!display;
|
|
||||||
+ opts.u.vnc.display = g_strdup(display);
|
|
||||||
+ } else if (proto == DISPLAY_PROTOCOL_SPICE) {
|
|
||||||
+ opts.u.spice.has_connected = !!connected;
|
|
||||||
+ opts.u.spice.connected =
|
|
||||||
+ qapi_enum_parse(&SetPasswordAction_lookup, connected,
|
|
||||||
+ SET_PASSWORD_ACTION_KEEP, &err);
|
|
||||||
+ if (err) {
|
|
||||||
+ hmp_handle_error(mon, err);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ qmp_set_password(&opts, &err);
|
|
||||||
+ g_free(opts.password);
|
|
||||||
+ g_free(opts.u.vnc.display);
|
|
||||||
hmp_handle_error(mon, err);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1462,9 +1493,31 @@ void hmp_expire_password(Monitor *mon, const QDict *qdict)
|
|
||||||
{
|
|
||||||
const char *protocol = qdict_get_str(qdict, "protocol");
|
|
||||||
const char *whenstr = qdict_get_str(qdict, "time");
|
|
||||||
+ const char *display = qdict_get_try_str(qdict, "display");
|
|
||||||
Error *err = NULL;
|
|
||||||
+ DisplayProtocol proto;
|
|
||||||
|
|
||||||
- qmp_expire_password(protocol, whenstr, &err);
|
|
||||||
+ ExpirePasswordOptions opts = {
|
|
||||||
+ .time = g_strdup(whenstr),
|
|
||||||
+ .u.vnc.display = NULL,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ proto = qapi_enum_parse(&DisplayProtocol_lookup, protocol,
|
|
||||||
+ DISPLAY_PROTOCOL_VNC, &err);
|
|
||||||
+ if (err) {
|
|
||||||
+ hmp_handle_error(mon, err);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ opts.protocol = proto;
|
|
||||||
+
|
|
||||||
+ if (proto == DISPLAY_PROTOCOL_VNC) {
|
|
||||||
+ opts.u.vnc.has_display = !!display;
|
|
||||||
+ opts.u.vnc.display = g_strdup(display);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ qmp_expire_password(&opts, &err);
|
|
||||||
+ g_free(opts.time);
|
|
||||||
+ g_free(opts.u.vnc.display);
|
|
||||||
hmp_handle_error(mon, err);
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
|
|
||||||
index f7d64a6457..65882b5997 100644
|
|
||||||
--- a/monitor/qmp-cmds.c
|
|
||||||
+++ b/monitor/qmp-cmds.c
|
|
||||||
@@ -164,45 +164,30 @@ void qmp_system_wakeup(Error **errp)
|
|
||||||
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, errp);
|
|
||||||
}
|
|
||||||
|
|
||||||
-void qmp_set_password(const char *protocol, const char *password,
|
|
||||||
- bool has_connected, const char *connected, Error **errp)
|
|
||||||
+void qmp_set_password(SetPasswordOptions *opts, Error **errp)
|
|
||||||
{
|
|
||||||
- int disconnect_if_connected = 0;
|
|
||||||
- int fail_if_connected = 0;
|
|
||||||
- int rc;
|
|
||||||
+ bool disconnect_if_connected = false;
|
|
||||||
+ bool fail_if_connected = false;
|
|
||||||
+ int rc = 0;
|
|
||||||
|
|
||||||
- if (has_connected) {
|
|
||||||
- if (strcmp(connected, "fail") == 0) {
|
|
||||||
- fail_if_connected = 1;
|
|
||||||
- } else if (strcmp(connected, "disconnect") == 0) {
|
|
||||||
- disconnect_if_connected = 1;
|
|
||||||
- } else if (strcmp(connected, "keep") == 0) {
|
|
||||||
- /* nothing */
|
|
||||||
- } else {
|
|
||||||
- error_setg(errp, QERR_INVALID_PARAMETER, "connected");
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (strcmp(protocol, "spice") == 0) {
|
|
||||||
+ if (opts->protocol == DISPLAY_PROTOCOL_SPICE) {
|
|
||||||
if (!qemu_using_spice(errp)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
- rc = qemu_spice.set_passwd(password, fail_if_connected,
|
|
||||||
+ if (opts->u.spice.has_connected) {
|
|
||||||
+ fail_if_connected =
|
|
||||||
+ opts->u.spice.connected == SET_PASSWORD_ACTION_FAIL;
|
|
||||||
+ disconnect_if_connected =
|
|
||||||
+ opts->u.spice.connected == SET_PASSWORD_ACTION_DISCONNECT;
|
|
||||||
+ }
|
|
||||||
+ rc = qemu_spice.set_passwd(opts->password, fail_if_connected,
|
|
||||||
disconnect_if_connected);
|
|
||||||
- } else if (strcmp(protocol, "vnc") == 0) {
|
|
||||||
- if (fail_if_connected || disconnect_if_connected) {
|
|
||||||
- /* vnc supports "connected=keep" only */
|
|
||||||
- error_setg(errp, QERR_INVALID_PARAMETER, "connected");
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
+ } else if (opts->protocol == DISPLAY_PROTOCOL_VNC) {
|
|
||||||
/* Note that setting an empty password will not disable login through
|
|
||||||
* this interface. */
|
|
||||||
- rc = vnc_display_password(NULL, password);
|
|
||||||
- } else {
|
|
||||||
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol",
|
|
||||||
- "'vnc' or 'spice'");
|
|
||||||
- return;
|
|
||||||
+ rc = vnc_display_password(
|
|
||||||
+ opts->u.vnc.has_display ? opts->u.vnc.display : NULL,
|
|
||||||
+ opts->password);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc != 0) {
|
|
||||||
@@ -210,11 +195,11 @@ void qmp_set_password(const char *protocol, const char *password,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-void qmp_expire_password(const char *protocol, const char *whenstr,
|
|
||||||
- Error **errp)
|
|
||||||
+void qmp_expire_password(ExpirePasswordOptions *opts, Error **errp)
|
|
||||||
{
|
|
||||||
time_t when;
|
|
||||||
int rc;
|
|
||||||
+ const char* whenstr = opts->time;
|
|
||||||
|
|
||||||
if (strcmp(whenstr, "now") == 0) {
|
|
||||||
when = 0;
|
|
||||||
@@ -226,17 +211,14 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
|
|
||||||
when = strtoull(whenstr, NULL, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (strcmp(protocol, "spice") == 0) {
|
|
||||||
+ if (opts->protocol == DISPLAY_PROTOCOL_SPICE) {
|
|
||||||
if (!qemu_using_spice(errp)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
rc = qemu_spice.set_pw_expire(when);
|
|
||||||
- } else if (strcmp(protocol, "vnc") == 0) {
|
|
||||||
- rc = vnc_display_pw_expire(NULL, when);
|
|
||||||
- } else {
|
|
||||||
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol",
|
|
||||||
- "'vnc' or 'spice'");
|
|
||||||
- return;
|
|
||||||
+ } else if (opts->protocol == DISPLAY_PROTOCOL_VNC) {
|
|
||||||
+ rc = vnc_display_pw_expire(
|
|
||||||
+ opts->u.vnc.has_display ? opts->u.vnc.display : NULL, when);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc != 0) {
|
|
||||||
diff --git a/qapi/ui.json b/qapi/ui.json
|
|
||||||
index fd9677d48e..cba8665b73 100644
|
|
||||||
--- a/qapi/ui.json
|
|
||||||
+++ b/qapi/ui.json
|
|
||||||
@@ -9,22 +9,23 @@
|
|
||||||
{ 'include': 'common.json' }
|
|
||||||
{ 'include': 'sockets.json' }
|
|
||||||
|
|
||||||
+##
|
|
||||||
+# @DisplayProtocol:
|
|
||||||
+#
|
|
||||||
+# Display protocols which support changing password options.
|
|
||||||
+#
|
|
||||||
+# Since: 6.2
|
|
||||||
+#
|
|
||||||
+##
|
|
||||||
+{ 'enum': 'DisplayProtocol',
|
|
||||||
+ 'data': [ { 'name': 'vnc', 'if': 'defined(CONFIG_VNC)' },
|
|
||||||
+ { 'name': 'spice', 'if': 'defined(CONFIG_SPICE)' } ] }
|
|
||||||
+
|
|
||||||
##
|
|
||||||
# @set_password:
|
|
||||||
#
|
|
||||||
# Sets the password of a remote display session.
|
|
||||||
#
|
|
||||||
-# @protocol: - 'vnc' to modify the VNC server password
|
|
||||||
-# - 'spice' to modify the Spice server password
|
|
||||||
-#
|
|
||||||
-# @password: the new password
|
|
||||||
-#
|
|
||||||
-# @connected: how to handle existing clients when changing the
|
|
||||||
-# password. If nothing is specified, defaults to 'keep'
|
|
||||||
-# 'fail' to fail the command if clients are connected
|
|
||||||
-# 'disconnect' to disconnect existing clients
|
|
||||||
-# 'keep' to maintain existing clients
|
|
||||||
-#
|
|
||||||
# Returns: - Nothing on success
|
|
||||||
# - If Spice is not enabled, DeviceNotFound
|
|
||||||
#
|
|
||||||
@@ -37,16 +38,123 @@
|
|
||||||
# <- { "return": {} }
|
|
||||||
#
|
|
||||||
##
|
|
||||||
-{ 'command': 'set_password',
|
|
||||||
- 'data': {'protocol': 'str', 'password': 'str', '*connected': 'str'} }
|
|
||||||
+{ 'command': 'set_password', 'boxed': true, 'data': 'SetPasswordOptions' }
|
|
||||||
+
|
|
||||||
+##
|
|
||||||
+# @SetPasswordOptions:
|
|
||||||
+#
|
|
||||||
+# Data required to set a new password on a display server protocol.
|
|
||||||
+#
|
|
||||||
+# @protocol: - 'vnc' to modify the VNC server password
|
|
||||||
+# - 'spice' to modify the Spice server password
|
|
||||||
+#
|
|
||||||
+# @password: the new password
|
|
||||||
+#
|
|
||||||
+# Since: 6.2
|
|
||||||
+#
|
|
||||||
+##
|
|
||||||
+{ 'union': 'SetPasswordOptions',
|
|
||||||
+ 'base': { 'protocol': 'DisplayProtocol',
|
|
||||||
+ 'password': 'str' },
|
|
||||||
+ 'discriminator': 'protocol',
|
|
||||||
+ 'data': { 'vnc': 'SetPasswordOptionsVnc',
|
|
||||||
+ 'spice': 'SetPasswordOptionsSpice' } }
|
|
||||||
+
|
|
||||||
+##
|
|
||||||
+# @SetPasswordAction:
|
|
||||||
+#
|
|
||||||
+# An action to take on changing a password on a connection with active clients.
|
|
||||||
+#
|
|
||||||
+# @fail: fail the command if clients are connected
|
|
||||||
+#
|
|
||||||
+# @disconnect: disconnect existing clients
|
|
||||||
+#
|
|
||||||
+# @keep: maintain existing clients
|
|
||||||
+#
|
|
||||||
+# Since: 6.2
|
|
||||||
+#
|
|
||||||
+##
|
|
||||||
+{ 'enum': 'SetPasswordAction',
|
|
||||||
+ 'data': [ 'fail', 'disconnect', 'keep' ] }
|
|
||||||
+
|
|
||||||
+##
|
|
||||||
+# @SetPasswordActionVnc:
|
|
||||||
+#
|
|
||||||
+# See @SetPasswordAction. VNC only supports the keep action. 'connection'
|
|
||||||
+# should just be omitted for VNC, this is kept for backwards compatibility.
|
|
||||||
+#
|
|
||||||
+# @keep: maintain existing clients
|
|
||||||
+#
|
|
||||||
+# Since: 6.2
|
|
||||||
+#
|
|
||||||
+##
|
|
||||||
+{ 'enum': 'SetPasswordActionVnc',
|
|
||||||
+ 'data': [ 'keep' ] }
|
|
||||||
+
|
|
||||||
+##
|
|
||||||
+# @SetPasswordOptionsSpice:
|
|
||||||
+#
|
|
||||||
+# Options for set_password specific to the VNC procotol.
|
|
||||||
+#
|
|
||||||
+# @connected: How to handle existing clients when changing the
|
|
||||||
+# password. If nothing is specified, defaults to 'keep'.
|
|
||||||
+#
|
|
||||||
+# Since: 6.2
|
|
||||||
+#
|
|
||||||
+##
|
|
||||||
+{ 'struct': 'SetPasswordOptionsSpice',
|
|
||||||
+ 'data': { '*connected': 'SetPasswordAction' } }
|
|
||||||
+
|
|
||||||
+##
|
|
||||||
+# @SetPasswordOptionsVnc:
|
|
||||||
+#
|
|
||||||
+# Options for set_password specific to the VNC procotol.
|
|
||||||
+#
|
|
||||||
+# @display: The id of the display where the password should be changed.
|
|
||||||
+# Defaults to the first.
|
|
||||||
+#
|
|
||||||
+# @connected: How to handle existing clients when changing the
|
|
||||||
+# password.
|
|
||||||
+#
|
|
||||||
+# Features:
|
|
||||||
+# @deprecated: For VNC, @connected will always be 'keep', parameter should be
|
|
||||||
+# omitted.
|
|
||||||
+#
|
|
||||||
+# Since: 6.2
|
|
||||||
+#
|
|
||||||
+##
|
|
||||||
+{ 'struct': 'SetPasswordOptionsVnc',
|
|
||||||
+ 'data': { '*display': 'str',
|
|
||||||
+ '*connected': { 'type': 'SetPasswordActionVnc',
|
|
||||||
+ 'features': ['deprecated'] } } }
|
|
||||||
|
|
||||||
##
|
|
||||||
# @expire_password:
|
|
||||||
#
|
|
||||||
# Expire the password of a remote display server.
|
|
||||||
#
|
|
||||||
-# @protocol: the name of the remote display protocol 'vnc' or 'spice'
|
|
||||||
+# Returns: - Nothing on success
|
|
||||||
+# - If @protocol is 'spice' and Spice is not active, DeviceNotFound
|
|
||||||
#
|
|
||||||
+# Since: 0.14
|
|
||||||
+#
|
|
||||||
+# Example:
|
|
||||||
+#
|
|
||||||
+# -> { "execute": "expire_password", "arguments": { "protocol": "vnc",
|
|
||||||
+# "time": "+60" } }
|
|
||||||
+# <- { "return": {} }
|
|
||||||
+#
|
|
||||||
+##
|
|
||||||
+{ 'command': 'expire_password', 'boxed': true, 'data': 'ExpirePasswordOptions' }
|
|
||||||
+
|
|
||||||
+##
|
|
||||||
+# @ExpirePasswordOptions:
|
|
||||||
+#
|
|
||||||
+# Data required to set password expiration on a display server protocol.
|
|
||||||
+#
|
|
||||||
+# @protocol: - 'vnc' to modify the VNC server expiration
|
|
||||||
+# - 'spice' to modify the Spice server expiration
|
|
||||||
+
|
|
||||||
# @time: when to expire the password.
|
|
||||||
#
|
|
||||||
# - 'now' to expire the password immediately
|
|
||||||
@@ -54,24 +162,33 @@
|
|
||||||
# - '+INT' where INT is the number of seconds from now (integer)
|
|
||||||
# - 'INT' where INT is the absolute time in seconds
|
|
||||||
#
|
|
||||||
-# Returns: - Nothing on success
|
|
||||||
-# - If @protocol is 'spice' and Spice is not active, DeviceNotFound
|
|
||||||
-#
|
|
||||||
-# Since: 0.14
|
|
||||||
-#
|
|
||||||
# Notes: Time is relative to the server and currently there is no way to
|
|
||||||
# coordinate server time with client time. It is not recommended to
|
|
||||||
# use the absolute time version of the @time parameter unless you're
|
|
||||||
# sure you are on the same machine as the QEMU instance.
|
|
||||||
#
|
|
||||||
-# Example:
|
|
||||||
+# Since: 6.2
|
|
||||||
#
|
|
||||||
-# -> { "execute": "expire_password", "arguments": { "protocol": "vnc",
|
|
||||||
-# "time": "+60" } }
|
|
||||||
-# <- { "return": {} }
|
|
||||||
+##
|
|
||||||
+{ 'union': 'ExpirePasswordOptions',
|
|
||||||
+ 'base': { 'protocol': 'DisplayProtocol',
|
|
||||||
+ 'time': 'str' },
|
|
||||||
+ 'discriminator': 'protocol',
|
|
||||||
+ 'data': { 'vnc': 'ExpirePasswordOptionsVnc' } }
|
|
||||||
+
|
|
||||||
+##
|
|
||||||
+# @ExpirePasswordOptionsVnc:
|
|
||||||
+#
|
|
||||||
+# Options for expire_password specific to the VNC procotol.
|
|
||||||
+#
|
|
||||||
+# @display: The id of the display where the expiration should be changed.
|
|
||||||
+# Defaults to the first.
|
|
||||||
+#
|
|
||||||
+# Since: 6.2
|
|
||||||
#
|
|
||||||
##
|
|
||||||
-{ 'command': 'expire_password', 'data': {'protocol': 'str', 'time': 'str'} }
|
|
||||||
+{ 'struct': 'ExpirePasswordOptionsVnc',
|
|
||||||
+ 'data': { '*display': 'str' } }
|
|
||||||
|
|
||||||
##
|
|
||||||
# @screendump:
|
|
51
debian/patches/extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch
vendored
Normal file
51
debian/patches/extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch
vendored
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Yusuke Okada <okada.yusuke@jp.fujitsu.com>
|
||||||
|
Date: Thu, 18 Aug 2022 14:46:19 -0400
|
||||||
|
Subject: [PATCH] virtiofsd: use g_date_time_get_microsecond to get subsecond
|
||||||
|
|
||||||
|
The "%f" specifier in g_date_time_format() is only available in glib
|
||||||
|
2.65.2 or later. If combined with older glib, the function returns null
|
||||||
|
and the timestamp displayed as "(null)".
|
||||||
|
|
||||||
|
For backward compatibility, g_date_time_get_microsecond should be used
|
||||||
|
to retrieve subsecond.
|
||||||
|
|
||||||
|
In this patch the g_date_time_format() leaves subsecond field as "%06d"
|
||||||
|
and let next snprintf to format with g_date_time_get_microsecond.
|
||||||
|
|
||||||
|
Signed-off-by: Yusuke Okada <okada.yusuke@jp.fujitsu.com>
|
||||||
|
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
||||||
|
Message-id: 20220818184618.2205172-1-yokada.996@gmail.com
|
||||||
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||||
|
(cherry-picked from commit f16d15c9276bd8f501f861c39cbd4adc812d0c1d)
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
tools/virtiofsd/passthrough_ll.c | 7 +++++--
|
||||||
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
|
||||||
|
index 371a7bead6..20f0f41f99 100644
|
||||||
|
--- a/tools/virtiofsd/passthrough_ll.c
|
||||||
|
+++ b/tools/virtiofsd/passthrough_ll.c
|
||||||
|
@@ -4185,6 +4185,7 @@ static void setup_nofile_rlimit(unsigned long rlimit_nofile)
|
||||||
|
static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
|
||||||
|
{
|
||||||
|
g_autofree char *localfmt = NULL;
|
||||||
|
+ char buf[64];
|
||||||
|
|
||||||
|
if (current_log_level < level) {
|
||||||
|
return;
|
||||||
|
@@ -4197,9 +4198,11 @@ static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
|
||||||
|
fmt);
|
||||||
|
} else {
|
||||||
|
g_autoptr(GDateTime) now = g_date_time_new_now_utc();
|
||||||
|
- g_autofree char *nowstr = g_date_time_format(now, "%Y-%m-%d %H:%M:%S.%f%z");
|
||||||
|
+ g_autofree char *nowstr = g_date_time_format(now,
|
||||||
|
+ "%Y-%m-%d %H:%M:%S.%%06d%z");
|
||||||
|
+ snprintf(buf, 64, nowstr, g_date_time_get_microsecond(now));
|
||||||
|
localfmt = g_strdup_printf("[%s] [ID: %08ld] %s",
|
||||||
|
- nowstr, syscall(__NR_gettid), fmt);
|
||||||
|
+ buf, syscall(__NR_gettid), fmt);
|
||||||
|
}
|
||||||
|
fmt = localfmt;
|
||||||
|
}
|
@@ -1,83 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stefano Garzarella <sgarzare@redhat.com>
|
|
||||||
Date: Fri, 10 Sep 2021 14:45:33 +0200
|
|
||||||
Subject: [PATCH] block/mirror: fix NULL pointer dereference in
|
|
||||||
mirror_wait_on_conflicts()
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
In mirror_iteration() we call mirror_wait_on_conflicts() with
|
|
||||||
`self` parameter set to NULL.
|
|
||||||
|
|
||||||
Starting from commit d44dae1a7c we dereference `self` pointer in
|
|
||||||
mirror_wait_on_conflicts() without checks if it is not NULL.
|
|
||||||
|
|
||||||
Backtrace:
|
|
||||||
Program terminated with signal SIGSEGV, Segmentation fault.
|
|
||||||
#0 mirror_wait_on_conflicts (self=0x0, s=<optimized out>, offset=<optimized out>, bytes=<optimized out>)
|
|
||||||
at ../block/mirror.c:172
|
|
||||||
172 self->waiting_for_op = op;
|
|
||||||
[Current thread is 1 (Thread 0x7f0908931ec0 (LWP 380249))]
|
|
||||||
(gdb) bt
|
|
||||||
#0 mirror_wait_on_conflicts (self=0x0, s=<optimized out>, offset=<optimized out>, bytes=<optimized out>)
|
|
||||||
at ../block/mirror.c:172
|
|
||||||
#1 0x00005610c5d9d631 in mirror_run (job=0x5610c76a2c00, errp=<optimized out>) at ../block/mirror.c:491
|
|
||||||
#2 0x00005610c5d58726 in job_co_entry (opaque=0x5610c76a2c00) at ../job.c:917
|
|
||||||
#3 0x00005610c5f046c6 in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>)
|
|
||||||
at ../util/coroutine-ucontext.c:173
|
|
||||||
#4 0x00007f0909975820 in ?? () at ../sysdeps/unix/sysv/linux/x86_64/__start_context.S:91
|
|
||||||
from /usr/lib64/libc.so.6
|
|
||||||
|
|
||||||
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2001404
|
|
||||||
Fixes: d44dae1a7c ("block/mirror: fix active mirror dead-lock in mirror_wait_on_conflicts")
|
|
||||||
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
||||||
Message-Id: <20210910124533.288318-1-sgarzare@redhat.com>
|
|
||||||
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
||||||
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
|
|
||||||
(cherry picked from commit 66fed30c9cd11854fc878a4eceb507e915d7c9cd)
|
|
||||||
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
|
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|
||||||
---
|
|
||||||
block/mirror.c | 25 ++++++++++++++++---------
|
|
||||||
1 file changed, 16 insertions(+), 9 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/block/mirror.c b/block/mirror.c
|
|
||||||
index 98fc66eabf..85b781bc21 100644
|
|
||||||
--- a/block/mirror.c
|
|
||||||
+++ b/block/mirror.c
|
|
||||||
@@ -160,18 +160,25 @@ static void coroutine_fn mirror_wait_on_conflicts(MirrorOp *self,
|
|
||||||
if (ranges_overlap(self_start_chunk, self_nb_chunks,
|
|
||||||
op_start_chunk, op_nb_chunks))
|
|
||||||
{
|
|
||||||
- /*
|
|
||||||
- * If the operation is already (indirectly) waiting for us, or
|
|
||||||
- * will wait for us as soon as it wakes up, then just go on
|
|
||||||
- * (instead of producing a deadlock in the former case).
|
|
||||||
- */
|
|
||||||
- if (op->waiting_for_op) {
|
|
||||||
- continue;
|
|
||||||
+ if (self) {
|
|
||||||
+ /*
|
|
||||||
+ * If the operation is already (indirectly) waiting for us,
|
|
||||||
+ * or will wait for us as soon as it wakes up, then just go
|
|
||||||
+ * on (instead of producing a deadlock in the former case).
|
|
||||||
+ */
|
|
||||||
+ if (op->waiting_for_op) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ self->waiting_for_op = op;
|
|
||||||
}
|
|
||||||
|
|
||||||
- self->waiting_for_op = op;
|
|
||||||
qemu_co_queue_wait(&op->waiting_requests, NULL);
|
|
||||||
- self->waiting_for_op = NULL;
|
|
||||||
+
|
|
||||||
+ if (self) {
|
|
||||||
+ self->waiting_for_op = NULL;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
56
debian/patches/extra/0004-chardev-fix-segfault-in-finalize.patch
vendored
Normal file
56
debian/patches/extra/0004-chardev-fix-segfault-in-finalize.patch
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Maksim Davydov <davydov-max@yandex-team.ru>
|
||||||
|
Date: Thu, 25 Aug 2022 19:52:47 +0300
|
||||||
|
Subject: [PATCH] chardev: fix segfault in finalize
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
If finalize chardev-msmouse or chardev-wctable is called immediately after
|
||||||
|
init it cases QEMU to crash with segfault. This happens because of
|
||||||
|
QTAILQ_REMOVE in qemu_input_handler_unregister tries to dereference
|
||||||
|
NULL pointer.
|
||||||
|
For instance, this error can be reproduced via `qom-list-properties`
|
||||||
|
command.
|
||||||
|
|
||||||
|
Signed-off-by: Maksim Davydov <davydov-max@yandex-team.ru>
|
||||||
|
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||||
|
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
|
||||||
|
Message-Id: <20220825165247.33704-1-davydov-max@yandex-team.ru>
|
||||||
|
(trivial backport from fc0c128531ed55f058bfbad4f1348ebd9a0187f2)
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
chardev/msmouse.c | 4 +++-
|
||||||
|
chardev/wctablet.c | 4 +++-
|
||||||
|
2 files changed, 6 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/chardev/msmouse.c b/chardev/msmouse.c
|
||||||
|
index eb9231dcdb..2cc1b16561 100644
|
||||||
|
--- a/chardev/msmouse.c
|
||||||
|
+++ b/chardev/msmouse.c
|
||||||
|
@@ -146,7 +146,9 @@ static void char_msmouse_finalize(Object *obj)
|
||||||
|
{
|
||||||
|
MouseChardev *mouse = MOUSE_CHARDEV(obj);
|
||||||
|
|
||||||
|
- qemu_input_handler_unregister(mouse->hs);
|
||||||
|
+ if (mouse->hs) {
|
||||||
|
+ qemu_input_handler_unregister(mouse->hs);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static QemuInputHandler msmouse_handler = {
|
||||||
|
diff --git a/chardev/wctablet.c b/chardev/wctablet.c
|
||||||
|
index e8b292c43c..43bdf6b608 100644
|
||||||
|
--- a/chardev/wctablet.c
|
||||||
|
+++ b/chardev/wctablet.c
|
||||||
|
@@ -319,7 +319,9 @@ static void wctablet_chr_finalize(Object *obj)
|
||||||
|
{
|
||||||
|
TabletChardev *tablet = WCTABLET_CHARDEV(obj);
|
||||||
|
|
||||||
|
- qemu_input_handler_unregister(tablet->hs);
|
||||||
|
+ if (tablet->hs) {
|
||||||
|
+ qemu_input_handler_unregister(tablet->hs);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static void wctablet_chr_open(Chardev *chr,
|
42
debian/patches/extra/0005-init-daemonize-defuse-PID-file-resolve-error.patch
vendored
Normal file
42
debian/patches/extra/0005-init-daemonize-defuse-PID-file-resolve-error.patch
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Fri, 28 Oct 2022 10:09:46 +0200
|
||||||
|
Subject: [PATCH] init: daemonize: defuse PID file resolve error
|
||||||
|
|
||||||
|
When proxmox-file-restore invokes QEMU, the PID file is a (temporary)
|
||||||
|
file that's already unlinked, so resolving the absolute path here
|
||||||
|
failed.
|
||||||
|
|
||||||
|
It should not be a critical error when the PID file unlink handler
|
||||||
|
can't be registered, because the path can't be resolved for whatever
|
||||||
|
reason. If the file is already gone from QEMU's perspective (i.e.
|
||||||
|
errno is ENOENT), silently ignore the error. Otherwise, print a
|
||||||
|
warning.
|
||||||
|
|
||||||
|
Reported-by: Dominik Csapak <d.csapak@proxmox.com>
|
||||||
|
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
softmmu/vl.c | 9 +++++----
|
||||||
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/softmmu/vl.c b/softmmu/vl.c
|
||||||
|
index 706bd7cff7..3381c56af7 100644
|
||||||
|
--- a/softmmu/vl.c
|
||||||
|
+++ b/softmmu/vl.c
|
||||||
|
@@ -2438,10 +2438,11 @@ static void qemu_maybe_daemonize(const char *pid_file)
|
||||||
|
|
||||||
|
pid_file_realpath = g_malloc0(PATH_MAX);
|
||||||
|
if (!realpath(pid_file, pid_file_realpath)) {
|
||||||
|
- error_report("cannot resolve PID file path: %s: %s",
|
||||||
|
- pid_file, strerror(errno));
|
||||||
|
- unlink(pid_file);
|
||||||
|
- exit(1);
|
||||||
|
+ if (errno != ENOENT) {
|
||||||
|
+ warn_report("not removing PID file on exit: cannot resolve PID "
|
||||||
|
+ "file path: %s: %s", pid_file, strerror(errno));
|
||||||
|
+ }
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qemu_unlink_pidfile_notifier = (struct UnlinkPidfileNotifier) {
|
77
debian/patches/extra/0006-block-block-backend-blk_set_enable_write_cache-is-IO.patch
vendored
Normal file
77
debian/patches/extra/0006-block-block-backend-blk_set_enable_write_cache-is-IO.patch
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||||
|
Date: Thu, 27 Oct 2022 03:27:26 -0400
|
||||||
|
Subject: [PATCH] block/block-backend: blk_set_enable_write_cache is IO_CODE
|
||||||
|
|
||||||
|
blk_set_enable_write_cache() is defined as GLOBAL_STATE_CODE
|
||||||
|
but can be invoked from iothreads when handling scsi requests.
|
||||||
|
This triggers an assertion failure:
|
||||||
|
|
||||||
|
0x00007fd6c3515ce1 in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
0x00007fd6c34ff537 in abort () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
0x00007fd6c34ff40f in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
0x00007fd6c350e662 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
0x000056149e2cea03 in blk_set_enable_write_cache (wce=true, blk=0x5614a01c27f0)
|
||||||
|
at ../src/block/block-backend.c:1949
|
||||||
|
0x000056149e2d0a67 in blk_set_enable_write_cache (blk=0x5614a01c27f0,
|
||||||
|
wce=<optimized out>) at ../src/block/block-backend.c:1951
|
||||||
|
0x000056149dfe9c59 in scsi_disk_apply_mode_select (p=0x7fd6b400c00e "\004",
|
||||||
|
page=<optimized out>, s=<optimized out>) at ../src/hw/scsi/scsi-disk.c:1520
|
||||||
|
mode_select_pages (change=true, len=18, p=0x7fd6b400c00e "\004", r=0x7fd6b4001ff0)
|
||||||
|
at ../src/hw/scsi/scsi-disk.c:1570
|
||||||
|
scsi_disk_emulate_mode_select (inbuf=<optimized out>, r=0x7fd6b4001ff0) at
|
||||||
|
../src/hw/scsi/scsi-disk.c:1640
|
||||||
|
scsi_disk_emulate_write_data (req=0x7fd6b4001ff0) at ../src/hw/scsi/scsi-disk.c:1934
|
||||||
|
0x000056149e18ff16 in virtio_scsi_handle_cmd_req_submit (req=<optimized out>,
|
||||||
|
req=<optimized out>, s=0x5614a12f16b0) at ../src/hw/scsi/virtio-scsi.c:719
|
||||||
|
virtio_scsi_handle_cmd_vq (vq=0x7fd6bab92140, s=0x5614a12f16b0) at
|
||||||
|
../src/hw/scsi/virtio-scsi.c:761
|
||||||
|
virtio_scsi_handle_cmd (vq=<optimized out>, vdev=<optimized out>) at
|
||||||
|
../src/hw/scsi/virtio-scsi.c:775
|
||||||
|
virtio_scsi_handle_cmd (vdev=0x5614a12f16b0, vq=0x7fd6bab92140) at
|
||||||
|
../src/hw/scsi/virtio-scsi.c:765
|
||||||
|
0x000056149e1a8aa6 in virtio_queue_notify_vq (vq=0x7fd6bab92140) at
|
||||||
|
../src/hw/virtio/virtio.c:2365
|
||||||
|
0x000056149e3ccea5 in aio_dispatch_handler (ctx=ctx@entry=0x5614a01babe0,
|
||||||
|
node=<optimized out>) at ../src/util/aio-posix.c:369
|
||||||
|
0x000056149e3cd868 in aio_dispatch_ready_handlers (ready_list=0x7fd6c09b2680,
|
||||||
|
ctx=0x5614a01babe0) at ../src/util/aio-posix.c:399
|
||||||
|
aio_poll (ctx=0x5614a01babe0, blocking=blocking@entry=true) at
|
||||||
|
../src/util/aio-posix.c:713
|
||||||
|
0x000056149e2a7796 in iothread_run (opaque=opaque@entry=0x56149ffde500) at
|
||||||
|
../src/iothread.c:67
|
||||||
|
0x000056149e3d0859 in qemu_thread_start (args=0x7fd6c09b26f0) at
|
||||||
|
../src/util/qemu-thread-posix.c:504
|
||||||
|
0x00007fd6c36b9ea7 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
|
||||||
|
0x00007fd6c35d9aef in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
||||||
|
|
||||||
|
Changing GLOBAL_STATE_CODE in IO_CODE is allowed, since GSC callers are
|
||||||
|
allowed to call IO_CODE.
|
||||||
|
|
||||||
|
Resolves: #1272
|
||||||
|
|
||||||
|
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||||
|
Message-Id: <20221027072726.2681500-1-eesposit@redhat.com>
|
||||||
|
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
||||||
|
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
|
||||||
|
Tested-by: Antoine Damhet <antoine.damhet@shadow.tech>
|
||||||
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
||||||
|
(cherry picked from commit be8da05b5ed8fb546731b9edb997f303f272bad8)
|
||||||
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
---
|
||||||
|
block/block-backend.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/block/block-backend.c b/block/block-backend.c
|
||||||
|
index d4a5df2ac2..1b563e628b 100644
|
||||||
|
--- a/block/block-backend.c
|
||||||
|
+++ b/block/block-backend.c
|
||||||
|
@@ -1946,7 +1946,7 @@ bool blk_enable_write_cache(BlockBackend *blk)
|
||||||
|
|
||||||
|
void blk_set_enable_write_cache(BlockBackend *blk, bool wce)
|
||||||
|
{
|
||||||
|
- GLOBAL_STATE_CODE();
|
||||||
|
+ IO_CODE();
|
||||||
|
blk->enable_write_cache = wce;
|
||||||
|
}
|
||||||
|
|
1191
debian/patches/pve-qemu-7.1-vitastor.patch
vendored
Normal file
1191
debian/patches/pve-qemu-7.1-vitastor.patch
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||||
index dd295cfc6d..3ac5177cbb 100644
|
index 48cd096624..3d60b80286 100644
|
||||||
--- a/block/file-posix.c
|
--- a/block/file-posix.c
|
||||||
+++ b/block/file-posix.c
|
+++ b/block/file-posix.c
|
||||||
@@ -533,7 +533,7 @@ static QemuOptsList raw_runtime_opts = {
|
@@ -553,7 +553,7 @@ static QemuOptsList raw_runtime_opts = {
|
||||||
{
|
{
|
||||||
.name = "locking",
|
.name = "locking",
|
||||||
.type = QEMU_OPT_STRING,
|
.type = QEMU_OPT_STRING,
|
||||||
@@ -26,7 +26,7 @@ index dd295cfc6d..3ac5177cbb 100644
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "pr-manager",
|
.name = "pr-manager",
|
||||||
@@ -631,7 +631,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
|
@@ -653,7 +653,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
|
||||||
s->use_lock = false;
|
s->use_lock = false;
|
||||||
break;
|
break;
|
||||||
case ON_OFF_AUTO_AUTO:
|
case ON_OFF_AUTO_AUTO:
|
||||||
|
@@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/include/net/net.h b/include/net/net.h
|
diff --git a/include/net/net.h b/include/net/net.h
|
||||||
index 5d1508081f..f665924193 100644
|
index 523136c7ac..c27859b4f6 100644
|
||||||
--- a/include/net/net.h
|
--- a/include/net/net.h
|
||||||
+++ b/include/net/net.h
|
+++ b/include/net/net.h
|
||||||
@@ -219,8 +219,8 @@ void netdev_add(QemuOpts *opts, Error **errp);
|
@@ -226,8 +226,8 @@ void netdev_add(QemuOpts *opts, Error **errp);
|
||||||
int net_hub_id_for_client(NetClientState *nc, int *id);
|
int net_hub_id_for_client(NetClientState *nc, int *id);
|
||||||
NetClientState *net_hub_port_find(int hub_id);
|
NetClientState *net_hub_port_find(int hub_id);
|
||||||
|
|
||||||
|
@@ -10,10 +10,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
|
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
|
||||||
index 21b33fbe2e..32514193a9 100644
|
index 82004b65b9..4868db8f94 100644
|
||||||
--- a/target/i386/cpu.h
|
--- a/target/i386/cpu.h
|
||||||
+++ b/target/i386/cpu.h
|
+++ b/target/i386/cpu.h
|
||||||
@@ -2007,9 +2007,9 @@ uint64_t cpu_get_tsc(CPUX86State *env);
|
@@ -2133,9 +2133,9 @@ uint64_t cpu_get_tsc(CPUX86State *env);
|
||||||
#define CPU_RESOLVING_TYPE TYPE_X86_CPU
|
#define CPU_RESOLVING_TYPE TYPE_X86_CPU
|
||||||
|
|
||||||
#ifdef TARGET_X86_64
|
#ifdef TARGET_X86_64
|
||||||
@@ -24,4 +24,4 @@ index 21b33fbe2e..32514193a9 100644
|
|||||||
+#define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("kvm32")
|
+#define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("kvm32")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define cpu_signal_handler cpu_x86_signal_handler
|
#define cpu_list x86_cpu_list
|
||||||
|
@@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 9 insertions(+), 6 deletions(-)
|
1 file changed, 9 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
diff --git a/ui/spice-core.c b/ui/spice-core.c
|
diff --git a/ui/spice-core.c b/ui/spice-core.c
|
||||||
index 0371055e6c..840cf56923 100644
|
index c3ac20ad43..37774f1c0a 100644
|
||||||
--- a/ui/spice-core.c
|
--- a/ui/spice-core.c
|
||||||
+++ b/ui/spice-core.c
|
+++ b/ui/spice-core.c
|
||||||
@@ -694,32 +694,35 @@ static void qemu_spice_init(void)
|
@@ -689,32 +689,35 @@ static void qemu_spice_init(void)
|
||||||
|
|
||||||
if (tls_port) {
|
if (tls_port) {
|
||||||
x509_dir = qemu_opt_get(opts, "x509-dir");
|
x509_dir = qemu_opt_get(opts, "x509-dir");
|
||||||
|
@@ -9,7 +9,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 11 insertions(+), 4 deletions(-)
|
1 file changed, 11 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/gluster.c b/block/gluster.c
|
diff --git a/block/gluster.c b/block/gluster.c
|
||||||
index e8ee14c8e9..3eb6a05500 100644
|
index b60213ab80..93da76bc31 100644
|
||||||
--- a/block/gluster.c
|
--- a/block/gluster.c
|
||||||
+++ b/block/gluster.c
|
+++ b/block/gluster.c
|
||||||
@@ -42,7 +42,7 @@
|
@@ -42,7 +42,7 @@
|
||||||
|
@@ -18,10 +18,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 2 insertions(+)
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
diff --git a/block/rbd.c b/block/rbd.c
|
diff --git a/block/rbd.c b/block/rbd.c
|
||||||
index dcf82b15b8..feeec452f0 100644
|
index f826410f40..64a8d7d48b 100644
|
||||||
--- a/block/rbd.c
|
--- a/block/rbd.c
|
||||||
+++ b/block/rbd.c
|
+++ b/block/rbd.c
|
||||||
@@ -814,6 +814,8 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx,
|
@@ -820,6 +820,8 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx,
|
||||||
rados_conf_set(*cluster, "rbd_cache", "false");
|
rados_conf_set(*cluster, "rbd_cache", "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,10 +11,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
3 files changed, 43 insertions(+)
|
3 files changed, 43 insertions(+)
|
||||||
|
|
||||||
diff --git a/net/net.c b/net/net.c
|
diff --git a/net/net.c b/net/net.c
|
||||||
index 76bbb7c31b..82e0a768b4 100644
|
index 2db160e063..8329347891 100644
|
||||||
--- a/net/net.c
|
--- a/net/net.c
|
||||||
+++ b/net/net.c
|
+++ b/net/net.c
|
||||||
@@ -1314,6 +1314,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict)
|
@@ -1343,6 +1343,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ index 76bbb7c31b..82e0a768b4 100644
|
|||||||
{
|
{
|
||||||
NetClientState *nc;
|
NetClientState *nc;
|
||||||
diff --git a/qapi/net.json b/qapi/net.json
|
diff --git a/qapi/net.json b/qapi/net.json
|
||||||
index 7fab2e7cd8..74c9a6109e 100644
|
index 75ba2cb989..a3c93ab88f 100644
|
||||||
--- a/qapi/net.json
|
--- a/qapi/net.json
|
||||||
+++ b/qapi/net.json
|
+++ b/qapi/net.json
|
||||||
@@ -35,6 +35,21 @@
|
@@ -35,6 +35,21 @@
|
||||||
@@ -75,12 +75,12 @@ index 7fab2e7cd8..74c9a6109e 100644
|
|||||||
# @netdev_add:
|
# @netdev_add:
|
||||||
#
|
#
|
||||||
diff --git a/qapi/pragma.json b/qapi/pragma.json
|
diff --git a/qapi/pragma.json b/qapi/pragma.json
|
||||||
index 3bc0335d1f..7c91ea3685 100644
|
index 7f810b0e97..a2358e303a 100644
|
||||||
--- a/qapi/pragma.json
|
--- a/qapi/pragma.json
|
||||||
+++ b/qapi/pragma.json
|
+++ b/qapi/pragma.json
|
||||||
@@ -22,6 +22,7 @@
|
@@ -26,6 +26,7 @@
|
||||||
'system_reset',
|
|
||||||
'system_wakeup' ],
|
'system_wakeup' ],
|
||||||
|
# Commands allowed to return a non-dictionary
|
||||||
'command-returns-exceptions': [
|
'command-returns-exceptions': [
|
||||||
+ 'get_link_status',
|
+ 'get_link_status',
|
||||||
'human-monitor-command',
|
'human-monitor-command',
|
||||||
|
@@ -16,7 +16,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/block/gluster.c b/block/gluster.c
|
diff --git a/block/gluster.c b/block/gluster.c
|
||||||
index 3eb6a05500..b612918ee8 100644
|
index 93da76bc31..1079b6186b 100644
|
||||||
--- a/block/gluster.c
|
--- a/block/gluster.c
|
||||||
+++ b/block/gluster.c
|
+++ b/block/gluster.c
|
||||||
@@ -57,6 +57,7 @@ typedef struct GlusterAIOCB {
|
@@ -57,6 +57,7 @@ typedef struct GlusterAIOCB {
|
||||||
@@ -39,15 +39,15 @@ index 3eb6a05500..b612918ee8 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
aio_co_schedule(acb->aio_context, acb->coroutine);
|
aio_co_schedule(acb->aio_context, acb->coroutine);
|
||||||
@@ -1021,6 +1024,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs,
|
@@ -1022,6 +1025,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs,
|
||||||
acb.ret = 0;
|
acb.ret = 0;
|
||||||
acb.coroutine = qemu_coroutine_self();
|
acb.coroutine = qemu_coroutine_self();
|
||||||
acb.aio_context = bdrv_get_aio_context(bs);
|
acb.aio_context = bdrv_get_aio_context(bs);
|
||||||
+ acb.is_write = true;
|
+ acb.is_write = true;
|
||||||
|
|
||||||
ret = glfs_zerofill_async(s->fd, offset, size, gluster_finish_aiocb, &acb);
|
ret = glfs_zerofill_async(s->fd, offset, bytes, gluster_finish_aiocb, &acb);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -1202,9 +1206,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs,
|
@@ -1203,9 +1207,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs,
|
||||||
acb.aio_context = bdrv_get_aio_context(bs);
|
acb.aio_context = bdrv_get_aio_context(bs);
|
||||||
|
|
||||||
if (write) {
|
if (write) {
|
||||||
@@ -59,7 +59,7 @@ index 3eb6a05500..b612918ee8 100644
|
|||||||
ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0,
|
ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0,
|
||||||
gluster_finish_aiocb, &acb);
|
gluster_finish_aiocb, &acb);
|
||||||
}
|
}
|
||||||
@@ -1268,6 +1274,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
|
@@ -1269,6 +1275,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
|
||||||
acb.ret = 0;
|
acb.ret = 0;
|
||||||
acb.coroutine = qemu_coroutine_self();
|
acb.coroutine = qemu_coroutine_self();
|
||||||
acb.aio_context = bdrv_get_aio_context(bs);
|
acb.aio_context = bdrv_get_aio_context(bs);
|
||||||
@@ -67,11 +67,11 @@ index 3eb6a05500..b612918ee8 100644
|
|||||||
|
|
||||||
ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb);
|
ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -1314,6 +1321,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs,
|
@@ -1317,6 +1324,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs,
|
||||||
acb.ret = 0;
|
acb.ret = 0;
|
||||||
acb.coroutine = qemu_coroutine_self();
|
acb.coroutine = qemu_coroutine_self();
|
||||||
acb.aio_context = bdrv_get_aio_context(bs);
|
acb.aio_context = bdrv_get_aio_context(bs);
|
||||||
+ acb.is_write = true;
|
+ acb.is_write = true;
|
||||||
|
|
||||||
ret = glfs_discard_async(s->fd, offset, size, gluster_finish_aiocb, &acb);
|
ret = glfs_discard_async(s->fd, offset, bytes, gluster_finish_aiocb, &acb);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@@ -9,10 +9,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/qemu-img.c b/qemu-img.c
|
diff --git a/qemu-img.c b/qemu-img.c
|
||||||
index 908fd0cce5..5dc1d0a2ca 100644
|
index 7d4b33b3da..bb36f42dd2 100644
|
||||||
--- a/qemu-img.c
|
--- a/qemu-img.c
|
||||||
+++ b/qemu-img.c
|
+++ b/qemu-img.c
|
||||||
@@ -2977,7 +2977,8 @@ static int img_info(int argc, char **argv)
|
@@ -3010,7 +3010,8 @@ static int img_info(int argc, char **argv)
|
||||||
list = collect_image_info_list(image_opts, filename, fmt, chain,
|
list = collect_image_info_list(image_opts, filename, fmt, chain,
|
||||||
force_share);
|
force_share);
|
||||||
if (!list) {
|
if (!list) {
|
||||||
|
@@ -31,13 +31,14 @@ override the output file's size.
|
|||||||
|
|
||||||
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
qemu-img-cmds.hx | 4 +-
|
qemu-img-cmds.hx | 4 +-
|
||||||
qemu-img.c | 187 +++++++++++++++++++++++++++++------------------
|
qemu-img.c | 202 ++++++++++++++++++++++++++++++-----------------
|
||||||
2 files changed, 119 insertions(+), 72 deletions(-)
|
2 files changed, 133 insertions(+), 73 deletions(-)
|
||||||
|
|
||||||
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
|
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
|
||||||
index b3620f29e5..e70ef3dc91 100644
|
index 1b1dab5b17..d1616c045a 100644
|
||||||
--- a/qemu-img-cmds.hx
|
--- a/qemu-img-cmds.hx
|
||||||
+++ b/qemu-img-cmds.hx
|
+++ b/qemu-img-cmds.hx
|
||||||
@@ -58,9 +58,9 @@ SRST
|
@@ -58,9 +58,9 @@ SRST
|
||||||
@@ -53,10 +54,10 @@ index b3620f29e5..e70ef3dc91 100644
|
|||||||
|
|
||||||
DEF("info", img_info,
|
DEF("info", img_info,
|
||||||
diff --git a/qemu-img.c b/qemu-img.c
|
diff --git a/qemu-img.c b/qemu-img.c
|
||||||
index 5dc1d0a2ca..f773182bd0 100644
|
index bb36f42dd2..74afcb79ef 100644
|
||||||
--- a/qemu-img.c
|
--- a/qemu-img.c
|
||||||
+++ b/qemu-img.c
|
+++ b/qemu-img.c
|
||||||
@@ -4793,10 +4793,12 @@ static int img_bitmap(int argc, char **argv)
|
@@ -4826,10 +4826,12 @@ static int img_bitmap(int argc, char **argv)
|
||||||
#define C_IF 04
|
#define C_IF 04
|
||||||
#define C_OF 010
|
#define C_OF 010
|
||||||
#define C_SKIP 020
|
#define C_SKIP 020
|
||||||
@@ -69,7 +70,7 @@ index 5dc1d0a2ca..f773182bd0 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct DdIo {
|
struct DdIo {
|
||||||
@@ -4872,6 +4874,19 @@ static int img_dd_skip(const char *arg,
|
@@ -4905,6 +4907,19 @@ static int img_dd_skip(const char *arg,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +90,7 @@ index 5dc1d0a2ca..f773182bd0 100644
|
|||||||
static int img_dd(int argc, char **argv)
|
static int img_dd(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -4912,6 +4927,7 @@ static int img_dd(int argc, char **argv)
|
@@ -4945,6 +4960,7 @@ static int img_dd(int argc, char **argv)
|
||||||
{ "if", img_dd_if, C_IF },
|
{ "if", img_dd_if, C_IF },
|
||||||
{ "of", img_dd_of, C_OF },
|
{ "of", img_dd_of, C_OF },
|
||||||
{ "skip", img_dd_skip, C_SKIP },
|
{ "skip", img_dd_skip, C_SKIP },
|
||||||
@@ -97,7 +98,7 @@ index 5dc1d0a2ca..f773182bd0 100644
|
|||||||
{ NULL, NULL, 0 }
|
{ NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
const struct option long_options[] = {
|
const struct option long_options[] = {
|
||||||
@@ -4987,91 +5003,112 @@ static int img_dd(int argc, char **argv)
|
@@ -5020,91 +5036,112 @@ static int img_dd(int argc, char **argv)
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,11 +135,7 @@ index 5dc1d0a2ca..f773182bd0 100644
|
|||||||
- error_report_err(local_err);
|
- error_report_err(local_err);
|
||||||
- ret = -1;
|
- ret = -1;
|
||||||
- goto out;
|
- goto out;
|
||||||
+ if (!blk1) {
|
- }
|
||||||
+ ret = -1;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
- if (!drv->create_opts) {
|
- if (!drv->create_opts) {
|
||||||
- error_report("Format driver '%s' does not support image creation",
|
- error_report("Format driver '%s' does not support image creation",
|
||||||
- drv->format_name);
|
- drv->format_name);
|
||||||
@@ -150,7 +147,11 @@ index 5dc1d0a2ca..f773182bd0 100644
|
|||||||
- proto_drv->format_name);
|
- proto_drv->format_name);
|
||||||
- ret = -1;
|
- ret = -1;
|
||||||
- goto out;
|
- goto out;
|
||||||
- }
|
+ if (!blk1) {
|
||||||
|
+ ret = -1;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
- create_opts = qemu_opts_append(create_opts, drv->create_opts);
|
- create_opts = qemu_opts_append(create_opts, drv->create_opts);
|
||||||
- create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
|
- create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
|
||||||
-
|
-
|
||||||
@@ -274,41 +275,54 @@ index 5dc1d0a2ca..f773182bd0 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz ||
|
if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz ||
|
||||||
@@ -5089,11 +5126,17 @@ static int img_dd(int argc, char **argv)
|
@@ -5121,20 +5158,43 @@ static int img_dd(int argc, char **argv)
|
||||||
|
in.buf = g_new(uint8_t, in.bsz);
|
||||||
|
|
||||||
for (out_pos = 0; in_pos < size; block_count++) {
|
for (out_pos = 0; in_pos < size; block_count++) {
|
||||||
int in_ret, out_ret;
|
+ int in_ret, out_ret;
|
||||||
|
int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz;
|
||||||
-
|
-
|
||||||
- if (in_pos + in.bsz > size) {
|
- ret = blk_pread(blk1, in_pos, bytes, in.buf, 0);
|
||||||
- in_ret = blk_pread(blk1, in_pos, in.buf, size - in_pos);
|
- if (ret < 0) {
|
||||||
+ size_t in_bsz = in_pos + in.bsz > size ? size - in_pos : in.bsz;
|
|
||||||
+ if (blk1) {
|
+ if (blk1) {
|
||||||
+ in_ret = blk_pread(blk1, in_pos, in.buf, in_bsz);
|
+ in_ret = blk_pread(blk1, in_pos, bytes, in.buf, 0);
|
||||||
} else {
|
+ if (in_ret == 0) {
|
||||||
- in_ret = blk_pread(blk1, in_pos, in.buf, in.bsz);
|
+ in_ret = bytes;
|
||||||
+ in_ret = read(STDIN_FILENO, in.buf, in_bsz);
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ in_ret = read(STDIN_FILENO, in.buf, bytes);
|
||||||
+ if (in_ret == 0) {
|
+ if (in_ret == 0) {
|
||||||
+ /* early EOF is considered an error */
|
+ /* early EOF is considered an error */
|
||||||
+ error_report("Input ended unexpectedly");
|
+ error_report("Input ended unexpectedly");
|
||||||
+ ret = -1;
|
+ ret = -1;
|
||||||
+ goto out;
|
+ goto out;
|
||||||
+ }
|
+ }
|
||||||
}
|
+ }
|
||||||
if (in_ret < 0) {
|
+ if (in_ret < 0) {
|
||||||
error_report("error while reading from input image file: %s",
|
error_report("error while reading from input image file: %s",
|
||||||
@@ -5103,9 +5146,13 @@ static int img_dd(int argc, char **argv)
|
- strerror(-ret));
|
||||||
|
+ strerror(-in_ret));
|
||||||
|
+ ret = -1;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
in_pos += in_ret;
|
in_pos += bytes;
|
||||||
|
|
||||||
- out_ret = blk_pwrite(blk2, out_pos, in.buf, in_ret, 0);
|
- ret = blk_pwrite(blk2, out_pos, bytes, in.buf, 0);
|
||||||
|
- if (ret < 0) {
|
||||||
+ if (blk2) {
|
+ if (blk2) {
|
||||||
+ out_ret = blk_pwrite(blk2, out_pos, in.buf, in_ret, 0);
|
+ out_ret = blk_pwrite(blk2, out_pos, in_ret, in.buf, 0);
|
||||||
|
+ if (out_ret == 0) {
|
||||||
|
+ out_ret = in_ret;
|
||||||
|
+ }
|
||||||
+ } else {
|
+ } else {
|
||||||
+ out_ret = write(STDOUT_FILENO, in.buf, in_ret);
|
+ out_ret = write(STDOUT_FILENO, in.buf, in_ret);
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
- if (out_ret < 0) {
|
|
||||||
+ if (out_ret != in_ret) {
|
+ if (out_ret != in_ret) {
|
||||||
error_report("error while writing to output image file: %s",
|
error_report("error while writing to output image file: %s",
|
||||||
strerror(-out_ret));
|
- strerror(-ret));
|
||||||
ret = -1;
|
+ strerror(-out_ret));
|
||||||
|
+ ret = -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
out_pos += bytes;
|
||||||
|
@@ -10,15 +10,16 @@ an expected end of input.
|
|||||||
|
|
||||||
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
qemu-img.c | 28 +++++++++++++++++++++++++---
|
qemu-img.c | 28 +++++++++++++++++++++++++---
|
||||||
1 file changed, 25 insertions(+), 3 deletions(-)
|
1 file changed, 25 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/qemu-img.c b/qemu-img.c
|
diff --git a/qemu-img.c b/qemu-img.c
|
||||||
index f773182bd0..98a6562364 100644
|
index 74afcb79ef..14594d44b6 100644
|
||||||
--- a/qemu-img.c
|
--- a/qemu-img.c
|
||||||
+++ b/qemu-img.c
|
+++ b/qemu-img.c
|
||||||
@@ -4794,11 +4794,13 @@ static int img_bitmap(int argc, char **argv)
|
@@ -4827,11 +4827,13 @@ static int img_bitmap(int argc, char **argv)
|
||||||
#define C_OF 010
|
#define C_OF 010
|
||||||
#define C_SKIP 020
|
#define C_SKIP 020
|
||||||
#define C_OSIZE 040
|
#define C_OSIZE 040
|
||||||
@@ -32,7 +33,7 @@ index f773182bd0..98a6562364 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct DdIo {
|
struct DdIo {
|
||||||
@@ -4887,6 +4889,19 @@ static int img_dd_osize(const char *arg,
|
@@ -4920,6 +4922,19 @@ static int img_dd_osize(const char *arg,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ index f773182bd0..98a6562364 100644
|
|||||||
static int img_dd(int argc, char **argv)
|
static int img_dd(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -4901,12 +4916,14 @@ static int img_dd(int argc, char **argv)
|
@@ -4934,12 +4949,14 @@ static int img_dd(int argc, char **argv)
|
||||||
int c, i;
|
int c, i;
|
||||||
const char *out_fmt = "raw";
|
const char *out_fmt = "raw";
|
||||||
const char *fmt = NULL;
|
const char *fmt = NULL;
|
||||||
@@ -68,7 +69,7 @@ index f773182bd0..98a6562364 100644
|
|||||||
};
|
};
|
||||||
struct DdIo in = {
|
struct DdIo in = {
|
||||||
.bsz = 512, /* Block size is by default 512 bytes */
|
.bsz = 512, /* Block size is by default 512 bytes */
|
||||||
@@ -4928,6 +4945,7 @@ static int img_dd(int argc, char **argv)
|
@@ -4961,6 +4978,7 @@ static int img_dd(int argc, char **argv)
|
||||||
{ "of", img_dd_of, C_OF },
|
{ "of", img_dd_of, C_OF },
|
||||||
{ "skip", img_dd_skip, C_SKIP },
|
{ "skip", img_dd_skip, C_SKIP },
|
||||||
{ "osize", img_dd_osize, C_OSIZE },
|
{ "osize", img_dd_osize, C_OSIZE },
|
||||||
@@ -76,7 +77,7 @@ index f773182bd0..98a6562364 100644
|
|||||||
{ NULL, NULL, 0 }
|
{ NULL, NULL, 0 }
|
||||||
};
|
};
|
||||||
const struct option long_options[] = {
|
const struct option long_options[] = {
|
||||||
@@ -5124,14 +5142,18 @@ static int img_dd(int argc, char **argv)
|
@@ -5157,9 +5175,10 @@ static int img_dd(int argc, char **argv)
|
||||||
|
|
||||||
in.buf = g_new(uint8_t, in.bsz);
|
in.buf = g_new(uint8_t, in.bsz);
|
||||||
|
|
||||||
@@ -84,12 +85,14 @@ index f773182bd0..98a6562364 100644
|
|||||||
+ readsize = (dd.isize > 0) ? dd.isize : size;
|
+ readsize = (dd.isize > 0) ? dd.isize : size;
|
||||||
+ for (out_pos = 0; in_pos < readsize; block_count++) {
|
+ for (out_pos = 0; in_pos < readsize; block_count++) {
|
||||||
int in_ret, out_ret;
|
int in_ret, out_ret;
|
||||||
- size_t in_bsz = in_pos + in.bsz > size ? size - in_pos : in.bsz;
|
- int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz;
|
||||||
+ size_t in_bsz = in_pos + in.bsz > readsize ? readsize - in_pos : in.bsz;
|
+ int bytes = (in_pos + in.bsz > readsize) ? readsize - in_pos : in.bsz;
|
||||||
if (blk1) {
|
if (blk1) {
|
||||||
in_ret = blk_pread(blk1, in_pos, in.buf, in_bsz);
|
in_ret = blk_pread(blk1, in_pos, bytes, in.buf, 0);
|
||||||
|
if (in_ret == 0) {
|
||||||
|
@@ -5168,6 +5187,9 @@ static int img_dd(int argc, char **argv)
|
||||||
} else {
|
} else {
|
||||||
in_ret = read(STDIN_FILENO, in.buf, in_bsz);
|
in_ret = read(STDIN_FILENO, in.buf, bytes);
|
||||||
if (in_ret == 0) {
|
if (in_ret == 0) {
|
||||||
+ if (dd.isize == 0) {
|
+ if (dd.isize == 0) {
|
||||||
+ goto out;
|
+ goto out;
|
||||||
|
@@ -4,15 +4,71 @@ Date: Mon, 6 Apr 2020 12:16:42 +0200
|
|||||||
Subject: [PATCH] PVE: [Up] qemu-img dd: add -n skip_create
|
Subject: [PATCH] PVE: [Up] qemu-img dd: add -n skip_create
|
||||||
|
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
[FE: fix getopt-string + add documentation]
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
qemu-img.c | 23 ++++++++++++++---------
|
docs/tools/qemu-img.rst | 11 ++++++++++-
|
||||||
1 file changed, 14 insertions(+), 9 deletions(-)
|
qemu-img-cmds.hx | 4 ++--
|
||||||
|
qemu-img.c | 23 ++++++++++++++---------
|
||||||
|
3 files changed, 26 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
|
||||||
|
index 85a6e05b35..699229eef6 100644
|
||||||
|
--- a/docs/tools/qemu-img.rst
|
||||||
|
+++ b/docs/tools/qemu-img.rst
|
||||||
|
@@ -208,6 +208,10 @@ Parameters to convert subcommand:
|
||||||
|
|
||||||
|
Parameters to dd subcommand:
|
||||||
|
|
||||||
|
+.. option:: -n
|
||||||
|
+
|
||||||
|
+ Skip the creation of the target volume
|
||||||
|
+
|
||||||
|
.. program:: qemu-img-dd
|
||||||
|
|
||||||
|
.. option:: bs=BLOCK_SIZE
|
||||||
|
@@ -488,7 +492,7 @@ Command description:
|
||||||
|
it doesn't need to be specified separately in this case.
|
||||||
|
|
||||||
|
|
||||||
|
-.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] if=INPUT of=OUTPUT
|
||||||
|
+.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [-n] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] if=INPUT of=OUTPUT
|
||||||
|
|
||||||
|
dd copies from *INPUT* file to *OUTPUT* file converting it from
|
||||||
|
*FMT* format to *OUTPUT_FMT* format.
|
||||||
|
@@ -499,6 +503,11 @@ Command description:
|
||||||
|
|
||||||
|
The size syntax is similar to :manpage:`dd(1)`'s size syntax.
|
||||||
|
|
||||||
|
+ If the ``-n`` option is specified, the target volume creation will be
|
||||||
|
+ skipped. This is useful for formats such as ``rbd`` if the target
|
||||||
|
+ volume has already been created with site specific options that cannot
|
||||||
|
+ be supplied through ``qemu-img``.
|
||||||
|
+
|
||||||
|
.. option:: info [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [--backing-chain] [-U] FILENAME
|
||||||
|
|
||||||
|
Give information about the disk image *FILENAME*. Use it in
|
||||||
|
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
|
||||||
|
index d1616c045a..b5b0bb4467 100644
|
||||||
|
--- a/qemu-img-cmds.hx
|
||||||
|
+++ b/qemu-img-cmds.hx
|
||||||
|
@@ -58,9 +58,9 @@ SRST
|
||||||
|
ERST
|
||||||
|
|
||||||
|
DEF("dd", img_dd,
|
||||||
|
- "dd [--image-opts] [-U] [-f fmt] [-O output_fmt] [bs=block_size] [count=blocks] [skip=blocks] [osize=output_size] if=input of=output")
|
||||||
|
+ "dd [--image-opts] [-U] [-f fmt] [-O output_fmt] [-n] [bs=block_size] [count=blocks] [skip=blocks] [osize=output_size] if=input of=output")
|
||||||
|
SRST
|
||||||
|
-.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] [osize=OUTPUT_SIZE] if=INPUT of=OUTPUT
|
||||||
|
+.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [-n] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] [osize=OUTPUT_SIZE] if=INPUT of=OUTPUT
|
||||||
|
ERST
|
||||||
|
|
||||||
|
DEF("info", img_info,
|
||||||
diff --git a/qemu-img.c b/qemu-img.c
|
diff --git a/qemu-img.c b/qemu-img.c
|
||||||
index 98a6562364..355b3b82f4 100644
|
index 14594d44b6..c6b4a5567d 100644
|
||||||
--- a/qemu-img.c
|
--- a/qemu-img.c
|
||||||
+++ b/qemu-img.c
|
+++ b/qemu-img.c
|
||||||
@@ -4918,7 +4918,7 @@ static int img_dd(int argc, char **argv)
|
@@ -4951,7 +4951,7 @@ static int img_dd(int argc, char **argv)
|
||||||
const char *fmt = NULL;
|
const char *fmt = NULL;
|
||||||
int64_t size = 0, readsize = 0;
|
int64_t size = 0, readsize = 0;
|
||||||
int64_t block_count = 0, out_pos, in_pos;
|
int64_t block_count = 0, out_pos, in_pos;
|
||||||
@@ -21,16 +77,16 @@ index 98a6562364..355b3b82f4 100644
|
|||||||
struct DdInfo dd = {
|
struct DdInfo dd = {
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.count = 0,
|
.count = 0,
|
||||||
@@ -4956,7 +4956,7 @@ static int img_dd(int argc, char **argv)
|
@@ -4989,7 +4989,7 @@ static int img_dd(int argc, char **argv)
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
- while ((c = getopt_long(argc, argv, ":hf:O:U", long_options, NULL))) {
|
- while ((c = getopt_long(argc, argv, ":hf:O:U", long_options, NULL))) {
|
||||||
+ while ((c = getopt_long(argc, argv, ":hf:O:U:n", long_options, NULL))) {
|
+ while ((c = getopt_long(argc, argv, ":hf:O:Un", long_options, NULL))) {
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -4976,6 +4976,9 @@ static int img_dd(int argc, char **argv)
|
@@ -5009,6 +5009,9 @@ static int img_dd(int argc, char **argv)
|
||||||
case 'h':
|
case 'h':
|
||||||
help();
|
help();
|
||||||
break;
|
break;
|
||||||
@@ -40,7 +96,7 @@ index 98a6562364..355b3b82f4 100644
|
|||||||
case 'U':
|
case 'U':
|
||||||
force_share = true;
|
force_share = true;
|
||||||
break;
|
break;
|
||||||
@@ -5106,13 +5109,15 @@ static int img_dd(int argc, char **argv)
|
@@ -5139,13 +5142,15 @@ static int img_dd(int argc, char **argv)
|
||||||
size - in.bsz * in.offset, &error_abort);
|
size - in.bsz * in.offset, &error_abort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,10 +14,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
3 files changed, 81 insertions(+), 4 deletions(-)
|
3 files changed, 81 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
|
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
|
||||||
index ae7867a8db..956e3f4e46 100644
|
index 73ac5eb675..bbfe7eca62 100644
|
||||||
--- a/hw/virtio/virtio-balloon.c
|
--- a/hw/virtio/virtio-balloon.c
|
||||||
+++ b/hw/virtio/virtio-balloon.c
|
+++ b/hw/virtio/virtio-balloon.c
|
||||||
@@ -820,8 +820,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f,
|
@@ -806,8 +806,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f,
|
||||||
static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
|
static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
|
||||||
{
|
{
|
||||||
VirtIOBalloon *dev = opaque;
|
VirtIOBalloon *dev = opaque;
|
||||||
@@ -58,10 +58,10 @@ index ae7867a8db..956e3f4e46 100644
|
|||||||
|
|
||||||
static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
|
static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
|
||||||
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
||||||
index f4ef58d257..c8b97909e7 100644
|
index c6cd6f91dd..15572befb1 100644
|
||||||
--- a/monitor/hmp-cmds.c
|
--- a/monitor/hmp-cmds.c
|
||||||
+++ b/monitor/hmp-cmds.c
|
+++ b/monitor/hmp-cmds.c
|
||||||
@@ -698,7 +698,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
|
@@ -715,7 +715,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,10 +99,10 @@ index f4ef58d257..c8b97909e7 100644
|
|||||||
qapi_free_BalloonInfo(info);
|
qapi_free_BalloonInfo(info);
|
||||||
}
|
}
|
||||||
diff --git a/qapi/machine.json b/qapi/machine.json
|
diff --git a/qapi/machine.json b/qapi/machine.json
|
||||||
index 157712f006..34035c25d1 100644
|
index 6afd1936b0..8b4be9b718 100644
|
||||||
--- a/qapi/machine.json
|
--- a/qapi/machine.json
|
||||||
+++ b/qapi/machine.json
|
+++ b/qapi/machine.json
|
||||||
@@ -1018,10 +1018,30 @@
|
@@ -1054,9 +1054,29 @@
|
||||||
# @actual: the logical size of the VM in bytes
|
# @actual: the logical size of the VM in bytes
|
||||||
# Formula used: logical_vm_size = vm_ram_size - balloon_size
|
# Formula used: logical_vm_size = vm_ram_size - balloon_size
|
||||||
#
|
#
|
||||||
@@ -123,7 +123,6 @@ index 157712f006..34035c25d1 100644
|
|||||||
+# @max_mem: amount of memory (in bytes) assigned to the guest
|
+# @max_mem: amount of memory (in bytes) assigned to the guest
|
||||||
+#
|
+#
|
||||||
# Since: 0.14
|
# Since: 0.14
|
||||||
#
|
|
||||||
##
|
##
|
||||||
-{ 'struct': 'BalloonInfo', 'data': {'actual': 'int' } }
|
-{ 'struct': 'BalloonInfo', 'data': {'actual': 'int' } }
|
||||||
+{ 'struct': 'BalloonInfo',
|
+{ 'struct': 'BalloonInfo',
|
||||||
|
@@ -13,10 +13,10 @@ Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
|
|||||||
2 files changed, 9 insertions(+), 1 deletion(-)
|
2 files changed, 9 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
|
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
|
||||||
index 216fdfaf3a..8f8d5d5276 100644
|
index 4f4ab30f8c..76fff60a6b 100644
|
||||||
--- a/hw/core/machine-qmp-cmds.c
|
--- a/hw/core/machine-qmp-cmds.c
|
||||||
+++ b/hw/core/machine-qmp-cmds.c
|
+++ b/hw/core/machine-qmp-cmds.c
|
||||||
@@ -98,6 +98,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
|
@@ -99,6 +99,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
|
||||||
info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
|
info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
|
||||||
info->numa_mem_supported = mc->numa_mem_supported;
|
info->numa_mem_supported = mc->numa_mem_supported;
|
||||||
info->deprecated = !!mc->deprecation_reason;
|
info->deprecated = !!mc->deprecation_reason;
|
||||||
@@ -30,10 +30,10 @@ index 216fdfaf3a..8f8d5d5276 100644
|
|||||||
info->default_cpu_type = g_strdup(mc->default_cpu_type);
|
info->default_cpu_type = g_strdup(mc->default_cpu_type);
|
||||||
info->has_default_cpu_type = true;
|
info->has_default_cpu_type = true;
|
||||||
diff --git a/qapi/machine.json b/qapi/machine.json
|
diff --git a/qapi/machine.json b/qapi/machine.json
|
||||||
index 34035c25d1..cf120ac343 100644
|
index 8b4be9b718..555458f785 100644
|
||||||
--- a/qapi/machine.json
|
--- a/qapi/machine.json
|
||||||
+++ b/qapi/machine.json
|
+++ b/qapi/machine.json
|
||||||
@@ -141,6 +141,8 @@
|
@@ -138,6 +138,8 @@
|
||||||
#
|
#
|
||||||
# @is-default: whether the machine is default
|
# @is-default: whether the machine is default
|
||||||
#
|
#
|
||||||
@@ -42,7 +42,7 @@ index 34035c25d1..cf120ac343 100644
|
|||||||
# @cpu-max: maximum number of CPUs supported by the machine type
|
# @cpu-max: maximum number of CPUs supported by the machine type
|
||||||
# (since 1.5)
|
# (since 1.5)
|
||||||
#
|
#
|
||||||
@@ -162,7 +164,7 @@
|
@@ -159,7 +161,7 @@
|
||||||
##
|
##
|
||||||
{ 'struct': 'MachineInfo',
|
{ 'struct': 'MachineInfo',
|
||||||
'data': { 'name': 'str', '*alias': 'str',
|
'data': { 'name': 'str', '*alias': 'str',
|
||||||
|
@@ -12,10 +12,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
2 files changed, 8 insertions(+)
|
2 files changed, 8 insertions(+)
|
||||||
|
|
||||||
diff --git a/qapi/ui.json b/qapi/ui.json
|
diff --git a/qapi/ui.json b/qapi/ui.json
|
||||||
index cba8665b73..081115ea8a 100644
|
index cf58ab4283..0be2388941 100644
|
||||||
--- a/qapi/ui.json
|
--- a/qapi/ui.json
|
||||||
+++ b/qapi/ui.json
|
+++ b/qapi/ui.json
|
||||||
@@ -333,11 +333,14 @@
|
@@ -310,11 +310,14 @@
|
||||||
#
|
#
|
||||||
# @channels: a list of @SpiceChannel for each active spice channel
|
# @channels: a list of @SpiceChannel for each active spice channel
|
||||||
#
|
#
|
||||||
@@ -28,10 +28,10 @@ index cba8665b73..081115ea8a 100644
|
|||||||
'*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str',
|
'*tls-port': 'int', '*auth': 'str', '*compiled-version': 'str',
|
||||||
+ '*ticket': 'str',
|
+ '*ticket': 'str',
|
||||||
'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']},
|
'mouse-mode': 'SpiceQueryMouseMode', '*channels': ['SpiceChannel']},
|
||||||
'if': 'defined(CONFIG_SPICE)' }
|
'if': 'CONFIG_SPICE' }
|
||||||
|
|
||||||
diff --git a/ui/spice-core.c b/ui/spice-core.c
|
diff --git a/ui/spice-core.c b/ui/spice-core.c
|
||||||
index 840cf56923..96be349635 100644
|
index 37774f1c0a..367f77f2b4 100644
|
||||||
--- a/ui/spice-core.c
|
--- a/ui/spice-core.c
|
||||||
+++ b/ui/spice-core.c
|
+++ b/ui/spice-core.c
|
||||||
@@ -534,6 +534,11 @@ static SpiceInfo *qmp_query_spice_real(Error **errp)
|
@@ -534,6 +534,11 @@ static SpiceInfo *qmp_query_spice_real(Error **errp)
|
||||||
|
281
debian/patches/pve/0016-PVE-add-IOChannel-implementation-for-savevm-async.patch
vendored
Normal file
281
debian/patches/pve/0016-PVE-add-IOChannel-implementation-for-savevm-async.patch
vendored
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Thu, 13 Oct 2022 11:33:50 +0200
|
||||||
|
Subject: [PATCH] PVE: add IOChannel implementation for savevm-async
|
||||||
|
|
||||||
|
based on migration/channel-block.c and the implementation that was
|
||||||
|
present in migration/savevm-async.c before QEMU 7.1.
|
||||||
|
|
||||||
|
Passes along read/write requests to the given BlockBackend, while
|
||||||
|
ensuring that a read request going beyond the end results in a
|
||||||
|
graceful short read.
|
||||||
|
|
||||||
|
Additionally, allows tracking the current position from the outside
|
||||||
|
(intended to be used for progress tracking).
|
||||||
|
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
migration/channel-savevm-async.c | 182 +++++++++++++++++++++++++++++++
|
||||||
|
migration/channel-savevm-async.h | 51 +++++++++
|
||||||
|
migration/meson.build | 1 +
|
||||||
|
3 files changed, 234 insertions(+)
|
||||||
|
create mode 100644 migration/channel-savevm-async.c
|
||||||
|
create mode 100644 migration/channel-savevm-async.h
|
||||||
|
|
||||||
|
diff --git a/migration/channel-savevm-async.c b/migration/channel-savevm-async.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..06d5484778
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/migration/channel-savevm-async.c
|
||||||
|
@@ -0,0 +1,182 @@
|
||||||
|
+/*
|
||||||
|
+ * QIO Channel implementation to be used by savevm-async QMP calls
|
||||||
|
+ */
|
||||||
|
+#include "qemu/osdep.h"
|
||||||
|
+#include "migration/channel-savevm-async.h"
|
||||||
|
+#include "qapi/error.h"
|
||||||
|
+#include "sysemu/block-backend.h"
|
||||||
|
+#include "trace.h"
|
||||||
|
+
|
||||||
|
+QIOChannelSavevmAsync *
|
||||||
|
+qio_channel_savevm_async_new(BlockBackend *be, size_t *bs_pos)
|
||||||
|
+{
|
||||||
|
+ QIOChannelSavevmAsync *ioc;
|
||||||
|
+
|
||||||
|
+ ioc = QIO_CHANNEL_SAVEVM_ASYNC(object_new(TYPE_QIO_CHANNEL_SAVEVM_ASYNC));
|
||||||
|
+
|
||||||
|
+ bdrv_ref(blk_bs(be));
|
||||||
|
+ ioc->be = be;
|
||||||
|
+ ioc->bs_pos = bs_pos;
|
||||||
|
+
|
||||||
|
+ return ioc;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+qio_channel_savevm_async_finalize(Object *obj)
|
||||||
|
+{
|
||||||
|
+ QIOChannelSavevmAsync *ioc = QIO_CHANNEL_SAVEVM_ASYNC(obj);
|
||||||
|
+
|
||||||
|
+ if (ioc->be) {
|
||||||
|
+ bdrv_unref(blk_bs(ioc->be));
|
||||||
|
+ ioc->be = NULL;
|
||||||
|
+ }
|
||||||
|
+ ioc->bs_pos = NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static ssize_t
|
||||||
|
+qio_channel_savevm_async_readv(QIOChannel *ioc,
|
||||||
|
+ const struct iovec *iov,
|
||||||
|
+ size_t niov,
|
||||||
|
+ int **fds,
|
||||||
|
+ size_t *nfds,
|
||||||
|
+ Error **errp)
|
||||||
|
+{
|
||||||
|
+ QIOChannelSavevmAsync *saioc = QIO_CHANNEL_SAVEVM_ASYNC(ioc);
|
||||||
|
+ BlockBackend *be = saioc->be;
|
||||||
|
+ int64_t maxlen = blk_getlength(be);
|
||||||
|
+ QEMUIOVector qiov;
|
||||||
|
+ size_t size;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ qemu_iovec_init_external(&qiov, (struct iovec *)iov, niov);
|
||||||
|
+
|
||||||
|
+ if (*saioc->bs_pos >= maxlen) {
|
||||||
|
+ error_setg(errp, "cannot read beyond maxlen");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (maxlen - *saioc->bs_pos < qiov.size) {
|
||||||
|
+ size = maxlen - *saioc->bs_pos;
|
||||||
|
+ } else {
|
||||||
|
+ size = qiov.size;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // returns 0 on success
|
||||||
|
+ ret = blk_preadv(be, *saioc->bs_pos, size, &qiov, 0);
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ error_setg_errno(errp, -ret, "blk_preadv failed");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ *saioc->bs_pos += size;
|
||||||
|
+ return size;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static ssize_t
|
||||||
|
+qio_channel_savevm_async_writev(QIOChannel *ioc,
|
||||||
|
+ const struct iovec *iov,
|
||||||
|
+ size_t niov,
|
||||||
|
+ int *fds,
|
||||||
|
+ size_t nfds,
|
||||||
|
+ int flags,
|
||||||
|
+ Error **errp)
|
||||||
|
+{
|
||||||
|
+ QIOChannelSavevmAsync *saioc = QIO_CHANNEL_SAVEVM_ASYNC(ioc);
|
||||||
|
+ BlockBackend *be = saioc->be;
|
||||||
|
+ QEMUIOVector qiov;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ qemu_iovec_init_external(&qiov, (struct iovec *)iov, niov);
|
||||||
|
+
|
||||||
|
+ if (qemu_in_coroutine()) {
|
||||||
|
+ ret = blk_co_pwritev(be, *saioc->bs_pos, qiov.size, &qiov, 0);
|
||||||
|
+ aio_wait_kick();
|
||||||
|
+ } else {
|
||||||
|
+ ret = blk_pwritev(be, *saioc->bs_pos, qiov.size, &qiov, 0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ error_setg_errno(errp, -ret, "blk(_co)_pwritev failed");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ *saioc->bs_pos += qiov.size;
|
||||||
|
+ return qiov.size;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+qio_channel_savevm_async_set_blocking(QIOChannel *ioc,
|
||||||
|
+ bool enabled,
|
||||||
|
+ Error **errp)
|
||||||
|
+{
|
||||||
|
+ if (!enabled) {
|
||||||
|
+ error_setg(errp, "Non-blocking mode not supported for savevm-async");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+qio_channel_savevm_async_close(QIOChannel *ioc,
|
||||||
|
+ Error **errp)
|
||||||
|
+{
|
||||||
|
+ QIOChannelSavevmAsync *saioc = QIO_CHANNEL_SAVEVM_ASYNC(ioc);
|
||||||
|
+ int rv = bdrv_flush(blk_bs(saioc->be));
|
||||||
|
+
|
||||||
|
+ if (rv < 0) {
|
||||||
|
+ error_setg_errno(errp, -rv, "Unable to flush VMState");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ bdrv_unref(blk_bs(saioc->be));
|
||||||
|
+ saioc->be = NULL;
|
||||||
|
+ saioc->bs_pos = NULL;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+qio_channel_savevm_async_set_aio_fd_handler(QIOChannel *ioc,
|
||||||
|
+ AioContext *ctx,
|
||||||
|
+ IOHandler *io_read,
|
||||||
|
+ IOHandler *io_write,
|
||||||
|
+ void *opaque)
|
||||||
|
+{
|
||||||
|
+ // if channel-block starts doing something, check if this needs adaptation
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+qio_channel_savevm_async_class_init(ObjectClass *klass,
|
||||||
|
+ void *class_data G_GNUC_UNUSED)
|
||||||
|
+{
|
||||||
|
+ QIOChannelClass *ioc_klass = QIO_CHANNEL_CLASS(klass);
|
||||||
|
+
|
||||||
|
+ ioc_klass->io_writev = qio_channel_savevm_async_writev;
|
||||||
|
+ ioc_klass->io_readv = qio_channel_savevm_async_readv;
|
||||||
|
+ ioc_klass->io_set_blocking = qio_channel_savevm_async_set_blocking;
|
||||||
|
+ ioc_klass->io_close = qio_channel_savevm_async_close;
|
||||||
|
+ ioc_klass->io_set_aio_fd_handler = qio_channel_savevm_async_set_aio_fd_handler;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const TypeInfo qio_channel_savevm_async_info = {
|
||||||
|
+ .parent = TYPE_QIO_CHANNEL,
|
||||||
|
+ .name = TYPE_QIO_CHANNEL_SAVEVM_ASYNC,
|
||||||
|
+ .instance_size = sizeof(QIOChannelSavevmAsync),
|
||||||
|
+ .instance_finalize = qio_channel_savevm_async_finalize,
|
||||||
|
+ .class_init = qio_channel_savevm_async_class_init,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+qio_channel_savevm_async_register_types(void)
|
||||||
|
+{
|
||||||
|
+ type_register_static(&qio_channel_savevm_async_info);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+type_init(qio_channel_savevm_async_register_types);
|
||||||
|
diff --git a/migration/channel-savevm-async.h b/migration/channel-savevm-async.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000..17ae2cb261
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/migration/channel-savevm-async.h
|
||||||
|
@@ -0,0 +1,51 @@
|
||||||
|
+/*
|
||||||
|
+ * QEMU I/O channels driver for savevm-async.c
|
||||||
|
+ *
|
||||||
|
+ * Copyright (c) 2022 Proxmox Server Solutions
|
||||||
|
+ *
|
||||||
|
+ * Authors:
|
||||||
|
+ * Fiona Ebner (f.ebner@proxmox.com)
|
||||||
|
+ *
|
||||||
|
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||||
|
+ * See the COPYING file in the top-level directory.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef QIO_CHANNEL_SAVEVM_ASYNC_H
|
||||||
|
+#define QIO_CHANNEL_SAVEVM_ASYNC_H
|
||||||
|
+
|
||||||
|
+#include "io/channel.h"
|
||||||
|
+#include "qom/object.h"
|
||||||
|
+
|
||||||
|
+#define TYPE_QIO_CHANNEL_SAVEVM_ASYNC "qio-channel-savevm-async"
|
||||||
|
+OBJECT_DECLARE_SIMPLE_TYPE(QIOChannelSavevmAsync, QIO_CHANNEL_SAVEVM_ASYNC)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * QIOChannelSavevmAsync:
|
||||||
|
+ *
|
||||||
|
+ * The QIOChannelBlock object provides a channel implementation that is able to
|
||||||
|
+ * perform I/O on any BlockBackend whose BlockDriverState directly contains a
|
||||||
|
+ * VMState (as opposed to indirectly, like qcow2). It allows tracking the
|
||||||
|
+ * current position from the outside.
|
||||||
|
+ */
|
||||||
|
+struct QIOChannelSavevmAsync {
|
||||||
|
+ QIOChannel parent;
|
||||||
|
+ BlockBackend *be;
|
||||||
|
+ size_t *bs_pos;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * qio_channel_savevm_async_new:
|
||||||
|
+ * @be: the block backend
|
||||||
|
+ * @bs_pos: used to keep track of the IOChannels current position
|
||||||
|
+ *
|
||||||
|
+ * Create a new IO channel object that can perform I/O on a BlockBackend object
|
||||||
|
+ * whose BlockDriverState directly contains a VMState.
|
||||||
|
+ *
|
||||||
|
+ * Returns: the new channel object
|
||||||
|
+ */
|
||||||
|
+QIOChannelSavevmAsync *
|
||||||
|
+qio_channel_savevm_async_new(BlockBackend *be, size_t *bs_pos);
|
||||||
|
+
|
||||||
|
+#endif /* QIO_CHANNEL_SAVEVM_ASYNC_H */
|
||||||
|
diff --git a/migration/meson.build b/migration/meson.build
|
||||||
|
index 690487cf1a..8cac83c06c 100644
|
||||||
|
--- a/migration/meson.build
|
||||||
|
+++ b/migration/meson.build
|
||||||
|
@@ -13,6 +13,7 @@ softmmu_ss.add(files(
|
||||||
|
'block-dirty-bitmap.c',
|
||||||
|
'channel.c',
|
||||||
|
'channel-block.c',
|
||||||
|
+ 'channel-savevm-async.c',
|
||||||
|
'colo-failover.c',
|
||||||
|
'colo.c',
|
||||||
|
'exec.c',
|
@@ -23,26 +23,29 @@ Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
|
|||||||
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||||
[improve aborting]
|
[improve aborting]
|
||||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
||||||
|
[FE: further improve aborting
|
||||||
|
adapt to removal of QEMUFileOps]
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
hmp-commands-info.hx | 13 +
|
hmp-commands-info.hx | 13 +
|
||||||
hmp-commands.hx | 33 ++
|
hmp-commands.hx | 33 +++
|
||||||
include/migration/snapshot.h | 2 +
|
include/migration/snapshot.h | 2 +
|
||||||
include/monitor/hmp.h | 5 +
|
include/monitor/hmp.h | 5 +
|
||||||
migration/meson.build | 1 +
|
migration/meson.build | 1 +
|
||||||
migration/savevm-async.c | 598 +++++++++++++++++++++++++++++++++++
|
migration/savevm-async.c | 531 +++++++++++++++++++++++++++++++++++
|
||||||
monitor/hmp-cmds.c | 57 ++++
|
monitor/hmp-cmds.c | 57 ++++
|
||||||
qapi/migration.json | 34 ++
|
qapi/migration.json | 34 +++
|
||||||
qapi/misc.json | 32 ++
|
qapi/misc.json | 32 +++
|
||||||
qemu-options.hx | 12 +
|
qemu-options.hx | 12 +
|
||||||
softmmu/vl.c | 10 +
|
softmmu/vl.c | 10 +
|
||||||
11 files changed, 797 insertions(+)
|
11 files changed, 730 insertions(+)
|
||||||
create mode 100644 migration/savevm-async.c
|
create mode 100644 migration/savevm-async.c
|
||||||
|
|
||||||
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
|
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
|
||||||
index 27206ac049..e6dd3be07a 100644
|
index 188d9ece3b..97b88eaaad 100644
|
||||||
--- a/hmp-commands-info.hx
|
--- a/hmp-commands-info.hx
|
||||||
+++ b/hmp-commands-info.hx
|
+++ b/hmp-commands-info.hx
|
||||||
@@ -551,6 +551,19 @@ SRST
|
@@ -538,6 +538,19 @@ SRST
|
||||||
Show current migration parameters.
|
Show current migration parameters.
|
||||||
ERST
|
ERST
|
||||||
|
|
||||||
@@ -63,12 +66,12 @@ index 27206ac049..e6dd3be07a 100644
|
|||||||
.name = "balloon",
|
.name = "balloon",
|
||||||
.args_type = "",
|
.args_type = "",
|
||||||
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
||||||
index d78e4cfc47..42203dbe92 100644
|
index 182e639d14..bbcc73e942 100644
|
||||||
--- a/hmp-commands.hx
|
--- a/hmp-commands.hx
|
||||||
+++ b/hmp-commands.hx
|
+++ b/hmp-commands.hx
|
||||||
@@ -1744,3 +1744,36 @@ ERST
|
@@ -1800,3 +1800,36 @@ ERST
|
||||||
.help = "start a round of guest dirty rate measurement",
|
"\n\t\t\t\t\t limit on a specified virtual cpu",
|
||||||
.cmd = hmp_calc_dirty_rate,
|
.cmd = hmp_cancel_vcpu_dirty_limit,
|
||||||
},
|
},
|
||||||
+
|
+
|
||||||
+ {
|
+ {
|
||||||
@@ -115,10 +118,10 @@ index e72083b117..c846d37806 100644
|
|||||||
+
|
+
|
||||||
#endif
|
#endif
|
||||||
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
|
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
|
||||||
index 3baa1058e2..1247d7362a 100644
|
index a618eb1e4e..55067beff1 100644
|
||||||
--- a/include/monitor/hmp.h
|
--- a/include/monitor/hmp.h
|
||||||
+++ b/include/monitor/hmp.h
|
+++ b/include/monitor/hmp.h
|
||||||
@@ -25,6 +25,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
|
@@ -26,6 +26,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_info_uuid(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_chardev(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_info_mice(Monitor *mon, const QDict *qdict);
|
void hmp_info_mice(Monitor *mon, const QDict *qdict);
|
||||||
@@ -126,7 +129,7 @@ index 3baa1058e2..1247d7362a 100644
|
|||||||
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
|
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
|
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
|
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
|
||||||
@@ -79,6 +80,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict);
|
@@ -80,6 +81,10 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_netdev_del(Monitor *mon, const QDict *qdict);
|
void hmp_netdev_del(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_getfd(Monitor *mon, const QDict *qdict);
|
void hmp_getfd(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_closefd(Monitor *mon, const QDict *qdict);
|
void hmp_closefd(Monitor *mon, const QDict *qdict);
|
||||||
@@ -138,10 +141,10 @@ index 3baa1058e2..1247d7362a 100644
|
|||||||
void hmp_screendump(Monitor *mon, const QDict *qdict);
|
void hmp_screendump(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
|
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
|
||||||
diff --git a/migration/meson.build b/migration/meson.build
|
diff --git a/migration/meson.build b/migration/meson.build
|
||||||
index f8714dcb15..ea9aedeefc 100644
|
index 8cac83c06c..0842d00cd2 100644
|
||||||
--- a/migration/meson.build
|
--- a/migration/meson.build
|
||||||
+++ b/migration/meson.build
|
+++ b/migration/meson.build
|
||||||
@@ -23,6 +23,7 @@ softmmu_ss.add(files(
|
@@ -24,6 +24,7 @@ softmmu_ss.add(files(
|
||||||
'multifd-zlib.c',
|
'multifd-zlib.c',
|
||||||
'postcopy-ram.c',
|
'postcopy-ram.c',
|
||||||
'savevm.c',
|
'savevm.c',
|
||||||
@@ -151,11 +154,12 @@ index f8714dcb15..ea9aedeefc 100644
|
|||||||
), gnutls)
|
), gnutls)
|
||||||
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
|
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..79a0cda906
|
index 0000000000..05d394c0e2
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/migration/savevm-async.c
|
+++ b/migration/savevm-async.c
|
||||||
@@ -0,0 +1,598 @@
|
@@ -0,0 +1,531 @@
|
||||||
+#include "qemu/osdep.h"
|
+#include "qemu/osdep.h"
|
||||||
|
+#include "migration/channel-savevm-async.h"
|
||||||
+#include "migration/migration.h"
|
+#include "migration/migration.h"
|
||||||
+#include "migration/savevm.h"
|
+#include "migration/savevm.h"
|
||||||
+#include "migration/snapshot.h"
|
+#include "migration/snapshot.h"
|
||||||
@@ -179,9 +183,6 @@ index 0000000000..79a0cda906
|
|||||||
+
|
+
|
||||||
+/* #define DEBUG_SAVEVM_STATE */
|
+/* #define DEBUG_SAVEVM_STATE */
|
||||||
+
|
+
|
||||||
+/* used while emulated sync operation in progress */
|
|
||||||
+#define NOT_DONE -EINPROGRESS
|
|
||||||
+
|
|
||||||
+#ifdef DEBUG_SAVEVM_STATE
|
+#ifdef DEBUG_SAVEVM_STATE
|
||||||
+#define DPRINTF(fmt, ...) \
|
+#define DPRINTF(fmt, ...) \
|
||||||
+ do { printf("savevm-async: " fmt, ## __VA_ARGS__); } while (0)
|
+ do { printf("savevm-async: " fmt, ## __VA_ARGS__); } while (0)
|
||||||
@@ -210,7 +211,7 @@ index 0000000000..79a0cda906
|
|||||||
+ int64_t total_time;
|
+ int64_t total_time;
|
||||||
+ QEMUBH *finalize_bh;
|
+ QEMUBH *finalize_bh;
|
||||||
+ Coroutine *co;
|
+ Coroutine *co;
|
||||||
+ QemuCoSleep *target_close_wait;
|
+ QemuCoSleep target_close_wait;
|
||||||
+} snap_state;
|
+} snap_state;
|
||||||
+
|
+
|
||||||
+static bool savevm_aborted(void)
|
+static bool savevm_aborted(void)
|
||||||
@@ -268,6 +269,7 @@ index 0000000000..79a0cda906
|
|||||||
+
|
+
|
||||||
+ if (snap_state.file) {
|
+ if (snap_state.file) {
|
||||||
+ ret = qemu_fclose(snap_state.file);
|
+ ret = qemu_fclose(snap_state.file);
|
||||||
|
+ snap_state.file = NULL;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (snap_state.target) {
|
+ if (snap_state.target) {
|
||||||
@@ -285,9 +287,7 @@ index 0000000000..79a0cda906
|
|||||||
+ blk_unref(snap_state.target);
|
+ blk_unref(snap_state.target);
|
||||||
+ snap_state.target = NULL;
|
+ snap_state.target = NULL;
|
||||||
+
|
+
|
||||||
+ if (snap_state.target_close_wait) {
|
+ qemu_co_sleep_wake(&snap_state.target_close_wait);
|
||||||
+ qemu_co_sleep_wake(snap_state.target_close_wait);
|
|
||||||
+ }
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return ret;
|
+ return ret;
|
||||||
@@ -313,60 +313,6 @@ index 0000000000..79a0cda906
|
|||||||
+ snap_state.state = SAVE_STATE_ERROR;
|
+ snap_state.state = SAVE_STATE_ERROR;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int block_state_close(void *opaque, Error **errp)
|
|
||||||
+{
|
|
||||||
+ snap_state.file = NULL;
|
|
||||||
+ return blk_flush(snap_state.target);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+typedef struct BlkRwCo {
|
|
||||||
+ int64_t offset;
|
|
||||||
+ QEMUIOVector *qiov;
|
|
||||||
+ ssize_t ret;
|
|
||||||
+} BlkRwCo;
|
|
||||||
+
|
|
||||||
+static void coroutine_fn block_state_write_entry(void *opaque) {
|
|
||||||
+ BlkRwCo *rwco = opaque;
|
|
||||||
+ rwco->ret = blk_co_pwritev(snap_state.target, rwco->offset, rwco->qiov->size,
|
|
||||||
+ rwco->qiov, 0);
|
|
||||||
+ aio_wait_kick();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static ssize_t block_state_writev_buffer(void *opaque, struct iovec *iov,
|
|
||||||
+ int iovcnt, int64_t pos, Error **errp)
|
|
||||||
+{
|
|
||||||
+ QEMUIOVector qiov;
|
|
||||||
+ BlkRwCo rwco;
|
|
||||||
+
|
|
||||||
+ assert(pos == snap_state.bs_pos);
|
|
||||||
+ rwco = (BlkRwCo) {
|
|
||||||
+ .offset = pos,
|
|
||||||
+ .qiov = &qiov,
|
|
||||||
+ .ret = NOT_DONE,
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ qemu_iovec_init_external(&qiov, iov, iovcnt);
|
|
||||||
+
|
|
||||||
+ if (qemu_in_coroutine()) {
|
|
||||||
+ block_state_write_entry(&rwco);
|
|
||||||
+ } else {
|
|
||||||
+ Coroutine *co = qemu_coroutine_create(&block_state_write_entry, &rwco);
|
|
||||||
+ bdrv_coroutine_enter(blk_bs(snap_state.target), co);
|
|
||||||
+ BDRV_POLL_WHILE(blk_bs(snap_state.target), rwco.ret == NOT_DONE);
|
|
||||||
+ }
|
|
||||||
+ if (rwco.ret < 0) {
|
|
||||||
+ return rwco.ret;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ snap_state.bs_pos += qiov.size;
|
|
||||||
+ return qiov.size;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static const QEMUFileOps block_file_ops = {
|
|
||||||
+ .writev_buffer = block_state_writev_buffer,
|
|
||||||
+ .close = block_state_close,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static void process_savevm_finalize(void *opaque)
|
+static void process_savevm_finalize(void *opaque)
|
||||||
+{
|
+{
|
||||||
+ int ret;
|
+ int ret;
|
||||||
@@ -422,8 +368,11 @@ index 0000000000..79a0cda906
|
|||||||
+ } else if (snap_state.state == SAVE_STATE_ACTIVE) {
|
+ } else if (snap_state.state == SAVE_STATE_ACTIVE) {
|
||||||
+ snap_state.state = SAVE_STATE_COMPLETED;
|
+ snap_state.state = SAVE_STATE_COMPLETED;
|
||||||
+ } else if (aborted) {
|
+ } else if (aborted) {
|
||||||
+ save_snapshot_error("process_savevm_cleanup: found aborted state: %d",
|
+ /*
|
||||||
+ snap_state.state);
|
+ * If there was an error, there's no need to set a new one here.
|
||||||
|
+ * If the snapshot was canceled, leave setting the state to
|
||||||
|
+ * qmp_savevm_end(), which is waked by save_snapshot_cleanup().
|
||||||
|
+ */
|
||||||
+ } else {
|
+ } else {
|
||||||
+ save_snapshot_error("process_savevm_cleanup: invalid state: %d",
|
+ save_snapshot_error("process_savevm_cleanup: invalid state: %d",
|
||||||
+ snap_state.state);
|
+ snap_state.state);
|
||||||
@@ -549,6 +498,7 @@ index 0000000000..79a0cda906
|
|||||||
+ snap_state.bs_pos = 0;
|
+ snap_state.bs_pos = 0;
|
||||||
+ snap_state.total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
+ snap_state.total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
|
||||||
+ snap_state.blocker = NULL;
|
+ snap_state.blocker = NULL;
|
||||||
|
+ snap_state.target_close_wait = (QemuCoSleep){ .to_wake = NULL };
|
||||||
+
|
+
|
||||||
+ if (snap_state.error) {
|
+ if (snap_state.error) {
|
||||||
+ error_free(snap_state.error);
|
+ error_free(snap_state.error);
|
||||||
@@ -575,7 +525,9 @@ index 0000000000..79a0cda906
|
|||||||
+ goto restart;
|
+ goto restart;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ snap_state.file = qemu_fopen_ops(&snap_state, &block_file_ops);
|
+ QIOChannel *ioc = QIO_CHANNEL(qio_channel_savevm_async_new(snap_state.target,
|
||||||
|
+ &snap_state.bs_pos));
|
||||||
|
+ snap_state.file = qemu_file_new_output(ioc);
|
||||||
+
|
+
|
||||||
+ if (!snap_state.file) {
|
+ if (!snap_state.file) {
|
||||||
+ error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
|
+ error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
|
||||||
@@ -653,9 +605,8 @@ index 0000000000..79a0cda906
|
|||||||
+ * call exits the statefile will be closed and can be removed immediately */
|
+ * call exits the statefile will be closed and can be removed immediately */
|
||||||
+ DPRINTF("savevm-end: waiting for cleanup\n");
|
+ DPRINTF("savevm-end: waiting for cleanup\n");
|
||||||
+ timeout = 30L * 1000 * 1000 * 1000;
|
+ timeout = 30L * 1000 * 1000 * 1000;
|
||||||
+ qemu_co_sleep_ns_wakeable(snap_state.target_close_wait,
|
+ qemu_co_sleep_ns_wakeable(&snap_state.target_close_wait,
|
||||||
+ QEMU_CLOCK_REALTIME, timeout);
|
+ QEMU_CLOCK_REALTIME, timeout);
|
||||||
+ snap_state.target_close_wait = NULL;
|
|
||||||
+ if (snap_state.target) {
|
+ if (snap_state.target) {
|
||||||
+ save_snapshot_error("timeout waiting for target file close in "
|
+ save_snapshot_error("timeout waiting for target file close in "
|
||||||
+ "qmp_savevm_end");
|
+ "qmp_savevm_end");
|
||||||
@@ -664,6 +615,11 @@ index 0000000000..79a0cda906
|
|||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ // File closed and no other error, so ensure next snapshot can be started.
|
||||||
|
+ if (snap_state.state != SAVE_STATE_ERROR) {
|
||||||
|
+ snap_state.state = SAVE_STATE_DONE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ DPRINTF("savevm-end: cleanup done\n");
|
+ DPRINTF("savevm-end: cleanup done\n");
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
@@ -683,27 +639,6 @@ index 0000000000..79a0cda906
|
|||||||
+ true, name, errp);
|
+ true, name, errp);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static ssize_t loadstate_get_buffer(void *opaque, uint8_t *buf, int64_t pos,
|
|
||||||
+ size_t size, Error **errp)
|
|
||||||
+{
|
|
||||||
+ BlockBackend *be = opaque;
|
|
||||||
+ int64_t maxlen = blk_getlength(be);
|
|
||||||
+ if (pos > maxlen) {
|
|
||||||
+ return -EIO;
|
|
||||||
+ }
|
|
||||||
+ if ((pos + size) > maxlen) {
|
|
||||||
+ size = maxlen - pos - 1;
|
|
||||||
+ }
|
|
||||||
+ if (size == 0) {
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ return blk_pread(be, pos, buf, size);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static const QEMUFileOps loadstate_file_ops = {
|
|
||||||
+ .get_buffer = loadstate_get_buffer,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+int load_snapshot_from_blockdev(const char *filename, Error **errp)
|
+int load_snapshot_from_blockdev(const char *filename, Error **errp)
|
||||||
+{
|
+{
|
||||||
+ BlockBackend *be;
|
+ BlockBackend *be;
|
||||||
@@ -711,6 +646,7 @@ index 0000000000..79a0cda906
|
|||||||
+ Error *blocker = NULL;
|
+ Error *blocker = NULL;
|
||||||
+
|
+
|
||||||
+ QEMUFile *f;
|
+ QEMUFile *f;
|
||||||
|
+ size_t bs_pos = 0;
|
||||||
+ int ret = -EINVAL;
|
+ int ret = -EINVAL;
|
||||||
+
|
+
|
||||||
+ be = blk_new_open(filename, NULL, NULL, 0, &local_err);
|
+ be = blk_new_open(filename, NULL, NULL, 0, &local_err);
|
||||||
@@ -724,7 +660,7 @@ index 0000000000..79a0cda906
|
|||||||
+ blk_op_block_all(be, blocker);
|
+ blk_op_block_all(be, blocker);
|
||||||
+
|
+
|
||||||
+ /* restore the VM state */
|
+ /* restore the VM state */
|
||||||
+ f = qemu_fopen_ops(be, &loadstate_file_ops);
|
+ f = qemu_file_new_input(QIO_CHANNEL(qio_channel_savevm_async_new(be, &bs_pos)));
|
||||||
+ if (!f) {
|
+ if (!f) {
|
||||||
+ error_setg(errp, "Could not open VM state file");
|
+ error_setg(errp, "Could not open VM state file");
|
||||||
+ goto the_end;
|
+ goto the_end;
|
||||||
@@ -754,10 +690,10 @@ index 0000000000..79a0cda906
|
|||||||
+ return ret;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
||||||
index c8b97909e7..64a84cf4ee 100644
|
index 15572befb1..1507180990 100644
|
||||||
--- a/monitor/hmp-cmds.c
|
--- a/monitor/hmp-cmds.c
|
||||||
+++ b/monitor/hmp-cmds.c
|
+++ b/monitor/hmp-cmds.c
|
||||||
@@ -1961,6 +1961,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
|
@@ -1925,6 +1925,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
|
||||||
hmp_handle_error(mon, err);
|
hmp_handle_error(mon, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -822,10 +758,10 @@ index c8b97909e7..64a84cf4ee 100644
|
|||||||
{
|
{
|
||||||
IOThreadInfoList *info_list = qmp_query_iothreads(NULL);
|
IOThreadInfoList *info_list = qmp_query_iothreads(NULL);
|
||||||
diff --git a/qapi/migration.json b/qapi/migration.json
|
diff --git a/qapi/migration.json b/qapi/migration.json
|
||||||
index 1124a2dda8..3d72b3e3f3 100644
|
index 81185d4311..3129f71fa8 100644
|
||||||
--- a/qapi/migration.json
|
--- a/qapi/migration.json
|
||||||
+++ b/qapi/migration.json
|
+++ b/qapi/migration.json
|
||||||
@@ -247,6 +247,40 @@
|
@@ -261,6 +261,40 @@
|
||||||
'*compression': 'CompressionStats',
|
'*compression': 'CompressionStats',
|
||||||
'*socket-address': ['SocketAddress'] } }
|
'*socket-address': ['SocketAddress'] } }
|
||||||
|
|
||||||
@@ -867,10 +803,10 @@ index 1124a2dda8..3d72b3e3f3 100644
|
|||||||
# @query-migrate:
|
# @query-migrate:
|
||||||
#
|
#
|
||||||
diff --git a/qapi/misc.json b/qapi/misc.json
|
diff --git a/qapi/misc.json b/qapi/misc.json
|
||||||
index 5c2ca3b556..9bc14e1032 100644
|
index 27ef5a2b20..b3ce75dcae 100644
|
||||||
--- a/qapi/misc.json
|
--- a/qapi/misc.json
|
||||||
+++ b/qapi/misc.json
|
+++ b/qapi/misc.json
|
||||||
@@ -431,6 +431,38 @@
|
@@ -435,6 +435,38 @@
|
||||||
##
|
##
|
||||||
{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
|
{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
|
||||||
|
|
||||||
@@ -910,10 +846,10 @@ index 5c2ca3b556..9bc14e1032 100644
|
|||||||
# @CommandLineParameterType:
|
# @CommandLineParameterType:
|
||||||
#
|
#
|
||||||
diff --git a/qemu-options.hx b/qemu-options.hx
|
diff --git a/qemu-options.hx b/qemu-options.hx
|
||||||
index 83aa59a920..002ba697e9 100644
|
index 31c04f7eea..c2ca6e91b5 100644
|
||||||
--- a/qemu-options.hx
|
--- a/qemu-options.hx
|
||||||
+++ b/qemu-options.hx
|
+++ b/qemu-options.hx
|
||||||
@@ -4131,6 +4131,18 @@ SRST
|
@@ -4341,6 +4341,18 @@ SRST
|
||||||
Start right away with a saved state (``loadvm`` in monitor)
|
Start right away with a saved state (``loadvm`` in monitor)
|
||||||
ERST
|
ERST
|
||||||
|
|
||||||
@@ -933,21 +869,21 @@ index 83aa59a920..002ba697e9 100644
|
|||||||
DEF("daemonize", 0, QEMU_OPTION_daemonize, \
|
DEF("daemonize", 0, QEMU_OPTION_daemonize, \
|
||||||
"-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
|
"-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
|
||||||
diff --git a/softmmu/vl.c b/softmmu/vl.c
|
diff --git a/softmmu/vl.c b/softmmu/vl.c
|
||||||
index 5ca11e7469..220c67cd32 100644
|
index 706bd7cff7..b8637c4262 100644
|
||||||
--- a/softmmu/vl.c
|
--- a/softmmu/vl.c
|
||||||
+++ b/softmmu/vl.c
|
+++ b/softmmu/vl.c
|
||||||
@@ -150,6 +150,7 @@ static const char *incoming;
|
@@ -165,6 +165,7 @@ static const char *accelerators;
|
||||||
static const char *loadvm;
|
static bool have_custom_ram_size;
|
||||||
static const char *accelerators;
|
static const char *ram_memdev_id;
|
||||||
static QDict *machine_opts_dict;
|
static QDict *machine_opts_dict;
|
||||||
+static const char *loadstate;
|
+static const char *loadstate;
|
||||||
static QTAILQ_HEAD(, ObjectOption) object_opts = QTAILQ_HEAD_INITIALIZER(object_opts);
|
static QTAILQ_HEAD(, ObjectOption) object_opts = QTAILQ_HEAD_INITIALIZER(object_opts);
|
||||||
static ram_addr_t maxram_size;
|
static QTAILQ_HEAD(, DeviceOption) device_opts = QTAILQ_HEAD_INITIALIZER(device_opts);
|
||||||
static uint64_t ram_slots;
|
static int display_remote;
|
||||||
@@ -2700,6 +2701,12 @@ void qmp_x_exit_preconfig(Error **errp)
|
@@ -2584,6 +2585,12 @@ void qmp_x_exit_preconfig(Error **errp)
|
||||||
autostart = 0;
|
|
||||||
exit(1);
|
if (loadvm) {
|
||||||
}
|
load_snapshot(loadvm, NULL, false, NULL, &error_fatal);
|
||||||
+ } else if (loadstate) {
|
+ } else if (loadstate) {
|
||||||
+ Error *local_err = NULL;
|
+ Error *local_err = NULL;
|
||||||
+ if (load_snapshot_from_blockdev(loadstate, &local_err) < 0) {
|
+ if (load_snapshot_from_blockdev(loadstate, &local_err) < 0) {
|
||||||
@@ -957,7 +893,7 @@ index 5ca11e7469..220c67cd32 100644
|
|||||||
}
|
}
|
||||||
if (replay_mode != REPLAY_MODE_NONE) {
|
if (replay_mode != REPLAY_MODE_NONE) {
|
||||||
replay_vmstate_init();
|
replay_vmstate_init();
|
||||||
@@ -3238,6 +3245,9 @@ void qemu_init(int argc, char **argv, char **envp)
|
@@ -3133,6 +3140,9 @@ void qemu_init(int argc, char **argv, char **envp)
|
||||||
case QEMU_OPTION_loadvm:
|
case QEMU_OPTION_loadvm:
|
||||||
loadvm = optarg;
|
loadvm = optarg;
|
||||||
break;
|
break;
|
@@ -10,17 +10,19 @@ Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
|||||||
[increase max IOV count in QEMUFile to actually write more data]
|
[increase max IOV count in QEMUFile to actually write more data]
|
||||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
[FE: adapt to removal of QEMUFileOps]
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
migration/qemu-file.c | 38 +++++++++++++++++++++++++-------------
|
migration/qemu-file.c | 49 +++++++++++++++++++++++++++-------------
|
||||||
migration/qemu-file.h | 1 +
|
migration/qemu-file.h | 2 ++
|
||||||
migration/savevm-async.c | 4 ++--
|
migration/savevm-async.c | 5 ++--
|
||||||
3 files changed, 28 insertions(+), 15 deletions(-)
|
3 files changed, 38 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
|
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
|
||||||
index 6338d8e2ff..6697a93a7e 100644
|
index 4f400c2e52..21e8998867 100644
|
||||||
--- a/migration/qemu-file.c
|
--- a/migration/qemu-file.c
|
||||||
+++ b/migration/qemu-file.c
|
+++ b/migration/qemu-file.c
|
||||||
@@ -30,8 +30,8 @@
|
@@ -31,8 +31,8 @@
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
|
|
||||||
@@ -30,9 +32,9 @@ index 6338d8e2ff..6697a93a7e 100644
|
|||||||
+#define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 256)
|
+#define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 256)
|
||||||
|
|
||||||
struct QEMUFile {
|
struct QEMUFile {
|
||||||
const QEMUFileOps *ops;
|
const QEMUFileHooks *hooks;
|
||||||
@@ -45,7 +45,8 @@ struct QEMUFile {
|
@@ -55,7 +55,8 @@ struct QEMUFile {
|
||||||
when reading */
|
|
||||||
int buf_index;
|
int buf_index;
|
||||||
int buf_size; /* 0 when writing */
|
int buf_size; /* 0 when writing */
|
||||||
- uint8_t buf[IO_BUF_SIZE];
|
- uint8_t buf[IO_BUF_SIZE];
|
||||||
@@ -41,53 +43,76 @@ index 6338d8e2ff..6697a93a7e 100644
|
|||||||
|
|
||||||
DECLARE_BITMAP(may_free, MAX_IOV_SIZE);
|
DECLARE_BITMAP(may_free, MAX_IOV_SIZE);
|
||||||
struct iovec iov[MAX_IOV_SIZE];
|
struct iovec iov[MAX_IOV_SIZE];
|
||||||
@@ -103,7 +104,7 @@ bool qemu_file_mode_is_not_valid(const char *mode)
|
@@ -106,7 +107,9 @@ bool qemu_file_mode_is_not_valid(const char *mode)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
-QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops, bool has_ioc)
|
-static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, bool is_writable)
|
||||||
+QEMUFile *qemu_fopen_ops_sized(void *opaque, const QEMUFileOps *ops, bool has_ioc, size_t buffer_size)
|
+static QEMUFile *qemu_file_new_impl(QIOChannel *ioc,
|
||||||
|
+ bool is_writable,
|
||||||
|
+ size_t buffer_size)
|
||||||
{
|
{
|
||||||
QEMUFile *f;
|
QEMUFile *f;
|
||||||
|
|
||||||
@@ -112,9 +113,17 @@ QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops, bool has_ioc)
|
@@ -115,6 +118,8 @@ static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, bool is_writable)
|
||||||
f->opaque = opaque;
|
object_ref(ioc);
|
||||||
f->ops = ops;
|
f->ioc = ioc;
|
||||||
f->has_ioc = has_ioc;
|
f->is_writable = is_writable;
|
||||||
+ f->buf_allocated_size = buffer_size;
|
+ f->buf_allocated_size = buffer_size;
|
||||||
+ f->buf = malloc(buffer_size);
|
+ f->buf = malloc(buffer_size);
|
||||||
+
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
@@ -125,17 +130,27 @@ static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, bool is_writable)
|
||||||
|
*/
|
||||||
|
QEMUFile *qemu_file_get_return_path(QEMUFile *f)
|
||||||
|
{
|
||||||
|
- return qemu_file_new_impl(f->ioc, !f->is_writable);
|
||||||
|
+ return qemu_file_new_impl(f->ioc, !f->is_writable, DEFAULT_IO_BUF_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
+QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops, bool has_ioc)
|
QEMUFile *qemu_file_new_output(QIOChannel *ioc)
|
||||||
+{
|
{
|
||||||
+ return qemu_fopen_ops_sized(opaque, ops, has_ioc, DEFAULT_IO_BUF_SIZE);
|
- return qemu_file_new_impl(ioc, true);
|
||||||
|
+ return qemu_file_new_impl(ioc, true, DEFAULT_IO_BUF_SIZE);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
|
+QEMUFile *qemu_file_new_output_sized(QIOChannel *ioc, size_t buffer_size)
|
||||||
|
+{
|
||||||
|
+ return qemu_file_new_impl(ioc, true, buffer_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
QEMUFile *qemu_file_new_input(QIOChannel *ioc)
|
||||||
|
{
|
||||||
|
- return qemu_file_new_impl(ioc, false);
|
||||||
|
+ return qemu_file_new_impl(ioc, false, DEFAULT_IO_BUF_SIZE);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+QEMUFile *qemu_file_new_input_sized(QIOChannel *ioc, size_t buffer_size)
|
||||||
|
+{
|
||||||
|
+ return qemu_file_new_impl(ioc, false, buffer_size);
|
||||||
|
}
|
||||||
|
|
||||||
void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks)
|
void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks)
|
||||||
{
|
@@ -393,7 +408,7 @@ static ssize_t qemu_fill_buffer(QEMUFile *f)
|
||||||
@@ -349,7 +358,7 @@ static ssize_t qemu_fill_buffer(QEMUFile *f)
|
do {
|
||||||
|
len = qio_channel_read(f->ioc,
|
||||||
|
(char *)f->buf + pending,
|
||||||
|
- IO_BUF_SIZE - pending,
|
||||||
|
+ f->buf_allocated_size - pending,
|
||||||
|
&local_error);
|
||||||
|
if (len == QIO_CHANNEL_ERR_BLOCK) {
|
||||||
|
if (qemu_in_coroutine()) {
|
||||||
|
@@ -443,6 +458,8 @@ int qemu_fclose(QEMUFile *f)
|
||||||
}
|
}
|
||||||
|
g_clear_pointer(&f->ioc, object_unref);
|
||||||
|
|
||||||
len = f->ops->get_buffer(f->opaque, f->buf + pending, f->pos,
|
|
||||||
- IO_BUF_SIZE - pending, &local_error);
|
|
||||||
+ f->buf_allocated_size - pending, &local_error);
|
|
||||||
if (len > 0) {
|
|
||||||
f->buf_size += len;
|
|
||||||
f->pos += len;
|
|
||||||
@@ -389,6 +398,9 @@ int qemu_fclose(QEMUFile *f)
|
|
||||||
ret = ret2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ free(f->buf);
|
+ free(f->buf);
|
||||||
+
|
+
|
||||||
/* If any error was spotted before closing, we should report it
|
/* If any error was spotted before closing, we should report it
|
||||||
* instead of the close() return value.
|
* instead of the close() return value.
|
||||||
*/
|
*/
|
||||||
@@ -443,7 +455,7 @@ static void add_buf_to_iovec(QEMUFile *f, size_t len)
|
@@ -497,7 +514,7 @@ static void add_buf_to_iovec(QEMUFile *f, size_t len)
|
||||||
{
|
{
|
||||||
if (!add_to_iovec(f, f->buf + f->buf_index, len, false)) {
|
if (!add_to_iovec(f, f->buf + f->buf_index, len, false)) {
|
||||||
f->buf_index += len;
|
f->buf_index += len;
|
||||||
@@ -96,7 +121,7 @@ index 6338d8e2ff..6697a93a7e 100644
|
|||||||
qemu_fflush(f);
|
qemu_fflush(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -469,7 +481,7 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size)
|
@@ -523,7 +540,7 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
@@ -105,7 +130,7 @@ index 6338d8e2ff..6697a93a7e 100644
|
|||||||
if (l > size) {
|
if (l > size) {
|
||||||
l = size;
|
l = size;
|
||||||
}
|
}
|
||||||
@@ -516,8 +528,8 @@ size_t qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset)
|
@@ -570,8 +587,8 @@ size_t qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset)
|
||||||
size_t index;
|
size_t index;
|
||||||
|
|
||||||
assert(!qemu_file_is_writable(f));
|
assert(!qemu_file_is_writable(f));
|
||||||
@@ -116,7 +141,7 @@ index 6338d8e2ff..6697a93a7e 100644
|
|||||||
|
|
||||||
/* The 1st byte to read from */
|
/* The 1st byte to read from */
|
||||||
index = f->buf_index + offset;
|
index = f->buf_index + offset;
|
||||||
@@ -567,7 +579,7 @@ size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size)
|
@@ -621,7 +638,7 @@ size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size)
|
||||||
size_t res;
|
size_t res;
|
||||||
uint8_t *src;
|
uint8_t *src;
|
||||||
|
|
||||||
@@ -125,7 +150,7 @@ index 6338d8e2ff..6697a93a7e 100644
|
|||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
@@ -601,7 +613,7 @@ size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size)
|
@@ -655,7 +672,7 @@ size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size)
|
||||||
*/
|
*/
|
||||||
size_t qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size)
|
size_t qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size)
|
||||||
{
|
{
|
||||||
@@ -134,7 +159,7 @@ index 6338d8e2ff..6697a93a7e 100644
|
|||||||
size_t res;
|
size_t res;
|
||||||
uint8_t *src = NULL;
|
uint8_t *src = NULL;
|
||||||
|
|
||||||
@@ -626,7 +638,7 @@ int qemu_peek_byte(QEMUFile *f, int offset)
|
@@ -680,7 +697,7 @@ int qemu_peek_byte(QEMUFile *f, int offset)
|
||||||
int index = f->buf_index + offset;
|
int index = f->buf_index + offset;
|
||||||
|
|
||||||
assert(!qemu_file_is_writable(f));
|
assert(!qemu_file_is_writable(f));
|
||||||
@@ -143,7 +168,7 @@ index 6338d8e2ff..6697a93a7e 100644
|
|||||||
|
|
||||||
if (index >= f->buf_size) {
|
if (index >= f->buf_size) {
|
||||||
qemu_fill_buffer(f);
|
qemu_fill_buffer(f);
|
||||||
@@ -778,7 +790,7 @@ static int qemu_compress_data(z_stream *stream, uint8_t *dest, size_t dest_len,
|
@@ -832,7 +849,7 @@ static int qemu_compress_data(z_stream *stream, uint8_t *dest, size_t dest_len,
|
||||||
ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream,
|
ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream,
|
||||||
const uint8_t *p, size_t size)
|
const uint8_t *p, size_t size)
|
||||||
{
|
{
|
||||||
@@ -153,36 +178,39 @@ index 6338d8e2ff..6697a93a7e 100644
|
|||||||
if (blen < compressBound(size)) {
|
if (blen < compressBound(size)) {
|
||||||
return -1;
|
return -1;
|
||||||
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
|
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
|
||||||
index 3f36d4dc8c..67501fd9cf 100644
|
index fa13d04d78..914f1a63a8 100644
|
||||||
--- a/migration/qemu-file.h
|
--- a/migration/qemu-file.h
|
||||||
+++ b/migration/qemu-file.h
|
+++ b/migration/qemu-file.h
|
||||||
@@ -121,6 +121,7 @@ typedef struct QEMUFileHooks {
|
@@ -63,7 +63,9 @@ typedef struct QEMUFileHooks {
|
||||||
} QEMUFileHooks;
|
} QEMUFileHooks;
|
||||||
|
|
||||||
QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops, bool has_ioc);
|
QEMUFile *qemu_file_new_input(QIOChannel *ioc);
|
||||||
+QEMUFile *qemu_fopen_ops_sized(void *opaque, const QEMUFileOps *ops, bool has_ioc, size_t buffer_size);
|
+QEMUFile *qemu_file_new_input_sized(QIOChannel *ioc, size_t buffer_size);
|
||||||
|
QEMUFile *qemu_file_new_output(QIOChannel *ioc);
|
||||||
|
+QEMUFile *qemu_file_new_output_sized(QIOChannel *ioc, size_t buffer_size);
|
||||||
void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks);
|
void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks);
|
||||||
int qemu_get_fd(QEMUFile *f);
|
|
||||||
int qemu_fclose(QEMUFile *f);
|
int qemu_fclose(QEMUFile *f);
|
||||||
|
|
||||||
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
|
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
|
||||||
index 79a0cda906..970ee3b3fc 100644
|
index b3692739a0..e65a5e3482 100644
|
||||||
--- a/migration/savevm-async.c
|
--- a/migration/savevm-async.c
|
||||||
+++ b/migration/savevm-async.c
|
+++ b/migration/savevm-async.c
|
||||||
@@ -418,7 +418,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
|
@@ -367,7 +367,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
|
||||||
goto restart;
|
|
||||||
}
|
|
||||||
|
|
||||||
- snap_state.file = qemu_fopen_ops(&snap_state, &block_file_ops);
|
QIOChannel *ioc = QIO_CHANNEL(qio_channel_savevm_async_new(snap_state.target,
|
||||||
+ snap_state.file = qemu_fopen_ops_sized(&snap_state, &block_file_ops, false, 4 * 1024 * 1024);
|
&snap_state.bs_pos));
|
||||||
|
- snap_state.file = qemu_file_new_output(ioc);
|
||||||
|
+ snap_state.file = qemu_file_new_output_sized(ioc, 4 * 1024 * 1024);
|
||||||
|
|
||||||
if (!snap_state.file) {
|
if (!snap_state.file) {
|
||||||
error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
|
error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
|
||||||
@@ -567,7 +567,7 @@ int load_snapshot_from_blockdev(const char *filename, Error **errp)
|
@@ -500,7 +500,8 @@ int load_snapshot_from_blockdev(const char *filename, Error **errp)
|
||||||
blk_op_block_all(be, blocker);
|
blk_op_block_all(be, blocker);
|
||||||
|
|
||||||
/* restore the VM state */
|
/* restore the VM state */
|
||||||
- f = qemu_fopen_ops(be, &loadstate_file_ops);
|
- f = qemu_file_new_input(QIO_CHANNEL(qio_channel_savevm_async_new(be, &bs_pos)));
|
||||||
+ f = qemu_fopen_ops_sized(be, &loadstate_file_ops, false, 4 * 1024 * 1024);
|
+ f = qemu_file_new_input_sized(QIO_CHANNEL(qio_channel_savevm_async_new(be, &bs_pos)),
|
||||||
|
+ 4 * 1024 * 1024);
|
||||||
if (!f) {
|
if (!f) {
|
||||||
error_setg(errp, "Could not open VM state file");
|
error_setg(errp, "Could not open VM state file");
|
||||||
goto the_end;
|
goto the_end;
|
@@ -4,6 +4,8 @@ Date: Mon, 6 Apr 2020 12:16:47 +0200
|
|||||||
Subject: [PATCH] PVE: block: add the zeroinit block driver filter
|
Subject: [PATCH] PVE: block: add the zeroinit block driver filter
|
||||||
|
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
[adapt to changed function signatures]
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
block/meson.build | 1 +
|
block/meson.build | 1 +
|
||||||
block/zeroinit.c | 196 ++++++++++++++++++++++++++++++++++++++++++++++
|
block/zeroinit.c | 196 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@@ -11,10 +13,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
create mode 100644 block/zeroinit.c
|
create mode 100644 block/zeroinit.c
|
||||||
|
|
||||||
diff --git a/block/meson.build b/block/meson.build
|
diff --git a/block/meson.build b/block/meson.build
|
||||||
index 0450914c7a..7a0bc3df09 100644
|
index 60bc305597..ad40c10b6a 100644
|
||||||
--- a/block/meson.build
|
--- a/block/meson.build
|
||||||
+++ b/block/meson.build
|
+++ b/block/meson.build
|
||||||
@@ -41,6 +41,7 @@ block_ss.add(files(
|
@@ -43,6 +43,7 @@ block_ss.add(files(
|
||||||
'vmdk.c',
|
'vmdk.c',
|
||||||
'vpc.c',
|
'vpc.c',
|
||||||
'write-threshold.c',
|
'write-threshold.c',
|
||||||
@@ -24,7 +26,7 @@ index 0450914c7a..7a0bc3df09 100644
|
|||||||
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
|
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
|
||||||
diff --git a/block/zeroinit.c b/block/zeroinit.c
|
diff --git a/block/zeroinit.c b/block/zeroinit.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..5529627f7e
|
index 0000000000..20ee611f22
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/block/zeroinit.c
|
+++ b/block/zeroinit.c
|
||||||
@@ -0,0 +1,196 @@
|
@@ -0,0 +1,196 @@
|
||||||
@@ -138,22 +140,22 @@ index 0000000000..5529627f7e
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int coroutine_fn zeroinit_co_preadv(BlockDriverState *bs,
|
+static int coroutine_fn zeroinit_co_preadv(BlockDriverState *bs,
|
||||||
+ uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)
|
+ int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||||
+{
|
+{
|
||||||
+ return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags);
|
+ return bdrv_co_preadv(bs->file, offset, bytes, qiov, flags);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int coroutine_fn zeroinit_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset,
|
+static int coroutine_fn zeroinit_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset,
|
||||||
+ int count, BdrvRequestFlags flags)
|
+ int64_t bytes, BdrvRequestFlags flags)
|
||||||
+{
|
+{
|
||||||
+ BDRVZeroinitState *s = bs->opaque;
|
+ BDRVZeroinitState *s = bs->opaque;
|
||||||
+ if (offset >= s->extents)
|
+ if (offset >= s->extents)
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+ return bdrv_pwrite_zeroes(bs->file, offset, count, flags);
|
+ return bdrv_pwrite_zeroes(bs->file, offset, bytes, flags);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int coroutine_fn zeroinit_co_pwritev(BlockDriverState *bs,
|
+static int coroutine_fn zeroinit_co_pwritev(BlockDriverState *bs,
|
||||||
+ uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)
|
+ int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||||
+{
|
+{
|
||||||
+ BDRVZeroinitState *s = bs->opaque;
|
+ BDRVZeroinitState *s = bs->opaque;
|
||||||
+ int64_t extents = offset + bytes;
|
+ int64_t extents = offset + bytes;
|
||||||
@@ -174,9 +176,9 @@ index 0000000000..5529627f7e
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int coroutine_fn zeroinit_co_pdiscard(BlockDriverState *bs,
|
+static int coroutine_fn zeroinit_co_pdiscard(BlockDriverState *bs,
|
||||||
+ int64_t offset, int count)
|
+ int64_t offset, int64_t bytes)
|
||||||
+{
|
+{
|
||||||
+ return bdrv_co_pdiscard(bs->file, offset, count);
|
+ return bdrv_co_pdiscard(bs->file, offset, bytes);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int zeroinit_co_truncate(BlockDriverState *bs, int64_t offset,
|
+static int zeroinit_co_truncate(BlockDriverState *bs, int64_t offset,
|
@@ -14,12 +14,12 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
2 files changed, 11 insertions(+)
|
2 files changed, 11 insertions(+)
|
||||||
|
|
||||||
diff --git a/qemu-options.hx b/qemu-options.hx
|
diff --git a/qemu-options.hx b/qemu-options.hx
|
||||||
index 002ba697e9..a05959b9f1 100644
|
index c2ca6e91b5..ab4734ef32 100644
|
||||||
--- a/qemu-options.hx
|
--- a/qemu-options.hx
|
||||||
+++ b/qemu-options.hx
|
+++ b/qemu-options.hx
|
||||||
@@ -1005,6 +1005,9 @@ DEFHEADING()
|
@@ -1118,6 +1118,9 @@ backend describes how QEMU handles the data.
|
||||||
|
|
||||||
DEFHEADING(Block device options:)
|
ERST
|
||||||
|
|
||||||
+DEF("id", HAS_ARG, QEMU_OPTION_id,
|
+DEF("id", HAS_ARG, QEMU_OPTION_id,
|
||||||
+ "-id n set the VMID", QEMU_ARCH_ALL)
|
+ "-id n set the VMID", QEMU_ARCH_ALL)
|
||||||
@@ -28,10 +28,10 @@ index 002ba697e9..a05959b9f1 100644
|
|||||||
"-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
|
"-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)
|
DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
|
||||||
diff --git a/softmmu/vl.c b/softmmu/vl.c
|
diff --git a/softmmu/vl.c b/softmmu/vl.c
|
||||||
index 220c67cd32..d87cf6e103 100644
|
index b8637c4262..39f149924e 100644
|
||||||
--- a/softmmu/vl.c
|
--- a/softmmu/vl.c
|
||||||
+++ b/softmmu/vl.c
|
+++ b/softmmu/vl.c
|
||||||
@@ -2736,6 +2736,7 @@ void qemu_init(int argc, char **argv, char **envp)
|
@@ -2620,6 +2620,7 @@ void qemu_init(int argc, char **argv, char **envp)
|
||||||
MachineClass *machine_class;
|
MachineClass *machine_class;
|
||||||
bool userconfig = true;
|
bool userconfig = true;
|
||||||
FILE *vmstate_dump_file = NULL;
|
FILE *vmstate_dump_file = NULL;
|
||||||
@@ -39,9 +39,9 @@ index 220c67cd32..d87cf6e103 100644
|
|||||||
|
|
||||||
qemu_add_opts(&qemu_drive_opts);
|
qemu_add_opts(&qemu_drive_opts);
|
||||||
qemu_add_drive_opts(&qemu_legacy_drive_opts);
|
qemu_add_drive_opts(&qemu_legacy_drive_opts);
|
||||||
@@ -3360,6 +3361,13 @@ void qemu_init(int argc, char **argv, char **envp)
|
@@ -3245,6 +3246,13 @@ void qemu_init(int argc, char **argv, char **envp)
|
||||||
case QEMU_OPTION_smp:
|
machine_parse_property_opt(qemu_find_opts("smp-opts"),
|
||||||
machine_parse_property_opt(qemu_find_opts("smp-opts"), "smp", optarg, &error_fatal);
|
"smp", optarg);
|
||||||
break;
|
break;
|
||||||
+ case QEMU_OPTION_id:
|
+ case QEMU_OPTION_id:
|
||||||
+ vm_id = strtol(optarg, (char **)&optarg, 10);
|
+ vm_id = strtol(optarg, (char **)&optarg, 10);
|
@@ -13,10 +13,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
2 files changed, 42 insertions(+), 20 deletions(-)
|
2 files changed, 42 insertions(+), 20 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/file-posix.c b/block/file-posix.c
|
diff --git a/block/file-posix.c b/block/file-posix.c
|
||||||
index 3ac5177cbb..907aa3f22e 100644
|
index 3d60b80286..49ee1db5f9 100644
|
||||||
--- a/block/file-posix.c
|
--- a/block/file-posix.c
|
||||||
+++ b/block/file-posix.c
|
+++ b/block/file-posix.c
|
||||||
@@ -2443,6 +2443,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
@@ -2475,6 +2475,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||||
int fd;
|
int fd;
|
||||||
uint64_t perm, shared;
|
uint64_t perm, shared;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@@ -24,7 +24,7 @@ index 3ac5177cbb..907aa3f22e 100644
|
|||||||
|
|
||||||
/* Validate options and set default values */
|
/* Validate options and set default values */
|
||||||
assert(options->driver == BLOCKDEV_DRIVER_FILE);
|
assert(options->driver == BLOCKDEV_DRIVER_FILE);
|
||||||
@@ -2483,19 +2484,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
@@ -2515,19 +2516,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||||
perm = BLK_PERM_WRITE | BLK_PERM_RESIZE;
|
perm = BLK_PERM_WRITE | BLK_PERM_RESIZE;
|
||||||
shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
|
shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ index 3ac5177cbb..907aa3f22e 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the file by truncating it to 0 */
|
/* Clear the file by truncating it to 0 */
|
||||||
@@ -2549,13 +2553,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
@@ -2581,13 +2585,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
|
||||||
}
|
}
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
@@ -82,7 +82,7 @@ index 3ac5177cbb..907aa3f22e 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
out_close:
|
out_close:
|
||||||
@@ -2580,6 +2586,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
@@ -2612,6 +2618,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||||
PreallocMode prealloc;
|
PreallocMode prealloc;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
@@ -90,7 +90,7 @@ index 3ac5177cbb..907aa3f22e 100644
|
|||||||
|
|
||||||
/* Skip file: protocol prefix */
|
/* Skip file: protocol prefix */
|
||||||
strstart(filename, "file:", &filename);
|
strstart(filename, "file:", &filename);
|
||||||
@@ -2602,6 +2609,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
@@ -2634,6 +2641,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ index 3ac5177cbb..907aa3f22e 100644
|
|||||||
options = (BlockdevCreateOptions) {
|
options = (BlockdevCreateOptions) {
|
||||||
.driver = BLOCKDEV_DRIVER_FILE,
|
.driver = BLOCKDEV_DRIVER_FILE,
|
||||||
.u.file = {
|
.u.file = {
|
||||||
@@ -2613,6 +2632,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
@@ -2645,6 +2664,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
|
||||||
.nocow = nocow,
|
.nocow = nocow,
|
||||||
.has_extent_size_hint = has_extent_size_hint,
|
.has_extent_size_hint = has_extent_size_hint,
|
||||||
.extent_size_hint = extent_size_hint,
|
.extent_size_hint = extent_size_hint,
|
||||||
@@ -119,10 +119,10 @@ index 3ac5177cbb..907aa3f22e 100644
|
|||||||
};
|
};
|
||||||
return raw_co_create(&options, errp);
|
return raw_co_create(&options, errp);
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index 6356a63695..fdfa579d00 100644
|
index e1857e7094..ddac91e8f6 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -4341,7 +4341,8 @@
|
@@ -4537,7 +4537,8 @@
|
||||||
'size': 'size',
|
'size': 'size',
|
||||||
'*preallocation': 'PreallocMode',
|
'*preallocation': 'PreallocMode',
|
||||||
'*nocow': 'bool',
|
'*nocow': 'bool',
|
@@ -26,10 +26,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/hw/core/machine.c b/hw/core/machine.c
|
diff --git a/hw/core/machine.c b/hw/core/machine.c
|
||||||
index 2cf2f321f9..e0f857820d 100644
|
index a673302cce..fa424440bd 100644
|
||||||
--- a/hw/core/machine.c
|
--- a/hw/core/machine.c
|
||||||
+++ b/hw/core/machine.c
|
+++ b/hw/core/machine.c
|
||||||
@@ -107,7 +107,8 @@ GlobalProperty hw_compat_4_0[] = {
|
@@ -127,7 +127,8 @@ GlobalProperty hw_compat_4_0[] = {
|
||||||
{ "virtio-vga", "edid", "false" },
|
{ "virtio-vga", "edid", "false" },
|
||||||
{ "virtio-gpu-device", "edid", "false" },
|
{ "virtio-gpu-device", "edid", "false" },
|
||||||
{ "virtio-device", "use-started", "false" },
|
{ "virtio-device", "use-started", "false" },
|
@@ -19,10 +19,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
4 files changed, 36 insertions(+), 1 deletion(-)
|
4 files changed, 36 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
|
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
|
||||||
index 8f8d5d5276..370e66d9cc 100644
|
index 76fff60a6b..ec9201fb9a 100644
|
||||||
--- a/hw/core/machine-qmp-cmds.c
|
--- a/hw/core/machine-qmp-cmds.c
|
||||||
+++ b/hw/core/machine-qmp-cmds.c
|
+++ b/hw/core/machine-qmp-cmds.c
|
||||||
@@ -102,6 +102,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
|
@@ -103,6 +103,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
|
||||||
if (strcmp(mc->name, MACHINE_GET_CLASS(current_machine)->name) == 0) {
|
if (strcmp(mc->name, MACHINE_GET_CLASS(current_machine)->name) == 0) {
|
||||||
info->has_is_current = true;
|
info->has_is_current = true;
|
||||||
info->is_current = true;
|
info->is_current = true;
|
||||||
@@ -36,10 +36,10 @@ index 8f8d5d5276..370e66d9cc 100644
|
|||||||
|
|
||||||
if (mc->default_cpu_type) {
|
if (mc->default_cpu_type) {
|
||||||
diff --git a/include/hw/boards.h b/include/hw/boards.h
|
diff --git a/include/hw/boards.h b/include/hw/boards.h
|
||||||
index accd6eff35..1b16728389 100644
|
index 7b416c9787..8ae15c51aa 100644
|
||||||
--- a/include/hw/boards.h
|
--- a/include/hw/boards.h
|
||||||
+++ b/include/hw/boards.h
|
+++ b/include/hw/boards.h
|
||||||
@@ -205,6 +205,8 @@ struct MachineClass {
|
@@ -230,6 +230,8 @@ struct MachineClass {
|
||||||
const char *desc;
|
const char *desc;
|
||||||
const char *deprecation_reason;
|
const char *deprecation_reason;
|
||||||
|
|
||||||
@@ -49,10 +49,10 @@ index accd6eff35..1b16728389 100644
|
|||||||
void (*reset)(MachineState *state);
|
void (*reset)(MachineState *state);
|
||||||
void (*wakeup)(MachineState *state);
|
void (*wakeup)(MachineState *state);
|
||||||
diff --git a/qapi/machine.json b/qapi/machine.json
|
diff --git a/qapi/machine.json b/qapi/machine.json
|
||||||
index cf120ac343..a6f483af4f 100644
|
index 555458f785..d868e4d31d 100644
|
||||||
--- a/qapi/machine.json
|
--- a/qapi/machine.json
|
||||||
+++ b/qapi/machine.json
|
+++ b/qapi/machine.json
|
||||||
@@ -160,6 +160,8 @@
|
@@ -157,6 +157,8 @@
|
||||||
#
|
#
|
||||||
# @default-ram-id: the default ID of initial RAM memory backend (since 5.2)
|
# @default-ram-id: the default ID of initial RAM memory backend (since 5.2)
|
||||||
#
|
#
|
||||||
@@ -61,7 +61,7 @@ index cf120ac343..a6f483af4f 100644
|
|||||||
# Since: 1.2
|
# Since: 1.2
|
||||||
##
|
##
|
||||||
{ 'struct': 'MachineInfo',
|
{ 'struct': 'MachineInfo',
|
||||||
@@ -167,7 +169,7 @@
|
@@ -164,7 +166,7 @@
|
||||||
'*is-default': 'bool', '*is-current': 'bool', 'cpu-max': 'int',
|
'*is-default': 'bool', '*is-current': 'bool', 'cpu-max': 'int',
|
||||||
'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool',
|
'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool',
|
||||||
'deprecated': 'bool', '*default-cpu-type': 'str',
|
'deprecated': 'bool', '*default-cpu-type': 'str',
|
||||||
@@ -71,10 +71,10 @@ index cf120ac343..a6f483af4f 100644
|
|||||||
##
|
##
|
||||||
# @query-machines:
|
# @query-machines:
|
||||||
diff --git a/softmmu/vl.c b/softmmu/vl.c
|
diff --git a/softmmu/vl.c b/softmmu/vl.c
|
||||||
index d87cf6e103..e9d40065bc 100644
|
index 39f149924e..0d233d55f3 100644
|
||||||
--- a/softmmu/vl.c
|
--- a/softmmu/vl.c
|
||||||
+++ b/softmmu/vl.c
|
+++ b/softmmu/vl.c
|
||||||
@@ -1621,6 +1621,7 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
|
@@ -1580,6 +1580,7 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
|
||||||
static MachineClass *select_machine(QDict *qdict, Error **errp)
|
static MachineClass *select_machine(QDict *qdict, Error **errp)
|
||||||
{
|
{
|
||||||
const char *optarg = qdict_get_try_str(qdict, "type");
|
const char *optarg = qdict_get_try_str(qdict, "type");
|
||||||
@@ -82,7 +82,7 @@ index d87cf6e103..e9d40065bc 100644
|
|||||||
GSList *machines = object_class_get_list(TYPE_MACHINE, false);
|
GSList *machines = object_class_get_list(TYPE_MACHINE, false);
|
||||||
MachineClass *machine_class;
|
MachineClass *machine_class;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
@@ -1638,6 +1639,11 @@ static MachineClass *select_machine(QDict *qdict, Error **errp)
|
@@ -1597,6 +1598,11 @@ static MachineClass *select_machine(QDict *qdict, Error **errp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ index d87cf6e103..e9d40065bc 100644
|
|||||||
g_slist_free(machines);
|
g_slist_free(machines);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_append_hint(&local_err, "Use -machine help to list supported machines\n");
|
error_append_hint(&local_err, "Use -machine help to list supported machines\n");
|
||||||
@@ -3312,12 +3318,31 @@ void qemu_init(int argc, char **argv, char **envp)
|
@@ -3187,12 +3193,31 @@ void qemu_init(int argc, char **argv, char **envp)
|
||||||
case QEMU_OPTION_machine:
|
case QEMU_OPTION_machine:
|
||||||
{
|
{
|
||||||
bool help;
|
bool help;
|
59
debian/patches/pve/0026-block-backup-move-bcs-bitmap-initialization-to-job-c.patch
vendored
Normal file
59
debian/patches/pve/0026-block-backup-move-bcs-bitmap-initialization-to-job-c.patch
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Wed, 2 Mar 2022 08:35:05 +0100
|
||||||
|
Subject: [PATCH] block/backup: move bcs bitmap initialization to job creation
|
||||||
|
|
||||||
|
For backing up the state of multiple disks from the same time, a job
|
||||||
|
for each disk has to be created. It's convenient if the jobs don't
|
||||||
|
have to be started at the same time and if operation of the VM can be
|
||||||
|
resumed after job creation. This would lead to a window between job
|
||||||
|
creation and running the job, where writes can happen. But no writes
|
||||||
|
should happen between setting up the copy-before-write filter and
|
||||||
|
setting up the block copy state bitmap, because then new writes would
|
||||||
|
just pass through.
|
||||||
|
|
||||||
|
Commit 06e0a9c16405c0a4c1eca33cf286cc04c42066a2 moved initalization of
|
||||||
|
the bitmap to setting up the copy-before-write filter when sync_mode
|
||||||
|
is not MIRROR_SYNC_MODE_BITMAP. Ensure that the bitmap is initialized
|
||||||
|
upon job creation for the remaining case too, by moving the
|
||||||
|
backup_init_bcs_bitmap call to backup_job_create.
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
---
|
||||||
|
block/backup.c | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/block/backup.c b/block/backup.c
|
||||||
|
index b2b649e305..b6fa9e8a69 100644
|
||||||
|
--- a/block/backup.c
|
||||||
|
+++ b/block/backup.c
|
||||||
|
@@ -237,8 +237,8 @@ static void backup_init_bcs_bitmap(BackupBlockJob *job)
|
||||||
|
true);
|
||||||
|
} else if (job->sync_mode == MIRROR_SYNC_MODE_TOP) {
|
||||||
|
/*
|
||||||
|
- * We can't hog the coroutine to initialize this thoroughly.
|
||||||
|
- * Set a flag and resume work when we are able to yield safely.
|
||||||
|
+ * Initialization is costly here. Simply set a flag and let the
|
||||||
|
+ * backup_run coroutine resume work once it can yield safely.
|
||||||
|
*/
|
||||||
|
block_copy_set_skip_unallocated(job->bcs, true);
|
||||||
|
}
|
||||||
|
@@ -252,8 +252,6 @@ static int coroutine_fn backup_run(Job *job, Error **errp)
|
||||||
|
BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
- backup_init_bcs_bitmap(s);
|
||||||
|
-
|
||||||
|
if (s->sync_mode == MIRROR_SYNC_MODE_TOP) {
|
||||||
|
int64_t offset = 0;
|
||||||
|
int64_t count;
|
||||||
|
@@ -492,6 +490,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
||||||
|
block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL,
|
||||||
|
&error_abort);
|
||||||
|
|
||||||
|
+ backup_init_bcs_bitmap(job);
|
||||||
|
+
|
||||||
|
return &job->common;
|
||||||
|
|
||||||
|
error:
|
@@ -9,21 +9,21 @@ Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
|||||||
---
|
---
|
||||||
block/meson.build | 2 +
|
block/meson.build | 2 +
|
||||||
meson.build | 5 +
|
meson.build | 5 +
|
||||||
vma-reader.c | 857 ++++++++++++++++++++++++++++++++++++++++++++++
|
vma-reader.c | 859 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
vma-writer.c | 790 ++++++++++++++++++++++++++++++++++++++++++
|
vma-writer.c | 791 ++++++++++++++++++++++++++++++++++++++++++
|
||||||
vma.c | 851 +++++++++++++++++++++++++++++++++++++++++++++
|
vma.c | 849 +++++++++++++++++++++++++++++++++++++++++++++
|
||||||
vma.h | 150 ++++++++
|
vma.h | 150 ++++++++
|
||||||
6 files changed, 2655 insertions(+)
|
6 files changed, 2656 insertions(+)
|
||||||
create mode 100644 vma-reader.c
|
create mode 100644 vma-reader.c
|
||||||
create mode 100644 vma-writer.c
|
create mode 100644 vma-writer.c
|
||||||
create mode 100644 vma.c
|
create mode 100644 vma.c
|
||||||
create mode 100644 vma.h
|
create mode 100644 vma.h
|
||||||
|
|
||||||
diff --git a/block/meson.build b/block/meson.build
|
diff --git a/block/meson.build b/block/meson.build
|
||||||
index 7a0bc3df09..9ce9246194 100644
|
index ad40c10b6a..3a0b84bc11 100644
|
||||||
--- a/block/meson.build
|
--- a/block/meson.build
|
||||||
+++ b/block/meson.build
|
+++ b/block/meson.build
|
||||||
@@ -44,6 +44,8 @@ block_ss.add(files(
|
@@ -46,6 +46,8 @@ block_ss.add(files(
|
||||||
'zeroinit.c',
|
'zeroinit.c',
|
||||||
), zstd, zlib, gnutls)
|
), zstd, zlib, gnutls)
|
||||||
|
|
||||||
@@ -31,23 +31,23 @@ index 7a0bc3df09..9ce9246194 100644
|
|||||||
+
|
+
|
||||||
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
|
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
|
||||||
|
|
||||||
block_ss.add(when: 'CONFIG_QCOW1', if_true: files('qcow.c'))
|
if get_option('qcow1').allowed()
|
||||||
diff --git a/meson.build b/meson.build
|
diff --git a/meson.build b/meson.build
|
||||||
index b3e7ec0e92..cc46eabb42 100644
|
index d5230eadd6..ffff66c0cc 100644
|
||||||
--- a/meson.build
|
--- a/meson.build
|
||||||
+++ b/meson.build
|
+++ b/meson.build
|
||||||
@@ -1064,6 +1064,8 @@ keyutils = dependency('libkeyutils', required: false,
|
@@ -1462,6 +1462,8 @@ keyutils = dependency('libkeyutils', required: false,
|
||||||
|
|
||||||
has_gettid = cc.has_function('gettid')
|
has_gettid = cc.has_function('gettid')
|
||||||
|
|
||||||
+libuuid = cc.find_library('uuid', required: true)
|
+libuuid = cc.find_library('uuid', required: true)
|
||||||
+
|
+
|
||||||
# Malloc tests
|
# libselinux
|
||||||
|
selinux = dependency('libselinux',
|
||||||
malloc = []
|
required: get_option('selinux'),
|
||||||
@@ -2743,6 +2745,9 @@ if have_tools
|
@@ -3607,6 +3609,9 @@ if have_tools
|
||||||
qemu_nbd = executable('qemu-nbd', files('qemu-nbd.c'),
|
dependencies: [blockdev, qemuutil, gnutls, selinux],
|
||||||
dependencies: [blockdev, qemuutil, gnutls], install: true)
|
install: true)
|
||||||
|
|
||||||
+ vma = executable('vma', files('vma.c', 'vma-reader.c') + genh,
|
+ vma = executable('vma', files('vma.c', 'vma-reader.c') + genh,
|
||||||
+ dependencies: [authz, block, crypto, io, qom], install: true)
|
+ dependencies: [authz, block, crypto, io, qom], install: true)
|
||||||
@@ -57,10 +57,10 @@ index b3e7ec0e92..cc46eabb42 100644
|
|||||||
subdir('contrib/elf2dmp')
|
subdir('contrib/elf2dmp')
|
||||||
diff --git a/vma-reader.c b/vma-reader.c
|
diff --git a/vma-reader.c b/vma-reader.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..2b1d1cdab3
|
index 0000000000..e65f1e8415
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/vma-reader.c
|
+++ b/vma-reader.c
|
||||||
@@ -0,0 +1,857 @@
|
@@ -0,0 +1,859 @@
|
||||||
+/*
|
+/*
|
||||||
+ * VMA: Virtual Machine Archive
|
+ * VMA: Virtual Machine Archive
|
||||||
+ *
|
+ *
|
||||||
@@ -78,7 +78,6 @@ index 0000000000..2b1d1cdab3
|
|||||||
+#include <glib.h>
|
+#include <glib.h>
|
||||||
+#include <uuid/uuid.h>
|
+#include <uuid/uuid.h>
|
||||||
+
|
+
|
||||||
+#include "qemu-common.h"
|
|
||||||
+#include "qemu/timer.h"
|
+#include "qemu/timer.h"
|
||||||
+#include "qemu/ratelimit.h"
|
+#include "qemu/ratelimit.h"
|
||||||
+#include "vma.h"
|
+#include "vma.h"
|
||||||
@@ -255,6 +254,9 @@ index 0000000000..2b1d1cdab3
|
|||||||
+ if (vmar->rstate[i].bitmap) {
|
+ if (vmar->rstate[i].bitmap) {
|
||||||
+ g_free(vmar->rstate[i].bitmap);
|
+ g_free(vmar->rstate[i].bitmap);
|
||||||
+ }
|
+ }
|
||||||
|
+ if (vmar->rstate[i].target) {
|
||||||
|
+ blk_unref(vmar->rstate[i].target);
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (vmar->md5csum) {
|
+ if (vmar->md5csum) {
|
||||||
@@ -586,7 +588,7 @@ index 0000000000..2b1d1cdab3
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ } else {
|
+ } else {
|
||||||
+ int res = blk_pwrite(target, sector_num * BDRV_SECTOR_SIZE, buf, nb_sectors * BDRV_SECTOR_SIZE, 0);
|
+ int res = blk_pwrite(target, sector_num * BDRV_SECTOR_SIZE, nb_sectors * BDRV_SECTOR_SIZE, buf, 0);
|
||||||
+ if (res < 0) {
|
+ if (res < 0) {
|
||||||
+ error_setg(errp, "blk_pwrite to %s failed (%d)",
|
+ error_setg(errp, "blk_pwrite to %s failed (%d)",
|
||||||
+ bdrv_get_device_name(blk_bs(target)), res);
|
+ bdrv_get_device_name(blk_bs(target)), res);
|
||||||
@@ -920,10 +922,10 @@ index 0000000000..2b1d1cdab3
|
|||||||
+
|
+
|
||||||
diff --git a/vma-writer.c b/vma-writer.c
|
diff --git a/vma-writer.c b/vma-writer.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..11d8321ffd
|
index 0000000000..df4b20793d
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/vma-writer.c
|
+++ b/vma-writer.c
|
||||||
@@ -0,0 +1,790 @@
|
@@ -0,0 +1,791 @@
|
||||||
+/*
|
+/*
|
||||||
+ * VMA: Virtual Machine Archive
|
+ * VMA: Virtual Machine Archive
|
||||||
+ *
|
+ *
|
||||||
@@ -947,6 +949,7 @@ index 0000000000..11d8321ffd
|
|||||||
+#include "qemu/main-loop.h"
|
+#include "qemu/main-loop.h"
|
||||||
+#include "qemu/coroutine.h"
|
+#include "qemu/coroutine.h"
|
||||||
+#include "qemu/cutils.h"
|
+#include "qemu/cutils.h"
|
||||||
|
+#include "qemu/memalign.h"
|
||||||
+
|
+
|
||||||
+#define DEBUG_VMA 0
|
+#define DEBUG_VMA 0
|
||||||
+
|
+
|
||||||
@@ -1130,9 +1133,9 @@ index 0000000000..11d8321ffd
|
|||||||
+ assert(qemu_in_coroutine());
|
+ assert(qemu_in_coroutine());
|
||||||
+ AioContext *ctx = qemu_get_current_aio_context();
|
+ AioContext *ctx = qemu_get_current_aio_context();
|
||||||
+ aio_set_fd_handler(ctx, fd, false, NULL, (IOHandler *)qemu_coroutine_enter,
|
+ aio_set_fd_handler(ctx, fd, false, NULL, (IOHandler *)qemu_coroutine_enter,
|
||||||
+ NULL, qemu_coroutine_self());
|
+ NULL, NULL, qemu_coroutine_self());
|
||||||
+ qemu_coroutine_yield();
|
+ qemu_coroutine_yield();
|
||||||
+ aio_set_fd_handler(ctx, fd, false, NULL, NULL, NULL, NULL);
|
+ aio_set_fd_handler(ctx, fd, false, NULL, NULL, NULL, NULL, NULL);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static ssize_t coroutine_fn
|
+static ssize_t coroutine_fn
|
||||||
@@ -1716,10 +1719,10 @@ index 0000000000..11d8321ffd
|
|||||||
+}
|
+}
|
||||||
diff --git a/vma.c b/vma.c
|
diff --git a/vma.c b/vma.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..df542b7732
|
index 0000000000..e8dffb43e0
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/vma.c
|
+++ b/vma.c
|
||||||
@@ -0,0 +1,851 @@
|
@@ -0,0 +1,849 @@
|
||||||
+/*
|
+/*
|
||||||
+ * VMA: Virtual Machine Archive
|
+ * VMA: Virtual Machine Archive
|
||||||
+ *
|
+ *
|
||||||
@@ -1737,11 +1740,11 @@ index 0000000000..df542b7732
|
|||||||
+#include <glib.h>
|
+#include <glib.h>
|
||||||
+
|
+
|
||||||
+#include "vma.h"
|
+#include "vma.h"
|
||||||
+#include "qemu-common.h"
|
|
||||||
+#include "qemu/module.h"
|
+#include "qemu/module.h"
|
||||||
+#include "qemu/error-report.h"
|
+#include "qemu/error-report.h"
|
||||||
+#include "qemu/main-loop.h"
|
+#include "qemu/main-loop.h"
|
||||||
+#include "qemu/cutils.h"
|
+#include "qemu/cutils.h"
|
||||||
|
+#include "qemu/memalign.h"
|
||||||
+#include "qapi/qmp/qdict.h"
|
+#include "qapi/qmp/qdict.h"
|
||||||
+#include "sysemu/block-backend.h"
|
+#include "sysemu/block-backend.h"
|
||||||
+
|
+
|
||||||
@@ -2031,8 +2034,6 @@ index 0000000000..df542b7732
|
|||||||
+ int vmstate_fd = -1;
|
+ int vmstate_fd = -1;
|
||||||
+ guint8 vmstate_stream = 0;
|
+ guint8 vmstate_stream = 0;
|
||||||
+
|
+
|
||||||
+ BlockBackend *blk = NULL;
|
|
||||||
+
|
|
||||||
+ for (i = 1; i < 255; i++) {
|
+ for (i = 1; i < 255; i++) {
|
||||||
+ VmaDeviceInfo *di = vma_reader_get_device_info(vmar, i);
|
+ VmaDeviceInfo *di = vma_reader_get_device_info(vmar, i);
|
||||||
+ if (di && (strcmp(di->devname, "vmstate") == 0)) {
|
+ if (di && (strcmp(di->devname, "vmstate") == 0)) {
|
||||||
@@ -2053,6 +2054,8 @@ index 0000000000..df542b7732
|
|||||||
+ int flags = BDRV_O_RDWR;
|
+ int flags = BDRV_O_RDWR;
|
||||||
+ bool write_zero = true;
|
+ bool write_zero = true;
|
||||||
+
|
+
|
||||||
|
+ BlockBackend *blk = NULL;
|
||||||
|
+
|
||||||
+ if (readmap) {
|
+ if (readmap) {
|
||||||
+ RestoreMap *map;
|
+ RestoreMap *map;
|
||||||
+ map = (RestoreMap *)g_hash_table_lookup(devmap, di->devname);
|
+ map = (RestoreMap *)g_hash_table_lookup(devmap, di->devname);
|
||||||
@@ -2165,8 +2168,6 @@ index 0000000000..df542b7732
|
|||||||
+
|
+
|
||||||
+ vma_reader_destroy(vmar);
|
+ vma_reader_destroy(vmar);
|
||||||
+
|
+
|
||||||
+ blk_unref(blk);
|
|
||||||
+
|
|
||||||
+ bdrv_close_all();
|
+ bdrv_close_all();
|
||||||
+
|
+
|
||||||
+ return ret;
|
+ return ret;
|
@@ -10,20 +10,20 @@ Subject: [PATCH] PVE-Backup: add backup-dump block driver
|
|||||||
|
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
---
|
---
|
||||||
block/backup-dump.c | 168 ++++++++++++++++++++++++++++++++++++++
|
block/backup-dump.c | 167 +++++++++++++++++++++++++++++++
|
||||||
block/backup.c | 32 +++-----
|
block/backup.c | 30 ++----
|
||||||
block/meson.build | 1 +
|
block/meson.build | 1 +
|
||||||
include/block/block_int.h | 35 ++++++++
|
include/block/block_int-common.h | 35 +++++++
|
||||||
job.c | 3 +-
|
job.c | 3 +-
|
||||||
5 files changed, 216 insertions(+), 23 deletions(-)
|
5 files changed, 213 insertions(+), 23 deletions(-)
|
||||||
create mode 100644 block/backup-dump.c
|
create mode 100644 block/backup-dump.c
|
||||||
|
|
||||||
diff --git a/block/backup-dump.c b/block/backup-dump.c
|
diff --git a/block/backup-dump.c b/block/backup-dump.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..93d7f46950
|
index 0000000000..04718a94e2
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/block/backup-dump.c
|
+++ b/block/backup-dump.c
|
||||||
@@ -0,0 +1,168 @@
|
@@ -0,0 +1,167 @@
|
||||||
+/*
|
+/*
|
||||||
+ * BlockDriver to send backup data stream to a callback function
|
+ * BlockDriver to send backup data stream to a callback function
|
||||||
+ *
|
+ *
|
||||||
@@ -35,7 +35,6 @@ index 0000000000..93d7f46950
|
|||||||
+ */
|
+ */
|
||||||
+
|
+
|
||||||
+#include "qemu/osdep.h"
|
+#include "qemu/osdep.h"
|
||||||
+#include "qemu-common.h"
|
|
||||||
+#include "qom/object_interfaces.h"
|
+#include "qom/object_interfaces.h"
|
||||||
+#include "block/block_int.h"
|
+#include "block/block_int.h"
|
||||||
+
|
+
|
||||||
@@ -193,16 +192,16 @@ index 0000000000..93d7f46950
|
|||||||
+ return bs;
|
+ return bs;
|
||||||
+}
|
+}
|
||||||
diff --git a/block/backup.c b/block/backup.c
|
diff --git a/block/backup.c b/block/backup.c
|
||||||
index bd3614ce70..8bae9b060e 100644
|
index b6fa9e8a69..789f8b7799 100644
|
||||||
--- a/block/backup.c
|
--- a/block/backup.c
|
||||||
+++ b/block/backup.c
|
+++ b/block/backup.c
|
||||||
@@ -31,28 +31,6 @@
|
@@ -29,28 +29,6 @@
|
||||||
|
|
||||||
#define BACKUP_CLUSTER_SIZE_DEFAULT (1 << 16)
|
#include "block/copy-before-write.h"
|
||||||
|
|
||||||
-typedef struct BackupBlockJob {
|
-typedef struct BackupBlockJob {
|
||||||
- BlockJob common;
|
- BlockJob common;
|
||||||
- BlockDriverState *backup_top;
|
- BlockDriverState *cbw;
|
||||||
- BlockDriverState *source_bs;
|
- BlockDriverState *source_bs;
|
||||||
- BlockDriverState *target_bs;
|
- BlockDriverState *target_bs;
|
||||||
-
|
-
|
||||||
@@ -225,11 +224,10 @@ index bd3614ce70..8bae9b060e 100644
|
|||||||
static const BlockJobDriver backup_job_driver;
|
static const BlockJobDriver backup_job_driver;
|
||||||
|
|
||||||
static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret)
|
static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret)
|
||||||
@@ -504,6 +482,16 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
@@ -454,6 +432,14 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ cluster_size = backup_calculate_cluster_size(target, errp);
|
cluster_size = block_copy_cluster_size(bcs);
|
||||||
+ if (cluster_size < 0) {
|
+ if (cluster_size < 0) {
|
||||||
+ goto error;
|
+ goto error;
|
||||||
+ }
|
+ }
|
||||||
@@ -238,12 +236,11 @@ index bd3614ce70..8bae9b060e 100644
|
|||||||
+ if (bdrv_get_info(bs, &bdi) == 0) {
|
+ if (bdrv_get_info(bs, &bdi) == 0) {
|
||||||
+ cluster_size = MAX(cluster_size, bdi.cluster_size);
|
+ cluster_size = MAX(cluster_size, bdi.cluster_size);
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
/*
|
if (perf->max_chunk && perf->max_chunk < cluster_size) {
|
||||||
* If source is in backing chain of target assume that target is going to be
|
error_setg(errp, "Required max-chunk (%" PRIi64 ") is less than backup "
|
||||||
* used for "image fleecing", i.e. it should represent a kind of snapshot of
|
|
||||||
diff --git a/block/meson.build b/block/meson.build
|
diff --git a/block/meson.build b/block/meson.build
|
||||||
index 9ce9246194..19bc2b7cbb 100644
|
index 3a0b84bc11..7f22e7f177 100644
|
||||||
--- a/block/meson.build
|
--- a/block/meson.build
|
||||||
+++ b/block/meson.build
|
+++ b/block/meson.build
|
||||||
@@ -4,6 +4,7 @@ block_ss.add(files(
|
@@ -4,6 +4,7 @@ block_ss.add(files(
|
||||||
@@ -251,13 +248,13 @@ index 9ce9246194..19bc2b7cbb 100644
|
|||||||
'amend.c',
|
'amend.c',
|
||||||
'backup.c',
|
'backup.c',
|
||||||
+ 'backup-dump.c',
|
+ 'backup-dump.c',
|
||||||
'backup-top.c',
|
'copy-before-write.c',
|
||||||
'blkdebug.c',
|
'blkdebug.c',
|
||||||
'blklogwrites.c',
|
'blklogwrites.c',
|
||||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
|
||||||
index 11442893d0..8f6135e6a5 100644
|
index 8947abab76..f272d0d8dc 100644
|
||||||
--- a/include/block/block_int.h
|
--- a/include/block/block_int-common.h
|
||||||
+++ b/include/block/block_int.h
|
+++ b/include/block/block_int-common.h
|
||||||
@@ -26,6 +26,7 @@
|
@@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "block/accounting.h"
|
#include "block/accounting.h"
|
||||||
@@ -266,13 +263,13 @@ index 11442893d0..8f6135e6a5 100644
|
|||||||
#include "block/aio-wait.h"
|
#include "block/aio-wait.h"
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qemu/coroutine.h"
|
#include "qemu/coroutine.h"
|
||||||
@@ -63,6 +64,40 @@
|
@@ -64,6 +65,40 @@
|
||||||
|
|
||||||
#define BLOCK_PROBE_BUF_SIZE 512
|
#define BLOCK_PROBE_BUF_SIZE 512
|
||||||
|
|
||||||
+typedef int BackupDumpFunc(void *opaque, uint64_t offset, uint64_t bytes, const void *buf);
|
+typedef int BackupDumpFunc(void *opaque, uint64_t offset, uint64_t bytes, const void *buf);
|
||||||
+
|
+
|
||||||
+BlockDriverState *bdrv_backuo_dump_create(
|
+BlockDriverState *bdrv_backup_dump_create(
|
||||||
+ int dump_cb_block_size,
|
+ int dump_cb_block_size,
|
||||||
+ uint64_t byte_size,
|
+ uint64_t byte_size,
|
||||||
+ BackupDumpFunc *dump_cb,
|
+ BackupDumpFunc *dump_cb,
|
||||||
@@ -284,7 +281,7 @@ index 11442893d0..8f6135e6a5 100644
|
|||||||
+typedef struct BlockCopyState BlockCopyState;
|
+typedef struct BlockCopyState BlockCopyState;
|
||||||
+typedef struct BackupBlockJob {
|
+typedef struct BackupBlockJob {
|
||||||
+ BlockJob common;
|
+ BlockJob common;
|
||||||
+ BlockDriverState *backup_top;
|
+ BlockDriverState *cbw;
|
||||||
+ BlockDriverState *source_bs;
|
+ BlockDriverState *source_bs;
|
||||||
+ BlockDriverState *target_bs;
|
+ BlockDriverState *target_bs;
|
||||||
+
|
+
|
||||||
@@ -308,10 +305,10 @@ index 11442893d0..8f6135e6a5 100644
|
|||||||
BDRV_TRACKED_READ,
|
BDRV_TRACKED_READ,
|
||||||
BDRV_TRACKED_WRITE,
|
BDRV_TRACKED_WRITE,
|
||||||
diff --git a/job.c b/job.c
|
diff --git a/job.c b/job.c
|
||||||
index e7a5d28854..44eec9a441 100644
|
index 075c6f3a20..e5699ad200 100644
|
||||||
--- a/job.c
|
--- a/job.c
|
||||||
+++ b/job.c
|
+++ b/job.c
|
||||||
@@ -269,7 +269,8 @@ static bool job_started(Job *job)
|
@@ -276,7 +276,8 @@ static bool job_started(Job *job)
|
||||||
return job->co;
|
return job->co;
|
||||||
}
|
}
|
||||||
|
|
@@ -7,13 +7,14 @@ Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
|
|||||||
[PVE-Backup: avoid coroutines to fix AIO freeze, cleanups]
|
[PVE-Backup: avoid coroutines to fix AIO freeze, cleanups]
|
||||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
[add new force parameter to job_cancel_sync calls]
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
block/meson.build | 5 +
|
block/meson.build | 5 +
|
||||||
block/monitor/block-hmp-cmds.c | 33 ++
|
block/monitor/block-hmp-cmds.c | 33 ++
|
||||||
blockdev.c | 1 +
|
blockdev.c | 1 +
|
||||||
hmp-commands-info.hx | 14 +
|
hmp-commands-info.hx | 14 +
|
||||||
hmp-commands.hx | 29 +
|
hmp-commands.hx | 29 +
|
||||||
include/block/block_int.h | 2 +-
|
|
||||||
include/monitor/hmp.h | 3 +
|
include/monitor/hmp.h | 3 +
|
||||||
meson.build | 1 +
|
meson.build | 1 +
|
||||||
monitor/hmp-cmds.c | 44 ++
|
monitor/hmp-cmds.c | 44 ++
|
||||||
@@ -23,16 +24,16 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
qapi/block-core.json | 109 ++++
|
qapi/block-core.json | 109 ++++
|
||||||
qapi/common.json | 13 +
|
qapi/common.json | 13 +
|
||||||
qapi/machine.json | 15 +-
|
qapi/machine.json | 15 +-
|
||||||
15 files changed, 1449 insertions(+), 14 deletions(-)
|
14 files changed, 1448 insertions(+), 13 deletions(-)
|
||||||
create mode 100644 proxmox-backup-client.c
|
create mode 100644 proxmox-backup-client.c
|
||||||
create mode 100644 proxmox-backup-client.h
|
create mode 100644 proxmox-backup-client.h
|
||||||
create mode 100644 pve-backup.c
|
create mode 100644 pve-backup.c
|
||||||
|
|
||||||
diff --git a/block/meson.build b/block/meson.build
|
diff --git a/block/meson.build b/block/meson.build
|
||||||
index 19bc2b7cbb..9e433daf2e 100644
|
index 7f22e7f177..2783b77e9c 100644
|
||||||
--- a/block/meson.build
|
--- a/block/meson.build
|
||||||
+++ b/block/meson.build
|
+++ b/block/meson.build
|
||||||
@@ -46,6 +46,11 @@ block_ss.add(files(
|
@@ -48,6 +48,11 @@ block_ss.add(files(
|
||||||
), zstd, zlib, gnutls)
|
), zstd, zlib, gnutls)
|
||||||
|
|
||||||
block_ss.add(files('../vma-writer.c'), libuuid)
|
block_ss.add(files('../vma-writer.c'), libuuid)
|
||||||
@@ -45,7 +46,7 @@ index 19bc2b7cbb..9e433daf2e 100644
|
|||||||
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
|
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
|
||||||
|
|
||||||
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
||||||
index 3e6670c963..1e29681d30 100644
|
index bfb3c043a0..89ca64444d 100644
|
||||||
--- a/block/monitor/block-hmp-cmds.c
|
--- a/block/monitor/block-hmp-cmds.c
|
||||||
+++ b/block/monitor/block-hmp-cmds.c
|
+++ b/block/monitor/block-hmp-cmds.c
|
||||||
@@ -1015,3 +1015,36 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
|
@@ -1015,3 +1015,36 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
|
||||||
@@ -86,7 +87,7 @@ index 3e6670c963..1e29681d30 100644
|
|||||||
+ hmp_handle_error(mon, error);
|
+ hmp_handle_error(mon, error);
|
||||||
+}
|
+}
|
||||||
diff --git a/blockdev.c b/blockdev.c
|
diff --git a/blockdev.c b/blockdev.c
|
||||||
index b6f797b41f..84e9b898be 100644
|
index ce62a9b439..1600b24eab 100644
|
||||||
--- a/blockdev.c
|
--- a/blockdev.c
|
||||||
+++ b/blockdev.c
|
+++ b/blockdev.c
|
||||||
@@ -36,6 +36,7 @@
|
@@ -36,6 +36,7 @@
|
||||||
@@ -98,10 +99,10 @@ index b6f797b41f..84e9b898be 100644
|
|||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
|
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
|
||||||
index e6dd3be07a..15ddecada1 100644
|
index 97b88eaaad..92a8867afb 100644
|
||||||
--- a/hmp-commands-info.hx
|
--- a/hmp-commands-info.hx
|
||||||
+++ b/hmp-commands-info.hx
|
+++ b/hmp-commands-info.hx
|
||||||
@@ -497,6 +497,20 @@ SRST
|
@@ -484,6 +484,20 @@ SRST
|
||||||
Show the current VM UUID.
|
Show the current VM UUID.
|
||||||
ERST
|
ERST
|
||||||
|
|
||||||
@@ -123,10 +124,10 @@ index e6dd3be07a..15ddecada1 100644
|
|||||||
{
|
{
|
||||||
.name = "usernet",
|
.name = "usernet",
|
||||||
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
||||||
index 42203dbe92..7faba36b39 100644
|
index bbcc73e942..97f24942b3 100644
|
||||||
--- a/hmp-commands.hx
|
--- a/hmp-commands.hx
|
||||||
+++ b/hmp-commands.hx
|
+++ b/hmp-commands.hx
|
||||||
@@ -99,6 +99,35 @@ ERST
|
@@ -101,6 +101,35 @@ ERST
|
||||||
SRST
|
SRST
|
||||||
``block_stream``
|
``block_stream``
|
||||||
Copy data from a backing file into a block device.
|
Copy data from a backing file into a block device.
|
||||||
@@ -162,24 +163,11 @@ index 42203dbe92..7faba36b39 100644
|
|||||||
ERST
|
ERST
|
||||||
|
|
||||||
{
|
{
|
||||||
diff --git a/include/block/block_int.h b/include/block/block_int.h
|
|
||||||
index 8f6135e6a5..4a572a2e34 100644
|
|
||||||
--- a/include/block/block_int.h
|
|
||||||
+++ b/include/block/block_int.h
|
|
||||||
@@ -66,7 +66,7 @@
|
|
||||||
|
|
||||||
typedef int BackupDumpFunc(void *opaque, uint64_t offset, uint64_t bytes, const void *buf);
|
|
||||||
|
|
||||||
-BlockDriverState *bdrv_backuo_dump_create(
|
|
||||||
+BlockDriverState *bdrv_backup_dump_create(
|
|
||||||
int dump_cb_block_size,
|
|
||||||
uint64_t byte_size,
|
|
||||||
BackupDumpFunc *dump_cb,
|
|
||||||
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
|
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
|
||||||
index 1247d7362a..8d3df46c93 100644
|
index 55067beff1..5a98d2d927 100644
|
||||||
--- a/include/monitor/hmp.h
|
--- a/include/monitor/hmp.h
|
||||||
+++ b/include/monitor/hmp.h
|
+++ b/include/monitor/hmp.h
|
||||||
@@ -29,6 +29,7 @@ void hmp_info_savevm(Monitor *mon, const QDict *qdict);
|
@@ -30,6 +30,7 @@ void hmp_info_savevm(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
|
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
|
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
|
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
|
||||||
@@ -187,7 +175,7 @@ index 1247d7362a..8d3df46c93 100644
|
|||||||
void hmp_info_cpus(Monitor *mon, const QDict *qdict);
|
void hmp_info_cpus(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_info_vnc(Monitor *mon, const QDict *qdict);
|
void hmp_info_vnc(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_info_spice(Monitor *mon, const QDict *qdict);
|
void hmp_info_spice(Monitor *mon, const QDict *qdict);
|
||||||
@@ -72,6 +73,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
|
@@ -73,6 +74,8 @@ void hmp_x_colo_lost_heartbeat(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_set_password(Monitor *mon, const QDict *qdict);
|
void hmp_set_password(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_expire_password(Monitor *mon, const QDict *qdict);
|
void hmp_expire_password(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_change(Monitor *mon, const QDict *qdict);
|
void hmp_change(Monitor *mon, const QDict *qdict);
|
||||||
@@ -197,22 +185,22 @@ index 1247d7362a..8d3df46c93 100644
|
|||||||
void hmp_device_add(Monitor *mon, const QDict *qdict);
|
void hmp_device_add(Monitor *mon, const QDict *qdict);
|
||||||
void hmp_device_del(Monitor *mon, const QDict *qdict);
|
void hmp_device_del(Monitor *mon, const QDict *qdict);
|
||||||
diff --git a/meson.build b/meson.build
|
diff --git a/meson.build b/meson.build
|
||||||
index cc46eabb42..7d7e474313 100644
|
index ffff66c0cc..0bc2fb5b10 100644
|
||||||
--- a/meson.build
|
--- a/meson.build
|
||||||
+++ b/meson.build
|
+++ b/meson.build
|
||||||
@@ -1065,6 +1065,7 @@ keyutils = dependency('libkeyutils', required: false,
|
@@ -1463,6 +1463,7 @@ keyutils = dependency('libkeyutils', required: false,
|
||||||
has_gettid = cc.has_function('gettid')
|
has_gettid = cc.has_function('gettid')
|
||||||
|
|
||||||
libuuid = cc.find_library('uuid', required: true)
|
libuuid = cc.find_library('uuid', required: true)
|
||||||
+libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true)
|
+libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true)
|
||||||
|
|
||||||
# Malloc tests
|
# libselinux
|
||||||
|
selinux = dependency('libselinux',
|
||||||
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
||||||
index 64a84cf4ee..7efcd2d641 100644
|
index 1507180990..1168773da7 100644
|
||||||
--- a/monitor/hmp-cmds.c
|
--- a/monitor/hmp-cmds.c
|
||||||
+++ b/monitor/hmp-cmds.c
|
+++ b/monitor/hmp-cmds.c
|
||||||
@@ -195,6 +195,50 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
|
@@ -197,6 +197,50 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
|
||||||
qapi_free_MouseInfoList(mice_list);
|
qapi_free_MouseInfoList(mice_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,7 +500,7 @@ index 0000000000..1dda8b7d8f
|
|||||||
+#endif /* PROXMOX_BACKUP_CLIENT_H */
|
+#endif /* PROXMOX_BACKUP_CLIENT_H */
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..66868dec14
|
index 0000000000..88f5ee133f
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -0,0 +1,959 @@
|
@@ -0,0 +1,959 @@
|
||||||
@@ -872,7 +860,7 @@ index 0000000000..66868dec14
|
|||||||
+ if (next_job) {
|
+ if (next_job) {
|
||||||
+ AioContext *aio_context = next_job->job.aio_context;
|
+ AioContext *aio_context = next_job->job.aio_context;
|
||||||
+ aio_context_acquire(aio_context);
|
+ aio_context_acquire(aio_context);
|
||||||
+ job_cancel_sync(&next_job->job);
|
+ job_cancel_sync(&next_job->job, true);
|
||||||
+ aio_context_release(aio_context);
|
+ aio_context_release(aio_context);
|
||||||
+ } else {
|
+ } else {
|
||||||
+ break;
|
+ break;
|
||||||
@@ -959,7 +947,7 @@ index 0000000000..66868dec14
|
|||||||
+ if (job_should_pause(&job->job)) {
|
+ if (job_should_pause(&job->job)) {
|
||||||
+ bool error_or_canceled = pvebackup_error_or_canceled();
|
+ bool error_or_canceled = pvebackup_error_or_canceled();
|
||||||
+ if (error_or_canceled) {
|
+ if (error_or_canceled) {
|
||||||
+ job_cancel_sync(&job->job);
|
+ job_cancel_sync(&job->job, true);
|
||||||
+ } else {
|
+ } else {
|
||||||
+ job_resume(&job->job);
|
+ job_resume(&job->job);
|
||||||
+ }
|
+ }
|
||||||
@@ -1476,12 +1464,12 @@ index 0000000000..66868dec14
|
|||||||
+ return info;
|
+ return info;
|
||||||
+}
|
+}
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index fdfa579d00..c5d604693f 100644
|
index ddac91e8f6..90ad07b7ee 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -699,6 +699,115 @@
|
@@ -740,6 +740,115 @@
|
||||||
{ 'command': 'query-block', 'returns': ['BlockInfo'] }
|
{ 'command': 'query-block', 'returns': ['BlockInfo'],
|
||||||
|
'allow-preconfig': true }
|
||||||
|
|
||||||
+##
|
+##
|
||||||
+# @BackupStatus:
|
+# @BackupStatus:
|
||||||
@@ -1596,13 +1584,13 @@ index fdfa579d00..c5d604693f 100644
|
|||||||
# @BlockDeviceTimedStats:
|
# @BlockDeviceTimedStats:
|
||||||
#
|
#
|
||||||
diff --git a/qapi/common.json b/qapi/common.json
|
diff --git a/qapi/common.json b/qapi/common.json
|
||||||
index 7c976296f0..0690b07903 100644
|
index 356db3f670..aae8a3b682 100644
|
||||||
--- a/qapi/common.json
|
--- a/qapi/common.json
|
||||||
+++ b/qapi/common.json
|
+++ b/qapi/common.json
|
||||||
@@ -197,3 +197,16 @@
|
@@ -206,3 +206,16 @@
|
||||||
{ 'enum': 'GrabToggleKeys',
|
##
|
||||||
'data': [ 'ctrl-ctrl', 'alt-alt', 'shift-shift','meta-meta', 'scrolllock',
|
{ 'struct': 'HumanReadableText',
|
||||||
'ctrl-scrolllock' ] }
|
'data': { 'human-readable-text': 'str' } }
|
||||||
+
|
+
|
||||||
+##
|
+##
|
||||||
+# @UuidInfo:
|
+# @UuidInfo:
|
||||||
@@ -1617,7 +1605,7 @@ index 7c976296f0..0690b07903 100644
|
|||||||
+##
|
+##
|
||||||
+{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} }
|
+{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} }
|
||||||
diff --git a/qapi/machine.json b/qapi/machine.json
|
diff --git a/qapi/machine.json b/qapi/machine.json
|
||||||
index a6f483af4f..6effa7ad30 100644
|
index d868e4d31d..a63d9a078d 100644
|
||||||
--- a/qapi/machine.json
|
--- a/qapi/machine.json
|
||||||
+++ b/qapi/machine.json
|
+++ b/qapi/machine.json
|
||||||
@@ -4,6 +4,8 @@
|
@@ -4,6 +4,8 @@
|
||||||
@@ -1629,7 +1617,7 @@ index a6f483af4f..6effa7ad30 100644
|
|||||||
##
|
##
|
||||||
# = Machines
|
# = Machines
|
||||||
##
|
##
|
||||||
@@ -229,19 +231,6 @@
|
@@ -226,19 +228,6 @@
|
||||||
##
|
##
|
||||||
{ 'command': 'query-target', 'returns': 'TargetInfo' }
|
{ 'command': 'query-target', 'returns': 'TargetInfo' }
|
||||||
|
|
@@ -7,15 +7,15 @@ Subject: [PATCH] PVE-Backup: pbs-restore - new command to restore from proxmox
|
|||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
---
|
---
|
||||||
meson.build | 4 +
|
meson.build | 4 +
|
||||||
pbs-restore.c | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
pbs-restore.c | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
2 files changed, 228 insertions(+)
|
2 files changed, 227 insertions(+)
|
||||||
create mode 100644 pbs-restore.c
|
create mode 100644 pbs-restore.c
|
||||||
|
|
||||||
diff --git a/meson.build b/meson.build
|
diff --git a/meson.build b/meson.build
|
||||||
index 7d7e474313..dd1c5bdb4e 100644
|
index 0bc2fb5b10..f48d2e0457 100644
|
||||||
--- a/meson.build
|
--- a/meson.build
|
||||||
+++ b/meson.build
|
+++ b/meson.build
|
||||||
@@ -2749,6 +2749,10 @@ if have_tools
|
@@ -3613,6 +3613,10 @@ if have_tools
|
||||||
vma = executable('vma', files('vma.c', 'vma-reader.c') + genh,
|
vma = executable('vma', files('vma.c', 'vma-reader.c') + genh,
|
||||||
dependencies: [authz, block, crypto, io, qom], install: true)
|
dependencies: [authz, block, crypto, io, qom], install: true)
|
||||||
|
|
||||||
@@ -28,10 +28,10 @@ index 7d7e474313..dd1c5bdb4e 100644
|
|||||||
subdir('contrib/elf2dmp')
|
subdir('contrib/elf2dmp')
|
||||||
diff --git a/pbs-restore.c b/pbs-restore.c
|
diff --git a/pbs-restore.c b/pbs-restore.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..4d3f925a1b
|
index 0000000000..2f834cf42e
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/pbs-restore.c
|
+++ b/pbs-restore.c
|
||||||
@@ -0,0 +1,224 @@
|
@@ -0,0 +1,223 @@
|
||||||
+/*
|
+/*
|
||||||
+ * Qemu image restore helper for Proxmox Backup
|
+ * Qemu image restore helper for Proxmox Backup
|
||||||
+ *
|
+ *
|
||||||
@@ -50,7 +50,6 @@ index 0000000000..4d3f925a1b
|
|||||||
+#include <getopt.h>
|
+#include <getopt.h>
|
||||||
+#include <string.h>
|
+#include <string.h>
|
||||||
+
|
+
|
||||||
+#include "qemu-common.h"
|
|
||||||
+#include "qemu/module.h"
|
+#include "qemu/module.h"
|
||||||
+#include "qemu/error-report.h"
|
+#include "qemu/error-report.h"
|
||||||
+#include "qemu/main-loop.h"
|
+#include "qemu/main-loop.h"
|
||||||
@@ -96,7 +95,7 @@ index 0000000000..4d3f925a1b
|
|||||||
+ }
|
+ }
|
||||||
+ res = blk_pwrite_zeroes(callback_data->target, offset, data_len, 0);
|
+ res = blk_pwrite_zeroes(callback_data->target, offset, data_len, 0);
|
||||||
+ } else {
|
+ } else {
|
||||||
+ res = blk_pwrite(callback_data->target, offset, data, data_len, 0);
|
+ res = blk_pwrite(callback_data->target, offset, data_len, data, 0);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (res < 0) {
|
+ if (res < 0) {
|
@@ -29,7 +29,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
6 files changed, 142 insertions(+), 23 deletions(-)
|
6 files changed, 142 insertions(+), 23 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
||||||
index 1e29681d30..3fca3ce3e9 100644
|
index 89ca64444d..45da74d7a0 100644
|
||||||
--- a/block/monitor/block-hmp-cmds.c
|
--- a/block/monitor/block-hmp-cmds.c
|
||||||
+++ b/block/monitor/block-hmp-cmds.c
|
+++ b/block/monitor/block-hmp-cmds.c
|
||||||
@@ -1042,6 +1042,7 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
|
@@ -1042,6 +1042,7 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
|
||||||
@@ -41,10 +41,10 @@ index 1e29681d30..3fca3ce3e9 100644
|
|||||||
false, NULL, false, NULL, !!devlist,
|
false, NULL, false, NULL, !!devlist,
|
||||||
devlist, qdict_haskey(qdict, "speed"), speed, &error);
|
devlist, qdict_haskey(qdict, "speed"), speed, &error);
|
||||||
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
||||||
index 7efcd2d641..b2b5f1298b 100644
|
index 1168773da7..4c1671e289 100644
|
||||||
--- a/monitor/hmp-cmds.c
|
--- a/monitor/hmp-cmds.c
|
||||||
+++ b/monitor/hmp-cmds.c
|
+++ b/monitor/hmp-cmds.c
|
||||||
@@ -221,19 +221,42 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
|
@@ -223,19 +223,42 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
|
||||||
monitor_printf(mon, "End time: %s", ctime(&info->end_time));
|
monitor_printf(mon, "End time: %s", ctime(&info->end_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ index 1dda8b7d8f..8cbf645b2c 100644
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
index 66868dec14..6cdbd40529 100644
|
index 88f5ee133f..1c49cd178d 100644
|
||||||
--- a/pve-backup.c
|
--- a/pve-backup.c
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -28,6 +28,8 @@
|
@@ -28,6 +28,8 @@
|
||||||
@@ -405,10 +405,10 @@ index 66868dec14..6cdbd40529 100644
|
|||||||
qemu_mutex_unlock(&backup_state.stat.lock);
|
qemu_mutex_unlock(&backup_state.stat.lock);
|
||||||
|
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index c5d604693f..a138ad08d4 100644
|
index 90ad07b7ee..3ad9eb5d1a 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -712,8 +712,13 @@
|
@@ -753,8 +753,13 @@
|
||||||
#
|
#
|
||||||
# @total: total amount of bytes involved in the backup process
|
# @total: total amount of bytes involved in the backup process
|
||||||
#
|
#
|
||||||
@@ -422,7 +422,7 @@ index c5d604693f..a138ad08d4 100644
|
|||||||
# @zero-bytes: amount of 'zero' bytes detected.
|
# @zero-bytes: amount of 'zero' bytes detected.
|
||||||
#
|
#
|
||||||
# @start-time: time (epoch) when backup job started.
|
# @start-time: time (epoch) when backup job started.
|
||||||
@@ -726,8 +731,8 @@
|
@@ -767,8 +772,8 @@
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
{ 'struct': 'BackupStatus',
|
{ 'struct': 'BackupStatus',
|
||||||
@@ -433,7 +433,7 @@ index c5d604693f..a138ad08d4 100644
|
|||||||
'*start-time': 'int', '*end-time': 'int',
|
'*start-time': 'int', '*end-time': 'int',
|
||||||
'*backup-file': 'str', '*uuid': 'str' } }
|
'*backup-file': 'str', '*uuid': 'str' } }
|
||||||
|
|
||||||
@@ -770,6 +775,8 @@
|
@@ -811,6 +816,8 @@
|
||||||
#
|
#
|
||||||
# @backup-time: backup timestamp (Unix epoch, required for format 'pbs')
|
# @backup-time: backup timestamp (Unix epoch, required for format 'pbs')
|
||||||
#
|
#
|
||||||
@@ -442,7 +442,7 @@ index c5d604693f..a138ad08d4 100644
|
|||||||
# Returns: the uuid of the backup job
|
# Returns: the uuid of the backup job
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
@@ -780,6 +787,7 @@
|
@@ -821,6 +828,7 @@
|
||||||
'*fingerprint': 'str',
|
'*fingerprint': 'str',
|
||||||
'*backup-id': 'str',
|
'*backup-id': 'str',
|
||||||
'*backup-time': 'int',
|
'*backup-time': 'int',
|
@@ -14,12 +14,12 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
|||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
---
|
---
|
||||||
block/monitor/block-hmp-cmds.c | 4 ++-
|
block/monitor/block-hmp-cmds.c | 4 ++-
|
||||||
pve-backup.c | 59 ++++++++++++++++++++++++++--------
|
pve-backup.c | 57 +++++++++++++++++++++++++++-------
|
||||||
qapi/block-core.json | 6 ++++
|
qapi/block-core.json | 6 ++++
|
||||||
3 files changed, 55 insertions(+), 14 deletions(-)
|
3 files changed, 54 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
||||||
index 3fca3ce3e9..69254396d5 100644
|
index 45da74d7a0..ea7b665aa2 100644
|
||||||
--- a/block/monitor/block-hmp-cmds.c
|
--- a/block/monitor/block-hmp-cmds.c
|
||||||
+++ b/block/monitor/block-hmp-cmds.c
|
+++ b/block/monitor/block-hmp-cmds.c
|
||||||
@@ -1042,7 +1042,9 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
|
@@ -1042,7 +1042,9 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
|
||||||
@@ -34,7 +34,7 @@ index 3fca3ce3e9..69254396d5 100644
|
|||||||
false, NULL, false, NULL, !!devlist,
|
false, NULL, false, NULL, !!devlist,
|
||||||
devlist, qdict_haskey(qdict, "speed"), speed, &error);
|
devlist, qdict_haskey(qdict, "speed"), speed, &error);
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
index 6cdbd40529..7527885251 100644
|
index 1c49cd178d..c15abefdda 100644
|
||||||
--- a/pve-backup.c
|
--- a/pve-backup.c
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -8,6 +8,7 @@
|
@@ -8,6 +8,7 @@
|
||||||
@@ -67,17 +67,24 @@ index 6cdbd40529..7527885251 100644
|
|||||||
qemu_co_mutex_lock(&backup_state.dump_callback_mutex);
|
qemu_co_mutex_lock(&backup_state.dump_callback_mutex);
|
||||||
|
|
||||||
// avoid deadlock if job is cancelled
|
// avoid deadlock if job is cancelled
|
||||||
@@ -147,16 +152,28 @@ pvebackup_co_dump_pbs_cb(
|
@@ -147,17 +152,29 @@ pvebackup_co_dump_pbs_cb(
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
- pbs_res = proxmox_backup_co_write_data(backup_state.pbs, di->dev_id, buf, start, size, &local_err);
|
- pbs_res = proxmox_backup_co_write_data(backup_state.pbs, di->dev_id, buf, start, size, &local_err);
|
||||||
|
- qemu_co_mutex_unlock(&backup_state.dump_callback_mutex);
|
||||||
+ uint64_t transferred = 0;
|
+ uint64_t transferred = 0;
|
||||||
+ uint64_t reused = 0;
|
+ uint64_t reused = 0;
|
||||||
+ while (transferred < size) {
|
+ while (transferred < size) {
|
||||||
+ uint64_t left = size - transferred;
|
+ uint64_t left = size - transferred;
|
||||||
+ uint64_t to_transfer = left < di->block_size ? left : di->block_size;
|
+ uint64_t to_transfer = left < di->block_size ? left : di->block_size;
|
||||||
+
|
|
||||||
|
- if (pbs_res < 0) {
|
||||||
|
- pvebackup_propagate_error(local_err);
|
||||||
|
- return pbs_res;
|
||||||
|
- } else {
|
||||||
|
- size_t reused = (pbs_res == 0) ? size : 0;
|
||||||
|
- pvebackup_add_transfered_bytes(size, !buf ? size : 0, reused);
|
||||||
+ pbs_res = proxmox_backup_co_write_data(backup_state.pbs, di->dev_id,
|
+ pbs_res = proxmox_backup_co_write_data(backup_state.pbs, di->dev_id,
|
||||||
+ is_zero_block ? NULL : buf + transferred, start + transferred,
|
+ is_zero_block ? NULL : buf + transferred, start + transferred,
|
||||||
+ to_transfer, &local_err);
|
+ to_transfer, &local_err);
|
||||||
@@ -90,21 +97,14 @@ index 6cdbd40529..7527885251 100644
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ reused += pbs_res == 0 ? to_transfer : 0;
|
+ reused += pbs_res == 0 ? to_transfer : 0;
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
qemu_co_mutex_unlock(&backup_state.dump_callback_mutex);
|
|
||||||
-
|
|
||||||
- if (pbs_res < 0) {
|
|
||||||
- pvebackup_propagate_error(local_err);
|
|
||||||
- return pbs_res;
|
|
||||||
- } else {
|
|
||||||
- size_t reused = (pbs_res == 0) ? size : 0;
|
|
||||||
- pvebackup_add_transfered_bytes(size, !buf ? size : 0, reused);
|
|
||||||
- }
|
|
||||||
+ pvebackup_add_transfered_bytes(size, is_zero_block ? size : 0, reused);
|
|
||||||
|
|
||||||
|
+ qemu_co_mutex_unlock(&backup_state.dump_callback_mutex);
|
||||||
|
+ pvebackup_add_transfered_bytes(size, is_zero_block ? size : 0, reused);
|
||||||
|
+
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,6 +195,7 @@ pvebackup_co_dump_vma_cb(
|
@@ -178,6 +195,7 @@ pvebackup_co_dump_vma_cb(
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@@ -194,10 +194,10 @@ index 6cdbd40529..7527885251 100644
|
|||||||
.format = format,
|
.format = format,
|
||||||
.has_config_file = has_config_file,
|
.has_config_file = has_config_file,
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index a138ad08d4..a75f1b4687 100644
|
index 3ad9eb5d1a..4120052690 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -777,6 +777,10 @@
|
@@ -818,6 +818,10 @@
|
||||||
#
|
#
|
||||||
# @use-dirty-bitmap: use dirty bitmap to detect incremental changes since last job (optional for format 'pbs')
|
# @use-dirty-bitmap: use dirty bitmap to detect incremental changes since last job (optional for format 'pbs')
|
||||||
#
|
#
|
||||||
@@ -208,7 +208,7 @@ index a138ad08d4..a75f1b4687 100644
|
|||||||
# Returns: the uuid of the backup job
|
# Returns: the uuid of the backup job
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
@@ -788,6 +792,8 @@
|
@@ -829,6 +833,8 @@
|
||||||
'*backup-id': 'str',
|
'*backup-id': 'str',
|
||||||
'*backup-time': 'int',
|
'*backup-time': 'int',
|
||||||
'*use-dirty-bitmap': 'bool',
|
'*use-dirty-bitmap': 'bool',
|
@@ -7,20 +7,23 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
|||||||
[error cleanups, file_open implementation]
|
[error cleanups, file_open implementation]
|
||||||
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
|
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
[FE: adapt to changed function signatures
|
||||||
|
make pbs_co_preadv return values consistent with QEMU]
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
block/meson.build | 3 +
|
block/meson.build | 3 +
|
||||||
block/pbs.c | 271 +++++++++++++++++++++++++++++++++++++++++++
|
block/pbs.c | 276 +++++++++++++++++++++++++++++++++++++++++++
|
||||||
configure | 9 ++
|
configure | 9 ++
|
||||||
meson.build | 1 +
|
meson.build | 2 +-
|
||||||
qapi/block-core.json | 13 +++
|
qapi/block-core.json | 13 ++
|
||||||
5 files changed, 297 insertions(+)
|
5 files changed, 302 insertions(+), 1 deletion(-)
|
||||||
create mode 100644 block/pbs.c
|
create mode 100644 block/pbs.c
|
||||||
|
|
||||||
diff --git a/block/meson.build b/block/meson.build
|
diff --git a/block/meson.build b/block/meson.build
|
||||||
index 9e433daf2e..e3ed5ac97c 100644
|
index 2783b77e9c..a26a69434e 100644
|
||||||
--- a/block/meson.build
|
--- a/block/meson.build
|
||||||
+++ b/block/meson.build
|
+++ b/block/meson.build
|
||||||
@@ -51,6 +51,9 @@ block_ss.add(files(
|
@@ -53,6 +53,9 @@ block_ss.add(files(
|
||||||
'../pve-backup.c',
|
'../pve-backup.c',
|
||||||
), libproxmox_backup_qemu)
|
), libproxmox_backup_qemu)
|
||||||
|
|
||||||
@@ -32,10 +35,10 @@ index 9e433daf2e..e3ed5ac97c 100644
|
|||||||
|
|
||||||
diff --git a/block/pbs.c b/block/pbs.c
|
diff --git a/block/pbs.c b/block/pbs.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..78dad0dcc4
|
index 0000000000..9d1f1f39d4
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/block/pbs.c
|
+++ b/block/pbs.c
|
||||||
@@ -0,0 +1,271 @@
|
@@ -0,0 +1,276 @@
|
||||||
+/*
|
+/*
|
||||||
+ * Proxmox Backup Server read-only block driver
|
+ * Proxmox Backup Server read-only block driver
|
||||||
+ */
|
+ */
|
||||||
@@ -232,20 +235,25 @@ index 0000000000..78dad0dcc4
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static coroutine_fn int pbs_co_preadv(BlockDriverState *bs,
|
+static coroutine_fn int pbs_co_preadv(BlockDriverState *bs,
|
||||||
+ uint64_t offset, uint64_t bytes,
|
+ int64_t offset, int64_t bytes,
|
||||||
+ QEMUIOVector *qiov, int flags)
|
+ QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||||
+{
|
+{
|
||||||
+ BDRVPBSState *s = bs->opaque;
|
+ BDRVPBSState *s = bs->opaque;
|
||||||
+ int ret;
|
+ int ret;
|
||||||
+ char *pbs_error = NULL;
|
+ char *pbs_error = NULL;
|
||||||
+ uint8_t *buf = malloc(bytes);
|
+ uint8_t *buf = malloc(bytes);
|
||||||
+
|
+
|
||||||
|
+ if (offset < 0 || bytes < 0) {
|
||||||
|
+ fprintf(stderr, "unexpected negative 'offset' or 'bytes' value!\n");
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ ReadCallbackData rcb = {
|
+ ReadCallbackData rcb = {
|
||||||
+ .co = qemu_coroutine_self(),
|
+ .co = qemu_coroutine_self(),
|
||||||
+ .ctx = bdrv_get_aio_context(bs),
|
+ .ctx = bdrv_get_aio_context(bs),
|
||||||
+ };
|
+ };
|
||||||
+
|
+
|
||||||
+ proxmox_restore_read_image_at_async(s->conn, s->aid, buf, offset, bytes,
|
+ proxmox_restore_read_image_at_async(s->conn, s->aid, buf, (uint64_t)offset, (uint64_t)bytes,
|
||||||
+ read_callback, (void *) &rcb, &ret, &pbs_error);
|
+ read_callback, (void *) &rcb, &ret, &pbs_error);
|
||||||
+
|
+
|
||||||
+ qemu_coroutine_yield();
|
+ qemu_coroutine_yield();
|
||||||
@@ -259,12 +267,12 @@ index 0000000000..78dad0dcc4
|
|||||||
+ qemu_iovec_from_buf(qiov, 0, buf, bytes);
|
+ qemu_iovec_from_buf(qiov, 0, buf, bytes);
|
||||||
+ free(buf);
|
+ free(buf);
|
||||||
+
|
+
|
||||||
+ return ret;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static coroutine_fn int pbs_co_pwritev(BlockDriverState *bs,
|
+static coroutine_fn int pbs_co_pwritev(BlockDriverState *bs,
|
||||||
+ uint64_t offset, uint64_t bytes,
|
+ int64_t offset, int64_t bytes,
|
||||||
+ QEMUIOVector *qiov, int flags)
|
+ QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||||
+{
|
+{
|
||||||
+ fprintf(stderr, "pbs-bdrv: cannot write to backup file, make sure "
|
+ fprintf(stderr, "pbs-bdrv: cannot write to backup file, make sure "
|
||||||
+ "any attached disk devices are set to read-only!\n");
|
+ "any attached disk devices are set to read-only!\n");
|
||||||
@@ -308,71 +316,72 @@ index 0000000000..78dad0dcc4
|
|||||||
+
|
+
|
||||||
+block_init(bdrv_pbs_init);
|
+block_init(bdrv_pbs_init);
|
||||||
diff --git a/configure b/configure
|
diff --git a/configure b/configure
|
||||||
index 6e308ed77f..869e97c72f 100755
|
index 72ab03f11a..7203c270ec 100755
|
||||||
--- a/configure
|
--- a/configure
|
||||||
+++ b/configure
|
+++ b/configure
|
||||||
@@ -428,6 +428,7 @@ vdi=${default_feature:-yes}
|
@@ -309,6 +309,7 @@ linux_user=""
|
||||||
vvfat=${default_feature:-yes}
|
bsd_user=""
|
||||||
qed=${default_feature:-yes}
|
pie=""
|
||||||
parallels=${default_feature:-yes}
|
coroutine=""
|
||||||
+pbs_bdrv="yes"
|
+pbs_bdrv="yes"
|
||||||
libxml2="auto"
|
plugins="$default_feature"
|
||||||
debug_mutex="no"
|
meson=""
|
||||||
libpmem="auto"
|
meson_args=""
|
||||||
@@ -1486,6 +1487,10 @@ for opt do
|
@@ -902,6 +903,10 @@ for opt do
|
||||||
;;
|
--enable-uuid|--disable-uuid)
|
||||||
--enable-parallels) parallels="yes"
|
echo "$0: $opt is obsolete, UUID support is always built" >&2
|
||||||
;;
|
;;
|
||||||
+ --disable-pbs-bdrv) pbs_bdrv="no"
|
+ --disable-pbs-bdrv) pbs_bdrv="no"
|
||||||
+ ;;
|
+ ;;
|
||||||
+ --enable-pbs-bdrv) pbs_bdrv="yes"
|
+ --enable-pbs-bdrv) pbs_bdrv="yes"
|
||||||
+ ;;
|
+ ;;
|
||||||
--disable-vhost-user) vhost_user="no"
|
--with-git=*) git="$optarg"
|
||||||
;;
|
;;
|
||||||
--enable-vhost-user) vhost_user="yes"
|
--with-git-submodules=*)
|
||||||
@@ -1956,6 +1961,7 @@ disabled with --disable-FEATURE, default is enabled if available
|
@@ -1087,6 +1092,7 @@ cat << EOF
|
||||||
vvfat vvfat image format support
|
debug-info debugging information
|
||||||
qed qed image format support
|
safe-stack SafeStack Stack Smash Protection. Depends on
|
||||||
parallels parallels image format support
|
clang/llvm >= 3.7 and requires coroutine backend ucontext.
|
||||||
+ pbs-bdrv Proxmox backup server read-only block driver support
|
+ pbs-bdrv Proxmox backup server read-only block driver support
|
||||||
crypto-afalg Linux AF_ALG crypto backend driver
|
|
||||||
capstone capstone disassembler support
|
NOTE: The object files are built at the place where configure is launched
|
||||||
debug-mutex mutex debugging support
|
EOF
|
||||||
@@ -4624,6 +4630,9 @@ fi
|
@@ -2463,6 +2469,9 @@ echo "TARGET_DIRS=$target_list" >> $config_host_mak
|
||||||
if test "$linux_aio" = "yes" ; then
|
if test "$modules" = "yes"; then
|
||||||
echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
|
echo "CONFIG_MODULES=y" >> $config_host_mak
|
||||||
fi
|
fi
|
||||||
+if test "$pbs_bdrv" = "yes" ; then
|
+if test "$pbs_bdrv" = "yes" ; then
|
||||||
+ echo "CONFIG_PBS_BDRV=y" >> $config_host_mak
|
+ echo "CONFIG_PBS_BDRV=y" >> $config_host_mak
|
||||||
+fi
|
+fi
|
||||||
if test "$vhost_scsi" = "yes" ; then
|
|
||||||
echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
|
# XXX: suppress that
|
||||||
fi
|
if [ "$bsd" = "yes" ] ; then
|
||||||
diff --git a/meson.build b/meson.build
|
diff --git a/meson.build b/meson.build
|
||||||
index dd1c5bdb4e..45c1f2de73 100644
|
index f48d2e0457..be4785e2f6 100644
|
||||||
--- a/meson.build
|
--- a/meson.build
|
||||||
+++ b/meson.build
|
+++ b/meson.build
|
||||||
@@ -3111,6 +3111,7 @@ summary_info += {'lzfse support': liblzfse.found()}
|
@@ -3986,7 +3986,7 @@ summary_info += {'bzip2 support': libbzip2}
|
||||||
summary_info += {'zstd support': zstd.found()}
|
summary_info += {'lzfse support': liblzfse}
|
||||||
summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
|
summary_info += {'zstd support': zstd}
|
||||||
summary_info += {'libxml2': libxml2.found()}
|
summary_info += {'NUMA host support': numa}
|
||||||
|
-summary_info += {'capstone': capstone}
|
||||||
+summary_info += {'PBS bdrv support': config_host.has_key('CONFIG_PBS_BDRV')}
|
+summary_info += {'PBS bdrv support': config_host.has_key('CONFIG_PBS_BDRV')}
|
||||||
summary_info += {'capstone': capstone_opt == 'disabled' ? false : capstone_opt}
|
summary_info += {'libpmem support': libpmem}
|
||||||
summary_info += {'libpmem support': libpmem.found()}
|
summary_info += {'libdaxctl support': libdaxctl}
|
||||||
summary_info += {'libdaxctl support': libdaxctl.found()}
|
summary_info += {'libudev': libudev}
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index a75f1b4687..e4d0c923a4 100644
|
index 4120052690..96bc696aaa 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -2982,6 +2982,7 @@
|
@@ -3099,6 +3099,7 @@
|
||||||
'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
|
'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
|
||||||
'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
|
'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
|
||||||
{ 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
|
{ 'name': 'replication', 'if': 'CONFIG_REPLICATION' },
|
||||||
+ 'pbs',
|
+ 'pbs',
|
||||||
'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
|
'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -3045,6 +3046,17 @@
|
@@ -3171,6 +3172,17 @@
|
||||||
{ 'struct': 'BlockdevOptionsNull',
|
{ 'struct': 'BlockdevOptionsNull',
|
||||||
'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
|
'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
|
||||||
|
|
||||||
@@ -390,7 +399,7 @@ index a75f1b4687..e4d0c923a4 100644
|
|||||||
##
|
##
|
||||||
# @BlockdevOptionsNVMe:
|
# @BlockdevOptionsNVMe:
|
||||||
#
|
#
|
||||||
@@ -4263,6 +4275,7 @@
|
@@ -4455,6 +4467,7 @@
|
||||||
'nfs': 'BlockdevOptionsNfs',
|
'nfs': 'BlockdevOptionsNfs',
|
||||||
'null-aio': 'BlockdevOptionsNull',
|
'null-aio': 'BlockdevOptionsNull',
|
||||||
'null-co': 'BlockdevOptionsNull',
|
'null-co': 'BlockdevOptionsNull',
|
@@ -16,7 +16,7 @@ Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
|||||||
2 files changed, 38 insertions(+)
|
2 files changed, 38 insertions(+)
|
||||||
|
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
index 7527885251..8cba8e97d3 100644
|
index c15abefdda..4684789813 100644
|
||||||
--- a/pve-backup.c
|
--- a/pve-backup.c
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -1075,3 +1075,12 @@ BackupStatus *qmp_query_backup(Error **errp)
|
@@ -1075,3 +1075,12 @@ BackupStatus *qmp_query_backup(Error **errp)
|
||||||
@@ -33,10 +33,10 @@ index 7527885251..8cba8e97d3 100644
|
|||||||
+ return ret;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index e4d0c923a4..3eebe7ff71 100644
|
index 96bc696aaa..0b453c61d4 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -822,6 +822,35 @@
|
@@ -863,6 +863,35 @@
|
||||||
##
|
##
|
||||||
{ 'command': 'backup-cancel' }
|
{ 'command': 'backup-cancel' }
|
||||||
|
|
@@ -15,10 +15,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
3 files changed, 159 insertions(+), 42 deletions(-)
|
3 files changed, 159 insertions(+), 42 deletions(-)
|
||||||
|
|
||||||
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
|
||||||
index b2b5f1298b..7a449edafa 100644
|
index 4c1671e289..c1152f55a7 100644
|
||||||
--- a/monitor/hmp-cmds.c
|
--- a/monitor/hmp-cmds.c
|
||||||
+++ b/monitor/hmp-cmds.c
|
+++ b/monitor/hmp-cmds.c
|
||||||
@@ -198,6 +198,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
|
@@ -200,6 +200,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
|
||||||
void hmp_info_backup(Monitor *mon, const QDict *qdict)
|
void hmp_info_backup(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
BackupStatus *info;
|
BackupStatus *info;
|
||||||
@@ -26,7 +26,7 @@ index b2b5f1298b..7a449edafa 100644
|
|||||||
|
|
||||||
info = qmp_query_backup(NULL);
|
info = qmp_query_backup(NULL);
|
||||||
|
|
||||||
@@ -228,26 +229,29 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
|
@@ -230,26 +231,29 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
|
||||||
// this should not happen normally
|
// this should not happen normally
|
||||||
monitor_printf(mon, "Total size: %d\n", 0);
|
monitor_printf(mon, "Total size: %d\n", 0);
|
||||||
} else {
|
} else {
|
||||||
@@ -69,7 +69,7 @@ index b2b5f1298b..7a449edafa 100644
|
|||||||
info->zero_bytes, zero_per);
|
info->zero_bytes, zero_per);
|
||||||
|
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
index 8cba8e97d3..22420db26a 100644
|
index 4684789813..f90abaa50a 100644
|
||||||
--- a/pve-backup.c
|
--- a/pve-backup.c
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -46,6 +46,7 @@ static struct PVEBackupState {
|
@@ -46,6 +46,7 @@ static struct PVEBackupState {
|
||||||
@@ -359,10 +359,10 @@ index 8cba8e97d3..22420db26a 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index 3eebe7ff71..170c13984d 100644
|
index 0b453c61d4..16e184dd28 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -830,6 +830,8 @@
|
@@ -871,6 +871,8 @@
|
||||||
# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are
|
# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are
|
||||||
# supported.
|
# supported.
|
||||||
#
|
#
|
||||||
@@ -371,7 +371,7 @@ index 3eebe7ff71..170c13984d 100644
|
|||||||
# @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can
|
# @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can
|
||||||
# safely be set for savevm-async.
|
# safely be set for savevm-async.
|
||||||
#
|
#
|
||||||
@@ -838,6 +840,7 @@
|
@@ -879,6 +881,7 @@
|
||||||
##
|
##
|
||||||
{ 'struct': 'ProxmoxSupportStatus',
|
{ 'struct': 'ProxmoxSupportStatus',
|
||||||
'data': { 'pbs-dirty-bitmap': 'bool',
|
'data': { 'pbs-dirty-bitmap': 'bool',
|
||||||
@@ -379,7 +379,7 @@ index 3eebe7ff71..170c13984d 100644
|
|||||||
'pbs-dirty-bitmap-savevm': 'bool',
|
'pbs-dirty-bitmap-savevm': 'bool',
|
||||||
'pbs-library-version': 'str' } }
|
'pbs-library-version': 'str' } }
|
||||||
|
|
||||||
@@ -851,6 +854,59 @@
|
@@ -892,6 +895,59 @@
|
||||||
##
|
##
|
||||||
{ 'command': 'query-proxmox-support', 'returns': 'ProxmoxSupportStatus' }
|
{ 'command': 'query-proxmox-support', 'returns': 'ProxmoxSupportStatus' }
|
||||||
|
|
@@ -14,18 +14,18 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
2 files changed, 7 insertions(+), 2 deletions(-)
|
2 files changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
diff --git a/meson.build b/meson.build
|
diff --git a/meson.build b/meson.build
|
||||||
index 45c1f2de73..44071acbb7 100644
|
index be4785e2f6..3fc7c8d435 100644
|
||||||
--- a/meson.build
|
--- a/meson.build
|
||||||
+++ b/meson.build
|
+++ b/meson.build
|
||||||
@@ -1065,6 +1065,7 @@ keyutils = dependency('libkeyutils', required: false,
|
@@ -1463,6 +1463,7 @@ keyutils = dependency('libkeyutils', required: false,
|
||||||
has_gettid = cc.has_function('gettid')
|
has_gettid = cc.has_function('gettid')
|
||||||
|
|
||||||
libuuid = cc.find_library('uuid', required: true)
|
libuuid = cc.find_library('uuid', required: true)
|
||||||
+libsystemd = cc.find_library('systemd', required: true)
|
+libsystemd = cc.find_library('systemd', required: true)
|
||||||
libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true)
|
libproxmox_backup_qemu = cc.find_library('proxmox_backup_qemu', required: true)
|
||||||
|
|
||||||
# Malloc tests
|
# libselinux
|
||||||
@@ -2246,6 +2247,7 @@ if have_block
|
@@ -3105,6 +3106,7 @@ if have_block
|
||||||
# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
|
# os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
|
||||||
# os-win32.c does not
|
# os-win32.c does not
|
||||||
blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
|
blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
|
||||||
@@ -34,7 +34,7 @@ index 45c1f2de73..44071acbb7 100644
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
diff --git a/os-posix.c b/os-posix.c
|
diff --git a/os-posix.c b/os-posix.c
|
||||||
index ae6c9f2a5e..36807806bf 100644
|
index 321fc4bd13..b1870d2690 100644
|
||||||
--- a/os-posix.c
|
--- a/os-posix.c
|
||||||
+++ b/os-posix.c
|
+++ b/os-posix.c
|
||||||
@@ -28,6 +28,8 @@
|
@@ -28,6 +28,8 @@
|
||||||
@@ -44,15 +44,15 @@ index ae6c9f2a5e..36807806bf 100644
|
|||||||
+#include <systemd/sd-journal.h>
|
+#include <systemd/sd-journal.h>
|
||||||
+#include <syslog.h>
|
+#include <syslog.h>
|
||||||
|
|
||||||
#include "qemu-common.h"
|
|
||||||
/* Needed early for CONFIG_BSD etc. */
|
/* Needed early for CONFIG_BSD etc. */
|
||||||
@@ -291,9 +293,10 @@ void os_setup_post(void)
|
#include "net/slirp.h"
|
||||||
|
@@ -281,9 +283,10 @@ void os_setup_post(void)
|
||||||
|
|
||||||
dup2(fd, 0);
|
dup2(fd, 0);
|
||||||
dup2(fd, 1);
|
dup2(fd, 1);
|
||||||
- /* In case -D is given do not redirect stderr to /dev/null */
|
- /* In case -D is given do not redirect stderr to /dev/null */
|
||||||
+ /* In case -D is given do not redirect stderr to journal */
|
+ /* In case -D is given do not redirect stderr to journal */
|
||||||
if (!qemu_logfile) {
|
if (!qemu_log_enabled()) {
|
||||||
- dup2(fd, 2);
|
- dup2(fd, 2);
|
||||||
+ int journal_fd = sd_journal_stream_fd("QEMU", LOG_ERR, 0);
|
+ int journal_fd = sd_journal_stream_fd("QEMU", LOG_ERR, 0);
|
||||||
+ dup2(journal_fd, 2);
|
+ dup2(journal_fd, 2);
|
@@ -11,10 +11,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
2 files changed, 43 insertions(+)
|
2 files changed, 43 insertions(+)
|
||||||
|
|
||||||
diff --git a/include/qemu/job.h b/include/qemu/job.h
|
diff --git a/include/qemu/job.h b/include/qemu/job.h
|
||||||
index 41162ed494..6662c63519 100644
|
index c105b31076..5096679571 100644
|
||||||
--- a/include/qemu/job.h
|
--- a/include/qemu/job.h
|
||||||
+++ b/include/qemu/job.h
|
+++ b/include/qemu/job.h
|
||||||
@@ -285,6 +285,18 @@ typedef enum JobCreateFlags {
|
@@ -316,6 +316,18 @@ typedef enum JobCreateFlags {
|
||||||
*/
|
*/
|
||||||
JobTxn *job_txn_new(void);
|
JobTxn *job_txn_new(void);
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ index 41162ed494..6662c63519 100644
|
|||||||
* Release a reference that was previously acquired with job_txn_add_job or
|
* Release a reference that was previously acquired with job_txn_add_job or
|
||||||
* job_txn_new. If it's the last reference to the object, it will be freed.
|
* job_txn_new. If it's the last reference to the object, it will be freed.
|
||||||
diff --git a/job.c b/job.c
|
diff --git a/job.c b/job.c
|
||||||
index 44eec9a441..a0753ff2f1 100644
|
index e5699ad200..34c9758349 100644
|
||||||
--- a/job.c
|
--- a/job.c
|
||||||
+++ b/job.c
|
+++ b/job.c
|
||||||
@@ -72,6 +72,8 @@ struct JobTxn {
|
@@ -72,6 +72,8 @@ struct JobTxn {
|
||||||
@@ -72,7 +72,7 @@ index 44eec9a441..a0753ff2f1 100644
|
|||||||
static void job_txn_ref(JobTxn *txn)
|
static void job_txn_ref(JobTxn *txn)
|
||||||
{
|
{
|
||||||
txn->refcnt++;
|
txn->refcnt++;
|
||||||
@@ -850,6 +871,9 @@ static void job_completed_txn_success(Job *job)
|
@@ -897,6 +918,9 @@ static void job_completed_txn_success(Job *job)
|
||||||
*/
|
*/
|
||||||
QLIST_FOREACH(other_job, &txn->jobs, txn_list) {
|
QLIST_FOREACH(other_job, &txn->jobs, txn_list) {
|
||||||
if (!job_is_completed(other_job)) {
|
if (!job_is_completed(other_job)) {
|
||||||
@@ -82,7 +82,7 @@ index 44eec9a441..a0753ff2f1 100644
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert(other_job->ret == 0);
|
assert(other_job->ret == 0);
|
||||||
@@ -1020,6 +1044,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
|
@@ -1093,6 +1117,13 @@ int job_finish_sync(Job *job, void (*finish)(Job *, Error **errp), Error **errp)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
@@ -12,12 +12,14 @@ transaction, so drives will still be backed up one after the other.
|
|||||||
|
|
||||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
[add new force parameter to job_cancel_sync calls]
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
pve-backup.c | 169 +++++++++++++++------------------------------------
|
pve-backup.c | 167 +++++++++++++++------------------------------------
|
||||||
1 file changed, 50 insertions(+), 119 deletions(-)
|
1 file changed, 49 insertions(+), 118 deletions(-)
|
||||||
|
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
index 22420db26a..2e628d68e4 100644
|
index f90abaa50a..63c686463f 100644
|
||||||
--- a/pve-backup.c
|
--- a/pve-backup.c
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -52,6 +52,7 @@ static struct PVEBackupState {
|
@@ -52,6 +52,7 @@ static struct PVEBackupState {
|
||||||
@@ -121,22 +123,8 @@ index 22420db26a..2e628d68e4 100644
|
|||||||
proxmox_backup_abort(backup_state.pbs, "backup canceled");
|
proxmox_backup_abort(backup_state.pbs, "backup canceled");
|
||||||
}
|
}
|
||||||
|
|
||||||
+ /* it's enough to cancel one job in the transaction, the rest will follow
|
- qemu_mutex_unlock(&backup_state.backup_mutex);
|
||||||
+ * automatically */
|
-
|
||||||
+ GList *bdi = g_list_first(backup_state.di_list);
|
|
||||||
+ BlockJob *cancel_job = bdi && bdi->data ?
|
|
||||||
+ ((PVEBackupDevInfo *)bdi->data)->job :
|
|
||||||
+ NULL;
|
|
||||||
+
|
|
||||||
+ /* ref the job before releasing the mutex, just to be safe */
|
|
||||||
+ if (cancel_job) {
|
|
||||||
+ job_ref(&cancel_job->job);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* job_cancel_sync may enter the job, so we need to release the
|
|
||||||
+ * backup_mutex to avoid deadlock */
|
|
||||||
qemu_mutex_unlock(&backup_state.backup_mutex);
|
|
||||||
|
|
||||||
- for(;;) {
|
- for(;;) {
|
||||||
-
|
-
|
||||||
- BlockJob *next_job = NULL;
|
- BlockJob *next_job = NULL;
|
||||||
@@ -147,20 +135,33 @@ index 22420db26a..2e628d68e4 100644
|
|||||||
- while (l) {
|
- while (l) {
|
||||||
- PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
|
- PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
|
||||||
- l = g_list_next(l);
|
- l = g_list_next(l);
|
||||||
-
|
+ /* it's enough to cancel one job in the transaction, the rest will follow
|
||||||
|
+ * automatically */
|
||||||
|
+ GList *bdi = g_list_first(backup_state.di_list);
|
||||||
|
+ BlockJob *cancel_job = bdi && bdi->data ?
|
||||||
|
+ ((PVEBackupDevInfo *)bdi->data)->job :
|
||||||
|
+ NULL;
|
||||||
|
|
||||||
- BlockJob *job = lookup_active_block_job(di);
|
- BlockJob *job = lookup_active_block_job(di);
|
||||||
- if (job != NULL) {
|
- if (job != NULL) {
|
||||||
- next_job = job;
|
- next_job = job;
|
||||||
- break;
|
- break;
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
-
|
+ /* ref the job before releasing the mutex, just to be safe */
|
||||||
|
+ if (cancel_job) {
|
||||||
|
+ job_ref(&cancel_job->job);
|
||||||
|
+ }
|
||||||
|
|
||||||
- qemu_mutex_unlock(&backup_state.backup_mutex);
|
- qemu_mutex_unlock(&backup_state.backup_mutex);
|
||||||
-
|
+ /* job_cancel_sync may enter the job, so we need to release the
|
||||||
|
+ * backup_mutex to avoid deadlock */
|
||||||
|
+ qemu_mutex_unlock(&backup_state.backup_mutex);
|
||||||
|
|
||||||
- if (next_job) {
|
- if (next_job) {
|
||||||
- AioContext *aio_context = next_job->job.aio_context;
|
- AioContext *aio_context = next_job->job.aio_context;
|
||||||
- aio_context_acquire(aio_context);
|
- aio_context_acquire(aio_context);
|
||||||
- job_cancel_sync(&next_job->job);
|
- job_cancel_sync(&next_job->job, true);
|
||||||
- aio_context_release(aio_context);
|
- aio_context_release(aio_context);
|
||||||
- } else {
|
- } else {
|
||||||
- break;
|
- break;
|
||||||
@@ -168,7 +169,7 @@ index 22420db26a..2e628d68e4 100644
|
|||||||
+ if (cancel_job) {
|
+ if (cancel_job) {
|
||||||
+ AioContext *aio_context = cancel_job->job.aio_context;
|
+ AioContext *aio_context = cancel_job->job.aio_context;
|
||||||
+ aio_context_acquire(aio_context);
|
+ aio_context_acquire(aio_context);
|
||||||
+ job_cancel_sync(&cancel_job->job);
|
+ job_cancel_sync(&cancel_job->job, true);
|
||||||
+ job_unref(&cancel_job->job);
|
+ job_unref(&cancel_job->job);
|
||||||
+ aio_context_release(aio_context);
|
+ aio_context_release(aio_context);
|
||||||
}
|
}
|
||||||
@@ -202,7 +203,7 @@ index 22420db26a..2e628d68e4 100644
|
|||||||
- if (job_should_pause(&job->job)) {
|
- if (job_should_pause(&job->job)) {
|
||||||
- bool error_or_canceled = pvebackup_error_or_canceled();
|
- bool error_or_canceled = pvebackup_error_or_canceled();
|
||||||
- if (error_or_canceled) {
|
- if (error_or_canceled) {
|
||||||
- job_cancel_sync(&job->job);
|
- job_cancel_sync(&job->job, true);
|
||||||
- } else {
|
- } else {
|
||||||
- job_resume(&job->job);
|
- job_resume(&job->job);
|
||||||
- }
|
- }
|
@@ -49,13 +49,15 @@ before.
|
|||||||
|
|
||||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
[add new force parameter to job_cancel_sync calls]
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
pve-backup.c | 217 ++++++++++++++++++++++++++++---------------
|
pve-backup.c | 217 ++++++++++++++++++++++++++++---------------
|
||||||
qapi/block-core.json | 5 +-
|
qapi/block-core.json | 5 +-
|
||||||
2 files changed, 144 insertions(+), 78 deletions(-)
|
2 files changed, 144 insertions(+), 78 deletions(-)
|
||||||
|
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
index 2e628d68e4..9c20ef3a5e 100644
|
index 63c686463f..6f05796fad 100644
|
||||||
--- a/pve-backup.c
|
--- a/pve-backup.c
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -33,7 +33,9 @@ const char *PBS_BITMAP_NAME = "pbs-incremental-dirty-bitmap";
|
@@ -33,7 +33,9 @@ const char *PBS_BITMAP_NAME = "pbs-incremental-dirty-bitmap";
|
||||||
@@ -208,7 +210,7 @@ index 2e628d68e4..9c20ef3a5e 100644
|
|||||||
- assert(!qemu_in_coroutine());
|
- assert(!qemu_in_coroutine());
|
||||||
+ PVEBackupDevInfo *di = opaque;
|
+ PVEBackupDevInfo *di = opaque;
|
||||||
+ di->completed_ret = ret;
|
+ di->completed_ret = ret;
|
||||||
|
+
|
||||||
+ /*
|
+ /*
|
||||||
+ * Schedule stream cleanup in async coroutine. close_image and finish might
|
+ * Schedule stream cleanup in async coroutine. close_image and finish might
|
||||||
+ * take a while, so we can't block on them here. This way it also doesn't
|
+ * take a while, so we can't block on them here. This way it also doesn't
|
||||||
@@ -229,11 +231,11 @@ index 2e628d68e4..9c20ef3a5e 100644
|
|||||||
+ Job *job = (Job*)data->data;
|
+ Job *job = (Job*)data->data;
|
||||||
+ AioContext *job_ctx = job->aio_context;
|
+ AioContext *job_ctx = job->aio_context;
|
||||||
+ aio_context_acquire(job_ctx);
|
+ aio_context_acquire(job_ctx);
|
||||||
+ job_cancel_sync(job);
|
+ job_cancel_sync(job, true);
|
||||||
+ aio_context_release(job_ctx);
|
+ aio_context_release(job_ctx);
|
||||||
+ aio_co_enter(data->ctx, data->co);
|
+ aio_co_enter(data->ctx, data->co);
|
||||||
+}
|
+}
|
||||||
+
|
|
||||||
+static void coroutine_fn pvebackup_co_cancel(void *opaque)
|
+static void coroutine_fn pvebackup_co_cancel(void *opaque)
|
||||||
+{
|
+{
|
||||||
Error *cancel_err = NULL;
|
Error *cancel_err = NULL;
|
||||||
@@ -268,7 +270,7 @@ index 2e628d68e4..9c20ef3a5e 100644
|
|||||||
- if (cancel_job) {
|
- if (cancel_job) {
|
||||||
- AioContext *aio_context = cancel_job->job.aio_context;
|
- AioContext *aio_context = cancel_job->job.aio_context;
|
||||||
- aio_context_acquire(aio_context);
|
- aio_context_acquire(aio_context);
|
||||||
- job_cancel_sync(&cancel_job->job);
|
- job_cancel_sync(&cancel_job->job, true);
|
||||||
- job_unref(&cancel_job->job);
|
- job_unref(&cancel_job->job);
|
||||||
- aio_context_release(aio_context);
|
- aio_context_release(aio_context);
|
||||||
- }
|
- }
|
||||||
@@ -309,13 +311,13 @@ index 2e628d68e4..9c20ef3a5e 100644
|
|||||||
- if (!job || local_err != NULL) {
|
- if (!job || local_err != NULL) {
|
||||||
- Error *create_job_err = NULL;
|
- Error *create_job_err = NULL;
|
||||||
- error_setg(&create_job_err, "backup_job_create failed: %s",
|
- error_setg(&create_job_err, "backup_job_create failed: %s",
|
||||||
|
- local_err ? error_get_pretty(local_err) : "null");
|
||||||
+ di->job = job;
|
+ di->job = job;
|
||||||
+
|
|
||||||
|
- pvebackup_propagate_error(create_job_err);
|
||||||
+ if (!job || local_err) {
|
+ if (!job || local_err) {
|
||||||
+ error_setg(errp, "backup_job_create failed: %s",
|
+ error_setg(errp, "backup_job_create failed: %s",
|
||||||
local_err ? error_get_pretty(local_err) : "null");
|
+ local_err ? error_get_pretty(local_err) : "null");
|
||||||
-
|
|
||||||
- pvebackup_propagate_error(create_job_err);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +340,7 @@ index 2e628d68e4..9c20ef3a5e 100644
|
|||||||
if (di->job) {
|
if (di->job) {
|
||||||
+ AioContext *ctx = di->job->job.aio_context;
|
+ AioContext *ctx = di->job->job.aio_context;
|
||||||
+ aio_context_acquire(ctx);
|
+ aio_context_acquire(ctx);
|
||||||
+ job_cancel_sync(&di->job->job);
|
+ job_cancel_sync(&di->job->job, true);
|
||||||
job_unref(&di->job->job);
|
job_unref(&di->job->job);
|
||||||
+ aio_context_release(ctx);
|
+ aio_context_release(ctx);
|
||||||
}
|
}
|
||||||
@@ -479,10 +481,10 @@ index 2e628d68e4..9c20ef3a5e 100644
|
|||||||
qemu_mutex_unlock(&backup_state.stat.lock);
|
qemu_mutex_unlock(&backup_state.stat.lock);
|
||||||
|
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index 170c13984d..a0d1d278e9 100644
|
index 16e184dd28..cb17d00fe0 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -729,12 +729,15 @@
|
@@ -770,12 +770,15 @@
|
||||||
#
|
#
|
||||||
# @uuid: uuid for this backup job
|
# @uuid: uuid for this backup job
|
||||||
#
|
#
|
@@ -36,11 +36,11 @@ index 465906710d..4f0aeceb6f 100644
|
|||||||
+
|
+
|
||||||
#endif
|
#endif
|
||||||
diff --git a/migration/meson.build b/migration/meson.build
|
diff --git a/migration/meson.build b/migration/meson.build
|
||||||
index ea9aedeefc..c27dc9bd97 100644
|
index 0842d00cd2..d012f4d8d3 100644
|
||||||
--- a/migration/meson.build
|
--- a/migration/meson.build
|
||||||
+++ b/migration/meson.build
|
+++ b/migration/meson.build
|
||||||
@@ -7,8 +7,10 @@ migration_files = files(
|
@@ -6,8 +6,10 @@ migration_files = files(
|
||||||
'qemu-file-channel.c',
|
'vmstate.c',
|
||||||
'qemu-file.c',
|
'qemu-file.c',
|
||||||
'yank_functions.c',
|
'yank_functions.c',
|
||||||
+ 'pbs-state.c',
|
+ 'pbs-state.c',
|
||||||
@@ -51,17 +51,17 @@ index ea9aedeefc..c27dc9bd97 100644
|
|||||||
softmmu_ss.add(files(
|
softmmu_ss.add(files(
|
||||||
'block-dirty-bitmap.c',
|
'block-dirty-bitmap.c',
|
||||||
diff --git a/migration/migration.c b/migration/migration.c
|
diff --git a/migration/migration.c b/migration/migration.c
|
||||||
index 041b8451a6..9df2eed75e 100644
|
index bb8bbddfe4..8109e468eb 100644
|
||||||
--- a/migration/migration.c
|
--- a/migration/migration.c
|
||||||
+++ b/migration/migration.c
|
+++ b/migration/migration.c
|
||||||
@@ -218,6 +218,7 @@ void migration_object_init(void)
|
@@ -229,6 +229,7 @@ void migration_object_init(void)
|
||||||
blk_mig_init();
|
blk_mig_init();
|
||||||
ram_mig_init();
|
ram_mig_init();
|
||||||
dirty_bitmap_mig_init();
|
dirty_bitmap_mig_init();
|
||||||
+ pbs_state_mig_init();
|
+ pbs_state_mig_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void migration_cancel(void)
|
void migration_cancel(const Error *error)
|
||||||
diff --git a/migration/pbs-state.c b/migration/pbs-state.c
|
diff --git a/migration/pbs-state.c b/migration/pbs-state.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..29f2b3860d
|
index 0000000000..29f2b3860d
|
||||||
@@ -175,7 +175,7 @@ index 0000000000..29f2b3860d
|
|||||||
+ NULL);
|
+ NULL);
|
||||||
+}
|
+}
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
index 9c20ef3a5e..59ccb38ceb 100644
|
index 6f05796fad..5fa3cc1352 100644
|
||||||
--- a/pve-backup.c
|
--- a/pve-backup.c
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -1132,6 +1132,7 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
|
@@ -1132,6 +1132,7 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
|
||||||
@@ -187,10 +187,10 @@ index 9c20ef3a5e..59ccb38ceb 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index a0d1d278e9..e5de769dc1 100644
|
index cb17d00fe0..bd978ea562 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -838,6 +838,11 @@
|
@@ -879,6 +879,11 @@
|
||||||
# @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can
|
# @pbs-dirty-bitmap-savevm: True if 'dirty-bitmaps' migration capability can
|
||||||
# safely be set for savevm-async.
|
# safely be set for savevm-async.
|
||||||
#
|
#
|
||||||
@@ -202,7 +202,7 @@ index a0d1d278e9..e5de769dc1 100644
|
|||||||
# @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
|
# @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
@@ -845,6 +850,7 @@
|
@@ -886,6 +891,7 @@
|
||||||
'data': { 'pbs-dirty-bitmap': 'bool',
|
'data': { 'pbs-dirty-bitmap': 'bool',
|
||||||
'query-bitmap-info': 'bool',
|
'query-bitmap-info': 'bool',
|
||||||
'pbs-dirty-bitmap-savevm': 'bool',
|
'pbs-dirty-bitmap-savevm': 'bool',
|
@@ -19,7 +19,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
|
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
|
||||||
index 35f5ef688d..c4640925e7 100644
|
index 9aba7d9c22..f4ecf9c9f9 100644
|
||||||
--- a/migration/block-dirty-bitmap.c
|
--- a/migration/block-dirty-bitmap.c
|
||||||
+++ b/migration/block-dirty-bitmap.c
|
+++ b/migration/block-dirty-bitmap.c
|
||||||
@@ -538,7 +538,7 @@ static int add_bitmaps_to_list(DBMSaveState *s, BlockDriverState *bs,
|
@@ -538,7 +538,7 @@ static int add_bitmaps_to_list(DBMSaveState *s, BlockDriverState *bs,
|
@@ -21,10 +21,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 30 insertions(+)
|
1 file changed, 30 insertions(+)
|
||||||
|
|
||||||
diff --git a/block/iscsi.c b/block/iscsi.c
|
diff --git a/block/iscsi.c b/block/iscsi.c
|
||||||
index 4d2a416ce7..c345d30812 100644
|
index d707d0b354..da6ed52323 100644
|
||||||
--- a/block/iscsi.c
|
--- a/block/iscsi.c
|
||||||
+++ b/block/iscsi.c
|
+++ b/block/iscsi.c
|
||||||
@@ -1372,12 +1372,42 @@ static char *get_initiator_name(QemuOpts *opts)
|
@@ -1386,12 +1386,42 @@ static char *get_initiator_name(QemuOpts *opts)
|
||||||
const char *name;
|
const char *name;
|
||||||
char *iscsi_name;
|
char *iscsi_name;
|
||||||
UuidInfo *uuid_info;
|
UuidInfo *uuid_info;
|
@@ -32,7 +32,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
5 files changed, 77 insertions(+), 196 deletions(-)
|
5 files changed, 77 insertions(+), 196 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
||||||
index 69254396d5..b838586fc0 100644
|
index ea7b665aa2..ef45552e3b 100644
|
||||||
--- a/block/monitor/block-hmp-cmds.c
|
--- a/block/monitor/block-hmp-cmds.c
|
||||||
+++ b/block/monitor/block-hmp-cmds.c
|
+++ b/block/monitor/block-hmp-cmds.c
|
||||||
@@ -1016,7 +1016,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
|
@@ -1016,7 +1016,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
|
||||||
@@ -54,10 +54,10 @@ index 69254396d5..b838586fc0 100644
|
|||||||
Error *error = NULL;
|
Error *error = NULL;
|
||||||
|
|
||||||
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
diff --git a/hmp-commands.hx b/hmp-commands.hx
|
||||||
index 7faba36b39..dca4e58858 100644
|
index 97f24942b3..7a2be816da 100644
|
||||||
--- a/hmp-commands.hx
|
--- a/hmp-commands.hx
|
||||||
+++ b/hmp-commands.hx
|
+++ b/hmp-commands.hx
|
||||||
@@ -109,6 +109,7 @@ ERST
|
@@ -111,6 +111,7 @@ ERST
|
||||||
"\n\t\t\t Use -d to dump data into a directory instead"
|
"\n\t\t\t Use -d to dump data into a directory instead"
|
||||||
"\n\t\t\t of using VMA format.",
|
"\n\t\t\t of using VMA format.",
|
||||||
.cmd = hmp_backup,
|
.cmd = hmp_backup,
|
||||||
@@ -65,7 +65,7 @@ index 7faba36b39..dca4e58858 100644
|
|||||||
},
|
},
|
||||||
|
|
||||||
SRST
|
SRST
|
||||||
@@ -122,6 +123,7 @@ ERST
|
@@ -124,6 +125,7 @@ ERST
|
||||||
.params = "",
|
.params = "",
|
||||||
.help = "cancel the current VM backup",
|
.help = "cancel the current VM backup",
|
||||||
.cmd = hmp_backup_cancel,
|
.cmd = hmp_backup_cancel,
|
||||||
@@ -116,7 +116,7 @@ index 4ce7bc0b5e..0923037dec 100644
|
|||||||
static void proxmox_backup_schedule_wake(void *data) {
|
static void proxmox_backup_schedule_wake(void *data) {
|
||||||
CoCtxData *waker = (CoCtxData *)data;
|
CoCtxData *waker = (CoCtxData *)data;
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
index 59ccb38ceb..f858003a06 100644
|
index 5fa3cc1352..323014744c 100644
|
||||||
--- a/pve-backup.c
|
--- a/pve-backup.c
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -357,7 +357,7 @@ static void job_cancel_bh(void *opaque) {
|
@@ -357,7 +357,7 @@ static void job_cancel_bh(void *opaque) {
|
||||||
@@ -575,10 +575,10 @@ index 59ccb38ceb..f858003a06 100644
|
|||||||
|
|
||||||
BackupStatus *qmp_query_backup(Error **errp)
|
BackupStatus *qmp_query_backup(Error **errp)
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index e5de769dc1..afa67c28d2 100644
|
index bd978ea562..ca1966f54b 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -801,7 +801,7 @@
|
@@ -842,7 +842,7 @@
|
||||||
'*config-file': 'str',
|
'*config-file': 'str',
|
||||||
'*firewall-file': 'str',
|
'*firewall-file': 'str',
|
||||||
'*devlist': 'str', '*speed': 'int' },
|
'*devlist': 'str', '*speed': 'int' },
|
||||||
@@ -587,7 +587,7 @@ index e5de769dc1..afa67c28d2 100644
|
|||||||
|
|
||||||
##
|
##
|
||||||
# @query-backup:
|
# @query-backup:
|
||||||
@@ -823,7 +823,7 @@
|
@@ -864,7 +864,7 @@
|
||||||
# Notes: This command succeeds even if there is no backup process running.
|
# Notes: This command succeeds even if there is no backup process running.
|
||||||
#
|
#
|
||||||
##
|
##
|
@@ -19,7 +19,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
3 files changed, 11 insertions(+)
|
3 files changed, 11 insertions(+)
|
||||||
|
|
||||||
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
||||||
index b838586fc0..5b52b93232 100644
|
index ef45552e3b..4c799f00d9 100644
|
||||||
--- a/block/monitor/block-hmp-cmds.c
|
--- a/block/monitor/block-hmp-cmds.c
|
||||||
+++ b/block/monitor/block-hmp-cmds.c
|
+++ b/block/monitor/block-hmp-cmds.c
|
||||||
@@ -1039,6 +1039,7 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
|
@@ -1039,6 +1039,7 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
|
||||||
@@ -31,7 +31,7 @@ index b838586fc0..5b52b93232 100644
|
|||||||
false, NULL, // PBS backup-id
|
false, NULL, // PBS backup-id
|
||||||
false, 0, // PBS backup-time
|
false, 0, // PBS backup-time
|
||||||
diff --git a/pve-backup.c b/pve-backup.c
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
index f858003a06..04ebfc1e33 100644
|
index 323014744c..9f6c04a512 100644
|
||||||
--- a/pve-backup.c
|
--- a/pve-backup.c
|
||||||
+++ b/pve-backup.c
|
+++ b/pve-backup.c
|
||||||
@@ -533,6 +533,7 @@ UuidInfo coroutine_fn *qmp_backup(
|
@@ -533,6 +533,7 @@ UuidInfo coroutine_fn *qmp_backup(
|
||||||
@@ -58,10 +58,10 @@ index f858003a06..04ebfc1e33 100644
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
index afa67c28d2..84e4406d21 100644
|
index ca1966f54b..fc8a125451 100644
|
||||||
--- a/qapi/block-core.json
|
--- a/qapi/block-core.json
|
||||||
+++ b/qapi/block-core.json
|
+++ b/qapi/block-core.json
|
||||||
@@ -772,6 +772,8 @@
|
@@ -813,6 +813,8 @@
|
||||||
#
|
#
|
||||||
# @key-password: password for keyfile (optional for format 'pbs')
|
# @key-password: password for keyfile (optional for format 'pbs')
|
||||||
#
|
#
|
||||||
@@ -70,7 +70,7 @@ index afa67c28d2..84e4406d21 100644
|
|||||||
# @fingerprint: server cert fingerprint (optional for format 'pbs')
|
# @fingerprint: server cert fingerprint (optional for format 'pbs')
|
||||||
#
|
#
|
||||||
# @backup-id: backup ID (required for format 'pbs')
|
# @backup-id: backup ID (required for format 'pbs')
|
||||||
@@ -791,6 +793,7 @@
|
@@ -832,6 +834,7 @@
|
||||||
'*password': 'str',
|
'*password': 'str',
|
||||||
'*keyfile': 'str',
|
'*keyfile': 'str',
|
||||||
'*key-password': 'str',
|
'*key-password': 'str',
|
||||||
@@ -78,7 +78,7 @@ index afa67c28d2..84e4406d21 100644
|
|||||||
'*fingerprint': 'str',
|
'*fingerprint': 'str',
|
||||||
'*backup-id': 'str',
|
'*backup-id': 'str',
|
||||||
'*backup-time': 'int',
|
'*backup-time': 'int',
|
||||||
@@ -843,6 +846,9 @@
|
@@ -884,6 +887,9 @@
|
||||||
# migration cap if this is false/unset may lead
|
# migration cap if this is false/unset may lead
|
||||||
# to crashes on migration!
|
# to crashes on migration!
|
||||||
#
|
#
|
||||||
@@ -88,7 +88,7 @@ index afa67c28d2..84e4406d21 100644
|
|||||||
# @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
|
# @pbs-library-version: Running version of libproxmox-backup-qemu0 library.
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
@@ -851,6 +857,7 @@
|
@@ -892,6 +898,7 @@
|
||||||
'query-bitmap-info': 'bool',
|
'query-bitmap-info': 'bool',
|
||||||
'pbs-dirty-bitmap-savevm': 'bool',
|
'pbs-dirty-bitmap-savevm': 'bool',
|
||||||
'pbs-dirty-bitmap-migration': 'bool',
|
'pbs-dirty-bitmap-migration': 'bool',
|
@@ -17,7 +17,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 14 insertions(+), 3 deletions(-)
|
1 file changed, 14 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
diff --git a/block/pbs.c b/block/pbs.c
|
diff --git a/block/pbs.c b/block/pbs.c
|
||||||
index 78dad0dcc4..ac54e816c0 100644
|
index 0b05ea9080..c5eb4d5bad 100644
|
||||||
--- a/block/pbs.c
|
--- a/block/pbs.c
|
||||||
+++ b/block/pbs.c
|
+++ b/block/pbs.c
|
||||||
@@ -200,7 +200,16 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs,
|
@@ -200,7 +200,16 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs,
|
||||||
@@ -36,9 +36,9 @@ index 78dad0dcc4..ac54e816c0 100644
|
|||||||
+ buf = g_malloc(bytes);
|
+ buf = g_malloc(bytes);
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
ReadCallbackData rcb = {
|
if (offset < 0 || bytes < 0) {
|
||||||
.co = qemu_coroutine_self(),
|
fprintf(stderr, "unexpected negative 'offset' or 'bytes' value!\n");
|
||||||
@@ -218,8 +227,10 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs,
|
@@ -223,8 +232,10 @@ static coroutine_fn int pbs_co_preadv(BlockDriverState *bs,
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,5 +49,5 @@ index 78dad0dcc4..ac54e816c0 100644
|
|||||||
+ g_free(buf);
|
+ g_free(buf);
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
@@ -11,7 +11,7 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/block/stream.c b/block/stream.c
|
diff --git a/block/stream.c b/block/stream.c
|
||||||
index 97bee482dc..50093c9f57 100644
|
index 694709bd25..e09bd5c4ef 100644
|
||||||
--- a/block/stream.c
|
--- a/block/stream.c
|
||||||
+++ b/block/stream.c
|
+++ b/block/stream.c
|
||||||
@@ -28,7 +28,7 @@ enum {
|
@@ -28,7 +28,7 @@ enum {
|
@@ -17,10 +17,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 4 insertions(+)
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
diff --git a/block/io.c b/block/io.c
|
diff --git a/block/io.c b/block/io.c
|
||||||
index f38e7f81d8..28c3a712b6 100644
|
index 0a8cbefe86..531b3b7a2d 100644
|
||||||
--- a/block/io.c
|
--- a/block/io.c
|
||||||
+++ b/block/io.c
|
+++ b/block/io.c
|
||||||
@@ -1764,6 +1764,10 @@ static int bdrv_pad_request(BlockDriverState *bs,
|
@@ -1734,6 +1734,10 @@ static int bdrv_pad_request(BlockDriverState *bs,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
@@ -24,18 +24,21 @@ once the backing image is removed. It will be replaced by 'file'.
|
|||||||
|
|
||||||
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
|
||||||
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
[FE: adapt to changed function signatures
|
||||||
|
make error return value consistent with QEMU]
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
---
|
---
|
||||||
block/alloc-track.c | 345 ++++++++++++++++++++++++++++++++++++++++++++
|
block/alloc-track.c | 350 ++++++++++++++++++++++++++++++++++++++++++++
|
||||||
block/meson.build | 1 +
|
block/meson.build | 1 +
|
||||||
2 files changed, 346 insertions(+)
|
2 files changed, 351 insertions(+)
|
||||||
create mode 100644 block/alloc-track.c
|
create mode 100644 block/alloc-track.c
|
||||||
|
|
||||||
diff --git a/block/alloc-track.c b/block/alloc-track.c
|
diff --git a/block/alloc-track.c b/block/alloc-track.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000..35f2737c89
|
index 0000000000..43d40d11af
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/block/alloc-track.c
|
+++ b/block/alloc-track.c
|
||||||
@@ -0,0 +1,345 @@
|
@@ -0,0 +1,350 @@
|
||||||
+/*
|
+/*
|
||||||
+ * Node to allow backing images to be applied to any node. Assumes a blank
|
+ * Node to allow backing images to be applied to any node. Assumes a blank
|
||||||
+ * image to begin with, only new writes are tracked as allocated, thus this
|
+ * image to begin with, only new writes are tracked as allocated, thus this
|
||||||
@@ -166,7 +169,7 @@ index 0000000000..35f2737c89
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int coroutine_fn track_co_preadv(BlockDriverState *bs,
|
+static int coroutine_fn track_co_preadv(BlockDriverState *bs,
|
||||||
+ uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)
|
+ int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||||
+{
|
+{
|
||||||
+ BDRVAllocTrackState *s = bs->opaque;
|
+ BDRVAllocTrackState *s = bs->opaque;
|
||||||
+ QEMUIOVector local_qiov;
|
+ QEMUIOVector local_qiov;
|
||||||
@@ -177,6 +180,11 @@ index 0000000000..35f2737c89
|
|||||||
+ int64_t local_bytes;
|
+ int64_t local_bytes;
|
||||||
+ bool alloc;
|
+ bool alloc;
|
||||||
+
|
+
|
||||||
|
+ if (offset < 0 || bytes < 0) {
|
||||||
|
+ fprintf(stderr, "unexpected negative 'offset' or 'bytes' value!\n");
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ /* a read request can span multiple granularity-sized chunks, and can thus
|
+ /* a read request can span multiple granularity-sized chunks, and can thus
|
||||||
+ * contain blocks with different allocation status - we could just iterate
|
+ * contain blocks with different allocation status - we could just iterate
|
||||||
+ * granularity-wise, but for better performance use bdrv_dirty_bitmap_next_X
|
+ * granularity-wise, but for better performance use bdrv_dirty_bitmap_next_X
|
||||||
@@ -219,21 +227,21 @@ index 0000000000..35f2737c89
|
|||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int coroutine_fn track_co_pwritev(BlockDriverState *bs,
|
+static int coroutine_fn track_co_pwritev(BlockDriverState *bs,
|
||||||
+ uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags)
|
+ int64_t offset, int64_t bytes, QEMUIOVector *qiov, BdrvRequestFlags flags)
|
||||||
+{
|
+{
|
||||||
+ return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags);
|
+ return bdrv_co_pwritev(bs->file, offset, bytes, qiov, flags);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int coroutine_fn track_co_pwrite_zeroes(BlockDriverState *bs,
|
+static int coroutine_fn track_co_pwrite_zeroes(BlockDriverState *bs,
|
||||||
+ int64_t offset, int count, BdrvRequestFlags flags)
|
+ int64_t offset, int64_t bytes, BdrvRequestFlags flags)
|
||||||
+{
|
+{
|
||||||
+ return bdrv_co_pwrite_zeroes(bs->file, offset, count, flags);
|
+ return bdrv_co_pwrite_zeroes(bs->file, offset, bytes, flags);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int coroutine_fn track_co_pdiscard(BlockDriverState *bs,
|
+static int coroutine_fn track_co_pdiscard(BlockDriverState *bs,
|
||||||
+ int64_t offset, int count)
|
+ int64_t offset, int64_t bytes)
|
||||||
+{
|
+{
|
||||||
+ return bdrv_co_pdiscard(bs->file, offset, count);
|
+ return bdrv_co_pdiscard(bs->file, offset, bytes);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static coroutine_fn int track_co_flush(BlockDriverState *bs)
|
+static coroutine_fn int track_co_flush(BlockDriverState *bs)
|
||||||
@@ -382,7 +390,7 @@ index 0000000000..35f2737c89
|
|||||||
+
|
+
|
||||||
+block_init(bdrv_alloc_track_init);
|
+block_init(bdrv_alloc_track_init);
|
||||||
diff --git a/block/meson.build b/block/meson.build
|
diff --git a/block/meson.build b/block/meson.build
|
||||||
index e3ed5ac97c..d1ee260048 100644
|
index a26a69434e..74e5f49758 100644
|
||||||
--- a/block/meson.build
|
--- a/block/meson.build
|
||||||
+++ b/block/meson.build
|
+++ b/block/meson.build
|
||||||
@@ -2,6 +2,7 @@ block_ss.add(genh)
|
@@ -2,6 +2,7 @@ block_ss.add(genh)
|
@@ -10,10 +10,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/qapi/pragma.json b/qapi/pragma.json
|
diff --git a/qapi/pragma.json b/qapi/pragma.json
|
||||||
index 7c91ea3685..c3888d654c 100644
|
index a2358e303a..9ff5c84ffd 100644
|
||||||
--- a/qapi/pragma.json
|
--- a/qapi/pragma.json
|
||||||
+++ b/qapi/pragma.json
|
+++ b/qapi/pragma.json
|
||||||
@@ -12,6 +12,7 @@
|
@@ -15,6 +15,7 @@
|
||||||
'device_add',
|
'device_add',
|
||||||
'device_del',
|
'device_del',
|
||||||
'expire_password',
|
'expire_password',
|
||||||
@@ -21,7 +21,7 @@ index 7c91ea3685..c3888d654c 100644
|
|||||||
'migrate_cancel',
|
'migrate_cancel',
|
||||||
'netdev_add',
|
'netdev_add',
|
||||||
'netdev_del',
|
'netdev_del',
|
||||||
@@ -60,6 +61,8 @@
|
@@ -64,6 +65,8 @@
|
||||||
'SysEmuTarget', # query-cpu-fast, query-target
|
'SysEmuTarget', # query-cpu-fast, query-target
|
||||||
'UuidInfo', # query-uuid
|
'UuidInfo', # query-uuid
|
||||||
'VncClientInfo', # query-vnc, query-vnc-servers, ...
|
'VncClientInfo', # query-vnc, query-vnc-servers, ...
|
@@ -11,10 +11,10 @@ Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
|||||||
1 file changed, 5 insertions(+)
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
|
diff --git a/migration/savevm-async.c b/migration/savevm-async.c
|
||||||
index 970ee3b3fc..b3ccc069f1 100644
|
index e65a5e3482..2ed2536816 100644
|
||||||
--- a/migration/savevm-async.c
|
--- a/migration/savevm-async.c
|
||||||
+++ b/migration/savevm-async.c
|
+++ b/migration/savevm-async.c
|
||||||
@@ -19,6 +19,7 @@
|
@@ -20,6 +20,7 @@
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
#include "qemu/rcu.h"
|
#include "qemu/rcu.h"
|
||||||
@@ -22,7 +22,7 @@ index 970ee3b3fc..b3ccc069f1 100644
|
|||||||
|
|
||||||
/* #define DEBUG_SAVEVM_STATE */
|
/* #define DEBUG_SAVEVM_STATE */
|
||||||
|
|
||||||
@@ -580,6 +581,10 @@ int load_snapshot_from_blockdev(const char *filename, Error **errp)
|
@@ -514,6 +515,10 @@ int load_snapshot_from_blockdev(const char *filename, Error **errp)
|
||||||
dirty_bitmap_mig_before_vm_start();
|
dirty_bitmap_mig_before_vm_start();
|
||||||
|
|
||||||
qemu_fclose(f);
|
qemu_fclose(f);
|
130
debian/patches/pve/0051-qemu-img-dd-add-l-option-for-loading-a-snapshot.patch
vendored
Normal file
130
debian/patches/pve/0051-qemu-img-dd-add-l-option-for-loading-a-snapshot.patch
vendored
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Mon, 7 Feb 2022 14:21:01 +0100
|
||||||
|
Subject: [PATCH] qemu-img: dd: add -l option for loading a snapshot
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
---
|
||||||
|
docs/tools/qemu-img.rst | 6 +++---
|
||||||
|
qemu-img-cmds.hx | 4 ++--
|
||||||
|
qemu-img.c | 33 +++++++++++++++++++++++++++++++--
|
||||||
|
3 files changed, 36 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
|
||||||
|
index 699229eef6..4189ced8bc 100644
|
||||||
|
--- a/docs/tools/qemu-img.rst
|
||||||
|
+++ b/docs/tools/qemu-img.rst
|
||||||
|
@@ -492,10 +492,10 @@ Command description:
|
||||||
|
it doesn't need to be specified separately in this case.
|
||||||
|
|
||||||
|
|
||||||
|
-.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [-n] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] if=INPUT of=OUTPUT
|
||||||
|
+.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [-n] [-l SNAPSHOT_PARAM] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] if=INPUT of=OUTPUT
|
||||||
|
|
||||||
|
- dd copies from *INPUT* file to *OUTPUT* file converting it from
|
||||||
|
- *FMT* format to *OUTPUT_FMT* format.
|
||||||
|
+ dd copies from *INPUT* file or snapshot *SNAPSHOT_PARAM* to *OUTPUT* file
|
||||||
|
+ converting it from *FMT* format to *OUTPUT_FMT* format.
|
||||||
|
|
||||||
|
The data is by default read and written using blocks of 512 bytes but can be
|
||||||
|
modified by specifying *BLOCK_SIZE*. If count=\ *BLOCKS* is specified
|
||||||
|
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
|
||||||
|
index b5b0bb4467..36f97e1f19 100644
|
||||||
|
--- a/qemu-img-cmds.hx
|
||||||
|
+++ b/qemu-img-cmds.hx
|
||||||
|
@@ -58,9 +58,9 @@ SRST
|
||||||
|
ERST
|
||||||
|
|
||||||
|
DEF("dd", img_dd,
|
||||||
|
- "dd [--image-opts] [-U] [-f fmt] [-O output_fmt] [-n] [bs=block_size] [count=blocks] [skip=blocks] [osize=output_size] if=input of=output")
|
||||||
|
+ "dd [--image-opts] [-U] [-f fmt] [-O output_fmt] [-n] [-l snapshot_param] [bs=block_size] [count=blocks] [skip=blocks] [osize=output_size] if=input of=output")
|
||||||
|
SRST
|
||||||
|
-.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [-n] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] [osize=OUTPUT_SIZE] if=INPUT of=OUTPUT
|
||||||
|
+.. option:: dd [--image-opts] [-U] [-f FMT] [-O OUTPUT_FMT] [-n] [-l SNAPSHOT_PARAM] [bs=BLOCK_SIZE] [count=BLOCKS] [skip=BLOCKS] [osize=OUTPUT_SIZE] if=INPUT of=OUTPUT
|
||||||
|
ERST
|
||||||
|
|
||||||
|
DEF("info", img_info,
|
||||||
|
diff --git a/qemu-img.c b/qemu-img.c
|
||||||
|
index c6b4a5567d..041c203fc3 100644
|
||||||
|
--- a/qemu-img.c
|
||||||
|
+++ b/qemu-img.c
|
||||||
|
@@ -4943,6 +4943,7 @@ static int img_dd(int argc, char **argv)
|
||||||
|
BlockDriver *drv = NULL, *proto_drv = NULL;
|
||||||
|
BlockBackend *blk1 = NULL, *blk2 = NULL;
|
||||||
|
QemuOpts *opts = NULL;
|
||||||
|
+ QemuOpts *sn_opts = NULL;
|
||||||
|
QemuOptsList *create_opts = NULL;
|
||||||
|
Error *local_err = NULL;
|
||||||
|
bool image_opts = false;
|
||||||
|
@@ -4952,6 +4953,7 @@ static int img_dd(int argc, char **argv)
|
||||||
|
int64_t size = 0, readsize = 0;
|
||||||
|
int64_t block_count = 0, out_pos, in_pos;
|
||||||
|
bool force_share = false, skip_create = false;
|
||||||
|
+ const char *snapshot_name = NULL;
|
||||||
|
struct DdInfo dd = {
|
||||||
|
.flags = 0,
|
||||||
|
.count = 0,
|
||||||
|
@@ -4989,7 +4991,7 @@ static int img_dd(int argc, char **argv)
|
||||||
|
{ 0, 0, 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
- while ((c = getopt_long(argc, argv, ":hf:O:Un", long_options, NULL))) {
|
||||||
|
+ while ((c = getopt_long(argc, argv, ":hf:O:l:Un", long_options, NULL))) {
|
||||||
|
if (c == EOF) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -5012,6 +5014,19 @@ static int img_dd(int argc, char **argv)
|
||||||
|
case 'n':
|
||||||
|
skip_create = true;
|
||||||
|
break;
|
||||||
|
+ case 'l':
|
||||||
|
+ if (strstart(optarg, SNAPSHOT_OPT_BASE, NULL)) {
|
||||||
|
+ sn_opts = qemu_opts_parse_noisily(&internal_snapshot_opts,
|
||||||
|
+ optarg, false);
|
||||||
|
+ if (!sn_opts) {
|
||||||
|
+ error_report("Failed in parsing snapshot param '%s'",
|
||||||
|
+ optarg);
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ snapshot_name = optarg;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
case 'U':
|
||||||
|
force_share = true;
|
||||||
|
break;
|
||||||
|
@@ -5071,11 +5086,24 @@ static int img_dd(int argc, char **argv)
|
||||||
|
if (dd.flags & C_IF) {
|
||||||
|
blk1 = img_open(image_opts, in.filename, fmt, 0, false, false,
|
||||||
|
force_share);
|
||||||
|
-
|
||||||
|
if (!blk1) {
|
||||||
|
ret = -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
+ if (sn_opts) {
|
||||||
|
+ bdrv_snapshot_load_tmp(blk_bs(blk1),
|
||||||
|
+ qemu_opt_get(sn_opts, SNAPSHOT_OPT_ID),
|
||||||
|
+ qemu_opt_get(sn_opts, SNAPSHOT_OPT_NAME),
|
||||||
|
+ &local_err);
|
||||||
|
+ } else if (snapshot_name != NULL) {
|
||||||
|
+ bdrv_snapshot_load_tmp_by_id_or_name(blk_bs(blk1), snapshot_name,
|
||||||
|
+ &local_err);
|
||||||
|
+ }
|
||||||
|
+ if (local_err) {
|
||||||
|
+ error_reportf_err(local_err, "Failed to load snapshot: ");
|
||||||
|
+ ret = -1;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dd.flags & C_OSIZE) {
|
||||||
|
@@ -5230,6 +5258,7 @@ static int img_dd(int argc, char **argv)
|
||||||
|
out:
|
||||||
|
g_free(arg);
|
||||||
|
qemu_opts_del(opts);
|
||||||
|
+ qemu_opts_del(sn_opts);
|
||||||
|
qemu_opts_free(create_opts);
|
||||||
|
blk_unref(blk1);
|
||||||
|
blk_unref(blk2);
|
407
debian/patches/pve/0052-vma-allow-partial-restore.patch
vendored
Normal file
407
debian/patches/pve/0052-vma-allow-partial-restore.patch
vendored
Normal file
@@ -0,0 +1,407 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Thu, 21 Apr 2022 13:26:48 +0200
|
||||||
|
Subject: [PATCH] vma: allow partial restore
|
||||||
|
|
||||||
|
Introduce a new map line for skipping a certain drive, of the form
|
||||||
|
skip=drive-scsi0
|
||||||
|
|
||||||
|
Since in PVE, most archives are compressed and piped to vma for
|
||||||
|
restore, it's not easily possible to skip reads.
|
||||||
|
|
||||||
|
For the reader, a new skip flag for VmaRestoreState is added and the
|
||||||
|
target is allowed to be NULL if skip is specified when registering. If
|
||||||
|
the skip flag is set, no writes will be made as well as no check for
|
||||||
|
duplicate clusters. Therefore, the flag is not set for verify.
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||||
|
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
|
||||||
|
---
|
||||||
|
vma-reader.c | 64 ++++++++++++---------
|
||||||
|
vma.c | 157 +++++++++++++++++++++++++++++----------------------
|
||||||
|
vma.h | 2 +-
|
||||||
|
3 files changed, 126 insertions(+), 97 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/vma-reader.c b/vma-reader.c
|
||||||
|
index e65f1e8415..81a891c6b1 100644
|
||||||
|
--- a/vma-reader.c
|
||||||
|
+++ b/vma-reader.c
|
||||||
|
@@ -28,6 +28,7 @@ typedef struct VmaRestoreState {
|
||||||
|
bool write_zeroes;
|
||||||
|
unsigned long *bitmap;
|
||||||
|
int bitmap_size;
|
||||||
|
+ bool skip;
|
||||||
|
} VmaRestoreState;
|
||||||
|
|
||||||
|
struct VmaReader {
|
||||||
|
@@ -425,13 +426,14 @@ VmaDeviceInfo *vma_reader_get_device_info(VmaReader *vmar, guint8 dev_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void allocate_rstate(VmaReader *vmar, guint8 dev_id,
|
||||||
|
- BlockBackend *target, bool write_zeroes)
|
||||||
|
+ BlockBackend *target, bool write_zeroes, bool skip)
|
||||||
|
{
|
||||||
|
assert(vmar);
|
||||||
|
assert(dev_id);
|
||||||
|
|
||||||
|
vmar->rstate[dev_id].target = target;
|
||||||
|
vmar->rstate[dev_id].write_zeroes = write_zeroes;
|
||||||
|
+ vmar->rstate[dev_id].skip = skip;
|
||||||
|
|
||||||
|
int64_t size = vmar->devinfo[dev_id].size;
|
||||||
|
|
||||||
|
@@ -446,28 +448,30 @@ static void allocate_rstate(VmaReader *vmar, guint8 dev_id,
|
||||||
|
}
|
||||||
|
|
||||||
|
int vma_reader_register_bs(VmaReader *vmar, guint8 dev_id, BlockBackend *target,
|
||||||
|
- bool write_zeroes, Error **errp)
|
||||||
|
+ bool write_zeroes, bool skip, Error **errp)
|
||||||
|
{
|
||||||
|
assert(vmar);
|
||||||
|
- assert(target != NULL);
|
||||||
|
+ assert(target != NULL || skip);
|
||||||
|
assert(dev_id);
|
||||||
|
- assert(vmar->rstate[dev_id].target == NULL);
|
||||||
|
-
|
||||||
|
- int64_t size = blk_getlength(target);
|
||||||
|
- int64_t size_diff = size - vmar->devinfo[dev_id].size;
|
||||||
|
-
|
||||||
|
- /* storage types can have different size restrictions, so it
|
||||||
|
- * is not always possible to create an image with exact size.
|
||||||
|
- * So we tolerate a size difference up to 4MB.
|
||||||
|
- */
|
||||||
|
- if ((size_diff < 0) || (size_diff > 4*1024*1024)) {
|
||||||
|
- error_setg(errp, "vma_reader_register_bs for stream %s failed - "
|
||||||
|
- "unexpected size %zd != %zd", vmar->devinfo[dev_id].devname,
|
||||||
|
- size, vmar->devinfo[dev_id].size);
|
||||||
|
- return -1;
|
||||||
|
+ assert(vmar->rstate[dev_id].target == NULL && !vmar->rstate[dev_id].skip);
|
||||||
|
+
|
||||||
|
+ if (target != NULL) {
|
||||||
|
+ int64_t size = blk_getlength(target);
|
||||||
|
+ int64_t size_diff = size - vmar->devinfo[dev_id].size;
|
||||||
|
+
|
||||||
|
+ /* storage types can have different size restrictions, so it
|
||||||
|
+ * is not always possible to create an image with exact size.
|
||||||
|
+ * So we tolerate a size difference up to 4MB.
|
||||||
|
+ */
|
||||||
|
+ if ((size_diff < 0) || (size_diff > 4*1024*1024)) {
|
||||||
|
+ error_setg(errp, "vma_reader_register_bs for stream %s failed - "
|
||||||
|
+ "unexpected size %zd != %zd", vmar->devinfo[dev_id].devname,
|
||||||
|
+ size, vmar->devinfo[dev_id].size);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
- allocate_rstate(vmar, dev_id, target, write_zeroes);
|
||||||
|
+ allocate_rstate(vmar, dev_id, target, write_zeroes, skip);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -560,19 +564,23 @@ static int restore_extent(VmaReader *vmar, unsigned char *buf,
|
||||||
|
VmaRestoreState *rstate = &vmar->rstate[dev_id];
|
||||||
|
BlockBackend *target = NULL;
|
||||||
|
|
||||||
|
+ bool skip = rstate->skip;
|
||||||
|
+
|
||||||
|
if (dev_id != vmar->vmstate_stream) {
|
||||||
|
target = rstate->target;
|
||||||
|
- if (!verify && !target) {
|
||||||
|
+ if (!verify && !target && !skip) {
|
||||||
|
error_setg(errp, "got wrong dev id %d", dev_id);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (vma_reader_get_bitmap(rstate, cluster_num)) {
|
||||||
|
- error_setg(errp, "found duplicated cluster %zd for stream %s",
|
||||||
|
- cluster_num, vmar->devinfo[dev_id].devname);
|
||||||
|
- return -1;
|
||||||
|
+ if (!skip) {
|
||||||
|
+ if (vma_reader_get_bitmap(rstate, cluster_num)) {
|
||||||
|
+ error_setg(errp, "found duplicated cluster %zd for stream %s",
|
||||||
|
+ cluster_num, vmar->devinfo[dev_id].devname);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+ vma_reader_set_bitmap(rstate, cluster_num, 1);
|
||||||
|
}
|
||||||
|
- vma_reader_set_bitmap(rstate, cluster_num, 1);
|
||||||
|
|
||||||
|
max_sector = vmar->devinfo[dev_id].size/BDRV_SECTOR_SIZE;
|
||||||
|
} else {
|
||||||
|
@@ -618,7 +626,7 @@ static int restore_extent(VmaReader *vmar, unsigned char *buf,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!verify) {
|
||||||
|
+ if (!verify && !skip) {
|
||||||
|
int nb_sectors = end_sector - sector_num;
|
||||||
|
if (restore_write_data(vmar, dev_id, target, vmstate_fd,
|
||||||
|
buf + start, sector_num, nb_sectors,
|
||||||
|
@@ -654,7 +662,7 @@ static int restore_extent(VmaReader *vmar, unsigned char *buf,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!verify) {
|
||||||
|
+ if (!verify && !skip) {
|
||||||
|
int nb_sectors = end_sector - sector_num;
|
||||||
|
if (restore_write_data(vmar, dev_id, target, vmstate_fd,
|
||||||
|
buf + start, sector_num,
|
||||||
|
@@ -679,7 +687,7 @@ static int restore_extent(VmaReader *vmar, unsigned char *buf,
|
||||||
|
vmar->partial_zero_cluster_data += zero_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (rstate->write_zeroes && !verify) {
|
||||||
|
+ if (rstate->write_zeroes && !verify && !skip) {
|
||||||
|
if (restore_write_data(vmar, dev_id, target, vmstate_fd,
|
||||||
|
zero_vma_block, sector_num,
|
||||||
|
nb_sectors, errp) < 0) {
|
||||||
|
@@ -850,7 +858,7 @@ int vma_reader_verify(VmaReader *vmar, bool verbose, Error **errp)
|
||||||
|
|
||||||
|
for (dev_id = 1; dev_id < 255; dev_id++) {
|
||||||
|
if (vma_reader_get_device_info(vmar, dev_id)) {
|
||||||
|
- allocate_rstate(vmar, dev_id, NULL, false);
|
||||||
|
+ allocate_rstate(vmar, dev_id, NULL, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/vma.c b/vma.c
|
||||||
|
index e8dffb43e0..e6e9ffc7fe 100644
|
||||||
|
--- a/vma.c
|
||||||
|
+++ b/vma.c
|
||||||
|
@@ -138,6 +138,7 @@ typedef struct RestoreMap {
|
||||||
|
char *throttling_group;
|
||||||
|
char *cache;
|
||||||
|
bool write_zero;
|
||||||
|
+ bool skip;
|
||||||
|
} RestoreMap;
|
||||||
|
|
||||||
|
static bool try_parse_option(char **line, const char *optname, char **out, const char *inbuf) {
|
||||||
|
@@ -245,47 +246,61 @@ static int extract_content(int argc, char **argv)
|
||||||
|
char *bps = NULL;
|
||||||
|
char *group = NULL;
|
||||||
|
char *cache = NULL;
|
||||||
|
+ char *devname = NULL;
|
||||||
|
+ bool skip = false;
|
||||||
|
+ uint64_t bps_value = 0;
|
||||||
|
+ const char *path = NULL;
|
||||||
|
+ bool write_zero = true;
|
||||||
|
+
|
||||||
|
if (!line || line[0] == '\0' || !strcmp(line, "done\n")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int len = strlen(line);
|
||||||
|
if (line[len - 1] == '\n') {
|
||||||
|
line[len - 1] = '\0';
|
||||||
|
- if (len == 1) {
|
||||||
|
+ len = len - 1;
|
||||||
|
+ if (len == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- while (1) {
|
||||||
|
- if (!try_parse_option(&line, "format", &format, inbuf) &&
|
||||||
|
- !try_parse_option(&line, "throttling.bps", &bps, inbuf) &&
|
||||||
|
- !try_parse_option(&line, "throttling.group", &group, inbuf) &&
|
||||||
|
- !try_parse_option(&line, "cache", &cache, inbuf))
|
||||||
|
- {
|
||||||
|
- break;
|
||||||
|
+ if (strncmp(line, "skip", 4) == 0) {
|
||||||
|
+ if (len < 6 || line[4] != '=') {
|
||||||
|
+ g_error("read map failed - option 'skip' has no value ('%s')",
|
||||||
|
+ inbuf);
|
||||||
|
+ } else {
|
||||||
|
+ devname = line + 5;
|
||||||
|
+ skip = true;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ while (1) {
|
||||||
|
+ if (!try_parse_option(&line, "format", &format, inbuf) &&
|
||||||
|
+ !try_parse_option(&line, "throttling.bps", &bps, inbuf) &&
|
||||||
|
+ !try_parse_option(&line, "throttling.group", &group, inbuf) &&
|
||||||
|
+ !try_parse_option(&line, "cache", &cache, inbuf))
|
||||||
|
+ {
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
|
||||||
|
- uint64_t bps_value = 0;
|
||||||
|
- if (bps) {
|
||||||
|
- bps_value = verify_u64(bps);
|
||||||
|
- g_free(bps);
|
||||||
|
- }
|
||||||
|
+ if (bps) {
|
||||||
|
+ bps_value = verify_u64(bps);
|
||||||
|
+ g_free(bps);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- const char *path;
|
||||||
|
- bool write_zero;
|
||||||
|
- if (line[0] == '0' && line[1] == ':') {
|
||||||
|
- path = line + 2;
|
||||||
|
- write_zero = false;
|
||||||
|
- } else if (line[0] == '1' && line[1] == ':') {
|
||||||
|
- path = line + 2;
|
||||||
|
- write_zero = true;
|
||||||
|
- } else {
|
||||||
|
- g_error("read map failed - parse error ('%s')", inbuf);
|
||||||
|
+ if (line[0] == '0' && line[1] == ':') {
|
||||||
|
+ path = line + 2;
|
||||||
|
+ write_zero = false;
|
||||||
|
+ } else if (line[0] == '1' && line[1] == ':') {
|
||||||
|
+ path = line + 2;
|
||||||
|
+ write_zero = true;
|
||||||
|
+ } else {
|
||||||
|
+ g_error("read map failed - parse error ('%s')", inbuf);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ path = extract_devname(path, &devname, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
- char *devname = NULL;
|
||||||
|
- path = extract_devname(path, &devname, -1);
|
||||||
|
if (!devname) {
|
||||||
|
g_error("read map failed - no dev name specified ('%s')",
|
||||||
|
inbuf);
|
||||||
|
@@ -299,6 +314,7 @@ static int extract_content(int argc, char **argv)
|
||||||
|
map->throttling_group = group;
|
||||||
|
map->cache = cache;
|
||||||
|
map->write_zero = write_zero;
|
||||||
|
+ map->skip = skip;
|
||||||
|
|
||||||
|
g_hash_table_insert(devmap, map->devname, map);
|
||||||
|
|
||||||
|
@@ -328,6 +344,7 @@ static int extract_content(int argc, char **argv)
|
||||||
|
const char *cache = NULL;
|
||||||
|
int flags = BDRV_O_RDWR;
|
||||||
|
bool write_zero = true;
|
||||||
|
+ bool skip = false;
|
||||||
|
|
||||||
|
BlockBackend *blk = NULL;
|
||||||
|
|
||||||
|
@@ -343,6 +360,7 @@ static int extract_content(int argc, char **argv)
|
||||||
|
throttling_group = map->throttling_group;
|
||||||
|
cache = map->cache;
|
||||||
|
write_zero = map->write_zero;
|
||||||
|
+ skip = map->skip;
|
||||||
|
} else {
|
||||||
|
devfn = g_strdup_printf("%s/tmp-disk-%s.raw",
|
||||||
|
dirname, di->devname);
|
||||||
|
@@ -361,57 +379,60 @@ static int extract_content(int argc, char **argv)
|
||||||
|
write_zero = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- size_t devlen = strlen(devfn);
|
||||||
|
- QDict *options = NULL;
|
||||||
|
- bool writethrough;
|
||||||
|
- if (format) {
|
||||||
|
- /* explicit format from commandline */
|
||||||
|
- options = qdict_new();
|
||||||
|
- qdict_put_str(options, "driver", format);
|
||||||
|
- } else if ((devlen > 4 && strcmp(devfn+devlen-4, ".raw") == 0) ||
|
||||||
|
- strncmp(devfn, "/dev/", 5) == 0)
|
||||||
|
- {
|
||||||
|
- /* This part is now deprecated for PVE as well (just as qemu
|
||||||
|
- * deprecated not specifying an explicit raw format, too.
|
||||||
|
- */
|
||||||
|
- /* explicit raw format */
|
||||||
|
- options = qdict_new();
|
||||||
|
- qdict_put_str(options, "driver", "raw");
|
||||||
|
- }
|
||||||
|
- if (cache && bdrv_parse_cache_mode(cache, &flags, &writethrough)) {
|
||||||
|
- g_error("invalid cache option: %s\n", cache);
|
||||||
|
- }
|
||||||
|
+ if (!skip) {
|
||||||
|
+ size_t devlen = strlen(devfn);
|
||||||
|
+ QDict *options = NULL;
|
||||||
|
+ bool writethrough;
|
||||||
|
+ if (format) {
|
||||||
|
+ /* explicit format from commandline */
|
||||||
|
+ options = qdict_new();
|
||||||
|
+ qdict_put_str(options, "driver", format);
|
||||||
|
+ } else if ((devlen > 4 && strcmp(devfn+devlen-4, ".raw") == 0) ||
|
||||||
|
+ strncmp(devfn, "/dev/", 5) == 0)
|
||||||
|
+ {
|
||||||
|
+ /* This part is now deprecated for PVE as well (just as qemu
|
||||||
|
+ * deprecated not specifying an explicit raw format, too.
|
||||||
|
+ */
|
||||||
|
+ /* explicit raw format */
|
||||||
|
+ options = qdict_new();
|
||||||
|
+ qdict_put_str(options, "driver", "raw");
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (errp || !(blk = blk_new_open(devfn, NULL, options, flags, &errp))) {
|
||||||
|
- g_error("can't open file %s - %s", devfn,
|
||||||
|
- error_get_pretty(errp));
|
||||||
|
- }
|
||||||
|
+ if (cache && bdrv_parse_cache_mode(cache, &flags, &writethrough)) {
|
||||||
|
+ g_error("invalid cache option: %s\n", cache);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (cache) {
|
||||||
|
- blk_set_enable_write_cache(blk, !writethrough);
|
||||||
|
- }
|
||||||
|
+ if (errp || !(blk = blk_new_open(devfn, NULL, options, flags, &errp))) {
|
||||||
|
+ g_error("can't open file %s - %s", devfn,
|
||||||
|
+ error_get_pretty(errp));
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (throttling_group) {
|
||||||
|
- blk_io_limits_enable(blk, throttling_group);
|
||||||
|
- }
|
||||||
|
+ if (cache) {
|
||||||
|
+ blk_set_enable_write_cache(blk, !writethrough);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (throttling_bps) {
|
||||||
|
- if (!throttling_group) {
|
||||||
|
- blk_io_limits_enable(blk, devfn);
|
||||||
|
+ if (throttling_group) {
|
||||||
|
+ blk_io_limits_enable(blk, throttling_group);
|
||||||
|
}
|
||||||
|
|
||||||
|
- ThrottleConfig cfg;
|
||||||
|
- throttle_config_init(&cfg);
|
||||||
|
- cfg.buckets[THROTTLE_BPS_WRITE].avg = throttling_bps;
|
||||||
|
- Error *err = NULL;
|
||||||
|
- if (!throttle_is_valid(&cfg, &err)) {
|
||||||
|
- error_report_err(err);
|
||||||
|
- g_error("failed to apply throttling");
|
||||||
|
+ if (throttling_bps) {
|
||||||
|
+ if (!throttling_group) {
|
||||||
|
+ blk_io_limits_enable(blk, devfn);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ThrottleConfig cfg;
|
||||||
|
+ throttle_config_init(&cfg);
|
||||||
|
+ cfg.buckets[THROTTLE_BPS_WRITE].avg = throttling_bps;
|
||||||
|
+ Error *err = NULL;
|
||||||
|
+ if (!throttle_is_valid(&cfg, &err)) {
|
||||||
|
+ error_report_err(err);
|
||||||
|
+ g_error("failed to apply throttling");
|
||||||
|
+ }
|
||||||
|
+ blk_set_io_limits(blk, &cfg);
|
||||||
|
}
|
||||||
|
- blk_set_io_limits(blk, &cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (vma_reader_register_bs(vmar, i, blk, write_zero, &errp) < 0) {
|
||||||
|
+ if (vma_reader_register_bs(vmar, i, blk, write_zero, skip, &errp) < 0) {
|
||||||
|
g_error("%s", error_get_pretty(errp));
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/vma.h b/vma.h
|
||||||
|
index c895c97f6d..1b62859165 100644
|
||||||
|
--- a/vma.h
|
||||||
|
+++ b/vma.h
|
||||||
|
@@ -142,7 +142,7 @@ GList *vma_reader_get_config_data(VmaReader *vmar);
|
||||||
|
VmaDeviceInfo *vma_reader_get_device_info(VmaReader *vmar, guint8 dev_id);
|
||||||
|
int vma_reader_register_bs(VmaReader *vmar, guint8 dev_id,
|
||||||
|
BlockBackend *target, bool write_zeroes,
|
||||||
|
- Error **errp);
|
||||||
|
+ bool skip, Error **errp);
|
||||||
|
int vma_reader_restore(VmaReader *vmar, int vmstate_fd, bool verbose,
|
||||||
|
Error **errp);
|
||||||
|
int vma_reader_verify(VmaReader *vmar, bool verbose, Error **errp);
|
233
debian/patches/pve/0053-pbs-namespace-support.patch
vendored
Normal file
233
debian/patches/pve/0053-pbs-namespace-support.patch
vendored
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||||
|
Date: Tue, 26 Apr 2022 16:06:28 +0200
|
||||||
|
Subject: [PATCH] pbs: namespace support
|
||||||
|
|
||||||
|
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||||
|
---
|
||||||
|
block/monitor/block-hmp-cmds.c | 1 +
|
||||||
|
block/pbs.c | 25 +++++++++++++++++++++----
|
||||||
|
pbs-restore.c | 19 ++++++++++++++++---
|
||||||
|
pve-backup.c | 6 +++++-
|
||||||
|
qapi/block-core.json | 5 ++++-
|
||||||
|
5 files changed, 47 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
||||||
|
index 4c799f00d9..0502f42be6 100644
|
||||||
|
--- a/block/monitor/block-hmp-cmds.c
|
||||||
|
+++ b/block/monitor/block-hmp-cmds.c
|
||||||
|
@@ -1041,6 +1041,7 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
|
||||||
|
false, NULL, // PBS key_password
|
||||||
|
false, NULL, // PBS master_keyfile
|
||||||
|
false, NULL, // PBS fingerprint
|
||||||
|
+ false, NULL, // PBS backup-ns
|
||||||
|
false, NULL, // PBS backup-id
|
||||||
|
false, 0, // PBS backup-time
|
||||||
|
false, false, // PBS use-dirty-bitmap
|
||||||
|
diff --git a/block/pbs.c b/block/pbs.c
|
||||||
|
index c5eb4d5bad..7471e2ef9d 100644
|
||||||
|
--- a/block/pbs.c
|
||||||
|
+++ b/block/pbs.c
|
||||||
|
@@ -14,6 +14,7 @@
|
||||||
|
#include <proxmox-backup-qemu.h>
|
||||||
|
|
||||||
|
#define PBS_OPT_REPOSITORY "repository"
|
||||||
|
+#define PBS_OPT_NAMESPACE "namespace"
|
||||||
|
#define PBS_OPT_SNAPSHOT "snapshot"
|
||||||
|
#define PBS_OPT_ARCHIVE "archive"
|
||||||
|
#define PBS_OPT_KEYFILE "keyfile"
|
||||||
|
@@ -27,6 +28,7 @@ typedef struct {
|
||||||
|
int64_t length;
|
||||||
|
|
||||||
|
char *repository;
|
||||||
|
+ char *namespace;
|
||||||
|
char *snapshot;
|
||||||
|
char *archive;
|
||||||
|
} BDRVPBSState;
|
||||||
|
@@ -40,6 +42,11 @@ static QemuOptsList runtime_opts = {
|
||||||
|
.type = QEMU_OPT_STRING,
|
||||||
|
.help = "The server address and repository to connect to.",
|
||||||
|
},
|
||||||
|
+ {
|
||||||
|
+ .name = PBS_OPT_NAMESPACE,
|
||||||
|
+ .type = QEMU_OPT_STRING,
|
||||||
|
+ .help = "Optional: The snapshot's namespace.",
|
||||||
|
+ },
|
||||||
|
{
|
||||||
|
.name = PBS_OPT_SNAPSHOT,
|
||||||
|
.type = QEMU_OPT_STRING,
|
||||||
|
@@ -76,7 +83,7 @@ static QemuOptsList runtime_opts = {
|
||||||
|
|
||||||
|
|
||||||
|
// filename format:
|
||||||
|
-// pbs:repository=<repo>,snapshot=<snap>,password=<pw>,key_password=<kpw>,fingerprint=<fp>,archive=<archive>
|
||||||
|
+// pbs:repository=<repo>,namespace=<ns>,snapshot=<snap>,password=<pw>,key_password=<kpw>,fingerprint=<fp>,archive=<archive>
|
||||||
|
static void pbs_parse_filename(const char *filename, QDict *options,
|
||||||
|
Error **errp)
|
||||||
|
{
|
||||||
|
@@ -112,6 +119,7 @@ static int pbs_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
|
s->archive = g_strdup(qemu_opt_get(opts, PBS_OPT_ARCHIVE));
|
||||||
|
const char *keyfile = qemu_opt_get(opts, PBS_OPT_KEYFILE);
|
||||||
|
const char *password = qemu_opt_get(opts, PBS_OPT_PASSWORD);
|
||||||
|
+ const char *namespace = qemu_opt_get(opts, PBS_OPT_NAMESPACE);
|
||||||
|
const char *fingerprint = qemu_opt_get(opts, PBS_OPT_FINGERPRINT);
|
||||||
|
const char *key_password = qemu_opt_get(opts, PBS_OPT_ENCRYPTION_PASSWORD);
|
||||||
|
|
||||||
|
@@ -124,9 +132,12 @@ static int pbs_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
|
if (!key_password) {
|
||||||
|
key_password = getenv("PBS_ENCRYPTION_PASSWORD");
|
||||||
|
}
|
||||||
|
+ if (namespace) {
|
||||||
|
+ s->namespace = g_strdup(namespace);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* connect to PBS server in read mode */
|
||||||
|
- s->conn = proxmox_restore_new(s->repository, s->snapshot, password,
|
||||||
|
+ s->conn = proxmox_restore_new_ns(s->repository, s->snapshot, s->namespace, password,
|
||||||
|
keyfile, key_password, fingerprint, &pbs_error);
|
||||||
|
|
||||||
|
/* invalidates qemu_opt_get char pointers from above */
|
||||||
|
@@ -171,6 +182,7 @@ static int pbs_file_open(BlockDriverState *bs, QDict *options, int flags,
|
||||||
|
static void pbs_close(BlockDriverState *bs) {
|
||||||
|
BDRVPBSState *s = bs->opaque;
|
||||||
|
g_free(s->repository);
|
||||||
|
+ g_free(s->namespace);
|
||||||
|
g_free(s->snapshot);
|
||||||
|
g_free(s->archive);
|
||||||
|
proxmox_restore_disconnect(s->conn);
|
||||||
|
@@ -252,8 +264,13 @@ static coroutine_fn int pbs_co_pwritev(BlockDriverState *bs,
|
||||||
|
static void pbs_refresh_filename(BlockDriverState *bs)
|
||||||
|
{
|
||||||
|
BDRVPBSState *s = bs->opaque;
|
||||||
|
- snprintf(bs->exact_filename, sizeof(bs->exact_filename), "%s/%s(%s)",
|
||||||
|
- s->repository, s->snapshot, s->archive);
|
||||||
|
+ if (s->namespace) {
|
||||||
|
+ snprintf(bs->exact_filename, sizeof(bs->exact_filename), "%s/%s:%s(%s)",
|
||||||
|
+ s->repository, s->namespace, s->snapshot, s->archive);
|
||||||
|
+ } else {
|
||||||
|
+ snprintf(bs->exact_filename, sizeof(bs->exact_filename), "%s/%s(%s)",
|
||||||
|
+ s->repository, s->snapshot, s->archive);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *const pbs_strong_runtime_opts[] = {
|
||||||
|
diff --git a/pbs-restore.c b/pbs-restore.c
|
||||||
|
index 2f834cf42e..f03d9bab8d 100644
|
||||||
|
--- a/pbs-restore.c
|
||||||
|
+++ b/pbs-restore.c
|
||||||
|
@@ -29,7 +29,7 @@
|
||||||
|
static void help(void)
|
||||||
|
{
|
||||||
|
const char *help_msg =
|
||||||
|
- "usage: pbs-restore [--repository <repo>] snapshot archive-name target [command options]\n"
|
||||||
|
+ "usage: pbs-restore [--repository <repo>] [--ns namespace] snapshot archive-name target [command options]\n"
|
||||||
|
;
|
||||||
|
|
||||||
|
printf("%s", help_msg);
|
||||||
|
@@ -77,6 +77,7 @@ int main(int argc, char **argv)
|
||||||
|
Error *main_loop_err = NULL;
|
||||||
|
const char *format = "raw";
|
||||||
|
const char *repository = NULL;
|
||||||
|
+ const char *backup_ns = NULL;
|
||||||
|
const char *keyfile = NULL;
|
||||||
|
int verbose = false;
|
||||||
|
bool skip_zero = false;
|
||||||
|
@@ -90,6 +91,7 @@ int main(int argc, char **argv)
|
||||||
|
{"verbose", no_argument, 0, 'v'},
|
||||||
|
{"format", required_argument, 0, 'f'},
|
||||||
|
{"repository", required_argument, 0, 'r'},
|
||||||
|
+ {"ns", required_argument, 0, 'n'},
|
||||||
|
{"keyfile", required_argument, 0, 'k'},
|
||||||
|
{0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
@@ -110,6 +112,9 @@ int main(int argc, char **argv)
|
||||||
|
case 'r':
|
||||||
|
repository = g_strdup(argv[optind - 1]);
|
||||||
|
break;
|
||||||
|
+ case 'n':
|
||||||
|
+ backup_ns = g_strdup(argv[optind - 1]);
|
||||||
|
+ break;
|
||||||
|
case 'k':
|
||||||
|
keyfile = g_strdup(argv[optind - 1]);
|
||||||
|
break;
|
||||||
|
@@ -160,8 +165,16 @@ int main(int argc, char **argv)
|
||||||
|
fprintf(stderr, "connecting to repository '%s'\n", repository);
|
||||||
|
}
|
||||||
|
char *pbs_error = NULL;
|
||||||
|
- ProxmoxRestoreHandle *conn = proxmox_restore_new(
|
||||||
|
- repository, snapshot, password, keyfile, key_password, fingerprint, &pbs_error);
|
||||||
|
+ ProxmoxRestoreHandle *conn = proxmox_restore_new_ns(
|
||||||
|
+ repository,
|
||||||
|
+ snapshot,
|
||||||
|
+ backup_ns,
|
||||||
|
+ password,
|
||||||
|
+ keyfile,
|
||||||
|
+ key_password,
|
||||||
|
+ fingerprint,
|
||||||
|
+ &pbs_error
|
||||||
|
+ );
|
||||||
|
if (conn == NULL) {
|
||||||
|
fprintf(stderr, "restore failed: %s\n", pbs_error);
|
||||||
|
return -1;
|
||||||
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
|
index 9f6c04a512..f6a5f8c785 100644
|
||||||
|
--- a/pve-backup.c
|
||||||
|
+++ b/pve-backup.c
|
||||||
|
@@ -10,6 +10,8 @@
|
||||||
|
#include "qapi/qmp/qerror.h"
|
||||||
|
#include "qemu/cutils.h"
|
||||||
|
|
||||||
|
+#include <proxmox-backup-qemu.h>
|
||||||
|
+
|
||||||
|
/* PVE backup state and related function */
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -535,6 +537,7 @@ UuidInfo coroutine_fn *qmp_backup(
|
||||||
|
bool has_key_password, const char *key_password,
|
||||||
|
bool has_master_keyfile, const char *master_keyfile,
|
||||||
|
bool has_fingerprint, const char *fingerprint,
|
||||||
|
+ bool has_backup_ns, const char *backup_ns,
|
||||||
|
bool has_backup_id, const char *backup_id,
|
||||||
|
bool has_backup_time, int64_t backup_time,
|
||||||
|
bool has_use_dirty_bitmap, bool use_dirty_bitmap,
|
||||||
|
@@ -674,8 +677,9 @@ UuidInfo coroutine_fn *qmp_backup(
|
||||||
|
firewall_name = "fw.conf";
|
||||||
|
|
||||||
|
char *pbs_err = NULL;
|
||||||
|
- pbs = proxmox_backup_new(
|
||||||
|
+ pbs = proxmox_backup_new_ns(
|
||||||
|
backup_file,
|
||||||
|
+ has_backup_ns ? backup_ns : NULL,
|
||||||
|
backup_id,
|
||||||
|
backup_time,
|
||||||
|
dump_cb_block_size,
|
||||||
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
|
index fc8a125451..cc2ead0b75 100644
|
||||||
|
--- a/qapi/block-core.json
|
||||||
|
+++ b/qapi/block-core.json
|
||||||
|
@@ -817,6 +817,8 @@
|
||||||
|
#
|
||||||
|
# @fingerprint: server cert fingerprint (optional for format 'pbs')
|
||||||
|
#
|
||||||
|
+# @backup-ns: backup namespace (required for format 'pbs')
|
||||||
|
+#
|
||||||
|
# @backup-id: backup ID (required for format 'pbs')
|
||||||
|
#
|
||||||
|
# @backup-time: backup timestamp (Unix epoch, required for format 'pbs')
|
||||||
|
@@ -836,6 +838,7 @@
|
||||||
|
'*key-password': 'str',
|
||||||
|
'*master-keyfile': 'str',
|
||||||
|
'*fingerprint': 'str',
|
||||||
|
+ '*backup-ns': 'str',
|
||||||
|
'*backup-id': 'str',
|
||||||
|
'*backup-time': 'int',
|
||||||
|
'*use-dirty-bitmap': 'bool',
|
||||||
|
@@ -3282,7 +3285,7 @@
|
||||||
|
{ 'struct': 'BlockdevOptionsPbs',
|
||||||
|
'data': { 'repository': 'str', 'snapshot': 'str', 'archive': 'str',
|
||||||
|
'*keyfile': 'str', '*password': 'str', '*fingerprint': 'str',
|
||||||
|
- '*key_password': 'str' } }
|
||||||
|
+ '*key_password': 'str', '*namespace': 'str' } }
|
||||||
|
|
||||||
|
##
|
||||||
|
# @BlockdevOptionsNVMe:
|
80
debian/patches/pve/0054-Revert-block-rbd-workaround-for-ceph-issue-53784.patch
vendored
Normal file
80
debian/patches/pve/0054-Revert-block-rbd-workaround-for-ceph-issue-53784.patch
vendored
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Thu, 23 Jun 2022 14:00:05 +0200
|
||||||
|
Subject: [PATCH] Revert "block/rbd: workaround for ceph issue #53784"
|
||||||
|
|
||||||
|
This reverts commit fc176116cdea816ceb8dd969080b2b95f58edbc0 in
|
||||||
|
preparation to revert 0347a8fd4c3faaedf119be04c197804be40a384b.
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
block/rbd.c | 42 ++----------------------------------------
|
||||||
|
1 file changed, 2 insertions(+), 40 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/block/rbd.c b/block/rbd.c
|
||||||
|
index 64a8d7d48b..9fc6dcb957 100644
|
||||||
|
--- a/block/rbd.c
|
||||||
|
+++ b/block/rbd.c
|
||||||
|
@@ -1348,7 +1348,6 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs,
|
||||||
|
int status, r;
|
||||||
|
RBDDiffIterateReq req = { .offs = offset };
|
||||||
|
uint64_t features, flags;
|
||||||
|
- uint64_t head = 0;
|
||||||
|
|
||||||
|
assert(offset + bytes <= s->image_size);
|
||||||
|
|
||||||
|
@@ -1376,43 +1375,7 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs,
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
-#if LIBRBD_VERSION_CODE < LIBRBD_VERSION(1, 17, 0)
|
||||||
|
- /*
|
||||||
|
- * librbd had a bug until early 2022 that affected all versions of ceph that
|
||||||
|
- * supported fast-diff. This bug results in reporting of incorrect offsets
|
||||||
|
- * if the offset parameter to rbd_diff_iterate2 is not object aligned.
|
||||||
|
- * Work around this bug by rounding down the offset to object boundaries.
|
||||||
|
- * This is OK because we call rbd_diff_iterate2 with whole_object = true.
|
||||||
|
- * However, this workaround only works for non cloned images with default
|
||||||
|
- * striping.
|
||||||
|
- *
|
||||||
|
- * See: https://tracker.ceph.com/issues/53784
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
- /* check if RBD image has non-default striping enabled */
|
||||||
|
- if (features & RBD_FEATURE_STRIPINGV2) {
|
||||||
|
- return status;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
-#pragma GCC diagnostic push
|
||||||
|
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
- /*
|
||||||
|
- * check if RBD image is a clone (= has a parent).
|
||||||
|
- *
|
||||||
|
- * rbd_get_parent_info is deprecated from Nautilus onwards, but the
|
||||||
|
- * replacement rbd_get_parent is not present in Luminous and Mimic.
|
||||||
|
- */
|
||||||
|
- if (rbd_get_parent_info(s->image, NULL, 0, NULL, 0, NULL, 0) != -ENOENT) {
|
||||||
|
- return status;
|
||||||
|
- }
|
||||||
|
-#pragma GCC diagnostic pop
|
||||||
|
-
|
||||||
|
- head = req.offs & (s->object_size - 1);
|
||||||
|
- req.offs -= head;
|
||||||
|
- bytes += head;
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
- r = rbd_diff_iterate2(s->image, NULL, req.offs, bytes, true, true,
|
||||||
|
+ r = rbd_diff_iterate2(s->image, NULL, offset, bytes, true, true,
|
||||||
|
qemu_rbd_diff_iterate_cb, &req);
|
||||||
|
if (r < 0 && r != QEMU_RBD_EXIT_DIFF_ITERATE2) {
|
||||||
|
return status;
|
||||||
|
@@ -1431,8 +1394,7 @@ static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs,
|
||||||
|
status = BDRV_BLOCK_ZERO | BDRV_BLOCK_OFFSET_VALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
- assert(req.bytes > head);
|
||||||
|
- *pnum = req.bytes - head;
|
||||||
|
+ *pnum = req.bytes;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
35
debian/patches/pve/0055-Revert-block-rbd-fix-handling-of-holes-in-.bdrv_co_b.patch
vendored
Normal file
35
debian/patches/pve/0055-Revert-block-rbd-fix-handling-of-holes-in-.bdrv_co_b.patch
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Thu, 23 Jun 2022 14:00:07 +0200
|
||||||
|
Subject: [PATCH] Revert "block/rbd: fix handling of holes in
|
||||||
|
.bdrv_co_block_status"
|
||||||
|
|
||||||
|
This reverts commit 9e302f64bb407a9bb097b626da97228c2654cfee in
|
||||||
|
preparation to revert 0347a8fd4c3faaedf119be04c197804be40a384b.
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
block/rbd.c | 10 +++++-----
|
||||||
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/block/rbd.c b/block/rbd.c
|
||||||
|
index 9fc6dcb957..98f4ba2620 100644
|
||||||
|
--- a/block/rbd.c
|
||||||
|
+++ b/block/rbd.c
|
||||||
|
@@ -1307,11 +1307,11 @@ static int qemu_rbd_diff_iterate_cb(uint64_t offs, size_t len,
|
||||||
|
RBDDiffIterateReq *req = opaque;
|
||||||
|
|
||||||
|
assert(req->offs + req->bytes <= offs);
|
||||||
|
-
|
||||||
|
- /* treat a hole like an unallocated area and bail out */
|
||||||
|
- if (!exists) {
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
+ /*
|
||||||
|
+ * we do not diff against a snapshot so we should never receive a callback
|
||||||
|
+ * for a hole.
|
||||||
|
+ */
|
||||||
|
+ assert(exists);
|
||||||
|
|
||||||
|
if (!req->exists && offs > req->offs) {
|
||||||
|
/*
|
161
debian/patches/pve/0056-Revert-block-rbd-implement-bdrv_co_block_status.patch
vendored
Normal file
161
debian/patches/pve/0056-Revert-block-rbd-implement-bdrv_co_block_status.patch
vendored
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Tue, 17 May 2022 09:46:02 +0200
|
||||||
|
Subject: [PATCH] Revert "block/rbd: implement bdrv_co_block_status"
|
||||||
|
|
||||||
|
During backup, bdrv_co_block_status is called for each block copy
|
||||||
|
chunk. When RBD is used, the current implementation with
|
||||||
|
rbd_diff_iterate2() using whole_object=true takes about linearly more
|
||||||
|
time, depending on the image size. Since there are linearly more
|
||||||
|
chunks, the slowdown is quadratic, becoming unacceptable for large
|
||||||
|
images (starting somewhere between 500-1000 GiB in my testing).
|
||||||
|
|
||||||
|
This reverts commit 0347a8fd4c3faaedf119be04c197804be40a384b as a
|
||||||
|
stop-gap measure, until it's clear how to make the implemenation
|
||||||
|
more efficient.
|
||||||
|
|
||||||
|
Upstream bug report:
|
||||||
|
https://gitlab.com/qemu-project/qemu/-/issues/1026
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
block/rbd.c | 112 ----------------------------------------------------
|
||||||
|
1 file changed, 112 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/block/rbd.c b/block/rbd.c
|
||||||
|
index 98f4ba2620..efcbbe5949 100644
|
||||||
|
--- a/block/rbd.c
|
||||||
|
+++ b/block/rbd.c
|
||||||
|
@@ -97,12 +97,6 @@ typedef struct RBDTask {
|
||||||
|
int64_t ret;
|
||||||
|
} RBDTask;
|
||||||
|
|
||||||
|
-typedef struct RBDDiffIterateReq {
|
||||||
|
- uint64_t offs;
|
||||||
|
- uint64_t bytes;
|
||||||
|
- bool exists;
|
||||||
|
-} RBDDiffIterateReq;
|
||||||
|
-
|
||||||
|
static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx,
|
||||||
|
BlockdevOptionsRbd *opts, bool cache,
|
||||||
|
const char *keypairs, const char *secretid,
|
||||||
|
@@ -1293,111 +1287,6 @@ static ImageInfoSpecific *qemu_rbd_get_specific_info(BlockDriverState *bs,
|
||||||
|
return spec_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
-/*
|
||||||
|
- * rbd_diff_iterate2 allows to interrupt the exection by returning a negative
|
||||||
|
- * value in the callback routine. Choose a value that does not conflict with
|
||||||
|
- * an existing exitcode and return it if we want to prematurely stop the
|
||||||
|
- * execution because we detected a change in the allocation status.
|
||||||
|
- */
|
||||||
|
-#define QEMU_RBD_EXIT_DIFF_ITERATE2 -9000
|
||||||
|
-
|
||||||
|
-static int qemu_rbd_diff_iterate_cb(uint64_t offs, size_t len,
|
||||||
|
- int exists, void *opaque)
|
||||||
|
-{
|
||||||
|
- RBDDiffIterateReq *req = opaque;
|
||||||
|
-
|
||||||
|
- assert(req->offs + req->bytes <= offs);
|
||||||
|
- /*
|
||||||
|
- * we do not diff against a snapshot so we should never receive a callback
|
||||||
|
- * for a hole.
|
||||||
|
- */
|
||||||
|
- assert(exists);
|
||||||
|
-
|
||||||
|
- if (!req->exists && offs > req->offs) {
|
||||||
|
- /*
|
||||||
|
- * we started in an unallocated area and hit the first allocated
|
||||||
|
- * block. req->bytes must be set to the length of the unallocated area
|
||||||
|
- * before the allocated area. stop further processing.
|
||||||
|
- */
|
||||||
|
- req->bytes = offs - req->offs;
|
||||||
|
- return QEMU_RBD_EXIT_DIFF_ITERATE2;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (req->exists && offs > req->offs + req->bytes) {
|
||||||
|
- /*
|
||||||
|
- * we started in an allocated area and jumped over an unallocated area,
|
||||||
|
- * req->bytes contains the length of the allocated area before the
|
||||||
|
- * unallocated area. stop further processing.
|
||||||
|
- */
|
||||||
|
- return QEMU_RBD_EXIT_DIFF_ITERATE2;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- req->bytes += len;
|
||||||
|
- req->exists = true;
|
||||||
|
-
|
||||||
|
- return 0;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static int coroutine_fn qemu_rbd_co_block_status(BlockDriverState *bs,
|
||||||
|
- bool want_zero, int64_t offset,
|
||||||
|
- int64_t bytes, int64_t *pnum,
|
||||||
|
- int64_t *map,
|
||||||
|
- BlockDriverState **file)
|
||||||
|
-{
|
||||||
|
- BDRVRBDState *s = bs->opaque;
|
||||||
|
- int status, r;
|
||||||
|
- RBDDiffIterateReq req = { .offs = offset };
|
||||||
|
- uint64_t features, flags;
|
||||||
|
-
|
||||||
|
- assert(offset + bytes <= s->image_size);
|
||||||
|
-
|
||||||
|
- /* default to all sectors allocated */
|
||||||
|
- status = BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID;
|
||||||
|
- *map = offset;
|
||||||
|
- *file = bs;
|
||||||
|
- *pnum = bytes;
|
||||||
|
-
|
||||||
|
- /* check if RBD image supports fast-diff */
|
||||||
|
- r = rbd_get_features(s->image, &features);
|
||||||
|
- if (r < 0) {
|
||||||
|
- return status;
|
||||||
|
- }
|
||||||
|
- if (!(features & RBD_FEATURE_FAST_DIFF)) {
|
||||||
|
- return status;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* check if RBD fast-diff result is valid */
|
||||||
|
- r = rbd_get_flags(s->image, &flags);
|
||||||
|
- if (r < 0) {
|
||||||
|
- return status;
|
||||||
|
- }
|
||||||
|
- if (flags & RBD_FLAG_FAST_DIFF_INVALID) {
|
||||||
|
- return status;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- r = rbd_diff_iterate2(s->image, NULL, offset, bytes, true, true,
|
||||||
|
- qemu_rbd_diff_iterate_cb, &req);
|
||||||
|
- if (r < 0 && r != QEMU_RBD_EXIT_DIFF_ITERATE2) {
|
||||||
|
- return status;
|
||||||
|
- }
|
||||||
|
- assert(req.bytes <= bytes);
|
||||||
|
- if (!req.exists) {
|
||||||
|
- if (r == 0) {
|
||||||
|
- /*
|
||||||
|
- * rbd_diff_iterate2 does not invoke callbacks for unallocated
|
||||||
|
- * areas. This here catches the case where no callback was
|
||||||
|
- * invoked at all (req.bytes == 0).
|
||||||
|
- */
|
||||||
|
- assert(req.bytes == 0);
|
||||||
|
- req.bytes = bytes;
|
||||||
|
- }
|
||||||
|
- status = BDRV_BLOCK_ZERO | BDRV_BLOCK_OFFSET_VALID;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- *pnum = req.bytes;
|
||||||
|
- return status;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static int64_t qemu_rbd_getlength(BlockDriverState *bs)
|
||||||
|
{
|
||||||
|
BDRVRBDState *s = bs->opaque;
|
||||||
|
@@ -1633,7 +1522,6 @@ static BlockDriver bdrv_rbd = {
|
||||||
|
#ifdef LIBRBD_SUPPORTS_WRITE_ZEROES
|
||||||
|
.bdrv_co_pwrite_zeroes = qemu_rbd_co_pwrite_zeroes,
|
||||||
|
#endif
|
||||||
|
- .bdrv_co_block_status = qemu_rbd_co_block_status,
|
||||||
|
|
||||||
|
.bdrv_snapshot_create = qemu_rbd_snap_create,
|
||||||
|
.bdrv_snapshot_delete = qemu_rbd_snap_remove,
|
59
debian/patches/pve/0057-PVE-Backup-create-jobs-correctly-cancel-in-error-sce.patch
vendored
Normal file
59
debian/patches/pve/0057-PVE-Backup-create-jobs-correctly-cancel-in-error-sce.patch
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Wed, 25 May 2022 13:59:37 +0200
|
||||||
|
Subject: [PATCH] PVE-Backup: create jobs: correctly cancel in error scenario
|
||||||
|
|
||||||
|
The first call to job_cancel_sync() will cancel and free all jobs in
|
||||||
|
the transaction, so ensure that it's called only once and get rid of
|
||||||
|
the job_unref() that would operate on freed memory.
|
||||||
|
|
||||||
|
It's also necessary to NULL backup_state.pbs in the error scenario,
|
||||||
|
because a subsequent backup_cancel QMP call (as happens in PVE when
|
||||||
|
the backup QMP command fails) would try to call proxmox_backup_abort()
|
||||||
|
and run into a segfault.
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||||
|
---
|
||||||
|
pve-backup.c | 10 ++++++++--
|
||||||
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
|
index f6a5f8c785..5bed6f4014 100644
|
||||||
|
--- a/pve-backup.c
|
||||||
|
+++ b/pve-backup.c
|
||||||
|
@@ -506,6 +506,11 @@ static void create_backup_jobs_bh(void *opaque) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*errp) {
|
||||||
|
+ /*
|
||||||
|
+ * It's enough to cancel one job in the transaction, the rest will
|
||||||
|
+ * follow automatically.
|
||||||
|
+ */
|
||||||
|
+ bool canceled = false;
|
||||||
|
l = backup_state.di_list;
|
||||||
|
while (l) {
|
||||||
|
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
|
||||||
|
@@ -516,12 +521,12 @@ static void create_backup_jobs_bh(void *opaque) {
|
||||||
|
di->target = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (di->job) {
|
||||||
|
+ if (!canceled && di->job) {
|
||||||
|
AioContext *ctx = di->job->job.aio_context;
|
||||||
|
aio_context_acquire(ctx);
|
||||||
|
job_cancel_sync(&di->job->job, true);
|
||||||
|
- job_unref(&di->job->job);
|
||||||
|
aio_context_release(ctx);
|
||||||
|
+ canceled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -947,6 +952,7 @@ err:
|
||||||
|
|
||||||
|
if (pbs) {
|
||||||
|
proxmox_backup_disconnect(pbs);
|
||||||
|
+ backup_state.pbs = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backup_dir) {
|
76
debian/patches/pve/0058-PVE-Backup-ensure-jobs-in-di_list-are-referenced.patch
vendored
Normal file
76
debian/patches/pve/0058-PVE-Backup-ensure-jobs-in-di_list-are-referenced.patch
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Wed, 25 May 2022 13:59:38 +0200
|
||||||
|
Subject: [PATCH] PVE-Backup: ensure jobs in di_list are referenced
|
||||||
|
|
||||||
|
Ensures that qmp_backup_cancel doesn't pick a job that's already been
|
||||||
|
freed. With unlucky timings it seems possible that:
|
||||||
|
1. job_exit -> job_completed -> job_finalize_single starts
|
||||||
|
2. pvebackup_co_complete_stream gets spawned in completion callback
|
||||||
|
3. job finalize_single finishes -> job's refcount hits zero -> job is
|
||||||
|
freed
|
||||||
|
4. qmp_backup_cancel comes in and locks backup_state.backup_mutex
|
||||||
|
before pvebackup_co_complete_stream can remove the job from the
|
||||||
|
di_list
|
||||||
|
5. qmp_backup_cancel will pick a job that's already been freed
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||||
|
---
|
||||||
|
pve-backup.c | 25 ++++++++++++++++++++-----
|
||||||
|
1 file changed, 20 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
|
index 5bed6f4014..0c34428713 100644
|
||||||
|
--- a/pve-backup.c
|
||||||
|
+++ b/pve-backup.c
|
||||||
|
@@ -316,6 +316,14 @@ static void coroutine_fn pvebackup_co_complete_stream(void *opaque)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (di->job) {
|
||||||
|
+ AioContext *ctx = di->job->job.aio_context;
|
||||||
|
+ aio_context_acquire(ctx);
|
||||||
|
+ job_unref(&di->job->job);
|
||||||
|
+ di->job = NULL;
|
||||||
|
+ aio_context_release(ctx);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// remove self from job list
|
||||||
|
backup_state.di_list = g_list_remove(backup_state.di_list, di);
|
||||||
|
|
||||||
|
@@ -491,9 +499,12 @@ static void create_backup_jobs_bh(void *opaque) {
|
||||||
|
bitmap_mode, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
|
||||||
|
JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn, &local_err);
|
||||||
|
|
||||||
|
- aio_context_release(aio_context);
|
||||||
|
-
|
||||||
|
di->job = job;
|
||||||
|
+ if (job) {
|
||||||
|
+ job_ref(&job->job);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ aio_context_release(aio_context);
|
||||||
|
|
||||||
|
if (!job || local_err) {
|
||||||
|
error_setg(errp, "backup_job_create failed: %s",
|
||||||
|
@@ -521,12 +532,16 @@ static void create_backup_jobs_bh(void *opaque) {
|
||||||
|
di->target = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!canceled && di->job) {
|
||||||
|
+ if (di->job) {
|
||||||
|
AioContext *ctx = di->job->job.aio_context;
|
||||||
|
aio_context_acquire(ctx);
|
||||||
|
- job_cancel_sync(&di->job->job, true);
|
||||||
|
+ if (!canceled) {
|
||||||
|
+ job_cancel_sync(&di->job->job, true);
|
||||||
|
+ canceled = true;
|
||||||
|
+ }
|
||||||
|
+ job_unref(&di->job->job);
|
||||||
|
+ di->job = NULL;
|
||||||
|
aio_context_release(ctx);
|
||||||
|
- canceled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
debian/patches/pve/0059-PVE-Backup-avoid-segfault-issues-upon-backup-cancel.patch
vendored
Normal file
120
debian/patches/pve/0059-PVE-Backup-avoid-segfault-issues-upon-backup-cancel.patch
vendored
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Wed, 25 May 2022 13:59:39 +0200
|
||||||
|
Subject: [PATCH] PVE-Backup: avoid segfault issues upon backup-cancel
|
||||||
|
|
||||||
|
When canceling a backup in PVE via a signal it's easy to run into a
|
||||||
|
situation where the job is already failing when the backup_cancel QMP
|
||||||
|
command comes in. With a bit of unlucky timing on top, it can happen
|
||||||
|
that job_exit() runs between schedulung of job_cancel_bh() and
|
||||||
|
execution of job_cancel_bh(). But job_cancel_sync() does not expect
|
||||||
|
that the job is already finalized (in fact, the job might've been
|
||||||
|
freed already, but even if it isn't, job_cancel_sync() would try to
|
||||||
|
deref job->txn which would be NULL at that point).
|
||||||
|
|
||||||
|
It is not possible to simply use the job_cancel() (which is advertised
|
||||||
|
as being async but isn't in all cases) in qmp_backup_cancel() for the
|
||||||
|
same reason job_cancel_sync() cannot be used. Namely, because it can
|
||||||
|
invoke job_finish_sync() (which uses AIO_WAIT_WHILE and thus hangs if
|
||||||
|
called from a coroutine). This happens when there's multiple jobs in
|
||||||
|
the transaction and job->deferred_to_main_loop is true (is set before
|
||||||
|
scheduling job_exit()) or if the job was not started yet.
|
||||||
|
|
||||||
|
Fix the issue by selecting the job to cancel in job_cancel_bh() itself
|
||||||
|
using the first job that's not completed yet. This is not necessarily
|
||||||
|
the first job in the list, because pvebackup_co_complete_stream()
|
||||||
|
might not yet have removed a completed job when job_cancel_bh() runs.
|
||||||
|
|
||||||
|
An alternative would be to continue using only the first job and
|
||||||
|
checking against JOB_STATUS_CONCLUDED or JOB_STATUS_NULL to decide if
|
||||||
|
it's still necessary and possible to cancel, but the approach with
|
||||||
|
using the first non-completed job seemed more robust.
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
||||||
|
---
|
||||||
|
pve-backup.c | 61 +++++++++++++++++++++++++++++++++-------------------
|
||||||
|
1 file changed, 39 insertions(+), 22 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
|
index 0c34428713..2e22030eec 100644
|
||||||
|
--- a/pve-backup.c
|
||||||
|
+++ b/pve-backup.c
|
||||||
|
@@ -355,15 +355,42 @@ static void pvebackup_complete_cb(void *opaque, int ret)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* job_cancel(_sync) does not like to be called from coroutines, so defer to
|
||||||
|
- * main loop processing via a bottom half.
|
||||||
|
+ * main loop processing via a bottom half. Assumes that caller holds
|
||||||
|
+ * backup_mutex.
|
||||||
|
*/
|
||||||
|
static void job_cancel_bh(void *opaque) {
|
||||||
|
CoCtxData *data = (CoCtxData*)opaque;
|
||||||
|
- Job *job = (Job*)data->data;
|
||||||
|
- AioContext *job_ctx = job->aio_context;
|
||||||
|
- aio_context_acquire(job_ctx);
|
||||||
|
- job_cancel_sync(job, true);
|
||||||
|
- aio_context_release(job_ctx);
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Be careful to pick a valid job to cancel:
|
||||||
|
+ * 1. job_cancel_sync() does not expect the job to be finalized already.
|
||||||
|
+ * 2. job_exit() might run between scheduling and running job_cancel_bh()
|
||||||
|
+ * and pvebackup_co_complete_stream() might not have removed the job from
|
||||||
|
+ * the list yet (in fact, cannot, because it waits for the backup_mutex).
|
||||||
|
+ * Requiring !job_is_completed() ensures that no finalized job is picked.
|
||||||
|
+ */
|
||||||
|
+ GList *bdi = g_list_first(backup_state.di_list);
|
||||||
|
+ while (bdi) {
|
||||||
|
+ if (bdi->data) {
|
||||||
|
+ BlockJob *bj = ((PVEBackupDevInfo *)bdi->data)->job;
|
||||||
|
+ if (bj) {
|
||||||
|
+ Job *job = &bj->job;
|
||||||
|
+ if (!job_is_completed(job)) {
|
||||||
|
+ AioContext *job_ctx = job->aio_context;
|
||||||
|
+ aio_context_acquire(job_ctx);
|
||||||
|
+ job_cancel_sync(job, true);
|
||||||
|
+ aio_context_release(job_ctx);
|
||||||
|
+ /*
|
||||||
|
+ * It's enough to cancel one job in the transaction, the
|
||||||
|
+ * rest will follow automatically.
|
||||||
|
+ */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ bdi = g_list_next(bdi);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
aio_co_enter(data->ctx, data->co);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -384,22 +411,12 @@ void coroutine_fn qmp_backup_cancel(Error **errp)
|
||||||
|
proxmox_backup_abort(backup_state.pbs, "backup canceled");
|
||||||
|
}
|
||||||
|
|
||||||
|
- /* it's enough to cancel one job in the transaction, the rest will follow
|
||||||
|
- * automatically */
|
||||||
|
- GList *bdi = g_list_first(backup_state.di_list);
|
||||||
|
- BlockJob *cancel_job = bdi && bdi->data ?
|
||||||
|
- ((PVEBackupDevInfo *)bdi->data)->job :
|
||||||
|
- NULL;
|
||||||
|
-
|
||||||
|
- if (cancel_job) {
|
||||||
|
- CoCtxData data = {
|
||||||
|
- .ctx = qemu_get_current_aio_context(),
|
||||||
|
- .co = qemu_coroutine_self(),
|
||||||
|
- .data = &cancel_job->job,
|
||||||
|
- };
|
||||||
|
- aio_bh_schedule_oneshot(data.ctx, job_cancel_bh, &data);
|
||||||
|
- qemu_coroutine_yield();
|
||||||
|
- }
|
||||||
|
+ CoCtxData data = {
|
||||||
|
+ .ctx = qemu_get_current_aio_context(),
|
||||||
|
+ .co = qemu_coroutine_self(),
|
||||||
|
+ };
|
||||||
|
+ aio_bh_schedule_oneshot(data.ctx, job_cancel_bh, &data);
|
||||||
|
+ qemu_coroutine_yield();
|
||||||
|
|
||||||
|
qemu_co_mutex_unlock(&backup_state.backup_mutex);
|
||||||
|
}
|
57
debian/patches/pve/0060-vma-create-support-64KiB-unaligned-input-images.patch
vendored
Normal file
57
debian/patches/pve/0060-vma-create-support-64KiB-unaligned-input-images.patch
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Wed, 22 Jun 2022 10:45:11 +0200
|
||||||
|
Subject: [PATCH] vma: create: support 64KiB-unaligned input images
|
||||||
|
|
||||||
|
which fixes backing up templates with such disks in PVE, for example
|
||||||
|
efitype=4m EFI disks on a file-based storage (size = 540672).
|
||||||
|
|
||||||
|
If there is not enough left to read, blk_co_preadv will return -EIO,
|
||||||
|
so limit the size in the last iteration.
|
||||||
|
|
||||||
|
For writing, an unaligned end is already handled correctly.
|
||||||
|
|
||||||
|
The call to memset is not strictly necessary, because writing also
|
||||||
|
checks that it doesn't write data beyond the end of the image. But
|
||||||
|
there are two reasons to do it:
|
||||||
|
1. It's cleaner that way.
|
||||||
|
2. It allows detecting when the final piece is all zeroes, which might
|
||||||
|
not happen if the buffer still contains data from the previous
|
||||||
|
iteration.
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
vma.c | 12 ++++++++++--
|
||||||
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/vma.c b/vma.c
|
||||||
|
index e6e9ffc7fe..304f02bc84 100644
|
||||||
|
--- a/vma.c
|
||||||
|
+++ b/vma.c
|
||||||
|
@@ -548,7 +548,7 @@ static void coroutine_fn backup_run(void *opaque)
|
||||||
|
struct iovec iov;
|
||||||
|
QEMUIOVector qiov;
|
||||||
|
|
||||||
|
- int64_t start, end;
|
||||||
|
+ int64_t start, end, readlen;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
unsigned char *buf = blk_blockalign(job->target, VMA_CLUSTER_SIZE);
|
||||||
|
@@ -562,8 +562,16 @@ static void coroutine_fn backup_run(void *opaque)
|
||||||
|
iov.iov_len = VMA_CLUSTER_SIZE;
|
||||||
|
qemu_iovec_init_external(&qiov, &iov, 1);
|
||||||
|
|
||||||
|
+ if (start + 1 == end) {
|
||||||
|
+ memset(buf, 0, VMA_CLUSTER_SIZE);
|
||||||
|
+ readlen = job->len - start * VMA_CLUSTER_SIZE;
|
||||||
|
+ assert(readlen > 0 && readlen <= VMA_CLUSTER_SIZE);
|
||||||
|
+ } else {
|
||||||
|
+ readlen = VMA_CLUSTER_SIZE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
ret = blk_co_preadv(job->target, start * VMA_CLUSTER_SIZE,
|
||||||
|
- VMA_CLUSTER_SIZE, &qiov, 0);
|
||||||
|
+ readlen, &qiov, 0);
|
||||||
|
if (ret < 0) {
|
||||||
|
vma_writer_set_error(job->vmaw, "read error", -1);
|
||||||
|
goto out;
|
25
debian/patches/pve/0061-vma-create-avoid-triggering-assertion-in-error-case.patch
vendored
Normal file
25
debian/patches/pve/0061-vma-create-avoid-triggering-assertion-in-error-case.patch
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Wed, 22 Jun 2022 10:45:12 +0200
|
||||||
|
Subject: [PATCH] vma: create: avoid triggering assertion in error case
|
||||||
|
|
||||||
|
error_setg expects its argument to not be initialized yet.
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
vma-writer.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/vma-writer.c b/vma-writer.c
|
||||||
|
index df4b20793d..ac7da237d0 100644
|
||||||
|
--- a/vma-writer.c
|
||||||
|
+++ b/vma-writer.c
|
||||||
|
@@ -311,6 +311,8 @@ VmaWriter *vma_writer_create(const char *filename, uuid_t uuid, Error **errp)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vmaw->fd < 0) {
|
||||||
|
+ error_free(*errp);
|
||||||
|
+ *errp = NULL;
|
||||||
|
error_setg(errp, "can't open file %s - %s\n", filename,
|
||||||
|
g_strerror(errno));
|
||||||
|
goto err;
|
36
debian/patches/pve/0062-block-alloc-track-avoid-premature-break.patch
vendored
Normal file
36
debian/patches/pve/0062-block-alloc-track-avoid-premature-break.patch
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Wed, 22 Jun 2022 10:45:13 +0200
|
||||||
|
Subject: [PATCH] block: alloc-track: avoid premature break
|
||||||
|
|
||||||
|
While the bdrv_co_preadv() calls are expected to return 0 on success,
|
||||||
|
qemu_iovec_memset() will return the number of bytes set (will be
|
||||||
|
local_bytes, because the slice with that size was just initialized).
|
||||||
|
|
||||||
|
Don't break out of the loop after the branch with qemu_iovec_memset(),
|
||||||
|
because there might still be work to do. Additionally, ret is an int,
|
||||||
|
which on 64-bit platforms is too small to hold the size_t returned by
|
||||||
|
qemu_iovec_memset().
|
||||||
|
|
||||||
|
The branch seems to be difficult to reach in practice, because the
|
||||||
|
whole point of alloc-track is to be used with a backing device.
|
||||||
|
|
||||||
|
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
block/alloc-track.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/block/alloc-track.c b/block/alloc-track.c
|
||||||
|
index 6b50fbe537..c1160af04b 100644
|
||||||
|
--- a/block/alloc-track.c
|
||||||
|
+++ b/block/alloc-track.c
|
||||||
|
@@ -174,7 +174,8 @@ static int coroutine_fn track_co_preadv(BlockDriverState *bs,
|
||||||
|
ret = bdrv_co_preadv(bs->backing, local_offset, local_bytes,
|
||||||
|
&local_qiov, flags);
|
||||||
|
} else {
|
||||||
|
- ret = qemu_iovec_memset(&local_qiov, cur_offset, 0, local_bytes);
|
||||||
|
+ qemu_iovec_memset(&local_qiov, cur_offset, 0, local_bytes);
|
||||||
|
+ ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret != 0) {
|
144
debian/patches/pve/0063-PVE-Backup-allow-passing-max-workers-performance-set.patch
vendored
Normal file
144
debian/patches/pve/0063-PVE-Backup-allow-passing-max-workers-performance-set.patch
vendored
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
|
Date: Mon, 3 Oct 2022 15:52:04 +0200
|
||||||
|
Subject: [PATCH] PVE Backup: allow passing max-workers performance setting
|
||||||
|
|
||||||
|
For query-proxmox-support, add an indication that it's possible to use
|
||||||
|
the setting.
|
||||||
|
|
||||||
|
For now, the other two BackupPerf settings are not exposed:
|
||||||
|
|
||||||
|
* use-copy-range: would need to be implemented by the backup-dump
|
||||||
|
block driver first, and in fact, the default for backup was changed,
|
||||||
|
because it wasn't as fast for backup in QEMU, see commit
|
||||||
|
6a30f663d4c0b3c45a544d541e0c4e214b2473a1.
|
||||||
|
|
||||||
|
* max-chunk: enforced to be at least the backup cluster size, which is
|
||||||
|
4 MiB for PBS and otherwise maximum of source and target cluster size.
|
||||||
|
And block-copy has a maximum buffer size of 1 MiB, so setting a larger
|
||||||
|
max-chunk doesn't even have an effect. To make the setting sensibly
|
||||||
|
usable the check would need to be removed and optionally the
|
||||||
|
block-copy max buffer size would need to be bumped. I tried doing just
|
||||||
|
that, and tested different source/target combinations with different
|
||||||
|
max-chunk settings, but there were no noticable improvements over the
|
||||||
|
default "unlimited" (resulting in 1 MiB for block-copy).
|
||||||
|
|
||||||
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
||||||
|
---
|
||||||
|
block/monitor/block-hmp-cmds.c | 4 +++-
|
||||||
|
pve-backup.c | 18 +++++++++++++-----
|
||||||
|
qapi/block-core.json | 9 +++++++--
|
||||||
|
3 files changed, 23 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
||||||
|
index 0502f42be6..cc231ec3f2 100644
|
||||||
|
--- a/block/monitor/block-hmp-cmds.c
|
||||||
|
+++ b/block/monitor/block-hmp-cmds.c
|
||||||
|
@@ -1049,7 +1049,9 @@ void coroutine_fn hmp_backup(Monitor *mon, const QDict *qdict)
|
||||||
|
false, false, // PBS encrypt
|
||||||
|
true, dir ? BACKUP_FORMAT_DIR : BACKUP_FORMAT_VMA,
|
||||||
|
false, NULL, false, NULL, !!devlist,
|
||||||
|
- devlist, qdict_haskey(qdict, "speed"), speed, &error);
|
||||||
|
+ devlist, qdict_haskey(qdict, "speed"), speed,
|
||||||
|
+ false, 0, // BackupPerf max-workers
|
||||||
|
+ &error);
|
||||||
|
|
||||||
|
hmp_handle_error(mon, error);
|
||||||
|
}
|
||||||
|
diff --git a/pve-backup.c b/pve-backup.c
|
||||||
|
index 2e22030eec..e9aa7e0f49 100644
|
||||||
|
--- a/pve-backup.c
|
||||||
|
+++ b/pve-backup.c
|
||||||
|
@@ -55,6 +55,7 @@ static struct PVEBackupState {
|
||||||
|
bool starting;
|
||||||
|
} stat;
|
||||||
|
int64_t speed;
|
||||||
|
+ BackupPerf perf;
|
||||||
|
VmaWriter *vmaw;
|
||||||
|
ProxmoxBackupHandle *pbs;
|
||||||
|
GList *di_list;
|
||||||
|
@@ -492,8 +493,6 @@ static void create_backup_jobs_bh(void *opaque) {
|
||||||
|
}
|
||||||
|
backup_state.txn = job_txn_new_seq();
|
||||||
|
|
||||||
|
- BackupPerf perf = { .max_workers = 16 };
|
||||||
|
-
|
||||||
|
/* create and start all jobs (paused state) */
|
||||||
|
GList *l = backup_state.di_list;
|
||||||
|
while (l) {
|
||||||
|
@@ -513,8 +512,9 @@ static void create_backup_jobs_bh(void *opaque) {
|
||||||
|
|
||||||
|
BlockJob *job = backup_job_create(
|
||||||
|
NULL, di->bs, di->target, backup_state.speed, sync_mode, di->bitmap,
|
||||||
|
- bitmap_mode, false, NULL, &perf, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
|
||||||
|
- JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn, &local_err);
|
||||||
|
+ bitmap_mode, false, NULL, &backup_state.perf, BLOCKDEV_ON_ERROR_REPORT,
|
||||||
|
+ BLOCKDEV_ON_ERROR_REPORT, JOB_DEFAULT, pvebackup_complete_cb, di, backup_state.txn,
|
||||||
|
+ &local_err);
|
||||||
|
|
||||||
|
di->job = job;
|
||||||
|
if (job) {
|
||||||
|
@@ -584,7 +584,9 @@ UuidInfo coroutine_fn *qmp_backup(
|
||||||
|
bool has_config_file, const char *config_file,
|
||||||
|
bool has_firewall_file, const char *firewall_file,
|
||||||
|
bool has_devlist, const char *devlist,
|
||||||
|
- bool has_speed, int64_t speed, Error **errp)
|
||||||
|
+ bool has_speed, int64_t speed,
|
||||||
|
+ bool has_max_workers, int64_t max_workers,
|
||||||
|
+ Error **errp)
|
||||||
|
{
|
||||||
|
assert(qemu_in_coroutine());
|
||||||
|
|
||||||
|
@@ -914,6 +916,11 @@ UuidInfo coroutine_fn *qmp_backup(
|
||||||
|
|
||||||
|
backup_state.speed = (has_speed && speed > 0) ? speed : 0;
|
||||||
|
|
||||||
|
+ backup_state.perf = (BackupPerf){ .max_workers = 16 };
|
||||||
|
+ if (has_max_workers) {
|
||||||
|
+ backup_state.perf.max_workers = max_workers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
backup_state.vmaw = vmaw;
|
||||||
|
backup_state.pbs = pbs;
|
||||||
|
|
||||||
|
@@ -1089,5 +1096,6 @@ ProxmoxSupportStatus *qmp_query_proxmox_support(Error **errp)
|
||||||
|
ret->pbs_dirty_bitmap_migration = true;
|
||||||
|
ret->query_bitmap_info = true;
|
||||||
|
ret->pbs_masterkey = true;
|
||||||
|
+ ret->backup_max_workers = true;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
||||||
|
index cc2ead0b75..e3f62faa81 100644
|
||||||
|
--- a/qapi/block-core.json
|
||||||
|
+++ b/qapi/block-core.json
|
||||||
|
@@ -829,6 +829,8 @@
|
||||||
|
#
|
||||||
|
# @encrypt: use encryption ((optional for format 'pbs', defaults to true if there is a keyfile)
|
||||||
|
#
|
||||||
|
+# @max-workers: see @BackupPerf for details. Default 16.
|
||||||
|
+#
|
||||||
|
# Returns: the uuid of the backup job
|
||||||
|
#
|
||||||
|
##
|
||||||
|
@@ -847,7 +849,9 @@
|
||||||
|
'*format': 'BackupFormat',
|
||||||
|
'*config-file': 'str',
|
||||||
|
'*firewall-file': 'str',
|
||||||
|
- '*devlist': 'str', '*speed': 'int' },
|
||||||
|
+ '*devlist': 'str',
|
||||||
|
+ '*speed': 'int',
|
||||||
|
+ '*max-workers': 'int' },
|
||||||
|
'returns': 'UuidInfo', 'coroutine': true }
|
||||||
|
|
||||||
|
##
|
||||||
|
@@ -902,7 +906,8 @@
|
||||||
|
'pbs-dirty-bitmap-savevm': 'bool',
|
||||||
|
'pbs-dirty-bitmap-migration': 'bool',
|
||||||
|
'pbs-masterkey': 'bool',
|
||||||
|
- 'pbs-library-version': 'str' } }
|
||||||
|
+ 'pbs-library-version': 'str',
|
||||||
|
+ 'backup-max-workers': 'bool' } }
|
||||||
|
|
||||||
|
##
|
||||||
|
# @query-proxmox-support:
|
90
debian/patches/series
vendored
90
debian/patches/series
vendored
@@ -1,7 +1,9 @@
|
|||||||
extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch
|
extra/0001-monitor-qmp-fix-race-with-clients-disconnecting-earl.patch
|
||||||
extra/0002-monitor-hmp-add-support-for-flag-argument-with-value.patch
|
extra/0002-block-io_uring-revert-Use-io_uring_register_ring_fd-.patch
|
||||||
extra/0003-monitor-refactor-set-expire_password-and-allow-VNC-d.patch
|
extra/0003-virtiofsd-use-g_date_time_get_microsecond-to-get-sub.patch
|
||||||
extra/0004-block-mirror-fix-NULL-pointer-dereference-in-mirror_.patch
|
extra/0004-chardev-fix-segfault-in-finalize.patch
|
||||||
|
extra/0005-init-daemonize-defuse-PID-file-resolve-error.patch
|
||||||
|
extra/0006-block-block-backend-blk_set_enable_write_cache-is-IO.patch
|
||||||
bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
|
bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
|
||||||
bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
|
bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
|
||||||
bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
|
bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
|
||||||
@@ -23,36 +25,52 @@ pve/0012-PVE-Up-qemu-img-dd-add-n-skip_create.patch
|
|||||||
pve/0013-PVE-virtio-balloon-improve-query-balloon.patch
|
pve/0013-PVE-virtio-balloon-improve-query-balloon.patch
|
||||||
pve/0014-PVE-qapi-modify-query-machines.patch
|
pve/0014-PVE-qapi-modify-query-machines.patch
|
||||||
pve/0015-PVE-qapi-modify-spice-query.patch
|
pve/0015-PVE-qapi-modify-spice-query.patch
|
||||||
pve/0016-PVE-add-savevm-async-for-background-state-snapshots.patch
|
pve/0016-PVE-add-IOChannel-implementation-for-savevm-async.patch
|
||||||
pve/0017-PVE-add-optional-buffer-size-to-QEMUFile.patch
|
pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch
|
||||||
pve/0018-PVE-block-add-the-zeroinit-block-driver-filter.patch
|
pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch
|
||||||
pve/0019-PVE-Add-dummy-id-command-line-parameter.patch
|
pve/0019-PVE-block-add-the-zeroinit-block-driver-filter.patch
|
||||||
pve/0020-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch
|
pve/0020-PVE-Add-dummy-id-command-line-parameter.patch
|
||||||
pve/0021-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch
|
pve/0021-PVE-Config-Revert-target-i386-disable-LINT0-after-re.patch
|
||||||
pve/0022-PVE-monitor-disable-oob-capability.patch
|
pve/0022-PVE-Up-Config-file-posix-make-locking-optiono-on-cre.patch
|
||||||
pve/0023-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch
|
pve/0023-PVE-monitor-disable-oob-capability.patch
|
||||||
pve/0024-PVE-Allow-version-code-in-machine-type.patch
|
pve/0024-PVE-Compat-4.0-used-balloon-qemu-4-0-config-size-fal.patch
|
||||||
pve/0025-PVE-Backup-add-vma-backup-format-code.patch
|
pve/0025-PVE-Allow-version-code-in-machine-type.patch
|
||||||
pve/0026-PVE-Backup-add-backup-dump-block-driver.patch
|
pve/0026-block-backup-move-bcs-bitmap-initialization-to-job-c.patch
|
||||||
pve/0027-PVE-Backup-proxmox-backup-patches-for-qemu.patch
|
pve/0027-PVE-Backup-add-vma-backup-format-code.patch
|
||||||
pve/0028-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch
|
pve/0028-PVE-Backup-add-backup-dump-block-driver.patch
|
||||||
pve/0029-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch
|
pve/0029-PVE-Backup-proxmox-backup-patches-for-qemu.patch
|
||||||
pve/0030-PVE-various-PBS-fixes.patch
|
pve/0030-PVE-Backup-pbs-restore-new-command-to-restore-from-p.patch
|
||||||
pve/0031-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
|
pve/0031-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch
|
||||||
pve/0032-PVE-add-query_proxmox_support-QMP-command.patch
|
pve/0032-PVE-various-PBS-fixes.patch
|
||||||
pve/0033-PVE-add-query-pbs-bitmap-info-QMP-call.patch
|
pve/0033-PVE-Add-PBS-block-driver-to-map-backup-archives-into.patch
|
||||||
pve/0034-PVE-redirect-stderr-to-journal-when-daemonized.patch
|
pve/0034-PVE-add-query_proxmox_support-QMP-command.patch
|
||||||
pve/0035-PVE-Add-sequential-job-transaction-support.patch
|
pve/0035-PVE-add-query-pbs-bitmap-info-QMP-call.patch
|
||||||
pve/0036-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch
|
pve/0036-PVE-redirect-stderr-to-journal-when-daemonized.patch
|
||||||
pve/0037-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch
|
pve/0037-PVE-Add-sequential-job-transaction-support.patch
|
||||||
pve/0038-PVE-Migrate-dirty-bitmap-state-via-savevm.patch
|
pve/0038-PVE-Backup-Use-a-transaction-to-synchronize-job-stat.patch
|
||||||
pve/0039-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch
|
pve/0039-PVE-Backup-Don-t-block-on-finishing-and-cleanup-crea.patch
|
||||||
pve/0040-PVE-fall-back-to-open-iscsi-initiatorname.patch
|
pve/0040-PVE-Migrate-dirty-bitmap-state-via-savevm.patch
|
||||||
pve/0041-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch
|
pve/0041-migration-block-dirty-bitmap-migrate-other-bitmaps-e.patch
|
||||||
pve/0042-PBS-add-master-key-support.patch
|
pve/0042-PVE-fall-back-to-open-iscsi-initiatorname.patch
|
||||||
pve/0043-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch
|
pve/0043-PVE-Use-coroutine-QMP-for-backup-cancel_backup.patch
|
||||||
pve/0044-PVE-block-stream-increase-chunk-size.patch
|
pve/0044-PBS-add-master-key-support.patch
|
||||||
pve/0045-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
|
pve/0045-PVE-block-pbs-fast-path-reads-without-allocation-if-.patch
|
||||||
pve/0046-block-add-alloc-track-driver.patch
|
pve/0046-PVE-block-stream-increase-chunk-size.patch
|
||||||
pve/0047-PVE-whitelist-invalid-QAPI-names-for-backwards-compa.patch
|
pve/0047-block-io-accept-NULL-qiov-in-bdrv_pad_request.patch
|
||||||
pve/0048-PVE-savevm-async-register-yank-before-migration_inco.patch
|
pve/0048-block-add-alloc-track-driver.patch
|
||||||
|
pve/0049-PVE-whitelist-invalid-QAPI-names-for-backwards-compa.patch
|
||||||
|
pve/0050-PVE-savevm-async-register-yank-before-migration_inco.patch
|
||||||
|
pve/0051-qemu-img-dd-add-l-option-for-loading-a-snapshot.patch
|
||||||
|
pve/0052-vma-allow-partial-restore.patch
|
||||||
|
pve/0053-pbs-namespace-support.patch
|
||||||
|
pve/0054-Revert-block-rbd-workaround-for-ceph-issue-53784.patch
|
||||||
|
pve/0055-Revert-block-rbd-fix-handling-of-holes-in-.bdrv_co_b.patch
|
||||||
|
pve/0056-Revert-block-rbd-implement-bdrv_co_block_status.patch
|
||||||
|
pve/0057-PVE-Backup-create-jobs-correctly-cancel-in-error-sce.patch
|
||||||
|
pve/0058-PVE-Backup-ensure-jobs-in-di_list-are-referenced.patch
|
||||||
|
pve/0059-PVE-Backup-avoid-segfault-issues-upon-backup-cancel.patch
|
||||||
|
pve/0060-vma-create-support-64KiB-unaligned-input-images.patch
|
||||||
|
pve/0061-vma-create-avoid-triggering-assertion-in-error-case.patch
|
||||||
|
pve/0062-block-alloc-track-avoid-premature-break.patch
|
||||||
|
pve/0063-PVE-Backup-allow-passing-max-workers-performance-set.patch
|
||||||
|
pve-qemu-7.1-vitastor.patch
|
||||||
|
12
debian/rules
vendored
12
debian/rules
vendored
@@ -48,7 +48,7 @@ ${BUILDDIR}/config.status: configure
|
|||||||
--sysconfdir=/etc \
|
--sysconfdir=/etc \
|
||||||
--target-list=$(ARCH)-softmmu,aarch64-softmmu \
|
--target-list=$(ARCH)-softmmu,aarch64-softmmu \
|
||||||
--with-suffix="kvm" \
|
--with-suffix="kvm" \
|
||||||
--with-pkgversion="${DEB_SOURCE}_${DEB_VERSION_UPSTREAM}" \
|
--with-pkgversion="${DEB_SOURCE}_${DEB_VERSION_UPSTREAM_REVISION}" \
|
||||||
--audio-drv-list="alsa" \
|
--audio-drv-list="alsa" \
|
||||||
--datadir=/usr/share \
|
--datadir=/usr/share \
|
||||||
--libexecdir=/usr/lib/kvm \
|
--libexecdir=/usr/lib/kvm \
|
||||||
@@ -57,7 +57,7 @@ ${BUILDDIR}/config.status: configure
|
|||||||
--disable-guest-agent \
|
--disable-guest-agent \
|
||||||
--disable-guest-agent-msi \
|
--disable-guest-agent-msi \
|
||||||
--disable-libnfs \
|
--disable-libnfs \
|
||||||
--disable-libxml2 \
|
--disable-libssh \
|
||||||
--disable-sdl \
|
--disable-sdl \
|
||||||
--disable-smartcard \
|
--disable-smartcard \
|
||||||
--disable-strip \
|
--disable-strip \
|
||||||
@@ -71,13 +71,15 @@ ${BUILDDIR}/config.status: configure
|
|||||||
--enable-linux-aio \
|
--enable-linux-aio \
|
||||||
--enable-linux-io-uring \
|
--enable-linux-io-uring \
|
||||||
--enable-numa \
|
--enable-numa \
|
||||||
|
--enable-opengl \
|
||||||
--enable-rbd \
|
--enable-rbd \
|
||||||
--enable-seccomp \
|
--enable-seccomp \
|
||||||
--enable-spice \
|
--enable-spice \
|
||||||
--enable-usb-redir \
|
--enable-usb-redir \
|
||||||
|
--enable-virglrenderer \
|
||||||
--enable-virtfs \
|
--enable-virtfs \
|
||||||
--enable-virtiofsd \
|
--enable-virtiofsd \
|
||||||
--enable-xfsctl
|
--enable-zstd
|
||||||
|
|
||||||
build: build-stamp
|
build: build-stamp
|
||||||
|
|
||||||
@@ -130,8 +132,8 @@ install: build
|
|||||||
# remove Alpha files
|
# remove Alpha files
|
||||||
rm $(destdir)/usr/share/kvm/palcode-clipper
|
rm $(destdir)/usr/share/kvm/palcode-clipper
|
||||||
# remove RISC-V files
|
# remove RISC-V files
|
||||||
rm $(destdir)/usr/share/kvm/opensbi-riscv32-generic-fw_dynamic.elf
|
rm $(destdir)/usr/share/kvm/opensbi-riscv32-generic-fw_dynamic.bin
|
||||||
rm $(destdir)/usr/share/kvm/opensbi-riscv64-generic-fw_dynamic.elf
|
rm $(destdir)/usr/share/kvm/opensbi-riscv64-generic-fw_dynamic.bin
|
||||||
|
|
||||||
# Remove things we don't package at all, would be a "kvm-dev" package
|
# Remove things we don't package at all, would be a "kvm-dev" package
|
||||||
rm -Rf $(destdir)/usr/include/linux/
|
rm -Rf $(destdir)/usr/include/linux/
|
||||||
|
3
debian/source/include-binaries
vendored
Normal file
3
debian/source/include-binaries
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
debian/OVMF_CODE-pure-efi.fd
|
||||||
|
debian/OVMF_VARS-pure-efi.fd
|
||||||
|
debian/Logo.bmp
|
2
qemu
2
qemu
Submodule qemu updated: 54e1f5be86...621da77890
Reference in New Issue
Block a user