RELEASE=2.3
# also update debian/changelog
-KVMVER=1.3
-KVMPKGREL=18
+KVMVER=1.4
+KVMPKGREL=1
KVMPACKAGE=pve-qemu-kvm
KVMDIR=qemu-kvm
download:
rm -rf ${KVMDIR} ${KVMSRC}
git clone git://git.qemu-project.org/qemu.git -b master ${KVMDIR}
- cd ${KVMDIR}; git checkout -b local v1.3.1
+ #cd ${KVMDIR}; git checkout -b local v1.4.0rc1
tar czf ${KVMSRC} --exclude CVS --exclude .git --exclude .svn ${KVMDIR}
${KVM_DEB} kvm: ${KVMSRC}
+pve-qemu-kvm (1.4-1) unstable; urgency=low
+
+ * update to latest 1.4.0 (03ec2f83087de34924489eeae0ea6fe7785cc050)
+
+ * remove ahci-add_migration-support.patch
+
+ * remove balloon stat patches
+
+ * remove always-update-expected-downtime.patch: seems latest qemu does
+ not set that value anymore?
+
+ * configure with --disable-smartcard-nss (else we need to install
+ vscclient and dynamic libraries)
+
+ -- Proxmox Support Team <support@proxmox.com> Tue, 12 Feb 2013 12:04:09 +0100
+
pve-qemu-kvm (1.3-18) unstable; urgency=low
* update qemu to v1.3.1
-From 5a37c10eb0991e86cba666b82ac756dc2ff1cd8c Mon Sep 17 00:00:00 2001
+From e9d7fc0567eb5bef368a950a4813d6eb5867572b Mon Sep 17 00:00:00 2001
From: Dietmar Maurer <dietmar@proxmox.com>
Date: Tue, 13 Nov 2012 09:24:50 +0100
Subject: [PATCH v3 1/6] RFC: Efficient VM backup for qemu
-From c51e1c591401926d7a5c3a41011736c329c6ef82 Mon Sep 17 00:00:00 2001
+From eb29d6acb8d8e671e292c9f50655bc87d9742282 Mon Sep 17 00:00:00 2001
From: Dietmar Maurer <dietmar@proxmox.com>
Date: Tue, 13 Nov 2012 10:03:52 +0100
Subject: [PATCH v3 2/6] add basic backup support to block driver
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
- Makefile.objs | 1 +
- backup.c | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- backup.h | 32 ++++++
- block.c | 71 +++++++++++-
- block.h | 2 +
- blockjob.h | 10 ++
- 6 files changed, 449 insertions(+), 6 deletions(-)
+ Makefile.objs | 1 +
+ backup.c | 338 ++++++++++++++++++++++++++++++++++++++++++++++
+ backup.h | 32 +++++
+ block.c | 71 +++++++++-
+ include/block/block.h | 2 +
+ include/block/blockjob.h | 10 ++
+ 6 files changed, 448 insertions(+), 6 deletions(-)
create mode 100644 backup.c
create mode 100644 backup.h
diff --git a/Makefile.objs b/Makefile.objs
-index 3c7abca..cb46be5 100644
+index 21e9c91..d72822b 100644
--- a/Makefile.objs
+++ b/Makefile.objs
-@@ -48,6 +48,7 @@ coroutine-obj-$(CONFIG_WIN32) += coroutine-win32.o
- block-obj-y = iov.o cache-utils.o qemu-option.o module.o async.o
- block-obj-y += nbd.o block.o blockjob.o aes.o qemu-config.o
- block-obj-y += thread-pool.o qemu-progress.o qemu-sockets.o uri.o notify.o
+@@ -13,6 +13,7 @@ block-obj-$(CONFIG_POSIX) += aio-posix.o
+ block-obj-$(CONFIG_WIN32) += aio-win32.o
+ block-obj-y += block/
+ block-obj-y += qapi-types.o qapi-visit.o
+block-obj-y += backup.o
- block-obj-y += $(coroutine-obj-y) $(qobject-obj-y) $(version-obj-y)
- block-obj-$(CONFIG_POSIX) += event_notifier-posix.o aio-posix.o
- block-obj-$(CONFIG_WIN32) += event_notifier-win32.o aio-win32.o
+
+ block-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o
+ block-obj-y += qemu-coroutine-sleep.o
diff --git a/backup.c b/backup.c
new file mode 100644
-index 0000000..5dcbd11
+index 0000000..61ca668
--- /dev/null
+++ b/backup.c
-@@ -0,0 +1,339 @@
+@@ -0,0 +1,338 @@
+/*
+ * QEMU backup
+ *
+#include <errno.h>
+#include <unistd.h>
+
-+#include "block.h"
-+#include "block_int.h"
-+#include "blockjob.h"
++#include "block/block.h"
++#include "block/block_int.h"
++#include "block/blockjob.h"
+#include "qemu/ratelimit.h"
+#include "backup.h"
+
+ while (0)
+
+
-+#define BITS_PER_LONG (sizeof(unsigned long) * 8)
+#define SLICE_TIME 100000000ULL /* ns */
+
+typedef struct BackupBlockJob {
+
+#endif /* QEMU_BACKUP_H */
diff --git a/block.c b/block.c
-index c05875f..4de7fbd 100644
+index 50dab8e..6e6d08f 100644
--- a/block.c
+++ b/block.c
@@ -54,6 +54,7 @@
} BdrvRequestFlags;
static void bdrv_dev_change_media_cb(BlockDriverState *bs, bool load);
-@@ -1542,7 +1543,7 @@ int bdrv_commit(BlockDriverState *bs)
+@@ -1554,7 +1555,7 @@ int bdrv_commit(BlockDriverState *bs)
if (!drv)
return -ENOMEDIUM;
if (!bs->backing_hd) {
return -ENOTSUP;
}
-@@ -1679,6 +1680,22 @@ static void round_to_clusters(BlockDriverState *bs,
+@@ -1691,6 +1692,22 @@ void bdrv_round_to_clusters(BlockDriverState *bs,
}
}
static bool tracked_request_overlaps(BdrvTrackedRequest *req,
int64_t sector_num, int nb_sectors) {
/* aaaa bbbb */
-@@ -1693,7 +1710,9 @@ static bool tracked_request_overlaps(BdrvTrackedRequest *req,
+@@ -1705,7 +1722,9 @@ static bool tracked_request_overlaps(BdrvTrackedRequest *req,
}
static void coroutine_fn wait_for_overlapping_requests(BlockDriverState *bs,
{
BdrvTrackedRequest *req;
int64_t cluster_sector_num;
-@@ -1709,6 +1728,11 @@ static void coroutine_fn wait_for_overlapping_requests(BlockDriverState *bs,
- round_to_clusters(bs, sector_num, nb_sectors,
- &cluster_sector_num, &cluster_nb_sectors);
+@@ -1721,6 +1740,11 @@ static void coroutine_fn wait_for_overlapping_requests(BlockDriverState *bs,
+ bdrv_round_to_clusters(bs, sector_num, nb_sectors,
+ &cluster_sector_num, &cluster_nb_sectors);
+ if (job_cluster_size) {
+ round_to_job_clusters(bs, sector_num, nb_sectors, job_cluster_size,
do {
retry = false;
QLIST_FOREACH(req, &bs->tracked_requests, list) {
-@@ -2278,12 +2302,24 @@ static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs,
+@@ -2260,12 +2284,24 @@ static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs,
bs->copy_on_read_in_flight++;
}
if (flags & BDRV_REQ_COPY_ON_READ) {
int pnum;
-@@ -2327,6 +2363,17 @@ int coroutine_fn bdrv_co_copy_on_readv(BlockDriverState *bs,
+@@ -2309,6 +2345,17 @@ int coroutine_fn bdrv_co_copy_on_readv(BlockDriverState *bs,
BDRV_REQ_COPY_ON_READ);
}
static int coroutine_fn bdrv_co_do_write_zeroes(BlockDriverState *bs,
int64_t sector_num, int nb_sectors)
{
-@@ -2384,12 +2431,23 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,
+@@ -2366,12 +2413,23 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,
bdrv_io_limits_intercept(bs, true, nb_sectors);
}
if (flags & BDRV_REQ_ZERO_WRITE) {
ret = bdrv_co_do_write_zeroes(bs, sector_num, nb_sectors);
} else {
-@@ -2408,6 +2466,7 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,
+@@ -2390,6 +2448,7 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs,
bs->wr_highest_sector = sector_num + nb_sectors - 1;
}
tracked_request_end(&req);
return ret;
-diff --git a/block.h b/block.h
-index 722c620..94e5903 100644
---- a/block.h
-+++ b/block.h
+diff --git a/include/block/block.h b/include/block/block.h
+index 5c3b911..b6144be 100644
+--- a/include/block/block.h
++++ b/include/block/block.h
@@ -172,6 +172,8 @@ int coroutine_fn bdrv_co_readv(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, QEMUIOVector *qiov);
int coroutine_fn bdrv_co_copy_on_readv(BlockDriverState *bs,
int coroutine_fn bdrv_co_writev(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, QEMUIOVector *qiov);
/*
-diff --git a/blockjob.h b/blockjob.h
-index 3792b73..6621173 100644
---- a/blockjob.h
-+++ b/blockjob.h
+diff --git a/include/block/blockjob.h b/include/block/blockjob.h
+index c290d07..6f42495 100644
+--- a/include/block/blockjob.h
++++ b/include/block/blockjob.h
@@ -50,6 +50,13 @@ typedef struct BlockJobType {
* manually.
*/
-From 4c0880f2561de8dec379eb6f02b3df88c023270c Mon Sep 17 00:00:00 2001
+From 02f8d395026b507cdcaaec00b324a67779298383 Mon Sep 17 00:00:00 2001
From: Dietmar Maurer <dietmar@proxmox.com>
Date: Tue, 13 Nov 2012 11:27:56 +0100
Subject: [PATCH v3 3/6] add backup related monitor commands
+
#endif /* QEMU_BACKUP_H */
diff --git a/blockdev.c b/blockdev.c
-index e73fd6e..c559903 100644
+index 63e6f1e..92a7ca3 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -20,6 +20,7 @@
#include "qmp-commands.h"
#include "trace.h"
- #include "arch_init.h"
+ #include "sysemu/arch_init.h"
+#include "backup.h"
static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives);
-@@ -1321,6 +1322,428 @@ void qmp_drive_mirror(const char *device, const char *target,
+@@ -1334,6 +1335,428 @@ void qmp_drive_mirror(const char *device, const char *target,
drive_get_ref(drive_get_by_blockdev(bs));
}
{
BlockDriverState *bs;
diff --git a/hmp-commands.hx b/hmp-commands.hx
-index 010b8c9..57be357 100644
+index 64008a9..0f178d8 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -83,6 +83,35 @@ STEXI
{
.name = "block_job_set_speed",
.args_type = "device:B,speed:o",
-@@ -1558,6 +1587,8 @@ show CPU statistics
+@@ -1630,6 +1659,8 @@ show CPU statistics
show user network stack connection states
@item info migrate
show migration status
show current migration capabilities
@item info migrate_cache_size
diff --git a/hmp.c b/hmp.c
-index 180ba2b..27fd421 100644
+index 2f47a8a..9ac34c5 100644
--- a/hmp.c
+++ b/hmp.c
-@@ -130,6 +130,38 @@ void hmp_info_mice(Monitor *mon)
+@@ -131,6 +131,38 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
qapi_free_MouseInfoList(mice_list);
}
-+void hmp_info_backup(Monitor *mon)
++void hmp_info_backup(Monitor *mon, const QDict *qdict)
+{
+ BackupStatus *info;
+
+ qapi_free_BackupStatus(info);
+}
+
- void hmp_info_migrate(Monitor *mon)
+ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
{
MigrationInfo *info;
-@@ -977,6 +1009,37 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict)
+@@ -998,6 +1030,37 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &error);
}
{
Error *error = NULL;
diff --git a/hmp.h b/hmp.h
-index 0ab03be..20c9a62 100644
+index 30b3c20..ad4cf80 100644
--- a/hmp.h
+++ b/hmp.h
-@@ -28,6 +28,7 @@ void hmp_info_mice(Monitor *mon);
- void hmp_info_migrate(Monitor *mon);
- void hmp_info_migrate_capabilities(Monitor *mon);
- void hmp_info_migrate_cache_size(Monitor *mon);
-+void hmp_info_backup(Monitor *mon);
- void hmp_info_cpus(Monitor *mon);
- void hmp_info_block(Monitor *mon);
- void hmp_info_blockstats(Monitor *mon);
-@@ -63,6 +64,8 @@ void hmp_eject(Monitor *mon, const QDict *qdict);
+@@ -28,6 +28,7 @@ void hmp_info_mice(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_cache_size(Monitor *mon, const QDict *qdict);
++void hmp_info_backup(Monitor *mon, const QDict *qdict);
+ void hmp_info_cpus(Monitor *mon, const QDict *qdict);
+ void hmp_info_block(Monitor *mon, const QDict *qdict);
+ void hmp_info_blockstats(Monitor *mon, const QDict *qdict);
+@@ -65,6 +66,8 @@ void hmp_eject(Monitor *mon, const QDict *qdict);
void hmp_change(Monitor *mon, const QDict *qdict);
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict);
void hmp_block_stream(Monitor *mon, const QDict *qdict);
void hmp_block_job_cancel(Monitor *mon, const QDict *qdict);
void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
diff --git a/monitor.c b/monitor.c
-index c0e32d6..85cf47e 100644
+index 20bd19b..5f979ce 100644
--- a/monitor.c
+++ b/monitor.c
-@@ -2680,6 +2680,13 @@ static mon_cmd_t info_cmds[] = {
+@@ -2666,6 +2666,13 @@ static mon_cmd_t info_cmds[] = {
},
#endif
{
+ .args_type = "",
+ .params = "",
+ .help = "show backup status",
-+ .mhandler.info = hmp_info_backup,
++ .mhandler.cmd = hmp_info_backup,
+ },
+ {
.name = "migrate",
.args_type = "",
.params = "",
diff --git a/qapi-schema.json b/qapi-schema.json
-index 5dfa052..2d3699b 100644
+index bd289ae..c91df47 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
-@@ -358,6 +358,39 @@
+@@ -425,6 +425,39 @@
{ 'type': 'EventInfo', 'data': {'name': 'str'} }
##
# @query-events:
#
# Return a list of supported QMP events by this server
-@@ -1764,6 +1797,64 @@
+@@ -1824,6 +1857,64 @@
'data': { 'path': 'str' },
'returns': [ 'ObjectPropertyInfo' ] }
# @qom-get:
#
diff --git a/qmp-commands.hx b/qmp-commands.hx
-index 5c692d0..c46fdc4 100644
+index 799adea..ca601b3 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
-@@ -822,6 +822,18 @@ EQMP
+@@ -889,6 +889,18 @@ EQMP
},
{
.name = "block-job-set-speed",
.args_type = "device:B,speed:o",
.mhandler.cmd_new = qmp_marshal_input_block_job_set_speed,
-@@ -2491,6 +2503,21 @@ EQMP
+@@ -2566,6 +2578,21 @@ EQMP
},
SQMP
-From 86ddce6dbd1cc88a0fad43b36300b8ffa573bd04 Mon Sep 17 00:00:00 2001
+From c04d17631e00ff368e42dc5d24e94152b6526014 Mon Sep 17 00:00:00 2001
From: Dietmar Maurer <dietmar@proxmox.com>
Date: Tue, 13 Nov 2012 11:11:38 +0100
Subject: [PATCH v3 4/6] introduce new vma archive format
---
Makefile | 3 +-
Makefile.objs | 2 +-
+ backup.h | 1 +
blockdev.c | 6 +-
docs/specs/vma_spec.txt | 24 ++
- vma-reader.c | 801 ++++++++++++++++++++++++++++++++++++++++
- vma-writer.c | 935 +++++++++++++++++++++++++++++++++++++++++++++++
- vma.c | 561 ++++++++++++++++++++++++++++
+ vma-reader.c | 799 ++++++++++++++++++++++++++++++++++++++++
+ vma-writer.c | 932 +++++++++++++++++++++++++++++++++++++++++++++++
+ vma.c | 559 ++++++++++++++++++++++++++++
vma.h | 145 ++++++++
- 8 files changed, 2473 insertions(+), 4 deletions(-)
+ 9 files changed, 2467 insertions(+), 4 deletions(-)
create mode 100644 docs/specs/vma_spec.txt
create mode 100644 vma-reader.c
create mode 100644 vma-writer.c
create mode 100644 vma.h
diff --git a/Makefile b/Makefile
-index 9ecbcbb..30a9268 100644
+index 0d9099a..16f1c25 100644
--- a/Makefile
+++ b/Makefile
-@@ -100,7 +100,7 @@ defconfig:
-
- -include config-all-devices.mak
+@@ -115,7 +115,7 @@ ifeq ($(CONFIG_SMARTCARD_NSS),y)
+ include $(SRC_PATH)/libcacard/Makefile
+ endif
-all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all
+all: $(DOCS) $(TOOLS) vma$(EXESUF) $(HELPERS-y) recurse-all
config-host.h: config-host.h-timestamp
config-host.h-timestamp: config-host.mak
-@@ -194,6 +194,7 @@ tools-obj-$(CONFIG_POSIX) += compatfd.o
- qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y) libqemustub.a
- qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y) $(block-obj-y) libqemustub.a
- qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y) libqemustub.a
-+vma$(EXESUF): vma.o vma-writer.o vma-reader.o $(tools-obj-y) $(block-obj-y) libqemustub.a
+@@ -167,6 +167,7 @@ qemu-img.o: qemu-img-cmds.h
+ qemu-img$(EXESUF): qemu-img.o $(block-obj-y) libqemuutil.a libqemustub.a
+ qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a
+ qemu-io$(EXESUF): qemu-io.o cmd.o $(block-obj-y) libqemuutil.a libqemustub.a
++vma$(EXESUF): vma.o vma-writer.o vma-reader.o $(block-obj-y) libqemuutil.a libqemustub.a
qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
diff --git a/Makefile.objs b/Makefile.objs
-index cb46be5..b5732e2 100644
+index d72822b..111b9f8 100644
--- a/Makefile.objs
+++ b/Makefile.objs
-@@ -48,7 +48,7 @@ coroutine-obj-$(CONFIG_WIN32) += coroutine-win32.o
- block-obj-y = iov.o cache-utils.o qemu-option.o module.o async.o
- block-obj-y += nbd.o block.o blockjob.o aes.o qemu-config.o
- block-obj-y += thread-pool.o qemu-progress.o qemu-sockets.o uri.o notify.o
+@@ -13,7 +13,7 @@ block-obj-$(CONFIG_POSIX) += aio-posix.o
+ block-obj-$(CONFIG_WIN32) += aio-win32.o
+ block-obj-y += block/
+ block-obj-y += qapi-types.o qapi-visit.o
-block-obj-y += backup.o
+block-obj-y += vma-writer.o backup.o
- block-obj-y += $(coroutine-obj-y) $(qobject-obj-y) $(version-obj-y)
- block-obj-$(CONFIG_POSIX) += event_notifier-posix.o aio-posix.o
- block-obj-$(CONFIG_WIN32) += event_notifier-win32.o aio-win32.o
+
+ block-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o
+ block-obj-y += qemu-coroutine-sleep.o
+diff --git a/backup.h b/backup.h
+index be52ea4..3a81e52 100644
+--- a/backup.h
++++ b/backup.h
+@@ -15,6 +15,7 @@
+ #define QEMU_BACKUP_H
+
+ #include <uuid/uuid.h>
++#include "block/block.h"
+
+ #define BACKUP_CLUSTER_BITS 16
+ #define BACKUP_CLUSTER_SIZE (1<<BACKUP_CLUSTER_BITS)
diff --git a/blockdev.c b/blockdev.c
-index c559903..467667e 100644
+index 92a7ca3..aad6e0c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -21,6 +21,7 @@
#include "trace.h"
- #include "arch_init.h"
+ #include "sysemu/arch_init.h"
#include "backup.h"
+#include "vma.h"
static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives);
-@@ -1517,10 +1518,11 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
+@@ -1530,10 +1531,11 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
/* Todo: try to auto-detect format based on file name */
format = has_format ? format : BACKUP_FORMAT_VMA;
+
diff --git a/vma-reader.c b/vma-reader.c
new file mode 100644
-index 0000000..2217a94
+index 0000000..7e81847
--- /dev/null
+++ b/vma-reader.c
-@@ -0,0 +1,801 @@
+@@ -0,0 +1,799 @@
+/*
+ * VMA: Virtual Machine Archive
+ *
+#include <uuid/uuid.h>
+
+#include "qemu-common.h"
-+#include "qemu_socket.h"
-+#include "qemu-coroutine.h"
-+#include "qemu-aio.h"
++#include "qemu/timer.h"
+#include "qemu/ratelimit.h"
+#include "vma.h"
-+#include "block.h"
++#include "block/block.h"
+
+#define BITS_PER_LONG (sizeof(unsigned long) * 8)
+
+
diff --git a/vma-writer.c b/vma-writer.c
new file mode 100644
-index 0000000..6ecbaf4
+index 0000000..04a346e
--- /dev/null
+++ b/vma-writer.c
-@@ -0,0 +1,935 @@
+@@ -0,0 +1,932 @@
+/*
+ * VMA: Virtual Machine Archive
+ *
+#include <uuid/uuid.h>
+
+#include "qemu-common.h"
-+#include "qemu_socket.h"
-+#include "qemu-coroutine.h"
-+#include "qemu-aio.h"
+#include "vma.h"
-+#include "block.h"
-+#include "monitor.h"
++#include "block/block.h"
++#include "monitor/monitor.h"
+
+#define DEBUG_VMA 0
+
+
diff --git a/vma.c b/vma.c
new file mode 100644
-index 0000000..66de9bb
+index 0000000..64da334
--- /dev/null
+++ b/vma.c
-@@ -0,0 +1,561 @@
+@@ -0,0 +1,559 @@
+/*
+ * VMA: Virtual Machine Archive
+ *
+#include <glib.h>
+
+#include "qemu-common.h"
-+#include "qemu-option.h"
-+#include "qemu-error.h"
-+#include "osdep.h"
-+#include "sysemu.h"
-+#include "block_int.h"
-+#include <stdio.h>
++#include "qemu/error-report.h"
+#include "vma.h"
++#include "block/block.h"
+
+static void help(void)
+{
+ dirname, di->devname);
+ printf("DEVINFO %s %zd\n", devfn, di->size);
+
-+ if (bdrv_img_create(devfn, "raw", NULL, NULL, NULL,
-+ di->size, flags)) {
-+ g_error("can't create file %s", devfn);
++ bdrv_img_create(devfn, "raw", NULL, NULL, NULL, di->size,
++ flags, &errp);
++ if (error_is_set(&errp)) {
++ g_error("can't create file %s: %s", devfn,
++ error_get_pretty(errp));
+ }
+
+ /* Note: we created an empty file above, so there is no
-From 2f16d5e7a7fdcbb83f2643cbbbf872e1b4fbac2f Mon Sep 17 00:00:00 2001
+From 6b0aa521526e0cc35539ee327b3e6c976da6e361 Mon Sep 17 00:00:00 2001
From: Dietmar Maurer <dietmar@proxmox.com>
Date: Wed, 14 Nov 2012 09:57:04 +0100
Subject: [PATCH v3 5/6] add regression tests for backup
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
tests/Makefile | 11 +-
- tests/backup-test.c | 516 +++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 525 insertions(+), 2 deletions(-)
+ tests/backup-test.c | 517 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 526 insertions(+), 2 deletions(-)
create mode 100644 tests/backup-test.c
diff --git a/tests/Makefile b/tests/Makefile
-index b60f0fb..cffbd22 100644
+index a2d62b8..c3d8b4a 100644
--- a/tests/Makefile
+++ b/tests/Makefile
-@@ -20,6 +20,8 @@ check-unit-y += tests/test-thread-pool$(EXESUF)
+@@ -57,6 +57,8 @@ gcov-files-test-cutils-y += util/cutils.c
check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
# All QTests for now are POSIX-only, but the dependencies are
# really in libqtest, not in the testcases themselves.
check-qtest-i386-y = tests/fdc-test$(EXESUF)
-@@ -54,6 +56,7 @@ tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(coroutine-obj-y) $(tools
- tests/test-aio$(EXESUF): tests/test-aio.o $(coroutine-obj-y) $(tools-obj-y) $(block-obj-y) libqemustub.a
- tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(coroutine-obj-y) $(tools-obj-y) $(block-obj-y) libqemustub.a
- tests/test-iov$(EXESUF): tests/test-iov.o iov.o
-+tests/backup-test$(EXESUF): tests/backup-test.o vma-reader.o $(tools-obj-y) $(block-obj-y) libqemustub.a
-
- tests/test-qapi-types.c tests/test-qapi-types.h :\
- $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
-@@ -146,10 +149,14 @@ check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF)
+@@ -100,6 +102,7 @@ tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(block-obj-y) libqemuutil
+ tests/test-aio$(EXESUF): tests/test-aio.o $(block-obj-y) libqemuutil.a libqemustub.a
+ tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(block-obj-y) libqemuutil.a libqemustub.a
+ tests/test-iov$(EXESUF): tests/test-iov.o libqemuutil.a
++tests/backup-test$(EXESUF): tests/backup-test.o vma-reader.o $(block-obj-y) libqemuutil.a libqemustub.a
+ tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o libqemuutil.a libqemustub.a
+ tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
+ tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o xbzrle.o page_cache.o libqemuutil.a
+@@ -209,10 +212,14 @@ check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF)
# Consolidated targets
-include $(wildcard tests/*.d)
diff --git a/tests/backup-test.c b/tests/backup-test.c
new file mode 100644
-index 0000000..36a6389
+index 0000000..5ee3b90
--- /dev/null
+++ b/tests/backup-test.c
-@@ -0,0 +1,516 @@
+@@ -0,0 +1,517 @@
+/*
+ * QEMU backup test suit
+ *
+#include <libgen.h>
+
+#include "qemu-common.h"
-+#include "main-loop.h"
-+#include "block_int.h"
++#include "block/block.h"
+
+#include "vma.h"
+
+
+ int flags = BDRV_O_NATIVE_AIO|BDRV_O_RDWR|BDRV_O_CACHE_WB;
+
-+ if (bdrv_img_create(TEST_IMG_RESTORE_NAME, "raw", NULL, NULL, NULL,
-+ size, flags)) {
-+ g_error("can't create file %s", TEST_IMG_RESTORE_NAME);
++ bdrv_img_create(TEST_IMG_RESTORE_NAME, "raw", NULL, NULL, NULL,
++ size, flags, &errp);
++ if (error_is_set(&errp)) {
++ g_error("can't create file %s: %s", TEST_IMG_RESTORE_NAME,
++ error_get_pretty(errp));
+ }
+
+ BlockDriverState *bs = NULL;
-From 1f4df212ac4408eaf685cd0febf2ae86ea96e6f3 Mon Sep 17 00:00:00 2001
+From 2b1f27dec5e3f38d00b7905870337025bed8f366 Mon Sep 17 00:00:00 2001
From: Dietmar Maurer <dietmar@proxmox.com>
Date: Thu, 29 Nov 2012 10:46:49 +0100
Subject: [PATCH v3 6/6] add vm state to backups
3 files changed, 200 insertions(+), 5 deletions(-)
diff --git a/blockdev.c b/blockdev.c
-index 467667e..b6d80a4 100644
+index aad6e0c..2805a1e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -22,6 +22,8 @@
- #include "arch_init.h"
+ #include "sysemu/arch_init.h"
#include "backup.h"
#include "vma.h"
+#include "qemu-file.h"
static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives);
-@@ -1342,6 +1344,10 @@ static struct GenericBackupState {
+@@ -1355,6 +1357,10 @@ static struct GenericBackupState {
size_t total;
size_t transferred;
size_t zero_bytes;
} backup_state;
typedef struct BackupCB {
-@@ -1497,10 +1503,170 @@ static void backup_start_jobs(void)
+@@ -1510,10 +1516,170 @@ static void backup_start_jobs(void)
backup_run_next_job();
}
{
BlockDriverState *bs;
Error *local_err = NULL;
-@@ -1515,6 +1681,8 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
+@@ -1528,6 +1694,8 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
return NULL;
}
/* Todo: try to auto-detect format based on file name */
format = has_format ? format : BACKUP_FORMAT_VMA;
-@@ -1595,6 +1763,22 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
+@@ -1608,6 +1776,22 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
size_t total = 0;
/* register all devices for vma writer */
l = bcblist;
while (l) {
BackupCB *bcb = l->data;
-@@ -1662,6 +1846,9 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
+@@ -1675,6 +1859,9 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
backup_state.total = total;
backup_state.transferred = 0;
backup_state.zero_bytes = 0;
/* Grab a reference so hotplug does not delete the
* BlockDriverState from underneath us.
-@@ -1673,7 +1860,12 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
+@@ -1686,7 +1873,12 @@ char *qmp_backup(const char *backupfile, bool has_format, BackupFormat format,
drive_get_ref(drive_get_by_blockdev(bcb->bs));
}
return g_strdup(backup_state.uuid_str);
diff --git a/hmp.c b/hmp.c
-index 27fd421..56e1cdc 100644
+index 9ac34c5..7b401cc 100644
--- a/hmp.c
+++ b/hmp.c
-@@ -1031,7 +1031,8 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
+@@ -1052,7 +1052,8 @@ void hmp_backup(Monitor *mon, const QDict *qdict)
Error *errp = NULL;
qmp_backup(backupfile, true, BACKUP_FORMAT_VMA, false, NULL, !!devlist,
if (error_is_set(&errp)) {
monitor_printf(mon, "%s\n", error_get_pretty(errp));
diff --git a/qapi-schema.json b/qapi-schema.json
-index 2d3699b..3f4889e 100644
+index c91df47..53655e6 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
-@@ -1822,13 +1822,15 @@
+@@ -1882,13 +1882,15 @@
#
# @speed: #optional the maximum speed, in bytes per second
#
-Index: new/net.h
+Index: new/include/net/net.h
===================================================================
---- new.orig/net.h 2012-11-21 11:11:22.000000000 +0100
-+++ new/net.h 2012-11-21 11:17:51.000000000 +0100
-@@ -161,8 +161,9 @@
- void netdev_add(QemuOpts *opts, Error **errp);
- int qmp_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret);
+--- new.orig/include/net/net.h 2013-02-11 11:06:09.000000000 +0100
++++ new/include/net/net.h 2013-02-11 11:15:16.000000000 +0100
+@@ -168,8 +168,9 @@
+ int net_hub_id_for_client(NetClientState *nc, int *id);
+ NetClientState *net_hub_port_find(int hub_id);
-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
#define DEFAULT_BRIDGE_INTERFACE "br0"
-Index: new/net/tap.h
+Index: new/net/tap_int.h
===================================================================
---- new.orig/net/tap.h 2012-11-21 11:11:22.000000000 +0100
-+++ new/net/tap.h 2012-11-21 11:17:51.000000000 +0100
+--- new.orig/net/tap_int.h 2013-02-11 11:06:09.000000000 +0100
++++ new/net/tap_int.h 2013-02-11 11:15:16.000000000 +0100
@@ -29,8 +29,6 @@
#include "qemu-common.h"
#include "qapi-types.h"
-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
- int tap_open(char *ifname, int ifname_size, int *vnet_hdr, int vnet_hdr_required);
-
+ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
+ int vnet_hdr_required, int mq_required);
Index: new/hw/pc_piix.c
===================================================================
---- new.orig/hw/pc_piix.c 2012-11-22 10:10:56.000000000 +0100
-+++ new/hw/pc_piix.c 2012-11-22 10:16:29.000000000 +0100
-@@ -352,6 +352,8 @@
+--- new.orig/hw/pc_piix.c 2013-02-11 11:06:09.000000000 +0100
++++ new/hw/pc_piix.c 2013-02-11 12:18:14.000000000 +0100
+@@ -294,6 +294,8 @@
}
#endif
+#define KVM_MACHINE_OPTIONS "accel=kvm"
+
- static QEMUMachine pc_machine_v1_3 = {
- .name = "pc-1.3",
+ static QEMUMachine pc_i440fx_machine_v1_4 = {
+ .name = "pc-i440fx-1.4",
.alias = "pc",
-@@ -359,6 +361,7 @@
- .init = pc_init_pci_1_3,
+@@ -301,6 +303,7 @@
+ .init = pc_init_pci,
.max_cpus = 255,
.is_default = 1,
+ .default_machine_opts = KVM_MACHINE_OPTIONS,
+ DEFAULT_MACHINE_OPTIONS,
+ };
+
+@@ -328,6 +331,7 @@
+ PC_COMPAT_1_3,
+ { /* end of list */ }
+ },
++ .default_machine_opts = KVM_MACHINE_OPTIONS,
+ DEFAULT_MACHINE_OPTIONS,
};
- #define PC_COMPAT_1_2 \
-@@ -393,6 +396,7 @@
+@@ -364,6 +368,7 @@
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
+ .default_machine_opts = KVM_MACHINE_OPTIONS,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_1_2,
{ /* end of list */ }
-@@ -436,6 +440,7 @@
+@@ -408,6 +413,7 @@
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
+ .default_machine_opts = KVM_MACHINE_OPTIONS,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_1_1,
{ /* end of list */ }
-@@ -471,6 +476,7 @@
+@@ -444,6 +450,7 @@
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
+ .default_machine_opts = KVM_MACHINE_OPTIONS,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_1_0,
{ /* end of list */ }
-@@ -486,6 +492,7 @@
+@@ -460,6 +467,7 @@
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
+ .default_machine_opts = KVM_MACHINE_OPTIONS,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_0_15,
{ /* end of list */ }
-@@ -518,6 +525,7 @@
+@@ -493,6 +501,7 @@
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
+ .default_machine_opts = KVM_MACHINE_OPTIONS,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_0_14,
{
-@@ -551,6 +559,7 @@
+@@ -527,6 +536,7 @@
.desc = "Standard PC",
.init = pc_init_pci_no_kvmclock,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_0_13,
{
-@@ -588,6 +597,7 @@
+@@ -565,6 +575,7 @@
.desc = "Standard PC",
.init = pc_init_pci_no_kvmclock,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_0_12,
{
-@@ -621,6 +631,7 @@
+@@ -599,6 +610,7 @@
.desc = "Standard PC, qemu 0.11",
.init = pc_init_pci_no_kvmclock,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_0_11,
{
-@@ -642,6 +653,7 @@
+@@ -621,6 +633,7 @@
.desc = "Standard PC, qemu 0.10",
.init = pc_init_pci_no_kvmclock,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_0_11,
{
-@@ -675,6 +687,7 @@
+@@ -655,6 +668,7 @@
.desc = "ISA-only PC",
.init = pc_init_isa,
.max_cpus = 1,
Index: new/qemu-options.hx
===================================================================
---- new.orig/qemu-options.hx 2012-11-21 11:11:22.000000000 +0100
-+++ new/qemu-options.hx 2012-11-21 11:25:23.000000000 +0100
+--- new.orig/qemu-options.hx 2013-02-12 12:05:14.000000000 +0100
++++ new/qemu-options.hx 2013-02-12 12:06:20.000000000 +0100
@@ -103,6 +103,12 @@
are split equally.
ETEXI
DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
Index: new/vl.c
===================================================================
---- new.orig/vl.c 2012-11-21 11:11:22.000000000 +0100
-+++ new/vl.c 2012-11-21 11:25:23.000000000 +0100
+--- new.orig/vl.c 2013-02-12 12:05:14.000000000 +0100
++++ new/vl.c 2013-02-12 12:06:20.000000000 +0100
@@ -154,6 +154,8 @@
#endif
- #include "qtest.h"
+ #include "sysemu/qtest.h"
+#include "vzsyscalls.h"
+
- #include "disas.h"
+ #include "disas/disas.h"
- #include "qemu_socket.h"
-@@ -205,6 +207,7 @@
- CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
+ #include "qemu/sockets.h"
+@@ -207,6 +209,7 @@
+ CharDriverState *sclp_hds[MAX_SCLP_CONSOLES];
int win2k_install_hack = 0;
int singlestep = 0;
+int fairsched_id = 0;
int smp_cpus = 1;
int max_cpus = 0;
int smp_cores = 1;
-@@ -2275,7 +2278,7 @@
+@@ -2544,7 +2547,7 @@
}
static int debugcon_parse(const char *devname)
QemuOpts *opts;
if (!qemu_chr_new("debugcon", devname, NULL)) {
-@@ -2527,6 +2530,9 @@
+@@ -2798,6 +2801,9 @@
int main(int argc, char **argv, char **envp)
{
int i;
int snapshot, linux_boot;
const char *icount_option = NULL;
const char *initrd_filename;
-@@ -3306,6 +3312,21 @@
+@@ -3582,6 +3588,21 @@
exit(1);
}
break;
case QEMU_OPTION_vnc:
#ifdef CONFIG_VNC
display_remote++;
-@@ -3377,8 +3398,8 @@
+@@ -3656,8 +3677,8 @@
}
p += 8;
os_set_proc_name(p);
break;
case QEMU_OPTION_prom_env:
if (nb_prom_envs >= MAX_PROM_ENVS) {
-@@ -3765,6 +3786,39 @@
+@@ -4085,6 +4106,39 @@
}
}
Index: new/vzsyscalls.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ new/vzsyscalls.h 2012-11-21 11:25:23.000000000 +0100
++++ new/vzsyscalls.h 2013-02-12 12:06:20.000000000 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2000-2008, Parallels, Inc. All rights reserved.
Index: new/qemu-img.c
===================================================================
---- new.orig/qemu-img.c 2012-11-21 11:11:22.000000000 +0100
-+++ new/qemu-img.c 2012-11-21 11:51:19.000000000 +0100
-@@ -1580,7 +1580,9 @@
+--- new.orig/qemu-img.c 2013-02-11 11:06:09.000000000 +0100
++++ new/qemu-img.c 2013-02-11 11:23:17.000000000 +0100
+@@ -1585,7 +1585,9 @@
error_report("Could not delete snapshot '%s': %d (%s)",
snapshot_name, ret, strerror(-ret));
}
Index: new/qapi-schema.json
===================================================================
---- new.orig/qapi-schema.json 2012-11-23 07:30:15.000000000 +0100
-+++ new/qapi-schema.json 2012-11-23 07:31:44.000000000 +0100
-@@ -461,6 +461,40 @@
+--- new.orig/qapi-schema.json 2013-02-12 12:05:14.000000000 +0100
++++ new/qapi-schema.json 2013-02-12 12:07:05.000000000 +0100
+@@ -528,6 +528,40 @@
'*downtime': 'int'} }
##
# @query-migrate
#
# Returns information about current migration process.
-@@ -2902,6 +2936,14 @@
+@@ -2965,6 +2999,14 @@
##
{ 'command': 'query-target', 'returns': 'TargetInfo' }
#
Index: new/qmp-commands.hx
===================================================================
---- new.orig/qmp-commands.hx 2012-11-23 07:30:15.000000000 +0100
-+++ new/qmp-commands.hx 2012-11-23 07:31:44.000000000 +0100
-@@ -2654,3 +2654,34 @@
- .args_type = "",
- .mhandler.cmd_new = qmp_marshal_input_query_target,
- },
+--- new.orig/qmp-commands.hx 2013-02-12 12:05:14.000000000 +0100
++++ new/qmp-commands.hx 2013-02-12 12:07:05.000000000 +0100
+@@ -2775,3 +2775,34 @@
+ <- { "return": {} }
+
+ EQMP
++
+
+ {
+ .name = "savevm-start",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_marshal_input_query_savevm,
+ },
-+
Index: new/hmp.c
===================================================================
---- new.orig/hmp.c 2012-11-23 07:30:15.000000000 +0100
-+++ new/hmp.c 2012-11-23 07:31:44.000000000 +0100
-@@ -1335,3 +1335,60 @@
- qmp_nbd_server_stop(&errp);
- hmp_handle_error(mon, &errp);
+--- new.orig/hmp.c 2013-02-12 12:05:14.000000000 +0100
++++ new/hmp.c 2013-02-12 12:07:05.000000000 +0100
+@@ -1379,3 +1379,60 @@
+ qmp_chardev_remove(qdict_get_str(qdict, "id"), &local_err);
+ hmp_handle_error(mon, &local_err);
}
+
+void hmp_savevm_start(Monitor *mon, const QDict *qdict)
+ hmp_handle_error(mon, &errp);
+}
+
-+void hmp_info_savevm(Monitor *mon)
++void hmp_info_savevm(Monitor *mon, const QDict *qdict)
+{
+ SaveVMInfo *info;
+ info = qmp_query_savevm(NULL);
+}
Index: new/hmp.h
===================================================================
---- new.orig/hmp.h 2012-11-23 07:30:15.000000000 +0100
-+++ new/hmp.h 2012-11-23 07:31:44.000000000 +0100
+--- new.orig/hmp.h 2013-02-12 12:05:14.000000000 +0100
++++ new/hmp.h 2013-02-12 12:07:05.000000000 +0100
@@ -25,6 +25,7 @@
- void hmp_info_uuid(Monitor *mon);
- void hmp_info_chardev(Monitor *mon);
- void hmp_info_mice(Monitor *mon);
-+void hmp_info_savevm(Monitor *mon);
- void hmp_info_migrate(Monitor *mon);
- void hmp_info_migrate_capabilities(Monitor *mon);
- void hmp_info_migrate_cache_size(Monitor *mon);
-@@ -75,6 +76,10 @@
+ void hmp_info_uuid(Monitor *mon, const QDict *qdict);
+ void hmp_info_chardev(Monitor *mon, const QDict *qdict);
+ void hmp_info_mice(Monitor *mon, const QDict *qdict);
++void hmp_info_savevm(Monitor *mon, const QDict *qdict);
+ void hmp_info_migrate(Monitor *mon, const QDict *qdict);
+ void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
+ void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict);
+@@ -77,6 +78,10 @@
void hmp_netdev_del(Monitor *mon, const QDict *qdict);
void hmp_getfd(Monitor *mon, const QDict *qdict);
void hmp_closefd(Monitor *mon, const QDict *qdict);
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict);
Index: new/hmp-commands.hx
===================================================================
---- new.orig/hmp-commands.hx 2012-11-23 07:30:15.000000000 +0100
-+++ new/hmp-commands.hx 2012-11-23 07:31:44.000000000 +0100
-@@ -1562,6 +1562,8 @@
+--- new.orig/hmp-commands.hx 2013-02-12 12:05:14.000000000 +0100
++++ new/hmp-commands.hx 2013-02-12 12:07:05.000000000 +0100
+@@ -1634,6 +1634,8 @@
show current migration capabilities
@item info migrate_cache_size
show current migration XBZRLE cache size
@item info balloon
show balloon information
@item info qtree
-@@ -1581,3 +1583,35 @@
+@@ -1653,3 +1655,35 @@
STEXI
@end table
ETEXI
Index: new/savevm-async.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ new/savevm-async.c 2012-11-23 07:32:48.000000000 +0100
-@@ -0,0 +1,458 @@
-+#include "qemu-common.h"
-+#include "qerror.h"
-+#include "sysemu.h"
++++ new/savevm-async.c 2013-02-12 12:07:05.000000000 +0100
+@@ -0,0 +1,459 @@
++#include "include/qemu-common.h"
++#include "include/qapi/qmp/qerror.h"
++#include "include/sysemu/sysemu.h"
+#include "qmp-commands.h"
-+#include "blockdev.h"
-+#include "qemu/qom-qobject.h"
-+#include "buffered_file.h"
-+#include "migration.h"
++#include "include/migration/qemu-file.h"
++#include "include/sysemu/blockdev.h"
++#include "include/qom/qom-qobject.h"
++#include "include/migration/migration.h"
+
+/* #define DEBUG_SAVEVM_STATE */
+
+static void process_savevm_co(void *opaque)
+{
+ int ret;
-+ uint64_t remaining;
+ int64_t maxlen;
+ MigrationParams params = {
+ .blk = 0,
+ }
+
+ while (snap_state.state == SAVE_STATE_ACTIVE) {
-+
-+ ret = qemu_savevm_state_iterate(snap_state.file);
-+ remaining = ram_bytes_remaining();
-+
-+ DPRINTF("savevm inerate %zd %d\n", remaining, ret);
-+
-+ if (ret < 0) {
-+ save_snapshot_error("qemu_savevm_state_iterate error %d", ret);
-+ return;
-+ }
-+
-+ /* stop the VM if we get to the end of available space,
-+ * or if remaining is just a few MB
-+ */
-+ maxlen = bdrv_getlength(snap_state.bs) - 30*1024*1024;
-+ if ((remaining < 100000) ||
-+ ((snap_state.bs_pos + remaining) >= maxlen)) {
-+ if (runstate_is_running()) {
-+ vm_stop(RUN_STATE_SAVE_VM);
-+ }
-+ }
-+
-+ if (ret == 1) { /* finished */
++ uint64_t pending_size;
++
++ pending_size = qemu_savevm_state_pending(snap_state.file, 0);
++
++ if (pending_size) {
++ ret = qemu_savevm_state_iterate(snap_state.file);
++ if (ret < 0) {
++ save_snapshot_error("qemu_savevm_state_iterate error %d", ret);
++ break;
++ }
++ DPRINTF("savevm inerate pending size %lu ret %d\n", pending_size, ret);
++ } else {
++ DPRINTF("done iterating\n");
+ if (runstate_is_running()) {
+ vm_stop(RUN_STATE_SAVE_VM);
+ }
+ DPRINTF("savevm inerate finished\n");
-+ if ((ret = qemu_savevm_state_complete(snap_state.file)) < 0) {
++ ret = qemu_savevm_state_complete(snap_state.file);
++ if (ret < 0) {
+ save_snapshot_error("qemu_savevm_state_complete error %d", ret);
-+ return;
++ break;
+ } else {
+ DPRINTF("save complete\n");
+ save_snapshot_completed();
-+ return;
++ break;
++ }
++ }
++
++ /* stop the VM if we get to the end of available space,
++ * or if pending_size is just a few MB
++ */
++ maxlen = bdrv_getlength(snap_state.bs) - 30*1024*1024;
++ if ((pending_size < 100000) ||
++ ((snap_state.bs_pos + pending_size) >= maxlen)) {
++ if (runstate_is_running()) {
++ vm_stop(RUN_STATE_SAVE_VM);
+ }
+ }
+ }
+}
Index: new/Makefile.objs
===================================================================
---- new.orig/Makefile.objs 2012-11-23 07:30:15.000000000 +0100
-+++ new/Makefile.objs 2012-11-23 07:31:44.000000000 +0100
-@@ -84,6 +84,7 @@
- common-obj-y += block-migration.o iohandler.o
- common-obj-y += bitmap.o bitops.o
- common-obj-y += page_cache.o
+--- new.orig/Makefile.objs 2013-02-12 12:05:14.000000000 +0100
++++ new/Makefile.objs 2013-02-12 12:07:05.000000000 +0100
+@@ -60,6 +60,7 @@
+ common-obj-y += qemu-char.o #aio.o
+ common-obj-y += block-migration.o
+ common-obj-y += page_cache.o xbzrle.o
+common-obj-y += savevm-async.o
common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
- common-obj-$(CONFIG_WIN32) += version.o
-Index: new/sysemu.h
-===================================================================
---- new.orig/sysemu.h 2012-11-23 07:30:15.000000000 +0100
-+++ new/sysemu.h 2012-11-23 07:31:44.000000000 +0100
-@@ -67,6 +67,7 @@
-
- void do_savevm(Monitor *mon, const QDict *qdict);
- int load_vmstate(const char *name);
-+int load_state_from_blockdev(const char *filename);
- void do_delvm(Monitor *mon, const QDict *qdict);
- void do_info_snapshots(Monitor *mon);
Index: new/qemu-options.hx
===================================================================
---- new.orig/qemu-options.hx 2012-11-23 07:31:24.000000000 +0100
-+++ new/qemu-options.hx 2012-11-23 07:31:44.000000000 +0100
-@@ -2575,6 +2575,19 @@
+--- new.orig/qemu-options.hx 2013-02-12 12:06:20.000000000 +0100
++++ new/qemu-options.hx 2013-02-12 12:07:05.000000000 +0100
+@@ -2605,6 +2605,19 @@
Start right away with a saved state (@code{loadvm} in monitor)
ETEXI
"-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
Index: new/vl.c
===================================================================
---- new.orig/vl.c 2012-11-23 07:31:29.000000000 +0100
-+++ new/vl.c 2012-11-23 07:31:44.000000000 +0100
-@@ -2545,6 +2545,7 @@
+--- new.orig/vl.c 2013-02-12 12:06:40.000000000 +0100
++++ new/vl.c 2013-02-12 12:07:05.000000000 +0100
+@@ -2816,6 +2816,7 @@
int optind;
const char *optarg;
const char *loadvm = NULL;
QEMUMachine *machine;
const char *cpu_model;
const char *vga_model = "none";
-@@ -3185,6 +3186,9 @@
+@@ -3466,6 +3467,9 @@
case QEMU_OPTION_loadvm:
loadvm = optarg;
break;
case QEMU_OPTION_full_screen:
full_screen = 1;
break;
-@@ -4038,6 +4042,10 @@
+@@ -4361,6 +4365,10 @@
if (load_vmstate(loadvm) < 0) {
autostart = 0;
}
if (incoming) {
Index: new/monitor.c
===================================================================
---- new.orig/monitor.c 2012-11-23 07:30:15.000000000 +0100
-+++ new/monitor.c 2012-11-23 07:31:44.000000000 +0100
-@@ -2701,6 +2701,13 @@
- .mhandler.info = hmp_info_migrate_cache_size,
+--- new.orig/monitor.c 2013-02-12 12:05:14.000000000 +0100
++++ new/monitor.c 2013-02-12 12:07:05.000000000 +0100
+@@ -2687,6 +2687,13 @@
+ .mhandler.cmd = hmp_info_migrate_cache_size,
},
{
+ .name = "savevm",
+ .args_type = "",
+ .params = "",
+ .help = "show savevm status",
-+ .mhandler.info = hmp_info_savevm,
++ .mhandler.cmd = hmp_info_savevm,
+ },
+ {
.name = "balloon",
.args_type = "",
.params = "",
+Index: new/include/sysemu/sysemu.h
+===================================================================
+--- new.orig/include/sysemu/sysemu.h 2013-02-12 12:05:14.000000000 +0100
++++ new/include/sysemu/sysemu.h 2013-02-12 12:07:05.000000000 +0100
+@@ -67,6 +67,7 @@
+
+ void do_savevm(Monitor *mon, const QDict *qdict);
+ int load_vmstate(const char *name);
++int load_state_from_blockdev(const char *filename);
+ void do_delvm(Monitor *mon, const QDict *qdict);
+ void do_info_snapshots(Monitor *mon, const QDict *qdict);
+
Index: new/ui/vnc.c
===================================================================
---- new.orig/ui/vnc.c 2012-11-21 11:11:22.000000000 +0100
-+++ new/ui/vnc.c 2012-11-21 11:25:33.000000000 +0100
-@@ -1497,6 +1497,10 @@
+--- new.orig/ui/vnc.c 2013-02-11 11:06:09.000000000 +0100
++++ new/ui/vnc.c 2013-02-11 11:18:28.000000000 +0100
+@@ -1540,6 +1540,10 @@
static void do_key_event(VncState *vs, int down, int keycode, int sym)
{
/* QEMU console switch */
switch(keycode) {
case 0x2a: /* Left Shift */
-@@ -1567,12 +1571,42 @@
+@@ -1610,12 +1614,42 @@
}
if (is_graphic_console()) {
} else {
bool numlock = vs->modifiers_state[0x45];
bool control = (vs->modifiers_state[0x1d] ||
-@@ -1709,7 +1743,8 @@
+@@ -1752,7 +1786,8 @@
lsym = lsym - 'A' + 'a';
}
Index: new/block.c
===================================================================
---- new.orig/block.c 2012-11-21 11:11:22.000000000 +0100
-+++ new/block.c 2012-11-21 11:51:35.000000000 +0100
-@@ -3137,6 +3137,28 @@
+--- new.orig/block.c 2013-02-12 12:05:14.000000000 +0100
++++ new/block.c 2013-02-12 12:06:52.000000000 +0100
+@@ -3162,6 +3162,28 @@
return -ENOTSUP;
}
int bdrv_snapshot_load_tmp(BlockDriverState *bs,
const char *snapshot_name)
{
-Index: new/block.h
+Index: new/include/block/block.h
===================================================================
---- new.orig/block.h 2012-11-21 11:11:22.000000000 +0100
-+++ new/block.h 2012-11-21 11:51:35.000000000 +0100
-@@ -327,6 +327,8 @@
+--- new.orig/include/block/block.h 2013-02-12 12:05:14.000000000 +0100
++++ new/include/block/block.h 2013-02-12 12:06:52.000000000 +0100
+@@ -331,6 +331,8 @@
int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id);
int bdrv_snapshot_list(BlockDriverState *bs,
QEMUSnapshotInfo **psn_info);
char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn);
Index: new/savevm.c
===================================================================
---- new.orig/savevm.c 2012-11-21 11:11:22.000000000 +0100
-+++ new/savevm.c 2012-11-21 11:51:35.000000000 +0100
-@@ -2061,28 +2061,6 @@
+--- new.orig/savevm.c 2013-02-12 12:05:14.000000000 +0100
++++ new/savevm.c 2013-02-12 12:06:52.000000000 +0100
+@@ -2055,28 +2055,6 @@
return ret;
}
Index: new/ui/vnc.c
===================================================================
---- new.orig/ui/vnc.c 2012-11-21 11:25:33.000000000 +0100
-+++ new/ui/vnc.c 2012-11-21 11:32:25.000000000 +0100
+--- new.orig/ui/vnc.c 2013-02-12 12:06:38.000000000 +0100
++++ new/ui/vnc.c 2013-02-12 12:06:40.000000000 +0100
@@ -43,6 +43,125 @@
#include "vnc_keysym.h"
#include "d3des.h"
static VncDisplay *vnc_display; /* needed for info vnc */
static DisplayChangeListener *dcl;
-@@ -1982,7 +2101,7 @@
+@@ -2025,7 +2144,7 @@
vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
vnc_write_u8(vs, 0);
vnc_write_u16(vs, 1); /* number of rects */
ds_get_height(vs->ds), VNC_ENCODING_WMVi);
pixel_format_message(vs);
vnc_unlock_output(vs);
-@@ -2892,7 +3011,7 @@
+@@ -2989,7 +3108,7 @@
char *vnc_display_local_addr(DisplayState *ds)
{
VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
return vnc_socket_local_addr("%s:%s", vs->lsock);
}
-@@ -2950,6 +3069,7 @@
+@@ -3077,6 +3196,7 @@
tls = 1; /* Require TLS */
} else if (strncmp(options, "x509", 4) == 0) {
char *start, *end;
x509 = 1; /* Require x509 certificates */
if (strncmp(options, "x509verify", 10) == 0)
vs->tls.x509verify = 1; /* ...and verify client certs */
-@@ -2970,8 +3090,10 @@
+@@ -3097,8 +3217,10 @@
}
g_free(path);
} else {
}
#endif
#if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
-@@ -3035,10 +3157,10 @@
+@@ -3162,10 +3284,10 @@
vs->auth = VNC_AUTH_VENCRYPT;
if (x509) {
VNC_DEBUG("Initializing VNC server with x509 password auth\n");
#endif /* CONFIG_VNC_TLS */
Index: new/ui/vnc-auth-vencrypt.c
===================================================================
---- new.orig/ui/vnc-auth-vencrypt.c 2012-11-21 11:11:22.000000000 +0100
-+++ new/ui/vnc-auth-vencrypt.c 2012-11-21 11:26:06.000000000 +0100
+--- new.orig/ui/vnc-auth-vencrypt.c 2013-02-12 12:05:14.000000000 +0100
++++ new/ui/vnc-auth-vencrypt.c 2013-02-12 12:06:40.000000000 +0100
@@ -25,7 +25,107 @@
*/
VNC_DEBUG("Start TLS auth VNC\n");
Index: new/ui/vnc.h
===================================================================
---- new.orig/ui/vnc.h 2012-11-21 11:11:22.000000000 +0100
-+++ new/ui/vnc.h 2012-11-21 11:26:06.000000000 +0100
-@@ -264,6 +264,8 @@
+--- new.orig/ui/vnc.h 2013-02-12 12:05:14.000000000 +0100
++++ new/ui/vnc.h 2013-02-12 12:06:40.000000000 +0100
+@@ -272,6 +272,8 @@
char challenge[VNC_AUTH_CHALLENGE_SIZE];
#ifdef CONFIG_VNC_TLS
int subauth; /* Used by VeNCrypt */
VncStateTLS tls;
#endif
#ifdef CONFIG_VNC_SASL
-@@ -560,4 +562,6 @@
+@@ -581,4 +583,6 @@
int vnc_zywrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h);
void vnc_zrle_clear(VncState *vs);
#endif /* __QEMU_VNC_H */
Index: new/ui/vnc-tls.c
===================================================================
---- new.orig/ui/vnc-tls.c 2012-11-21 11:11:22.000000000 +0100
-+++ new/ui/vnc-tls.c 2012-11-21 11:26:06.000000000 +0100
+--- new.orig/ui/vnc-tls.c 2013-02-12 12:05:14.000000000 +0100
++++ new/ui/vnc-tls.c 2013-02-12 12:06:40.000000000 +0100
@@ -302,6 +302,14 @@
static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)
const char *certdir)
Index: new/ui/vnc-tls.h
===================================================================
---- new.orig/ui/vnc-tls.h 2012-11-21 11:11:22.000000000 +0100
-+++ new/ui/vnc-tls.h 2012-11-21 11:26:06.000000000 +0100
+--- new.orig/ui/vnc-tls.h 2013-02-12 12:05:14.000000000 +0100
++++ new/ui/vnc-tls.h 2013-02-12 12:06:40.000000000 +0100
@@ -68,6 +68,8 @@
int vnc_tls_validate_certificate(VncState *vs);
Index: new/vl.c
===================================================================
---- new.orig/vl.c 2012-11-21 11:25:23.000000000 +0100
-+++ new/vl.c 2012-11-21 11:26:06.000000000 +0100
-@@ -3319,6 +3319,7 @@
+--- new.orig/vl.c 2013-02-12 12:06:20.000000000 +0100
++++ new/vl.c 2013-02-12 12:06:40.000000000 +0100
+@@ -3595,6 +3595,7 @@
fprintf(stderr, "Invalid ID\n");
exit(1);
}
break;
case QEMU_OPTION_cpuunits:
cpuunits = atoi(optarg);
-Index: new/console.h
+Index: new/include/ui/console.h
===================================================================
---- new.orig/console.h 2012-11-21 11:11:22.000000000 +0100
-+++ new/console.h 2012-11-21 11:26:06.000000000 +0100
-@@ -448,6 +448,7 @@
+--- new.orig/include/ui/console.h 2013-02-12 12:05:14.000000000 +0100
++++ new/include/ui/console.h 2013-02-12 12:06:40.000000000 +0100
+@@ -457,6 +457,7 @@
void cocoa_display_init(DisplayState *ds, int full_screen);
/* vnc.c */
Index: new/qemu-img.c
===================================================================
---- new.orig/qemu-img.c 2012-11-21 11:51:19.000000000 +0100
-+++ new/qemu-img.c 2012-11-21 12:45:10.000000000 +0100
-@@ -660,7 +660,7 @@
+--- new.orig/qemu-img.c 2013-02-11 12:01:06.000000000 +0100
++++ new/qemu-img.c 2013-02-11 12:12:34.000000000 +0100
+@@ -665,7 +665,7 @@
static int img_convert(int argc, char **argv)
{
int progress = 0, flags;
const char *fmt, *out_fmt, *cache, *out_baseimg, *out_filename;
BlockDriver *drv, *proto_drv;
-@@ -682,8 +682,9 @@
+@@ -687,8 +687,9 @@
cache = "unsafe";
out_baseimg = NULL;
compress = 0;
if (c == -1) {
break;
}
-@@ -704,6 +705,9 @@
+@@ -709,6 +710,9 @@
case 'c':
compress = 1;
break;
case 'e':
error_report("option -e is deprecated, please use \'-o "
"encryption\' instead!");
-@@ -864,20 +868,22 @@
+@@ -869,20 +873,22 @@
}
}
keymap.diff
pve-auth.patch
vencrypt-auth-plain.patch
-ahci-add_migration-support.patch
fix-qemu-img-snapshot-removal.patch
move-bdrv-snapshot-find.patch
internal-snapshot-async.patch
0003-add-backup-related-monitor-commands.patch
0004-introduce-new-vma-archive-format.patch
0005-add-regression-tests-for-backup.patch
-0006-add-vm-state-to-backups.patch
-virtio-balloon-drop-old-stats-code.patch
-virtio-balloon-re-enable-balloon-stats.patch
-virtio-balloon-document-stats.patch
-virtio-balloon-fix-query.patch
-always-update-expected-downtime.patch
+#0006-add-vm-state-to-backups.patch
+# always-update-expected-downtime.patch
Index: new/ui/vnc-auth-vencrypt.c
===================================================================
---- new.orig/ui/vnc-auth-vencrypt.c 2012-09-24 07:15:24.000000000 +0200
-+++ new/ui/vnc-auth-vencrypt.c 2012-09-24 07:15:27.000000000 +0200
+--- new.orig/ui/vnc-auth-vencrypt.c 2013-02-11 11:18:48.000000000 +0100
++++ new/ui/vnc-auth-vencrypt.c 2013-02-11 11:54:47.000000000 +0100
+@@ -25,7 +25,7 @@
+ */
+
+ #include "vnc.h"
+-#include "qemu_socket.h"
++#include "qemu/sockets.h"
+
+ static int protocol_client_auth_plain(VncState *vs, uint8_t *data, size_t len)
+ {
@@ -143,6 +143,11 @@
vnc_read_when(vs, protocol_client_auth_plain_start, 8);
break;
config.status: configure
dh_testdir
# Add here commands to configure the package.
- ./configure --with-confsuffix="/kvm" --target-list=x86_64-softmmu --prefix=/usr --datadir=/usr/share --docdir=/usr/share/doc/pve-qemu-kvm --sysconfdir=/etc --disable-xen --enable-vnc-tls --enable-sdl --enable-uuid --enable-linux-aio --enable-rbd --enable-libiscsi --audio-drv-list="alsa"
+ ./configure --with-confsuffix="/kvm" --target-list=x86_64-softmmu --prefix=/usr --datadir=/usr/share --docdir=/usr/share/doc/pve-qemu-kvm --sysconfdir=/etc --disable-xen --enable-vnc-tls --enable-sdl --enable-uuid --enable-linux-aio --enable-rbd --enable-libiscsi --disable-smartcard-nss --audio-drv-list="alsa"
build: patch build-stamp