Try to use the same cleanup method as other command do.
Index: new/qapi-schema.json
===================================================================
Index: new/qapi-schema.json
===================================================================
---- new.orig/qapi-schema.json 2013-12-06 07:46:40.000000000 +0100
-+++ new/qapi-schema.json 2013-12-06 07:46:45.000000000 +0100
+--- new.orig/qapi-schema.json 2013-12-06 08:42:27.000000000 +0100
++++ new/qapi-schema.json 2013-12-06 08:57:27.000000000 +0100
@@ -586,7 +586,7 @@
# @vma: Proxmox vma backup format
##
@@ -586,7 +586,7 @@
# @vma: Proxmox vma backup format
##
# @backup:
Index: new/blockdev.c
===================================================================
# @backup:
Index: new/blockdev.c
===================================================================
---- new.orig/blockdev.c 2013-12-06 07:46:40.000000000 +0100
-+++ new/blockdev.c 2013-12-06 08:09:32.000000000 +0100
-@@ -1463,6 +1463,8 @@
+--- new.orig/blockdev.c 2013-12-06 08:53:36.000000000 +0100
++++ new/blockdev.c 2013-12-06 08:59:07.000000000 +0100
+@@ -1760,6 +1760,8 @@
uint8_t dev_id;
//bool started;
bool completed;
uint8_t dev_id;
//bool started;
bool completed;
} PVEBackupDevInfo;
static void pvebackup_run_next_job(void);
} PVEBackupDevInfo;
static void pvebackup_run_next_job(void);
{
PVEBackupDevInfo *di = opaque;
- assert(backup_state.vmaw);
-
di->completed = true;
{
PVEBackupDevInfo *di = opaque;
- assert(backup_state.vmaw);
-
di->completed = true;
+
+ BlockDriverState *bs = di->bs;
+
di->bs = NULL;
+ di->target = NULL;
di->bs = NULL;
+ di->target = NULL;
+ vma_writer_close_stream(backup_state.vmaw, di->dev_id);
+ }
+ vma_writer_close_stream(backup_state.vmaw, di->dev_id);
+ }
- if (!backup_state.cancel) {
- pvebackup_run_next_job();
-@@ -1610,6 +1613,7 @@
+ block_job_cb(bs, ret);
+
+@@ -1912,6 +1915,7 @@
bool has_speed, int64_t speed, Error **errp)
{
BlockDriverState *bs;
bool has_speed, int64_t speed, Error **errp)
{
BlockDriverState *bs;
Error *local_err = NULL;
uuid_t uuid;
VmaWriter *vmaw = NULL;
Error *local_err = NULL;
uuid_t uuid;
VmaWriter *vmaw = NULL;
/* Todo: try to auto-detect format based on file name */
format = has_format ? format : BACKUP_FORMAT_VMA;
/* Todo: try to auto-detect format based on file name */
format = has_format ? format : BACKUP_FORMAT_VMA;
if (has_devlist) {
devs = g_strsplit_set(devlist, ",;:", -1);
if (has_devlist) {
devs = g_strsplit_set(devlist, ",;:", -1);
}
/* add configuration file to archive */
}
/* add configuration file to archive */
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l);
PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
l = g_list_next(l);
if (local_err != NULL) {
error_setg(&backup_state.error, "backup_job_create failed");
pvebackup_cancel(NULL);
if (local_err != NULL) {
error_setg(&backup_state.error, "backup_job_create failed");
pvebackup_cancel(NULL);
Index: new/hmp-commands.hx
===================================================================
Index: new/hmp-commands.hx
===================================================================
---- new.orig/hmp-commands.hx 2013-12-06 07:46:38.000000000 +0100
-+++ new/hmp-commands.hx 2013-12-06 08:01:26.000000000 +0100
+--- new.orig/hmp-commands.hx 2013-12-06 08:42:27.000000000 +0100
++++ new/hmp-commands.hx 2013-12-06 08:57:27.000000000 +0100
Index: new/hmp.c
===================================================================
Index: new/hmp.c
===================================================================
---- new.orig/hmp.c 2013-12-06 07:46:38.000000000 +0100
-+++ new/hmp.c 2013-12-06 07:50:58.000000000 +0100
+--- new.orig/hmp.c 2013-12-06 08:42:27.000000000 +0100
++++ new/hmp.c 2013-12-06 08:57:27.000000000 +0100
@@ -1245,11 +1245,13 @@
{
Error *error = NULL;
@@ -1245,11 +1245,13 @@
{
Error *error = NULL;
Index: new/blockdev.c
===================================================================
Index: new/blockdev.c
===================================================================
---- new.orig/blockdev.c 2013-12-05 13:39:59.000000000 +0100
-+++ new/blockdev.c 2013-12-06 06:59:11.000000000 +0100
+--- new.orig/blockdev.c 2013-12-06 07:46:29.000000000 +0100
++++ new/blockdev.c 2013-12-06 08:53:36.000000000 +0100
@@ -45,6 +45,7 @@
#include "qmp-commands.h"
#include "trace.h"
@@ -45,6 +45,7 @@
#include "qmp-commands.h"
#include "trace.h"
static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives);
static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives);
+-
+ static void eject_device(BlockDriverState *bs, int force, Error **errp)
+ {
+ if (bdrv_in_use(bs)) {
+@@ -1736,6 +1736,431 @@
+ bdrv_put_ref_bh_schedule(bs);
+ }
+
+/* PVE backup related function */
+
+static struct PVEBackupState {
+/* PVE backup related function */
+
+static struct PVEBackupState {
+ assert(backup_state.vmaw);
+
+ di->completed = true;
+ assert(backup_state.vmaw);
+
+ di->completed = true;
++
++ BlockDriverState *bs = di->bs;
++
+ di->bs = NULL;
+
+ vma_writer_close_stream(backup_state.vmaw, di->dev_id);
+
+ di->bs = NULL;
+
+ vma_writer_close_stream(backup_state.vmaw, di->dev_id);
+
++ block_job_cb(bs, ret);
++
+ if (!backup_state.cancel) {
+ pvebackup_run_next_job();
+ }
+ if (!backup_state.cancel) {
+ pvebackup_run_next_job();
+ }
-
- static void eject_device(BlockDriverState *bs, int force, Error **errp)
- {
++
+ void qmp_block_stream(const char *device, bool has_base,
+ const char *base, bool has_speed, int64_t speed,
+ bool has_on_error, BlockdevOnError on_error,
Index: new/hmp-commands.hx
===================================================================
Index: new/hmp-commands.hx
===================================================================
---- new.orig/hmp-commands.hx 2013-12-05 13:39:59.000000000 +0100
-+++ new/hmp-commands.hx 2013-12-05 13:40:07.000000000 +0100
+--- new.orig/hmp-commands.hx 2013-12-03 06:36:18.000000000 +0100
++++ new/hmp-commands.hx 2013-12-06 08:42:27.000000000 +0100
@@ -83,6 +83,35 @@
Copy data from a backing file into a block device.
ETEXI
@@ -83,6 +83,35 @@
Copy data from a backing file into a block device.
ETEXI
@item info migrate_capabilities
Index: new/hmp.c
===================================================================
@item info migrate_capabilities
Index: new/hmp.c
===================================================================
---- new.orig/hmp.c 2013-12-05 13:39:59.000000000 +0100
-+++ new/hmp.c 2013-12-06 07:25:28.000000000 +0100
+--- new.orig/hmp.c 2013-12-06 07:46:29.000000000 +0100
++++ new/hmp.c 2013-12-06 08:42:27.000000000 +0100
@@ -133,6 +133,44 @@
qapi_free_MouseInfoList(mice_list);
}
@@ -133,6 +133,44 @@
qapi_free_MouseInfoList(mice_list);
}
{
Index: new/hmp.h
===================================================================
{
Index: new/hmp.h
===================================================================
---- new.orig/hmp.h 2013-12-05 13:39:59.000000000 +0100
-+++ new/hmp.h 2013-12-05 13:40:07.000000000 +0100
+--- new.orig/hmp.h 2013-12-03 06:36:18.000000000 +0100
++++ new/hmp.h 2013-12-06 07:46:38.000000000 +0100
@@ -28,6 +28,7 @@
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
@@ -28,6 +28,7 @@
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
Index: new/monitor.c
===================================================================
void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
Index: new/monitor.c
===================================================================
---- new.orig/monitor.c 2013-12-05 13:39:59.000000000 +0100
-+++ new/monitor.c 2013-12-05 13:40:07.000000000 +0100
+--- new.orig/monitor.c 2013-12-03 06:36:18.000000000 +0100
++++ new/monitor.c 2013-12-06 07:46:38.000000000 +0100
@@ -2880,6 +2880,13 @@
},
#endif
@@ -2880,6 +2880,13 @@
},
#endif
.params = "",
Index: new/qapi-schema.json
===================================================================
.params = "",
Index: new/qapi-schema.json
===================================================================
---- new.orig/qapi-schema.json 2013-12-05 13:39:59.000000000 +0100
-+++ new/qapi-schema.json 2013-12-06 06:59:11.000000000 +0100
+--- new.orig/qapi-schema.json 2013-12-06 07:46:29.000000000 +0100
++++ new/qapi-schema.json 2013-12-06 08:42:27.000000000 +0100
@@ -547,6 +547,95 @@
##
{ 'command': 'query-events', 'returns': ['EventInfo'] }
@@ -547,6 +547,95 @@
##
{ 'command': 'query-events', 'returns': ['EventInfo'] }
#
Index: new/qmp-commands.hx
===================================================================
#
Index: new/qmp-commands.hx
===================================================================
---- new.orig/qmp-commands.hx 2013-12-05 13:39:59.000000000 +0100
-+++ new/qmp-commands.hx 2013-12-05 13:40:07.000000000 +0100
+--- new.orig/qmp-commands.hx 2013-12-06 07:46:29.000000000 +0100
++++ new/qmp-commands.hx 2013-12-06 07:46:38.000000000 +0100
@@ -966,6 +966,24 @@
EQMP
@@ -966,6 +966,24 @@
EQMP
Index: new/Makefile.objs
===================================================================
Index: new/Makefile.objs
===================================================================
---- new.orig/Makefile.objs 2013-12-04 10:45:45.000000000 +0100
-+++ new/Makefile.objs 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/Makefile.objs 2013-12-06 07:46:38.000000000 +0100
++++ new/Makefile.objs 2013-12-06 08:59:22.000000000 +0100
@@ -56,6 +56,7 @@
common-obj-y += qemu-char.o #aio.o
common-obj-y += block-migration.o
@@ -56,6 +56,7 @@
common-obj-y += qemu-char.o #aio.o
common-obj-y += block-migration.o
Index: new/block.c
===================================================================
Index: new/block.c
===================================================================
---- new.orig/block.c 2013-12-04 10:07:06.000000000 +0100
-+++ new/block.c 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/block.c 2013-12-06 07:46:38.000000000 +0100
++++ new/block.c 2013-12-06 08:59:22.000000000 +0100
@@ -1710,7 +1710,7 @@
bs_new->drv ? bs_new->drv->format_name : "");
}
@@ -1710,7 +1710,7 @@
bs_new->drv ? bs_new->drv->format_name : "");
}
assert(!bs->job);
Index: new/hmp-commands.hx
===================================================================
assert(!bs->job);
Index: new/hmp-commands.hx
===================================================================
---- new.orig/hmp-commands.hx 2013-12-04 10:48:06.000000000 +0100
-+++ new/hmp-commands.hx 2013-12-04 10:48:07.000000000 +0100
-@@ -1729,6 +1729,8 @@
+--- new.orig/hmp-commands.hx 2013-12-06 08:57:27.000000000 +0100
++++ new/hmp-commands.hx 2013-12-06 08:59:22.000000000 +0100
+@@ -1731,6 +1731,8 @@
show current migration capabilities
@item info migrate_cache_size
show current migration XBZRLE cache size
show current migration capabilities
@item info migrate_cache_size
show current migration XBZRLE cache size
@item info balloon
show balloon information
@item info qtree
@item info balloon
show balloon information
@item info qtree
+ },
Index: new/hmp.c
===================================================================
+ },
Index: new/hmp.c
===================================================================
---- new.orig/hmp.c 2013-12-04 10:48:06.000000000 +0100
-+++ new/hmp.c 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/hmp.c 2013-12-06 08:57:27.000000000 +0100
++++ new/hmp.c 2013-12-06 08:59:22.000000000 +0100
@@ -1655,3 +1655,60 @@
hmp_handle_error(mon, &err);
@@ -1655,3 +1655,60 @@
hmp_handle_error(mon, &err);
+}
Index: new/hmp.h
===================================================================
+}
Index: new/hmp.h
===================================================================
---- new.orig/hmp.h 2013-12-04 10:48:06.000000000 +0100
-+++ new/hmp.h 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/hmp.h 2013-12-06 07:46:38.000000000 +0100
++++ new/hmp.h 2013-12-06 08:59:22.000000000 +0100
@@ -25,6 +25,7 @@
void hmp_info_uuid(Monitor *mon, const QDict *qdict);
void hmp_info_chardev(Monitor *mon, const QDict *qdict);
@@ -25,6 +25,7 @@
void hmp_info_uuid(Monitor *mon, const QDict *qdict);
void hmp_info_chardev(Monitor *mon, const QDict *qdict);
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict);
Index: new/include/block/block.h
===================================================================
void hmp_nbd_server_start(Monitor *mon, const QDict *qdict);
Index: new/include/block/block.h
===================================================================
---- new.orig/include/block/block.h 2013-12-04 10:07:06.000000000 +0100
-+++ new/include/block/block.h 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/include/block/block.h 2013-12-06 07:46:38.000000000 +0100
++++ new/include/block/block.h 2013-12-06 08:59:22.000000000 +0100
@@ -214,6 +214,7 @@
const char *backing_file);
int bdrv_get_backing_file_depth(BlockDriverState *bs);
@@ -214,6 +214,7 @@
const char *backing_file);
int bdrv_get_backing_file_depth(BlockDriverState *bs);
void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr);
Index: new/include/sysemu/sysemu.h
===================================================================
void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr);
Index: new/include/sysemu/sysemu.h
===================================================================
---- new.orig/include/sysemu/sysemu.h 2013-12-04 10:07:06.000000000 +0100
-+++ new/include/sysemu/sysemu.h 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/include/sysemu/sysemu.h 2013-12-06 07:46:38.000000000 +0100
++++ new/include/sysemu/sysemu.h 2013-12-06 08:59:22.000000000 +0100
@@ -73,16 +73,17 @@
void do_savevm(Monitor *mon, const QDict *qdict);
@@ -73,16 +73,17 @@
void do_savevm(Monitor *mon, const QDict *qdict);
int qemu_loadvm_state(QEMUFile *f);
Index: new/monitor.c
===================================================================
int qemu_loadvm_state(QEMUFile *f);
Index: new/monitor.c
===================================================================
---- new.orig/monitor.c 2013-12-04 10:48:06.000000000 +0100
-+++ new/monitor.c 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/monitor.c 2013-12-06 07:46:38.000000000 +0100
++++ new/monitor.c 2013-12-06 08:59:22.000000000 +0100
@@ -2908,6 +2908,13 @@
.mhandler.cmd = hmp_info_migrate_cache_size,
},
@@ -2908,6 +2908,13 @@
.mhandler.cmd = hmp_info_migrate_cache_size,
},
.params = "",
Index: new/qapi-schema.json
===================================================================
.params = "",
Index: new/qapi-schema.json
===================================================================
---- new.orig/qapi-schema.json 2013-12-04 10:48:06.000000000 +0100
-+++ new/qapi-schema.json 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/qapi-schema.json 2013-12-06 08:57:27.000000000 +0100
++++ new/qapi-schema.json 2013-12-06 08:59:22.000000000 +0100
@@ -740,6 +740,42 @@
'*downtime': 'int',
'*setup-time': 'int'} }
@@ -740,6 +740,42 @@
'*downtime': 'int',
'*setup-time': 'int'} }
#
Index: new/qemu-options.hx
===================================================================
#
Index: new/qemu-options.hx
===================================================================
---- new.orig/qemu-options.hx 2013-12-04 10:07:06.000000000 +0100
-+++ new/qemu-options.hx 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/qemu-options.hx 2013-12-06 07:46:38.000000000 +0100
++++ new/qemu-options.hx 2013-12-06 08:59:22.000000000 +0100
@@ -2734,6 +2734,19 @@
Start right away with a saved state (@code{loadvm} in monitor)
ETEXI
@@ -2734,6 +2734,19 @@
Start right away with a saved state (@code{loadvm} in monitor)
ETEXI
"-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
Index: new/qmp-commands.hx
===================================================================
"-daemonize daemonize QEMU after initializing\n", QEMU_ARCH_ALL)
Index: new/qmp-commands.hx
===================================================================
---- new.orig/qmp-commands.hx 2013-12-04 10:48:06.000000000 +0100
-+++ new/qmp-commands.hx 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/qmp-commands.hx 2013-12-06 07:46:38.000000000 +0100
++++ new/qmp-commands.hx 2013-12-06 08:59:22.000000000 +0100
@@ -3326,3 +3326,34 @@
<- { "return": {} }
@@ -3326,3 +3326,34 @@
<- { "return": {} }
Index: new/savevm-async.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
Index: new/savevm-async.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ new/savevm-async.c 2013-12-04 10:48:07.000000000 +0100
++++ new/savevm-async.c 2013-12-06 08:59:22.000000000 +0100
@@ -0,0 +1,478 @@
+#include "qemu-common.h"
+#include "qapi/qmp/qerror.h"
@@ -0,0 +1,478 @@
+#include "qemu-common.h"
+#include "qapi/qmp/qerror.h"
+}
Index: new/savevm.c
===================================================================
+}
Index: new/savevm.c
===================================================================
---- new.orig/savevm.c 2013-12-04 10:07:06.000000000 +0100
-+++ new/savevm.c 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/savevm.c 2013-12-06 07:46:38.000000000 +0100
++++ new/savevm.c 2013-12-06 08:59:22.000000000 +0100
@@ -1845,11 +1845,11 @@
return false;
}
@@ -1845,11 +1845,11 @@
return false;
}
uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size)
Index: new/vl.c
===================================================================
uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size)
Index: new/vl.c
===================================================================
---- new.orig/vl.c 2013-12-04 10:07:06.000000000 +0100
-+++ new/vl.c 2013-12-04 10:48:07.000000000 +0100
+--- new.orig/vl.c 2013-12-06 07:46:38.000000000 +0100
++++ new/vl.c 2013-12-06 08:59:22.000000000 +0100
@@ -1643,6 +1643,7 @@
info->name = g_strdup(m->name);
info->cpu_max = !m->max_cpus ? 1 : m->max_cpus;
@@ -1643,6 +1643,7 @@
info->name = g_strdup(m->name);
info->cpu_max = !m->max_cpus ? 1 : m->max_cpus;