--- /dev/null
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Stefan Reiter <s.reiter@proxmox.com>
+Date: Thu, 6 Aug 2020 15:43:58 +0200
+Subject: [PATCH] block/block-copy: always align copied region to cluster size
+
+Since commit 42ac214406e0 (block/block-copy: refactor task creation)
+block_copy_task_create calculates the area to be copied via
+bdrv_dirty_bitmap_next_dirty_area, but that can return an unaligned byte
+count if the image's last cluster end is not aligned to the bitmap's
+granularity.
+
+Always ALIGN_UP the resulting bytes value to satisfy block_copy_do_copy,
+which requires the 'bytes' parameter to be aligned to cluster size.
+
+Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
+Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
+---
+ block/block-copy.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/block/block-copy.c b/block/block-copy.c
+index f7428a7c08..a30b9097ef 100644
+--- a/block/block-copy.c
++++ b/block/block-copy.c
+@@ -142,6 +142,9 @@ static BlockCopyTask *block_copy_task_create(BlockCopyState *s,
+ return NULL;
+ }
+
++ assert(QEMU_IS_ALIGNED(offset, s->cluster_size));
++ bytes = QEMU_ALIGN_UP(bytes, s->cluster_size);
++
+ /* region is dirty, so no existent tasks possible in it */
+ assert(!find_conflicting_task(s, offset, bytes));
+
+++ /dev/null
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Thomas Huth <thuth@redhat.com>
-Date: Thu, 11 Jun 2020 11:36:40 -0600
-Subject: [PATCH] hw/vfio/pci-quirks: Fix broken legacy IGD passthrough
-
-The #ifdef CONFIG_VFIO_IGD in pci-quirks.c is not working since the
-required header config-devices.h is not included, so that the legacy
-IGD passthrough is currently broken. Let's include the right header
-to fix this issue.
-
-Buglink: https://bugs.launchpad.net/qemu/+bug/1882784
-Fixes: 29d62771c81d ("hw/vfio: Move the IGD quirk code to a separate file")
-Signed-off-by: Thomas Huth <thuth@redhat.com>
-Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
-Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
----
- hw/vfio/pci-quirks.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
-index 2d348f8237..656098b827 100644
---- a/hw/vfio/pci-quirks.c
-+++ b/hw/vfio/pci-quirks.c
-@@ -11,6 +11,7 @@
- */
-
- #include "qemu/osdep.h"
-+#include "config-devices.h"
- #include "exec/memop.h"
- #include "qemu/units.h"
- #include "qemu/error-report.h"
---
-2.20.1
-
+++ /dev/null
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Mauro Matteo Cascella <mcascell@redhat.com>
-Date: Sat, 1 Aug 2020 18:42:38 +0200
-Subject: [PATCH] hw/net/net_tx_pkt: fix assertion failure in
- net_tx_pkt_add_raw_fragment()
-
-An assertion failure issue was found in the code that processes network packets
-while adding data fragments into the packet context. It could be abused by a
-malicious guest to abort the QEMU process on the host. This patch replaces the
-affected assert() with a conditional statement, returning false if the current
-data fragment exceeds max_raw_frags.
-
-Reported-by: Alexander Bulekov <alxndr@bu.edu>
-Reported-by: Ziming Zhang <ezrakiez@gmail.com>
-Reviewed-by: Dmitry Fleytman <dmitry.fleytman@gmail.com>
-Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
-Signed-off-by: Jason Wang <jasowang@redhat.com>
-(cherry picked from commit 035e69b063835a5fd23cacabd63690a3d84532a8)
-Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
----
- hw/net/net_tx_pkt.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c
-index 162f802dd7..54d4c3bbd0 100644
---- a/hw/net/net_tx_pkt.c
-+++ b/hw/net/net_tx_pkt.c
-@@ -379,7 +379,10 @@ bool net_tx_pkt_add_raw_fragment(struct NetTxPkt *pkt, hwaddr pa,
- hwaddr mapped_len = 0;
- struct iovec *ventry;
- assert(pkt);
-- assert(pkt->max_raw_frags > pkt->raw_frags);
-+
-+ if (pkt->raw_frags >= pkt->max_raw_frags) {
-+ return false;
-+ }
-
- if (!len) {
- return true;
---
-2.20.1
-
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c
-index 7e19bbff5f..b527e82a82 100644
+index 9a00d4190a..bb72e1e5ca 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
-@@ -450,7 +450,7 @@ static QemuOptsList raw_runtime_opts = {
+@@ -508,7 +508,7 @@ static QemuOptsList raw_runtime_opts = {
{
.name = "locking",
.type = QEMU_OPT_STRING,
},
{
.name = "pr-manager",
-@@ -550,7 +550,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
+@@ -606,7 +606,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
s->use_lock = false;
break;
case ON_OFF_AUTO_AUTO:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/net/net.h b/include/net/net.h
-index 39085d9444..487e3ea1b4 100644
+index e7ef42d62b..4fd1144e58 100644
--- a/include/net/net.h
+++ b/include/net/net.h
-@@ -208,8 +208,9 @@ void netdev_add(QemuOpts *opts, Error **errp);
+@@ -209,8 +209,9 @@ void netdev_add(QemuOpts *opts, Error **errp);
int net_hub_id_for_client(NetClientState *nc, int *id);
NetClientState *net_hub_port_find(int hub_id);
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
-index e818fc712a..dd9bf7b3da 100644
+index e1a5c174dc..8973d3160f 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
-@@ -1954,9 +1954,9 @@ uint64_t cpu_get_tsc(CPUX86State *env);
+@@ -1975,9 +1975,9 @@ uint64_t cpu_get_tsc(CPUX86State *env);
#define CPU_RESOLVING_TYPE TYPE_X86_CPU
#ifdef TARGET_X86_64
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
-index b82770024c..bd05b3c79a 100644
+index 67bee1bcb8..d954bf77b9 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
-@@ -896,7 +896,7 @@ bool x86_machine_is_smm_enabled(X86MachineState *x86ms)
+@@ -856,7 +856,7 @@ bool x86_machine_is_smm_enabled(X86MachineState *x86ms)
if (tcg_enabled() || qtest_enabled()) {
smm_available = true;
} else if (kvm_enabled()) {
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/block/gluster.c b/block/gluster.c
-index 0aa1f2cda4..dcd1ef7ebc 100644
+index 4f1448e2bc..715f06394c 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -42,7 +42,7 @@
1 file changed, 2 insertions(+)
diff --git a/block/rbd.c b/block/rbd.c
-index e637639a07..5717e7258c 100644
+index 688074c64b..8ae39abb46 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -651,6 +651,8 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx,
3 files changed, 43 insertions(+)
diff --git a/net/net.c b/net/net.c
-index 38778e831d..dabfb482f0 100644
+index bbaedb3c7a..9de23ec834 100644
--- a/net/net.c
+++ b/net/net.c
-@@ -1331,6 +1331,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict)
+@@ -1276,6 +1276,33 @@ void hmp_info_network(Monitor *mon, const QDict *qdict)
}
}
{
NetClientState *nc;
diff --git a/qapi/net.json b/qapi/net.json
-index cebb1b52e3..f6854483b1 100644
+index ddb113e5e5..eb3b785984 100644
--- a/qapi/net.json
+++ b/qapi/net.json
-@@ -34,6 +34,21 @@
+@@ -35,6 +35,21 @@
##
{ 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} }
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/block/gluster.c b/block/gluster.c
-index dcd1ef7ebc..ac79b4bdb4 100644
+index 715f06394c..6d02170d9b 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -57,6 +57,7 @@ typedef struct GlusterAIOCB {
} GlusterAIOCB;
typedef struct BDRVGlusterState {
-@@ -763,8 +764,10 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret,
+@@ -759,8 +760,10 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret,
acb->ret = 0; /* Success */
} else if (ret < 0) {
acb->ret = -errno; /* Read/Write failed */
}
aio_co_schedule(acb->aio_context, acb->coroutine);
-@@ -1035,6 +1038,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs,
+@@ -1028,6 +1031,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs,
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
acb.aio_context = bdrv_get_aio_context(bs);
ret = glfs_zerofill_async(s->fd, offset, size, gluster_finish_aiocb, &acb);
if (ret < 0) {
-@@ -1216,9 +1220,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs,
+@@ -1209,9 +1213,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs,
acb.aio_context = bdrv_get_aio_context(bs);
if (write) {
ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0,
gluster_finish_aiocb, &acb);
}
-@@ -1281,6 +1287,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
+@@ -1275,6 +1281,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
acb.aio_context = bdrv_get_aio_context(bs);
ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb);
if (ret < 0) {
-@@ -1327,6 +1334,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs,
+@@ -1321,6 +1328,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs,
acb.ret = 0;
acb.coroutine = qemu_coroutine_self();
acb.aio_context = bdrv_get_aio_context(bs);
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/qemu-img.c b/qemu-img.c
-index 821cbf610e..667c540a89 100644
+index 5308773811..45aa024acc 100644
--- a/qemu-img.c
+++ b/qemu-img.c
-@@ -2821,7 +2821,8 @@ static int img_info(int argc, char **argv)
+@@ -2955,7 +2955,8 @@ static int img_info(int argc, char **argv)
list = collect_image_info_list(image_opts, filename, fmt, chain,
force_share);
if (!list) {
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
qemu-img-cmds.hx | 4 +-
- qemu-img.c | 192 +++++++++++++++++++++++++++++------------------
- 2 files changed, 122 insertions(+), 74 deletions(-)
+ qemu-img.c | 191 +++++++++++++++++++++++++++++------------------
+ 2 files changed, 121 insertions(+), 74 deletions(-)
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
-index c9c54de1df..0f98033658 100644
+index b89c019b76..91d18a4819 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
-@@ -51,9 +51,9 @@ SRST
+@@ -58,9 +58,9 @@ SRST
ERST
DEF("dd", img_dd,
DEF("info", img_info,
diff --git a/qemu-img.c b/qemu-img.c
-index 667c540a89..6b7d1fcb51 100644
+index 45aa024acc..af54d0896e 100644
--- a/qemu-img.c
+++ b/qemu-img.c
-@@ -4444,10 +4444,12 @@ out:
+@@ -4819,10 +4819,12 @@ static int img_bitmap(int argc, char **argv)
#define C_IF 04
#define C_OF 010
#define C_SKIP 020
};
struct DdIo {
-@@ -4526,6 +4528,20 @@ static int img_dd_skip(const char *arg,
+@@ -4898,6 +4900,19 @@ static int img_dd_skip(const char *arg,
return 0;
}
+ struct DdIo *in, struct DdIo *out,
+ struct DdInfo *dd)
+{
-+ dd->osize = cvtnum(arg);
++ dd->osize = cvtnum("size", arg);
+
+ if (dd->osize < 0) {
-+ error_report("invalid number: '%s'", arg);
+ return 1;
+ }
+
static int img_dd(int argc, char **argv)
{
int ret = 0;
-@@ -4566,6 +4582,7 @@ static int img_dd(int argc, char **argv)
+@@ -4938,6 +4953,7 @@ static int img_dd(int argc, char **argv)
{ "if", img_dd_if, C_IF },
{ "of", img_dd_of, C_OF },
{ "skip", img_dd_skip, C_SKIP },
{ NULL, NULL, 0 }
};
const struct option long_options[] = {
-@@ -4644,8 +4661,13 @@ static int img_dd(int argc, char **argv)
+@@ -5016,8 +5032,13 @@ static int img_dd(int argc, char **argv)
arg = NULL;
}
ret = -1;
goto out;
}
-@@ -4657,85 +4679,101 @@ static int img_dd(int argc, char **argv)
+@@ -5029,85 +5050,101 @@ static int img_dd(int argc, char **argv)
goto out;
}
}
if (dd.flags & C_SKIP && (in.offset > INT64_MAX / in.bsz ||
-@@ -4753,11 +4791,17 @@ static int img_dd(int argc, char **argv)
+@@ -5125,11 +5162,17 @@ static int img_dd(int argc, char **argv)
for (out_pos = 0; in_pos < size; block_count++) {
int in_ret, out_ret;
}
if (in_ret < 0) {
error_report("error while reading from input image file: %s",
-@@ -4767,9 +4811,13 @@ static int img_dd(int argc, char **argv)
+@@ -5139,9 +5182,13 @@ static int img_dd(int argc, char **argv)
}
in_pos += in_ret;
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
- qemu-img.c | 29 ++++++++++++++++++++++++++---
- 1 file changed, 26 insertions(+), 3 deletions(-)
+ qemu-img.c | 28 +++++++++++++++++++++++++---
+ 1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
-index 6b7d1fcb51..17393b2f53 100644
+index af54d0896e..0f1d464392 100644
--- a/qemu-img.c
+++ b/qemu-img.c
-@@ -4445,11 +4445,13 @@ out:
+@@ -4820,11 +4820,13 @@ static int img_bitmap(int argc, char **argv)
#define C_OF 010
#define C_SKIP 020
#define C_OSIZE 040
};
struct DdIo {
-@@ -4542,6 +4544,20 @@ static int img_dd_osize(const char *arg,
+@@ -4913,6 +4915,19 @@ static int img_dd_osize(const char *arg,
return 0;
}
+ struct DdIo *in, struct DdIo *out,
+ struct DdInfo *dd)
+{
-+ dd->isize = cvtnum(arg);
++ dd->isize = cvtnum("size", arg);
+
+ if (dd->isize < 0) {
-+ error_report("invalid number: '%s'", arg);
+ return 1;
+ }
+
static int img_dd(int argc, char **argv)
{
int ret = 0;
-@@ -4556,12 +4572,14 @@ static int img_dd(int argc, char **argv)
+@@ -4927,12 +4942,14 @@ static int img_dd(int argc, char **argv)
int c, i;
const char *out_fmt = "raw";
const char *fmt = NULL;
};
struct DdIo in = {
.bsz = 512, /* Block size is by default 512 bytes */
-@@ -4583,6 +4601,7 @@ static int img_dd(int argc, char **argv)
+@@ -4954,6 +4971,7 @@ static int img_dd(int argc, char **argv)
{ "of", img_dd_of, C_OF },
{ "skip", img_dd_skip, C_SKIP },
{ "osize", img_dd_osize, C_OSIZE },
{ NULL, NULL, 0 }
};
const struct option long_options[] = {
-@@ -4789,14 +4808,18 @@ static int img_dd(int argc, char **argv)
+@@ -5160,14 +5178,18 @@ static int img_dd(int argc, char **argv)
in.buf = g_new(uint8_t, in.bsz);
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
-index 17393b2f53..574bb3c73d 100644
+index 0f1d464392..9635e9c001 100644
--- a/qemu-img.c
+++ b/qemu-img.c
-@@ -4574,7 +4574,7 @@ static int img_dd(int argc, char **argv)
+@@ -4944,7 +4944,7 @@ static int img_dd(int argc, char **argv)
const char *fmt = NULL;
int64_t size = 0, readsize = 0;
int64_t block_count = 0, out_pos, in_pos;
struct DdInfo dd = {
.flags = 0,
.count = 0,
-@@ -4612,7 +4612,7 @@ static int img_dd(int argc, char **argv)
+@@ -4982,7 +4982,7 @@ static int img_dd(int argc, char **argv)
{ 0, 0, 0, 0 }
};
if (c == EOF) {
break;
}
-@@ -4632,6 +4632,9 @@ static int img_dd(int argc, char **argv)
+@@ -5002,6 +5002,9 @@ static int img_dd(int argc, char **argv)
case 'h':
help();
break;
case 'U':
force_share = true;
break;
-@@ -4772,13 +4775,15 @@ static int img_dd(int argc, char **argv)
+@@ -5142,13 +5145,15 @@ static int img_dd(int argc, char **argv)
size - in.bsz * in.offset, &error_abort);
}
3 files changed, 81 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
-index a4729f7fc9..97c1c16ccf 100644
+index 22cb5df717..6513adb0a6 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
-@@ -713,8 +713,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f,
+@@ -805,8 +805,37 @@ static uint64_t virtio_balloon_get_features(VirtIODevice *vdev, uint64_t f,
static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
{
VirtIOBalloon *dev = opaque;
static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 9b94e67879..0c6f6ff331 100644
+index ae4b6a4246..6e26ea2cd0 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
-@@ -653,7 +653,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
+@@ -660,7 +660,35 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict)
return;
}
qapi_free_BalloonInfo(info);
}
diff --git a/qapi/misc.json b/qapi/misc.json
-index 99b90ac80b..e2a6678eae 100644
+index 9d32820dc1..44b1fb6fa7 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
-@@ -225,10 +225,30 @@
+@@ -226,10 +226,30 @@
#
# @actual: the number of bytes the balloon currently contains
#
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
-index eed5aeb2f7..1953633e82 100644
+index 963088b798..32f630549e 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
-@@ -230,6 +230,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
+@@ -234,6 +234,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
info->numa_mem_supported = mc->numa_mem_supported;
info->deprecated = !!mc->deprecation_reason;
info->default_cpu_type = g_strdup(mc->default_cpu_type);
info->has_default_cpu_type = true;
diff --git a/qapi/machine.json b/qapi/machine.json
-index ff7b5032e3..f6cf28f9fd 100644
+index 481b1f07ec..268044a34b 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
-@@ -340,6 +340,8 @@
+@@ -342,6 +342,8 @@
#
# @is-default: whether the machine is default
#
# @cpu-max: maximum number of CPUs supported by the machine type
# (since 1.5.0)
#
-@@ -359,7 +361,7 @@
+@@ -361,7 +363,7 @@
##
{ 'struct': 'MachineInfo',
'data': { 'name': 'str', '*alias': 'str',
2 files changed, 8 insertions(+)
diff --git a/qapi/ui.json b/qapi/ui.json
-index e16e98a060..feda6ef090 100644
+index 9d6721037f..af87b18db9 100644
--- a/qapi/ui.json
+++ b/qapi/ui.json
-@@ -213,11 +213,14 @@
+@@ -214,11 +214,14 @@
#
# @channels: a list of @SpiceChannel for each active spice channel
#
create mode 100644 savevm-async.c
diff --git a/Makefile.objs b/Makefile.objs
-index a7c967633a..d0b4dde836 100644
+index d22b3b45d7..a1307c12a8 100644
--- a/Makefile.objs
+++ b/Makefile.objs
-@@ -47,6 +47,7 @@ common-obj-y += bootdevice.o iothread.o
+@@ -46,6 +46,7 @@ common-obj-y += bootdevice.o iothread.o
common-obj-y += dump/
common-obj-y += job-qmp.o
common-obj-y += monitor/
common-obj-y += qdev-monitor.o
common-obj-$(CONFIG_WIN32) += os-win32.o
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
-index ca5198438d..89fea71972 100644
+index 30209e3903..ae8ff21789 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
-@@ -579,6 +579,19 @@ SRST
+@@ -580,6 +580,19 @@ SRST
Show current migration xbzrle cache size.
ERST
.name = "balloon",
.args_type = "",
diff --git a/hmp-commands.hx b/hmp-commands.hx
-index 7f0f3974ad..81fe305d07 100644
+index 60f395c276..2b58ac4a1c 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
-@@ -1814,3 +1814,35 @@ ERST
+@@ -1829,3 +1829,35 @@ ERST
.flags = "p",
},
+ .cmd = hmp_savevm_end,
+ },
diff --git a/include/block/aio.h b/include/block/aio.h
-index 62ed954344..d5399c67d6 100644
+index b2f703fa3f..c37617b404 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -17,6 +17,7 @@
#endif
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
-index e33ca5a911..601827d43f 100644
+index c986cfd28b..243952d32f 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -25,6 +25,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict);
void hmp_screendump(Monitor *mon, const QDict *qdict);
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 0c6f6ff331..39c7474cea 100644
+index 6e26ea2cd0..280bb447a6 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
-@@ -1876,6 +1876,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
+@@ -1904,6 +1904,63 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, err);
}
{
IOThreadInfoList *info_list = qmp_query_iothreads(NULL);
diff --git a/qapi/migration.json b/qapi/migration.json
-index eca2981d0a..081663d67a 100644
+index ea53b23dca..c556257544 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
-@@ -222,6 +222,40 @@
+@@ -225,6 +225,40 @@
'*compression': 'CompressionStats',
'*socket-address': ['SocketAddress'] } }
# @query-migrate:
#
diff --git a/qapi/misc.json b/qapi/misc.json
-index e2a6678eae..0868de22b7 100644
+index 44b1fb6fa7..9895899f8b 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
-@@ -1165,6 +1165,38 @@
+@@ -1168,6 +1168,38 @@
##
{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
# @AcpiTableOptions:
#
diff --git a/qemu-options.hx b/qemu-options.hx
-index 292d4e7c0c..55eef64ddf 100644
+index 708583b4ce..d32995cc50 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
-@@ -3832,6 +3832,18 @@ SRST
+@@ -3866,6 +3866,18 @@ SRST
Start right away with a saved state (``loadvm`` in monitor)
ERST
"-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
diff --git a/savevm-async.c b/savevm-async.c
new file mode 100644
-index 0000000000..7fd8a69374
+index 0000000000..f918e18dce
--- /dev/null
+++ b/savevm-async.c
@@ -0,0 +1,542 @@
+ * note2: PVE requires 1024 (BDRV_SECTOR_SIZE*2) alignment
+ */
+ size_t size = QEMU_ALIGN_UP(snap_state.bs_pos, BDRV_SECTOR_SIZE*2);
-+ blk_truncate(snap_state.target, size, false, PREALLOC_MODE_OFF, NULL);
++ blk_truncate(snap_state.target, size, false, PREALLOC_MODE_OFF, 0, NULL);
+ blk_op_unblock_all(snap_state.target, snap_state.blocker);
+ error_free(snap_state.blocker);
+ snap_state.blocker = NULL;
+ return ret;
+}
diff --git a/softmmu/vl.c b/softmmu/vl.c
-index 32c0047889..4b45eb0c37 100644
+index 4eb9d1f7fd..670b7e427c 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
-@@ -2827,6 +2827,7 @@ void qemu_init(int argc, char **argv, char **envp)
+@@ -2844,6 +2844,7 @@ void qemu_init(int argc, char **argv, char **envp)
int optind;
const char *optarg;
const char *loadvm = NULL;
MachineClass *machine_class;
const char *cpu_option;
const char *vga_model = NULL;
-@@ -3391,6 +3392,9 @@ void qemu_init(int argc, char **argv, char **envp)
+@@ -3408,6 +3409,9 @@ void qemu_init(int argc, char **argv, char **envp)
case QEMU_OPTION_loadvm:
loadvm = optarg;
break;
case QEMU_OPTION_full_screen:
dpy.has_full_screen = true;
dpy.full_screen = true;
-@@ -4447,6 +4451,12 @@ void qemu_init(int argc, char **argv, char **envp)
+@@ -4464,6 +4468,12 @@ void qemu_init(int argc, char **argv, char **envp)
autostart = 0;
exit(1);
}
if (replay_mode != REPLAY_MODE_NONE) {
replay_vmstate_init();
diff --git a/util/async.c b/util/async.c
-index 3165a28f2f..4eba1e6f1b 100644
+index 1319eee3bc..b68e73f488 100644
--- a/util/async.c
+++ b/util/async.c
-@@ -558,6 +558,36 @@ void aio_co_schedule(AioContext *ctx, Coroutine *co)
+@@ -559,6 +559,36 @@ void aio_co_schedule(AioContext *ctx, Coroutine *co)
aio_context_unref(ctx);
}
3 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
-index 1c3a358a14..7362e51c71 100644
+index be21518c57..a4d2e2c8ff 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -30,7 +30,7 @@
-#define IO_BUF_SIZE 32768
+#define DEFAULT_IO_BUF_SIZE 32768
- #define MAX_IOV_SIZE MIN(IOV_MAX, 64)
+ #define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 64)
struct QEMUFile {
@@ -45,7 +45,8 @@ struct QEMUFile {
int qemu_get_fd(QEMUFile *f);
int qemu_fclose(QEMUFile *f);
diff --git a/savevm-async.c b/savevm-async.c
-index 7fd8a69374..0388cebbe9 100644
+index f918e18dce..156b7a030e 100644
--- a/savevm-async.c
+++ b/savevm-async.c
@@ -392,7 +392,7 @@ void qmp_savevm_start(bool has_statefile, const char *statefile, Error **errp)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
block/Makefile.objs | 1 +
- block/zeroinit.c | 197 ++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 198 insertions(+)
+ block/zeroinit.c | 198 ++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 199 insertions(+)
create mode 100644 block/zeroinit.c
diff --git a/block/Makefile.objs b/block/Makefile.objs
-index 3635b6b4c1..1282445672 100644
+index 19c6f371c9..d1a9227b8f 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -11,6 +11,7 @@ block-obj-$(CONFIG_QED) += qed.o qed-l2-cache.o qed-table.o qed-cluster.o
block-obj-y += blklogwrites.o
diff --git a/block/zeroinit.c b/block/zeroinit.c
new file mode 100644
-index 0000000000..ff38388d94
+index 0000000000..4fbb80eab0
--- /dev/null
+++ b/block/zeroinit.c
-@@ -0,0 +1,197 @@
+@@ -0,0 +1,198 @@
+/*
+ * Filter to fake a zero-initialized block device.
+ *
+
+ /* Open the raw file */
+ bs->file = bdrv_open_child(qemu_opt_get(opts, "x-next"), options, "next",
-+ bs, &child_file, false, &local_err);
++ bs, &child_of_bds, BDRV_CHILD_FILTERED, false, &local_err);
+ if (local_err) {
+ ret = -EINVAL;
+ error_propagate(errp, local_err);
+}
+
+static int zeroinit_co_truncate(BlockDriverState *bs, int64_t offset,
-+ _Bool exact, PreallocMode prealloc, Error **errp)
++ _Bool exact, PreallocMode prealloc,
++ BdrvRequestFlags req_flags, Error **errp)
+{
-+ return bdrv_co_truncate(bs->file, offset, exact, prealloc, errp);
++ return bdrv_co_truncate(bs->file, offset, exact, prealloc, req_flags, errp);
+}
+
+static int zeroinit_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
+ .bdrv_file_open = zeroinit_open,
+ .bdrv_close = zeroinit_close,
+ .bdrv_getlength = zeroinit_getlength,
-+ .bdrv_child_perm = bdrv_filter_default_perms,
++ .bdrv_child_perm = bdrv_default_perms,
+ .bdrv_co_flush_to_disk = zeroinit_co_flush,
+
+ .bdrv_co_pwrite_zeroes = zeroinit_co_pwrite_zeroes,
2 files changed, 11 insertions(+)
diff --git a/qemu-options.hx b/qemu-options.hx
-index 55eef64ddf..e11b4f8ff5 100644
+index d32995cc50..abfde19ce0 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
-@@ -904,6 +904,9 @@ DEFHEADING()
+@@ -914,6 +914,9 @@ DEFHEADING()
DEFHEADING(Block device options:)
"-fda/-fdb file use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
diff --git a/softmmu/vl.c b/softmmu/vl.c
-index 4b45eb0c37..9de81875fd 100644
+index 670b7e427c..366e30e594 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
-@@ -2815,6 +2815,7 @@ static void create_default_memdev(MachineState *ms, const char *path)
+@@ -2832,6 +2832,7 @@ static void create_default_memdev(MachineState *ms, const char *path)
void qemu_init(int argc, char **argv, char **envp)
{
int i;
int snapshot, linux_boot;
const char *initrd_filename;
const char *kernel_filename, *kernel_cmdline;
-@@ -3518,6 +3519,13 @@ void qemu_init(int argc, char **argv, char **envp)
+@@ -3530,6 +3531,13 @@ void qemu_init(int argc, char **argv, char **envp)
exit(1);
}
break;
1 file changed, 9 insertions(+)
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
-index 9ec0f2deb2..a00d45251f 100644
+index 81addd6390..c2026b07c5 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
-@@ -259,6 +259,15 @@ static void apic_reset_common(DeviceState *dev)
+@@ -278,6 +278,15 @@ static void apic_reset_common(DeviceState *dev)
info->vapic_base_update(s);
apic_init_reset(dev);
2 files changed, 43 insertions(+), 21 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c
-index b527e82a82..36ebd0967e 100644
+index bb72e1e5ca..914bd1f367 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
-@@ -2309,6 +2309,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
+@@ -2390,6 +2390,7 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
int fd;
uint64_t perm, shared;
int result = 0;
/* Validate options and set default values */
assert(options->driver == BLOCKDEV_DRIVER_FILE);
-@@ -2342,19 +2343,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
+@@ -2431,19 +2432,22 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
perm = BLK_PERM_WRITE | BLK_PERM_RESIZE;
shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
}
/* Clear the file by truncating it to 0 */
-@@ -2387,13 +2391,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
+@@ -2497,13 +2501,15 @@ raw_co_create(BlockdevCreateOptions *options, Error **errp)
}
out_unlock:
}
out_close:
-@@ -2416,6 +2422,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
+@@ -2528,6 +2534,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
PreallocMode prealloc;
char *buf = NULL;
Error *local_err = NULL;
/* Skip file: protocol prefix */
strstart(filename, "file:", &filename);
-@@ -2433,6 +2440,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
+@@ -2550,6 +2557,18 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
return -EINVAL;
}
options = (BlockdevCreateOptions) {
.driver = BLOCKDEV_DRIVER_FILE,
.u.file = {
-@@ -2442,6 +2461,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
- .preallocation = prealloc,
- .has_nocow = true,
+@@ -2561,6 +2580,8 @@ static int coroutine_fn raw_co_create_opts(BlockDriver *drv,
.nocow = nocow,
+ .has_extent_size_hint = has_extent_size_hint,
+ .extent_size_hint = extent_size_hint,
+ .has_locking = true,
+ .locking = locking,
},
};
return raw_co_create(&options, errp);
-@@ -2983,7 +3004,7 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared,
+@@ -3107,7 +3128,7 @@ static int raw_check_perm(BlockDriverState *bs, uint64_t perm, uint64_t shared,
}
/* Copy locks to the new fd */
false, errp);
if (ret < 0) {
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 943df1926a..4c55464f86 100644
+index 197bdc1c36..ea5fae22ae 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -4183,7 +4183,8 @@
- 'data': { 'filename': 'str',
- 'size': 'size',
- '*preallocation': 'PreallocMode',
-- '*nocow': 'bool' } }
-+ '*nocow': 'bool',
+@@ -4178,7 +4178,8 @@
+ 'size': 'size',
+ '*preallocation': 'PreallocMode',
+ '*nocow': 'bool',
+- '*extent-size-hint': 'size'} }
++ '*extent-size-hint': 'size',
+ '*locking': 'OnOffAuto' } }
##
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/monitor/qmp.c b/monitor/qmp.c
-index f89e7daf27..ed5e39fcf7 100644
+index d433ceae5b..a16cf3532d 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
-@@ -406,8 +406,7 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
+@@ -409,8 +409,7 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
qemu_chr_fe_set_echo(&mon->common.chr, true);
/* Note: we run QMP monitor in I/O thread when @chr supports that */
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/core/machine.c b/hw/core/machine.c
-index c1a444cb75..9f56ecc4e8 100644
+index 8d1a90c6cf..413902777e 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
-@@ -56,7 +56,8 @@ GlobalProperty hw_compat_4_0[] = {
+@@ -66,7 +66,8 @@ GlobalProperty hw_compat_4_0[] = {
{ "virtio-vga", "edid", "false" },
{ "virtio-gpu-device", "edid", "false" },
{ "virtio-device", "use-started", "false" },
4 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
-index 1953633e82..ca8c0dc53d 100644
+index 32f630549e..71e19db4e1 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
-@@ -234,6 +234,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
+@@ -238,6 +238,12 @@ MachineInfoList *qmp_query_machines(Error **errp)
if (strcmp(mc->name, MACHINE_GET_CLASS(current_machine)->name) == 0) {
info->has_is_current = true;
info->is_current = true;
if (mc->default_cpu_type) {
diff --git a/include/hw/boards.h b/include/hw/boards.h
-index fd4d62b501..dd395e9232 100644
+index 426ce5f625..3bce25a25f 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -170,6 +170,8 @@ struct MachineClass {
void (*reset)(MachineState *state);
void (*wakeup)(MachineState *state);
diff --git a/qapi/machine.json b/qapi/machine.json
-index f6cf28f9fd..a7f9c79a59 100644
+index 268044a34b..7a811a5860 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
-@@ -363,7 +363,8 @@
+@@ -365,7 +365,8 @@
'data': { 'name': 'str', '*alias': 'str',
'*is-default': 'bool', '*is-current': 'bool', 'cpu-max': 'int',
'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool',
##
# @query-machines:
diff --git a/softmmu/vl.c b/softmmu/vl.c
-index 9de81875fd..8340c4ca53 100644
+index 366e30e594..16aa2186b0 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
-@@ -2300,6 +2300,8 @@ static MachineClass *machine_parse(const char *name, GSList *machines)
+@@ -2322,6 +2322,8 @@ static MachineClass *machine_parse(const char *name, GSList *machines)
{
MachineClass *mc;
GSList *el;
if (is_help_option(name)) {
printf("Supported machines are:\n");
-@@ -2316,12 +2318,23 @@ static MachineClass *machine_parse(const char *name, GSList *machines)
+@@ -2338,12 +2340,23 @@ static MachineClass *machine_parse(const char *name, GSList *machines)
exit(0);
}
5 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/block/backup.c b/block/backup.c
-index a7a7dcaf4c..ecd93e91e0 100644
+index 4f13bb20a5..5f373a4f9b 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -338,6 +338,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
+ int pause_count,
JobTxn *txn, Error **errp)
{
- int64_t len;
-@@ -459,6 +460,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
+ int64_t len, target_len;
+@@ -471,6 +472,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);
error:
diff --git a/block/replication.c b/block/replication.c
-index da013c2041..17246a822c 100644
+index 0c70215784..59270a0468 100644
--- a/block/replication.c
+++ b/block/replication.c
-@@ -554,7 +554,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
+@@ -560,7 +560,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
0, MIRROR_SYNC_MODE_NONE, NULL, 0, false, NULL,
BLOCKDEV_ON_ERROR_REPORT,
BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL,
error_propagate(errp, local_err);
backup_job_cleanup(bs);
diff --git a/blockdev.c b/blockdev.c
-index 5faddaa705..65c358e4ef 100644
+index 3848a9c8ab..5107c5445e 100644
--- a/blockdev.c
+++ b/blockdev.c
-@@ -3114,7 +3114,8 @@ static BlockJob *do_backup_common(BackupCommon *backup,
+@@ -2832,7 +2832,8 @@ static BlockJob *do_backup_common(BackupCommon *backup,
backup->filter_node_name,
backup->on_source_error,
backup->on_target_error,
}
diff --git a/include/block/block_int.h b/include/block/block_int.h
-index 4c3587ea19..336f71e69d 100644
+index 38dec0275b..5094ae1e95 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
-@@ -1219,6 +1219,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
+@@ -1254,6 +1254,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
BlockdevOnError on_target_error,
int creation_flags,
BlockCompletionFunc *cb, void *opaque,
create mode 100644 vma.h
diff --git a/Makefile b/Makefile
-index 8a9113e666..74c2039005 100644
+index 13dd708c4a..7b8c17ce2d 100644
--- a/Makefile
+++ b/Makefile
@@ -479,7 +479,7 @@ dummy := $(call unnest-vars,, \
qemu-version.h: FORCE
$(call quiet-command, \
-@@ -608,6 +608,7 @@ qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io
+@@ -602,6 +602,7 @@ qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io
qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) $(storage-daemon-obj-y) $(COMMON_LDADDS)
qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
diff --git a/Makefile.objs b/Makefile.objs
-index d0b4dde836..05031a3da7 100644
+index a1307c12a8..ade7b17a69 100644
--- a/Makefile.objs
+++ b/Makefile.objs
-@@ -18,6 +18,7 @@ block-obj-y += block.o blockjob.o job.o
- block-obj-y += block/ scsi/
+@@ -17,6 +17,7 @@ block-obj-y = block/ nbd/ scsi/
+ block-obj-y += block.o blockjob.o job.o
block-obj-y += qemu-io-cmds.o
block-obj-$(CONFIG_REPLICATION) += replication.o
+block-obj-y += vma-writer.o
- job.c: make job_should_pause non-static
---
block/Makefile.objs | 1 +
- block/backup-dump.c | 169 ++++++++++++++++++++++++++++++++++++++
+ block/backup-dump.c | 168 ++++++++++++++++++++++++++++++++++++++
block/backup.c | 23 ++----
include/block/block_int.h | 30 +++++++
job.c | 3 +-
- 5 files changed, 207 insertions(+), 19 deletions(-)
+ 5 files changed, 206 insertions(+), 19 deletions(-)
create mode 100644 block/backup-dump.c
diff --git a/block/Makefile.objs b/block/Makefile.objs
-index 1282445672..8af7073c83 100644
+index d1a9227b8f..9ea0477d0b 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
-@@ -34,6 +34,7 @@ block-obj-$(CONFIG_RBD) += rbd.o
+@@ -33,6 +33,7 @@ block-obj-$(CONFIG_CURL) += curl.o
+ block-obj-$(CONFIG_RBD) += rbd.o
block-obj-$(CONFIG_GLUSTERFS) += gluster.o
- block-obj-$(CONFIG_VXHS) += vxhs.o
block-obj-$(CONFIG_LIBSSH) += ssh.o
+block-obj-y += backup-dump.o
block-obj-y += accounting.o dirty-bitmap.o
block-obj-y += backup.o
diff --git a/block/backup-dump.c b/block/backup-dump.c
new file mode 100644
-index 0000000000..3066ab0698
+index 0000000000..93d7f46950
--- /dev/null
+++ b/block/backup-dump.c
-@@ -0,0 +1,169 @@
+@@ -0,0 +1,168 @@
+/*
+ * BlockDriver to send backup data stream to a callback function
+ *
+ BDRVBackupDumpState *s = bs->opaque;
+
+ bdi->cluster_size = s->dump_cb_block_size;
-+ bdi->unallocated_blocks_are_zero = true;
+ return 0;
+}
+
+static void qemu_backup_dump_child_perm(
+ BlockDriverState *bs,
+ BdrvChild *c,
-+ const BdrvChildRole *role,
++ BdrvChildRole role,
+ BlockReopenQueue *reopen_queue,
+ uint64_t perm, uint64_t shared,
+ uint64_t *nperm, uint64_t *nshared)
+ return bs;
+}
diff --git a/block/backup.c b/block/backup.c
-index ecd93e91e0..cf8f5ad25d 100644
+index 5f373a4f9b..1bcc7faa32 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -32,24 +32,6 @@
static const BlockJobDriver backup_job_driver;
static void backup_progress_bytes_callback(int64_t bytes, void *opaque)
-@@ -411,6 +393,11 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
+@@ -423,6 +405,11 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
goto error;
}
* If source is in backing chain of target assume that target is going to be
* used for "image fleecing", i.e. it should represent a kind of snapshot of
diff --git a/include/block/block_int.h b/include/block/block_int.h
-index 336f71e69d..62e5579723 100644
+index 5094ae1e95..dc72197388 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
-@@ -60,6 +60,36 @@
+@@ -62,6 +62,36 @@
#define BLOCK_PROBE_BUF_SIZE 512
create mode 100644 pve-backup.c
diff --git a/Makefile b/Makefile
-index 74c2039005..dbd9542ae4 100644
+index 7b8c17ce2d..aec216968d 100644
--- a/Makefile
+++ b/Makefile
-@@ -608,6 +608,7 @@ qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io
+@@ -602,6 +602,7 @@ qemu-img$(EXESUF): qemu-img.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io
qemu-nbd$(EXESUF): qemu-nbd.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) $(storage-daemon-obj-y) $(COMMON_LDADDS)
qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o $(COMMON_LDADDS)
diff --git a/Makefile.objs b/Makefile.objs
-index 05031a3da7..b7d58e592e 100644
+index ade7b17a69..240eb503f2 100644
--- a/Makefile.objs
+++ b/Makefile.objs
-@@ -34,6 +34,7 @@ endif # CONFIG_SOFTMMU or CONFIG_TOOLS
+@@ -33,6 +33,7 @@ endif # CONFIG_SOFTMMU or CONFIG_TOOLS
storage-daemon-obj-y = block/ monitor/ qapi/ qom/ storage-daemon/
storage-daemon-obj-y += blockdev.o blockdev-nbd.o iothread.o job-qmp.o
storage-daemon-obj-$(CONFIG_WIN32) += os-win32.o
storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
-@@ -45,6 +46,7 @@ storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
+@@ -44,6 +45,7 @@ storage-daemon-obj-$(CONFIG_POSIX) += os-posix.o
ifeq ($(CONFIG_SOFTMMU),y)
common-obj-y = blockdev.o blockdev-nbd.o block/
common-obj-y += bootdevice.o iothread.o
common-obj-y += job-qmp.o
common-obj-y += monitor/
diff --git a/Makefile.target b/Makefile.target
-index 8ed1eba95b..f453a95efc 100644
+index ffa2657269..fd3fd6d2a7 100644
--- a/Makefile.target
+++ b/Makefile.target
-@@ -162,7 +162,7 @@ obj-y += memory.o
- obj-y += memory_mapping.o
+@@ -159,7 +159,7 @@ obj-y += hw/
+ obj-y += monitor/
+ obj-y += qapi/
obj-y += migration/ram.o
- obj-y += softmmu/
-LIBS := $(libs_softmmu) $(LIBS)
+LIBS := $(libs_softmmu) $(LIBS) -lproxmox_backup_qemu
+ hmp_handle_error(mon, error);
+}
diff --git a/blockdev.c b/blockdev.c
-index 65c358e4ef..f391c3b3c7 100644
+index 5107c5445e..3c427fc4be 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -36,6 +36,7 @@
#include "monitor/monitor.h"
#include "qemu/error-report.h"
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
-index 89fea71972..64995443d4 100644
+index ae8ff21789..da16499f8d 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
-@@ -512,6 +512,19 @@ SRST
+@@ -513,6 +513,19 @@ SRST
Show CPU statistics.
ERST
{
.name = "usernet",
diff --git a/hmp-commands.hx b/hmp-commands.hx
-index 81fe305d07..8a03b45c44 100644
+index 2b58ac4a1c..9e58b6a5fc 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -97,6 +97,35 @@ ERST
{
diff --git a/include/block/block_int.h b/include/block/block_int.h
-index 62e5579723..6d234f1de9 100644
+index dc72197388..5ff3b1186f 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
-@@ -62,7 +62,7 @@
+@@ -64,7 +64,7 @@
typedef int BackupDumpFunc(void *opaque, uint64_t offset, uint64_t bytes, const void *buf);
uint64_t byte_size,
BackupDumpFunc *dump_cb,
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
-index 601827d43f..6653d04c3c 100644
+index 243952d32f..892a6064be 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -30,6 +30,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict);
void hmp_device_add(Monitor *mon, const QDict *qdict);
void hmp_device_del(Monitor *mon, const QDict *qdict);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 39c7474cea..7fd59b1c22 100644
+index 280bb447a6..0e2d166552 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -192,6 +192,50 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
+ return task.result;
+}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 4c55464f86..97d1f64636 100644
+index ea5fae22ae..69db270b1a 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -744,6 +744,115 @@
+@@ -754,6 +754,115 @@
{ 'command': 'query-block', 'returns': ['BlockInfo'] }
# @BlockDeviceTimedStats:
#
diff --git a/qapi/common.json b/qapi/common.json
-index 7b9cbcd97b..c3b8bb7b48 100644
+index 716712d4b3..556dab79e1 100644
--- a/qapi/common.json
+++ b/qapi/common.json
-@@ -144,3 +144,16 @@
+@@ -145,3 +145,16 @@
##
{ 'enum': 'PCIELinkWidth',
'data': [ '1', '2', '4', '8', '12', '16', '32' ] }
+##
+{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} }
diff --git a/qapi/misc.json b/qapi/misc.json
-index 0868de22b7..c690a3707d 100644
+index 9895899f8b..75dff1b306 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
-@@ -129,19 +129,6 @@
+@@ -130,19 +130,6 @@
##
{ 'command': 'query-kvm', 'returns': 'KvmInfo' }
create mode 100644 pbs-restore.c
diff --git a/Makefile b/Makefile
-index dbd9542ae4..7c1fb58e18 100644
+index aec216968d..b73da29f24 100644
--- a/Makefile
+++ b/Makefile
@@ -479,7 +479,7 @@ dummy := $(call unnest-vars,, \
qemu-version.h: FORCE
$(call quiet-command, \
-@@ -610,6 +610,8 @@ qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-o
+@@ -604,6 +604,8 @@ qemu-io$(EXESUF): qemu-io.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-o
qemu-storage-daemon$(EXESUF): qemu-storage-daemon.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(chardev-obj-y) $(io-obj-y) $(qom-obj-y) $(storage-daemon-obj-y) $(COMMON_LDADDS)
qemu-storage-daemon$(EXESUF): LIBS += -lproxmox_backup_qemu
vma$(EXESUF): vma.o vma-reader.o $(authz-obj-y) $(block-obj-y) $(crypto-obj-y) $(io-obj-y) $(qom-obj-y) $(COMMON_LDADDS)
5 files changed, 145 insertions(+), 29 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
-index c26fd9260d..3c9cd42c50 100644
+index e8e8844afc..100e828639 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -49,7 +49,7 @@ typedef struct MirrorBlockJob {
static void coroutine_fn mirror_throttle(MirrorBlockJob *s)
{
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
-@@ -949,7 +962,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
+@@ -952,7 +965,8 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
mirror_free_init(s);
s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
ret = mirror_dirty_init(s);
if (ret < 0 || job_is_cancelled(&s->common.job)) {
goto immediate_exit;
-@@ -1181,6 +1195,7 @@ static const BlockJobDriver mirror_job_driver = {
+@@ -1184,6 +1198,7 @@ static const BlockJobDriver mirror_job_driver = {
.run = mirror_run,
.prepare = mirror_prepare,
.abort = mirror_abort,
.pause = mirror_pause,
.complete = mirror_complete,
},
-@@ -1196,6 +1211,7 @@ static const BlockJobDriver commit_active_job_driver = {
+@@ -1199,6 +1214,7 @@ static const BlockJobDriver commit_active_job_driver = {
.run = mirror_run,
.prepare = mirror_prepare,
.abort = mirror_abort,
.pause = mirror_pause,
.complete = mirror_complete,
},
-@@ -1542,7 +1558,10 @@ static BlockJob *mirror_start_job(
+@@ -1547,7 +1563,10 @@ static BlockJob *mirror_start_job(
BlockCompletionFunc *cb,
void *opaque,
const BlockJobDriver *driver,
bool auto_complete, const char *filter_node_name,
bool is_mirror, MirrorCopyMode copy_mode,
Error **errp)
-@@ -1555,10 +1574,39 @@ static BlockJob *mirror_start_job(
+@@ -1560,10 +1579,39 @@ static BlockJob *mirror_start_job(
Error *local_err = NULL;
int ret;
assert(is_power_of_2(granularity));
if (buf_size < 0) {
-@@ -1662,7 +1710,9 @@ static BlockJob *mirror_start_job(
+@@ -1667,7 +1715,9 @@ static BlockJob *mirror_start_job(
s->replaces = g_strdup(replaces);
s->on_source_error = on_source_error;
s->on_target_error = on_target_error;
s->backing_mode = backing_mode;
s->zero_target = zero_target;
s->copy_mode = copy_mode;
-@@ -1682,6 +1732,18 @@ static BlockJob *mirror_start_job(
+@@ -1687,6 +1737,18 @@ static BlockJob *mirror_start_job(
bdrv_disable_dirty_bitmap(s->dirty_bitmap);
}
ret = block_job_add_bdrv(&s->common, "source", bs, 0,
BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE |
BLK_PERM_CONSISTENT_READ,
-@@ -1735,6 +1797,9 @@ fail:
+@@ -1740,6 +1802,9 @@ fail:
if (s->dirty_bitmap) {
bdrv_release_dirty_bitmap(s->dirty_bitmap);
}
job_early_fail(&s->common.job);
}
-@@ -1752,29 +1817,23 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
+@@ -1757,29 +1822,23 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
BlockDriverState *target, const char *replaces,
int creation_flags, int64_t speed,
uint32_t granularity, int64_t buf_size,
}
BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
-@@ -1800,7 +1859,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
+@@ -1805,7 +1864,8 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
job_id, bs, creation_flags, base, NULL, speed, 0, 0,
MIRROR_LEAVE_BACKING_CHAIN, false,
on_error, on_error, true, cb, opaque,
&local_err);
if (local_err) {
diff --git a/blockdev.c b/blockdev.c
-index f391c3b3c7..bbeff9c439 100644
+index 3c427fc4be..28ed750ba5 100644
--- a/blockdev.c
+++ b/blockdev.c
-@@ -3159,6 +3159,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2877,6 +2877,10 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
BlockDriverState *target,
bool has_replaces, const char *replaces,
enum MirrorSyncMode sync,
BlockMirrorBackingMode backing_mode,
bool zero_target,
bool has_speed, int64_t speed,
-@@ -3177,6 +3181,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2895,6 +2899,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
Error **errp)
{
int job_flags = JOB_DEFAULT;
if (!has_speed) {
speed = 0;
-@@ -3231,6 +3236,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2949,6 +2954,29 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
sync = MIRROR_SYNC_MODE_FULL;
}
if (has_replaces) {
BlockDriverState *to_replace_bs;
AioContext *replace_aio_context;
-@@ -3268,8 +3296,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2986,8 +3014,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
* and will allow to check whether the node still exist at mirror completion
*/
mirror_start(job_id, bs, target,
on_source_error, on_target_error, unmap, filter_node_name,
copy_mode, errp);
}
-@@ -3410,6 +3438,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
+@@ -3128,6 +3156,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
blockdev_mirror_common(arg->has_job_id ? arg->job_id : NULL, bs, target_bs,
arg->has_replaces, arg->replaces, arg->sync,
backing_mode, zero_target,
arg->has_speed, arg->speed,
arg->has_granularity, arg->granularity,
-@@ -3432,6 +3462,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
+@@ -3149,6 +3179,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
const char *device, const char *target,
bool has_replaces, const char *replaces,
MirrorSyncMode sync,
bool has_speed, int64_t speed,
bool has_granularity, uint32_t granularity,
bool has_buf_size, int64_t buf_size,
-@@ -3482,7 +3514,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
+@@ -3198,7 +3230,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,
has_granularity, granularity,
has_buf_size, buf_size,
diff --git a/include/block/block_int.h b/include/block/block_int.h
-index 6d234f1de9..180a5e00fd 100644
+index 5ff3b1186f..befdae125b 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
-@@ -1210,7 +1210,9 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
+@@ -1245,7 +1245,9 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
BlockDriverState *target, const char *replaces,
int creation_flags, int64_t speed,
uint32_t granularity, int64_t buf_size,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 97d1f64636..8bdbccb397 100644
+index 69db270b1a..9db8e26517 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -2054,10 +2054,19 @@
+@@ -2064,10 +2064,19 @@
# (all the disk, only the sectors allocated in the topmost image, or
# only new I/O).
#
#
# @buf-size: maximum amount of data in flight from source to
# target (since 1.4).
-@@ -2095,7 +2104,9 @@
+@@ -2105,7 +2114,9 @@
{ 'struct': 'DriveMirror',
'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
'*format': 'str', '*node-name': 'str', '*replaces': 'str',
'*speed': 'int', '*granularity': 'uint32',
'*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
'*on-target-error': 'BlockdevOnError',
-@@ -2362,10 +2373,19 @@
+@@ -2372,10 +2383,19 @@
# (all the disk, only the sectors allocated in the topmost image, or
# only new I/O).
#
#
# @buf-size: maximum amount of data in flight from source to
# target
-@@ -2414,7 +2434,8 @@
+@@ -2424,7 +2444,8 @@
{ 'command': 'blockdev-mirror',
'data': { '*job-id': 'str', 'device': 'str', 'target': 'str',
'*replaces': 'str',
'*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
'*on-target-error': 'BlockdevOnError',
diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c
-index 0c861809f0..da87a67a57 100644
+index 3f866a35c6..500ede71c8 100644
--- a/tests/test-block-iothread.c
+++ b/tests/test-block-iothread.c
-@@ -611,8 +611,8 @@ static void test_propagate_mirror(void)
+@@ -623,8 +623,8 @@ static void test_propagate_mirror(void)
/* Start a mirror job */
mirror_start("job0", src, target, NULL, JOB_DEFAULT, 0, 0, 0,
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
-index 3c9cd42c50..08ac9827f2 100644
+index 100e828639..7d3c3252f3 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -653,8 +653,6 @@ static int mirror_exit_common(Job *job)
bs_opaque->job = NULL;
bdrv_drained_end(src);
-@@ -1584,10 +1594,6 @@ static BlockJob *mirror_start_job(
+@@ -1589,10 +1599,6 @@ static BlockJob *mirror_start_job(
" sync mode",
MirrorSyncMode_str(sync_mode));
return NULL;
}
} else if (bitmap) {
error_setg(errp,
-@@ -1604,6 +1610,12 @@ static BlockJob *mirror_start_job(
+@@ -1609,6 +1615,12 @@ static BlockJob *mirror_start_job(
return NULL;
}
granularity = bdrv_dirty_bitmap_granularity(bitmap);
1 file changed, 3 insertions(+)
diff --git a/blockdev.c b/blockdev.c
-index bbeff9c439..fa3c2f5548 100644
+index 28ed750ba5..4665321bd8 100644
--- a/blockdev.c
+++ b/blockdev.c
-@@ -3257,6 +3257,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2975,6 +2975,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_ALLOW_RO, errp)) {
return;
}
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
-index 08ac9827f2..c56b0f87e3 100644
+index 7d3c3252f3..fb12ccb932 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -756,8 +756,8 @@ static int mirror_exit_common(Job *job)
}
}
bdrv_release_dirty_bitmap(s->dirty_bitmap);
-@@ -1749,8 +1749,8 @@ static BlockJob *mirror_start_job(
+@@ -1754,8 +1754,8 @@ static BlockJob *mirror_start_job(
}
if (s->sync_mode == MIRROR_SYNC_MODE_BITMAP) {
+{"error": {"class": "GenericError", "desc": "bitmap-mode must be specified if a bitmap is provided"}}
+
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
-index 435dccd5af..939efd9c70 100644
+index 025ed5238d..bee527c012 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -270,6 +270,7 @@
3 files changed, 70 insertions(+), 59 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
-index c56b0f87e3..dbba6fc80e 100644
+index fb12ccb932..dfce442e97 100644
--- a/block/mirror.c
+++ b/block/mirror.c
-@@ -1584,31 +1584,13 @@ static BlockJob *mirror_start_job(
+@@ -1589,31 +1589,13 @@ static BlockJob *mirror_start_job(
Error *local_err = NULL;
int ret;
if (bitmap_mode != BITMAP_SYNC_MODE_NEVER) {
diff --git a/blockdev.c b/blockdev.c
-index fa3c2f5548..206de2b6c2 100644
+index 4665321bd8..1db0cbcad5 100644
--- a/blockdev.c
+++ b/blockdev.c
-@@ -3236,7 +3236,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
+@@ -2954,7 +2954,36 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
sync = MIRROR_SYNC_MODE_FULL;
}
false, NULL, false, NULL, !!devlist,
devlist, qdict_haskey(qdict, "speed"), speed, &error);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 7fd59b1c22..4f692c15a2 100644
+index 0e2d166552..3ff014d32a 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -218,19 +218,42 @@ void hmp_info_backup(Monitor *mon, const QDict *qdict)
qemu_mutex_unlock(&backup_state.stat.lock);
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 8bdbccb397..8ffff7aaab 100644
+index 9db8e26517..6cad1e0e38 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -757,8 +757,13 @@
+@@ -767,8 +767,13 @@
#
# @total: total amount of bytes involved in the backup process
#
# @zero-bytes: amount of 'zero' bytes detected.
#
# @start-time: time (epoch) when backup job started.
-@@ -771,8 +776,8 @@
+@@ -781,8 +786,8 @@
#
##
{ 'struct': 'BackupStatus',
'*start-time': 'int', '*end-time': 'int',
'*backup-file': 'str', '*uuid': 'str' } }
-@@ -815,6 +820,8 @@
+@@ -825,6 +830,8 @@
#
# @backup-time: backup timestamp (Unix epoch, required for format 'pbs')
#
# Returns: the uuid of the backup job
#
##
-@@ -825,6 +832,7 @@
+@@ -835,6 +842,7 @@
'*fingerprint': 'str',
'*backup-id': 'str',
'*backup-time': 'int',
.format = format,
.has_config_file = has_config_file,
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 8ffff7aaab..4fe3d6f751 100644
+index 6cad1e0e38..e00e577c6c 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -757,7 +757,7 @@
+@@ -767,7 +767,7 @@
#
# @total: total amount of bytes involved in the backup process
#
# in the backup process which are marked dirty.
#
# @transferred: amount of bytes already backed up.
-@@ -820,7 +820,7 @@
+@@ -830,7 +830,7 @@
#
# @backup-time: backup timestamp (Unix epoch, required for format 'pbs')
#
#
# Returns: the uuid of the backup job
#
-@@ -832,7 +832,7 @@
+@@ -842,7 +842,7 @@
'*fingerprint': 'str',
'*backup-id': 'str',
'*backup-time': 'int',
false, NULL, false, NULL, !!devlist,
devlist, qdict_haskey(qdict, "speed"), speed, &error);
diff --git a/pve-backup.c b/pve-backup.c
-index 46191bb328..3323b195a4 100644
+index aa62a1da16..343035b5c9 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -567,6 +567,10 @@ typedef struct QmpBackupTask {
.speed = speed,
.errp = errp,
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 4fe3d6f751..0bc15a5098 100644
+index e00e577c6c..a177fea6cd 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -822,6 +822,10 @@
+@@ -832,6 +832,10 @@
#
# @use-dirty-bitmap: use dirty bitmap to detect incremental changes since last job (optional for format 'pbs')
#
# Returns: the uuid of the backup job
#
##
-@@ -833,6 +837,8 @@
+@@ -843,6 +847,8 @@
'*backup-id': 'str',
'*backup-time': 'int',
'*use-dirty-bitmap': 'bool',
create mode 100644 block/pbs.c
diff --git a/block/Makefile.objs b/block/Makefile.objs
-index 8af7073c83..9785e4431d 100644
+index 9ea0477d0b..28fb3b7f7c 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -5,6 +5,7 @@ block-obj-$(CONFIG_CLOOP) += cloop.o
block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o qcow2-bitmap.o qcow2-threads.o
block-obj-$(CONFIG_QED) += qed.o qed-l2-cache.o qed-table.o qed-cluster.o
-@@ -76,3 +77,4 @@ io_uring.o-cflags := $(LINUX_IO_URING_CFLAGS)
+@@ -75,3 +76,4 @@ io_uring.o-cflags := $(LINUX_IO_URING_CFLAGS)
io_uring.o-libs := $(LINUX_IO_URING_LIBS)
parallels.o-cflags := $(LIBXML2_CFLAGS)
parallels.o-libs := $(LIBXML2_LIBS)
+
+block_init(bdrv_pbs_init);
diff --git a/configure b/configure
-index 23b5e93752..67054b5795 100755
+index 2acc4d1465..3fc80d0c2c 100755
--- a/configure
+++ b/configure
-@@ -503,6 +503,7 @@ vvfat="yes"
+@@ -510,6 +510,7 @@ vvfat="yes"
qed="yes"
parallels="yes"
sheepdog="yes"
libxml2=""
debug_mutex="no"
libpmem=""
-@@ -1553,6 +1554,10 @@ for opt do
+@@ -1576,6 +1577,10 @@ for opt do
;;
--enable-sheepdog) sheepdog="yes"
;;
--disable-vhost-user) vhost_user="no"
;;
--enable-vhost-user) vhost_user="yes"
-@@ -1889,6 +1894,7 @@ disabled with --disable-FEATURE, default is enabled if available:
+@@ -1936,6 +1941,7 @@ disabled with --disable-FEATURE, default is enabled if available:
qed qed image format support
parallels parallels image format support
sheepdog sheepdog block driver support
crypto-afalg Linux AF_ALG crypto backend driver
capstone capstone disassembler support
debug-mutex mutex debugging support
-@@ -6726,6 +6732,7 @@ echo "vvfat support $vvfat"
+@@ -7009,6 +7015,7 @@ echo "vvfat support $vvfat"
echo "qed support $qed"
echo "parallels support $parallels"
echo "sheepdog support $sheepdog"
+echo "pbs-bdrv support $pbs_bdrv"
echo "capstone $capstone"
echo "libpmem support $libpmem"
- echo "libudev $libudev"
-@@ -7578,6 +7585,9 @@ fi
+ echo "libdaxctl support $libdaxctl"
+@@ -7885,6 +7892,9 @@ fi
if test "$sheepdog" = "yes" ; then
echo "CONFIG_SHEEPDOG=y" >> $config_host_mak
fi
+if test "$pbs_bdrv" = "yes" ; then
+ echo "CONFIG_PBS_BDRV=y" >> $config_host_mak
+fi
- if test "$fuzzing" = "yes" ; then
- if test "$have_fuzzer" = "yes"; then
- FUZZ_LDFLAGS=" -fsanitize=address,fuzzer"
+ if test "$pty_h" = "yes" ; then
+ echo "HAVE_PTY_H=y" >> $config_host_mak
+ fi
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 0bc15a5098..13c63d8e6a 100644
+index a177fea6cd..f782c2cf96 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -2942,7 +2942,7 @@
+@@ -2951,7 +2951,7 @@
'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
{ 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
- 'sheepdog',
+ 'sheepdog', 'pbs',
- 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }
+ 'ssh', 'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
##
-@@ -3006,6 +3006,17 @@
+@@ -3015,6 +3015,17 @@
{ 'struct': 'BlockdevOptionsNull',
'data': { '*size': 'int', '*latency-ns': 'uint64', '*read-zeroes': 'bool' } }
##
# @BlockdevOptionsNVMe:
#
-@@ -4128,6 +4139,7 @@
+@@ -4121,6 +4132,7 @@
'nfs': 'BlockdevOptionsNfs',
'null-aio': 'BlockdevOptionsNull',
'null-co': 'BlockdevOptionsNull',
2 files changed, 29 insertions(+)
diff --git a/pve-backup.c b/pve-backup.c
-index 3323b195a4..5bdfd1fedd 100644
+index 343035b5c9..b0e7b51eef 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -1055,3 +1055,10 @@ BackupStatus *qmp_query_backup(Error **errp)
+ return ret;
+}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 13c63d8e6a..355a184ea8 100644
+index f782c2cf96..6dd5e35473 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -867,6 +867,28 @@
+@@ -877,6 +877,28 @@
##
{ 'command': 'backup-cancel' }
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/pve-backup.c b/pve-backup.c
-index 5bdfd1fedd..64a9406cee 100644
+index b0e7b51eef..77eb475563 100644
--- a/pve-backup.c
+++ b/pve-backup.c
@@ -962,6 +962,8 @@ UuidInfo *qmp_backup(
3 files changed, 159 insertions(+), 43 deletions(-)
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
-index 4f692c15a2..4717fe7d2c 100644
+index 3ff014d32a..c3227a1498 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -195,6 +195,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
return ret;
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
-index 355a184ea8..a3d54b85e2 100644
+index 6dd5e35473..5fc42e87f3 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
-@@ -875,9 +875,11 @@
+@@ -885,9 +885,11 @@
# @pbs-dirty-bitmap: True if dirty-bitmap-incremental backups to PBS are
# supported.
#
##
# @query-proxmox-support:
-@@ -889,6 +891,59 @@
+@@ -899,6 +901,59 @@
##
{ 'command': 'query-proxmox-support', 'returns': 'ProxmoxSupportStatus' }
-extra/0001-hw-vfio-pci-quirks-Fix-broken-legacy-IGD-passthrough.patch
-extra/0002-hw-net-net_tx_pkt-fix-assertion-failure-in-net_tx_pk.patch
+extra/0001-block-block-copy-always-align-copied-region-to-clust.patch
pve/0001-PVE-Config-block-file-change-locking-default-to-off.patch
pve/0002-PVE-Config-Adjust-network-script-path-to-etc-kvm.patch
pve/0003-PVE-Config-set-the-CPU-model-to-kvm64-32-instead-of-.patch
-Subproject commit fdd76fecdde1ad444ff4deb7f1c4f7e4a1ef97d6
+Subproject commit d0ed6a69d399ae193959225cdeaa9382746c91cc