Index: new/qapi-schema.json
===================================================================
---- new.orig/qapi-schema.json 2012-09-18 06:20:41.000000000 +0200
-+++ new/qapi-schema.json 2012-09-18 08:43:25.000000000 +0200
+--- new.orig/qapi-schema.json 2012-09-19 12:46:53.000000000 +0200
++++ new/qapi-schema.json 2012-09-19 12:51:10.000000000 +0200
@@ -2493,3 +2493,12 @@
# Since: 1.2.0
##
+{ 'command': 'snapshot-end' }
Index: new/qmp.c
===================================================================
---- new.orig/qmp.c 2012-09-18 06:20:41.000000000 +0200
-+++ new/qmp.c 2012-09-18 08:54:54.000000000 +0200
-@@ -479,3 +479,193 @@
+--- new.orig/qmp.c 2012-09-19 12:46:53.000000000 +0200
++++ new/qmp.c 2012-09-19 12:51:10.000000000 +0200
+@@ -479,3 +479,196 @@
return arch_query_cpu_definitions(errp);
}
+ BlockDriverState *bs = NULL;
+ BlockDriver *drv = NULL;
+ int bdrv_oflags = BDRV_O_NOCACHE | BDRV_O_RDWR;
++ int64_t pos;
+ QEMUFile *f;
+ int ret;
+
+ ret = qemu_savevm_state(f);
+
+ // try to truncate, but ignore errors (will fail on block devices).
-+ bdrv_truncate(bs, qemu_ftell(f));
++ // note: bdrv_read() need whole blocks, so we round up
++ pos = qemu_ftell(f);
++ bdrv_truncate(bs, (pos + BDRV_SECTOR_SIZE) & BDRV_SECTOR_MASK);
+
+ qemu_fclose(f);
+
+}
Index: new/qmp-commands.hx
===================================================================
---- new.orig/qmp-commands.hx 2012-09-18 06:20:41.000000000 +0200
-+++ new/qmp-commands.hx 2012-09-18 08:43:25.000000000 +0200
+--- new.orig/qmp-commands.hx 2012-09-19 12:46:53.000000000 +0200
++++ new/qmp-commands.hx 2012-09-19 12:51:10.000000000 +0200
@@ -2514,3 +2514,27 @@
.args_type = "",
.mhandler.cmd_new = qmp_marshal_input_query_target,
+ },
Index: new/hmp.c
===================================================================
---- new.orig/hmp.c 2012-09-18 06:20:41.000000000 +0200
-+++ new/hmp.c 2012-09-18 08:43:25.000000000 +0200
+--- new.orig/hmp.c 2012-09-19 12:46:53.000000000 +0200
++++ new/hmp.c 2012-09-19 12:51:10.000000000 +0200
@@ -1102,3 +1102,40 @@
qmp_closefd(fdname, &errp);
hmp_handle_error(mon, &errp);
+}
Index: new/hmp.h
===================================================================
---- new.orig/hmp.h 2012-09-18 06:20:41.000000000 +0200
-+++ new/hmp.h 2012-09-18 08:43:25.000000000 +0200
+--- new.orig/hmp.h 2012-09-19 12:46:53.000000000 +0200
++++ new/hmp.h 2012-09-19 12:51:10.000000000 +0200
@@ -71,5 +71,9 @@
void hmp_netdev_del(Monitor *mon, const QDict *qdict);
void hmp_getfd(Monitor *mon, const QDict *qdict);
#endif
Index: new/hmp-commands.hx
===================================================================
---- new.orig/hmp-commands.hx 2012-09-18 06:20:41.000000000 +0200
-+++ new/hmp-commands.hx 2012-09-18 08:43:25.000000000 +0200
+--- new.orig/hmp-commands.hx 2012-09-19 12:46:53.000000000 +0200
++++ new/hmp-commands.hx 2012-09-19 12:51:10.000000000 +0200
@@ -1494,3 +1494,35 @@
STEXI
@end table
+ },
Index: new/sysemu.h
===================================================================
---- new.orig/sysemu.h 2012-09-18 07:35:53.000000000 +0200
-+++ new/sysemu.h 2012-09-18 08:43:25.000000000 +0200
+--- new.orig/sysemu.h 2012-09-19 12:46:53.000000000 +0200
++++ new/sysemu.h 2012-09-19 12:51:10.000000000 +0200
@@ -84,6 +84,7 @@
int qemu_savevm_state_iterate(QEMUFile *f);
int qemu_savevm_state_complete(QEMUFile *f);
/* SLIRP */
Index: new/savevm.c
===================================================================
---- new.orig/savevm.c 2012-09-18 08:53:28.000000000 +0200
-+++ new/savevm.c 2012-09-18 08:53:55.000000000 +0200
-@@ -1743,7 +1743,7 @@
+--- new.orig/savevm.c 2012-09-19 12:51:07.000000000 +0200
++++ new/savevm.c 2012-09-19 12:51:10.000000000 +0200
+@@ -1754,7 +1754,7 @@
}
}
Index: new/savevm.c
===================================================================
---- new.orig/savevm.c 2012-09-18 07:20:45.000000000 +0200
-+++ new/savevm.c 2012-09-18 07:36:55.000000000 +0200
-@@ -2223,6 +2223,50 @@
+--- new.orig/savevm.c 2012-09-19 07:17:28.000000000 +0200
++++ new/savevm.c 2012-09-19 12:53:58.000000000 +0200
+@@ -407,6 +407,17 @@
+
+ static int block_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)
+ {
++ int ret;
++ int64_t maxlen = bdrv_getlength(opaque);
++ if (pos > maxlen) {
++ return -EIO;
++ }
++ if ((pos + size) > maxlen) {
++ size = maxlen - pos - 1;
++ }
++ if (size == 0) {
++ return 0;
++ }
+ return bdrv_pread(opaque, pos, buf, size);
+ }
+
+@@ -2223,6 +2234,50 @@
return;
}
BlockDriverState *bs, *bs_vm_state;
Index: new/sysemu.h
===================================================================
---- new.orig/sysemu.h 2012-09-18 07:35:26.000000000 +0200
-+++ new/sysemu.h 2012-09-18 07:35:53.000000000 +0200
+--- new.orig/sysemu.h 2012-09-19 07:17:21.000000000 +0200
++++ new/sysemu.h 2012-09-19 12:53:31.000000000 +0200
@@ -72,6 +72,7 @@
void do_savevm(Monitor *mon, const QDict *qdict);
Index: new/qemu-options.hx
===================================================================
---- new.orig/qemu-options.hx 2012-09-18 07:39:54.000000000 +0200
-+++ new/qemu-options.hx 2012-09-18 07:52:56.000000000 +0200
+--- new.orig/qemu-options.hx 2012-09-19 07:17:28.000000000 +0200
++++ new/qemu-options.hx 2012-09-19 07:17:28.000000000 +0200
@@ -2477,6 +2477,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-09-18 07:53:19.000000000 +0200
-+++ new/vl.c 2012-09-18 07:55:47.000000000 +0200
+--- new.orig/vl.c 2012-09-19 07:17:28.000000000 +0200
++++ new/vl.c 2012-09-19 07:17:28.000000000 +0200
@@ -2364,6 +2364,7 @@
int optind;
const char *optarg;
Index: new/block.c
===================================================================
---- new.orig/block.c 2012-09-18 08:38:03.000000000 +0200
-+++ new/block.c 2012-09-18 08:39:00.000000000 +0200
+--- new.orig/block.c 2012-09-19 12:47:55.000000000 +0200
++++ new/block.c 2012-09-19 12:51:07.000000000 +0200
@@ -2724,6 +2724,28 @@
return -ENOTSUP;
}
{
Index: new/block.h
===================================================================
---- new.orig/block.h 2012-09-18 08:38:03.000000000 +0200
-+++ new/block.h 2012-09-18 08:39:42.000000000 +0200
+--- new.orig/block.h 2012-09-19 12:46:56.000000000 +0200
++++ new/block.h 2012-09-19 12:51:07.000000000 +0200
@@ -302,6 +302,8 @@
int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id);
int bdrv_snapshot_list(BlockDriverState *bs,
char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn);
Index: new/savevm.c
===================================================================
---- new.orig/savevm.c 2012-09-18 08:38:03.000000000 +0200
-+++ new/savevm.c 2012-09-18 08:39:05.000000000 +0200
-@@ -2034,28 +2034,6 @@
+--- new.orig/savevm.c 2012-09-19 12:50:39.000000000 +0200
++++ new/savevm.c 2012-09-19 12:51:07.000000000 +0200
+@@ -2045,28 +2045,6 @@
return ret;
}