]> git.proxmox.com Git - pve-qemu-kvm.git/blob - debian/patches/backup-add-pve-monitor-commands.patch
86695ebdb302fea389678dbe2394d5efeb1f4476
[pve-qemu-kvm.git] / debian / patches / backup-add-pve-monitor-commands.patch
1 Index: new/blockdev.c
2 ===================================================================
3 --- new.orig/blockdev.c 2013-12-06 10:04:18.000000000 +0100
4 +++ new/blockdev.c 2013-12-06 10:07:21.000000000 +0100
5 @@ -45,6 +45,7 @@
6 #include "qmp-commands.h"
7 #include "trace.h"
8 #include "sysemu/arch_init.h"
9 +#include "vma.h"
10
11 static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives);
12
13 @@ -1438,7 +1439,6 @@
14 }
15 }
16
17 -
18 static void eject_device(BlockDriverState *bs, int force, Error **errp)
19 {
20 if (bdrv_in_use(bs)) {
21 @@ -1736,6 +1736,436 @@
22 bdrv_put_ref_bh_schedule(bs);
23 }
24
25 +/* PVE backup related function */
26 +
27 +static struct PVEBackupState {
28 + Error *error;
29 + bool cancel;
30 + uuid_t uuid;
31 + char uuid_str[37];
32 + int64_t speed;
33 + time_t start_time;
34 + time_t end_time;
35 + char *backup_file;
36 + VmaWriter *vmaw;
37 + GList *di_list;
38 + size_t total;
39 + size_t transferred;
40 + size_t zero_bytes;
41 +} backup_state;
42 +
43 +typedef struct PVEBackupDevInfo {
44 + BlockDriverState *bs;
45 + size_t size;
46 + uint8_t dev_id;
47 + //bool started;
48 + bool completed;
49 +} PVEBackupDevInfo;
50 +
51 +static void pvebackup_run_next_job(void);
52 +
53 +static int pvebackup_dump_cb(void *opaque, BlockDriverState *target,
54 + int64_t sector_num, int n_sectors,
55 + unsigned char *buf)
56 +{
57 + PVEBackupDevInfo *di = opaque;
58 +
59 + if (sector_num & 0x7f) {
60 + if (!backup_state.error) {
61 + error_setg(&backup_state.error,
62 + "got unaligned write inside backup dump "
63 + "callback (sector %ld)", sector_num);
64 + }
65 + return -1; // not aligned to cluster size
66 + }
67 +
68 + int64_t cluster_num = sector_num >> 7;
69 + int size = n_sectors * BDRV_SECTOR_SIZE;
70 +
71 + int ret = -1;
72 +
73 + if (backup_state.vmaw) {
74 + size_t zero_bytes = 0;
75 + ret = vma_writer_write(backup_state.vmaw, di->dev_id, cluster_num,
76 + buf, &zero_bytes);
77 + backup_state.zero_bytes += zero_bytes;
78 + } else {
79 + ret = size;
80 + if (!buf) {
81 + backup_state.zero_bytes += size;
82 + }
83 + }
84 +
85 + backup_state.transferred += size;
86 +
87 + return ret;
88 +}
89 +
90 +static void pvebackup_cleanup(void)
91 +{
92 + if (backup_state.vmaw) {
93 + backup_state.end_time = time(NULL);
94 + Error *local_err = NULL;
95 + vma_writer_close(backup_state.vmaw, &local_err);
96 + error_propagate(&backup_state.error, local_err);
97 + backup_state.vmaw = NULL;
98 + }
99 +
100 + if (backup_state.di_list) {
101 + GList *l = backup_state.di_list;
102 + while (l) {
103 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
104 + l = g_list_next(l);
105 + g_free(di);
106 + }
107 + g_list_free(backup_state.di_list);
108 + backup_state.di_list = NULL;
109 + }
110 +}
111 +
112 +static void pvebackup_complete_cb(void *opaque, int ret)
113 +{
114 + PVEBackupDevInfo *di = opaque;
115 +
116 + assert(backup_state.vmaw);
117 +
118 + di->completed = true;
119 +
120 + if (ret < 0 && !backup_state.error) {
121 + error_setg(&backup_state.error, "job failed with err %d - %s",
122 + ret, strerror(-ret));
123 + }
124 +
125 + BlockDriverState *bs = di->bs;
126 +
127 + di->bs = NULL;
128 +
129 + vma_writer_close_stream(backup_state.vmaw, di->dev_id);
130 +
131 + block_job_cb(bs, ret);
132 +
133 + if (!backup_state.cancel) {
134 + pvebackup_run_next_job();
135 + }
136 +}
137 +
138 +static void pvebackup_cancel(void *opaque)
139 +{
140 + backup_state.cancel = true;
141 +
142 + if (!backup_state.error) {
143 + error_setg(&backup_state.error, "backup cancelled");
144 + }
145 +
146 + /* drain all i/o (awake jobs waiting for aio) */
147 + bdrv_drain_all();
148 +
149 + GList *l = backup_state.di_list;
150 + while (l) {
151 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
152 + l = g_list_next(l);
153 + if (!di->completed && di->bs) {
154 + BlockJob *job = di->bs->job;
155 + if (job) {
156 + if (!di->completed) {
157 + block_job_cancel_sync(job);
158 + }
159 + }
160 + }
161 + }
162 +
163 + pvebackup_cleanup();
164 +}
165 +
166 +void qmp_backup_cancel(Error **errp)
167 +{
168 + Coroutine *co = qemu_coroutine_create(pvebackup_cancel);
169 + qemu_coroutine_enter(co, NULL);
170 +
171 + while (backup_state.vmaw) {
172 + qemu_aio_wait();
173 + }
174 +}
175 +
176 +static void pvebackup_run_next_job(void)
177 +{
178 + GList *l = backup_state.di_list;
179 + while (l) {
180 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
181 + l = g_list_next(l);
182 + if (!di->completed && di->bs && di->bs->job) {
183 + BlockJob *job = di->bs->job;
184 + if (block_job_is_paused(job)) {
185 + bool cancel = backup_state.error || backup_state.cancel;
186 + if (cancel) {
187 + block_job_cancel(job);
188 + } else {
189 + block_job_resume(job);
190 + }
191 + }
192 + return;
193 + }
194 + }
195 +
196 + pvebackup_cleanup();
197 +}
198 +
199 +char *qmp_backup(const char *backup_file, bool has_format,
200 + BackupFormat format,
201 + bool has_config_file, const char *config_file,
202 + bool has_devlist, const char *devlist,
203 + bool has_speed, int64_t speed, Error **errp)
204 +{
205 + BlockDriverState *bs;
206 + Error *local_err = NULL;
207 + uuid_t uuid;
208 + VmaWriter *vmaw = NULL;
209 + gchar **devs = NULL;
210 + GList *di_list = NULL;
211 + GList *l;
212 +
213 + if (backup_state.di_list) {
214 + error_set(errp, ERROR_CLASS_GENERIC_ERROR,
215 + "previous backup not finished");
216 + return NULL;
217 + }
218 +
219 + /* Todo: try to auto-detect format based on file name */
220 + format = has_format ? format : BACKUP_FORMAT_VMA;
221 +
222 + if (format != BACKUP_FORMAT_VMA) {
223 + error_set(errp, ERROR_CLASS_GENERIC_ERROR, "unknown backup format");
224 + return NULL;
225 + }
226 +
227 + if (has_devlist) {
228 + devs = g_strsplit_set(devlist, ",;:", -1);
229 +
230 + gchar **d = devs;
231 + while (d && *d) {
232 + bs = bdrv_find(*d);
233 + if (bs) {
234 + if (bdrv_is_read_only(bs)) {
235 + error_set(errp, QERR_DEVICE_IS_READ_ONLY, *d);
236 + goto err;
237 + }
238 + if (!bdrv_is_inserted(bs)) {
239 + error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, *d);
240 + goto err;
241 + }
242 + PVEBackupDevInfo *di = g_new0(PVEBackupDevInfo, 1);
243 + di->bs = bs;
244 + di_list = g_list_append(di_list, di);
245 + } else {
246 + error_set(errp, QERR_DEVICE_NOT_FOUND, *d);
247 + goto err;
248 + }
249 + d++;
250 + }
251 +
252 + } else {
253 +
254 + bs = NULL;
255 + while ((bs = bdrv_next(bs))) {
256 +
257 + if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
258 + continue;
259 + }
260 +
261 + PVEBackupDevInfo *di = g_new0(PVEBackupDevInfo, 1);
262 + di->bs = bs;
263 + di_list = g_list_append(di_list, di);
264 + }
265 + }
266 +
267 + if (!di_list) {
268 + error_set(errp, ERROR_CLASS_GENERIC_ERROR, "empty device list");
269 + goto err;
270 + }
271 +
272 + size_t total = 0;
273 +
274 + l = di_list;
275 + while (l) {
276 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
277 + l = g_list_next(l);
278 + if (bdrv_in_use(di->bs)) {
279 + error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(di->bs));
280 + goto err;
281 + }
282 +
283 + ssize_t size = bdrv_getlength(di->bs);
284 + if (size < 0) {
285 + error_setg_errno(errp, -di->size, "bdrv_getlength failed");
286 + goto err;
287 + }
288 + di->size = size;
289 + total += size;
290 + }
291 +
292 + uuid_generate(uuid);
293 +
294 + vmaw = vma_writer_create(backup_file, uuid, &local_err);
295 + if (!vmaw) {
296 + if (error_is_set(&local_err)) {
297 + error_propagate(errp, local_err);
298 + }
299 + goto err;
300 + }
301 +
302 + /* register all devices for vma writer */
303 + l = di_list;
304 + while (l) {
305 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
306 + l = g_list_next(l);
307 +
308 + const char *devname = bdrv_get_device_name(di->bs);
309 + di->dev_id = vma_writer_register_stream(vmaw, devname, di->size);
310 + if (di->dev_id <= 0) {
311 + error_set(errp, ERROR_CLASS_GENERIC_ERROR,
312 + "register_stream failed");
313 + goto err;
314 + }
315 + }
316 +
317 + /* add configuration file to archive */
318 + if (has_config_file) {
319 + char *cdata = NULL;
320 + gsize clen = 0;
321 + GError *err = NULL;
322 + if (!g_file_get_contents(config_file, &cdata, &clen, &err)) {
323 + error_setg(errp, "unable to read file '%s'", config_file);
324 + goto err;
325 + }
326 +
327 + const char *basename = g_path_get_basename(config_file);
328 + if (vma_writer_add_config(vmaw, basename, cdata, clen) != 0) {
329 + error_setg(errp, "unable to add config data to vma archive");
330 + g_free(cdata);
331 + goto err;
332 + }
333 + g_free(cdata);
334 + }
335 +
336 + /* initialize global backup_state now */
337 +
338 + backup_state.cancel = false;
339 +
340 + if (backup_state.error) {
341 + error_free(backup_state.error);
342 + backup_state.error = NULL;
343 + }
344 +
345 + backup_state.speed = (has_speed && speed > 0) ? speed : 0;
346 +
347 + backup_state.start_time = time(NULL);
348 + backup_state.end_time = 0;
349 +
350 + if (backup_state.backup_file) {
351 + g_free(backup_state.backup_file);
352 + }
353 + backup_state.backup_file = g_strdup(backup_file);
354 +
355 + backup_state.vmaw = vmaw;
356 +
357 + uuid_copy(backup_state.uuid, uuid);
358 + uuid_unparse_lower(uuid, backup_state.uuid_str);
359 +
360 + backup_state.di_list = di_list;
361 +
362 + backup_state.total = total;
363 + backup_state.transferred = 0;
364 + backup_state.zero_bytes = 0;
365 +
366 + /* start all jobs (paused state) */
367 + l = di_list;
368 + while (l) {
369 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
370 + l = g_list_next(l);
371 +
372 + backup_start(di->bs, NULL, speed, MIRROR_SYNC_MODE_FULL,
373 + BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
374 + pvebackup_dump_cb, pvebackup_complete_cb, di,
375 + true, &local_err);
376 + if (local_err != NULL) {
377 + error_setg(&backup_state.error, "backup_job_create failed");
378 + pvebackup_cancel(NULL);
379 + }
380 + }
381 +
382 + if (!backup_state.error) {
383 + pvebackup_run_next_job(); // run one job
384 + }
385 +
386 + return g_strdup(backup_state.uuid_str);
387 +
388 +err:
389 +
390 + l = di_list;
391 + while (l) {
392 + g_free(l->data);
393 + l = g_list_next(l);
394 + }
395 + g_list_free(di_list);
396 +
397 + if (devs) {
398 + g_strfreev(devs);
399 + }
400 +
401 + if (vmaw) {
402 + Error *err = NULL;
403 + vma_writer_close(vmaw, &err);
404 + unlink(backup_file);
405 + }
406 +
407 + return NULL;
408 +}
409 +
410 +BackupStatus *qmp_query_backup(Error **errp)
411 +{
412 + BackupStatus *info = g_malloc0(sizeof(*info));
413 +
414 + if (!backup_state.start_time) {
415 + /* not started, return {} */
416 + return info;
417 + }
418 +
419 + info->has_status = true;
420 + info->has_start_time = true;
421 + info->start_time = backup_state.start_time;
422 +
423 + if (backup_state.backup_file) {
424 + info->has_backup_file = true;
425 + info->backup_file = g_strdup(backup_state.backup_file);
426 + }
427 +
428 + info->has_uuid = true;
429 + info->uuid = g_strdup(backup_state.uuid_str);
430 +
431 + if (backup_state.end_time) {
432 + if (backup_state.error) {
433 + info->status = g_strdup("error");
434 + info->has_errmsg = true;
435 + info->errmsg = g_strdup(error_get_pretty(backup_state.error));
436 + } else {
437 + info->status = g_strdup("done");
438 + }
439 + info->has_end_time = true;
440 + info->end_time = backup_state.end_time;
441 + } else {
442 + info->status = g_strdup("active");
443 + }
444 +
445 + info->has_total = true;
446 + info->total = backup_state.total;
447 + info->has_zero_bytes = true;
448 + info->zero_bytes = backup_state.zero_bytes;
449 + info->has_transferred = true;
450 + info->transferred = backup_state.transferred;
451 +
452 + return info;
453 +}
454 +
455 void qmp_block_stream(const char *device, bool has_base,
456 const char *base, bool has_speed, int64_t speed,
457 bool has_on_error, BlockdevOnError on_error,
458 Index: new/hmp-commands.hx
459 ===================================================================
460 --- new.orig/hmp-commands.hx 2013-12-03 06:36:18.000000000 +0100
461 +++ new/hmp-commands.hx 2013-12-06 10:06:44.000000000 +0100
462 @@ -83,6 +83,35 @@
463 Copy data from a backing file into a block device.
464 ETEXI
465
466 + {
467 + .name = "backup",
468 + .args_type = "backupfile:s,speed:o?,devlist:s?",
469 + .params = "backupfile [speed [devlist]]",
470 + .help = "create a VM Backup.",
471 + .mhandler.cmd = hmp_backup,
472 + },
473 +
474 +STEXI
475 +@item backup
476 +@findex backup
477 +Create a VM backup.
478 +ETEXI
479 +
480 + {
481 + .name = "backup_cancel",
482 + .args_type = "",
483 + .params = "",
484 + .help = "cancel the current VM backup",
485 + .mhandler.cmd = hmp_backup_cancel,
486 + },
487 +
488 +STEXI
489 +@item backup_cancel
490 +@findex backup_cancel
491 +Cancel the current VM backup.
492 +
493 +ETEXI
494 +
495 {
496 .name = "block_job_set_speed",
497 .args_type = "device:B,speed:o",
498 @@ -1692,6 +1721,8 @@
499 show CPU statistics
500 @item info usernet
501 show user network stack connection states
502 +@item info backup
503 +show backup status
504 @item info migrate
505 show migration status
506 @item info migrate_capabilities
507 Index: new/hmp.c
508 ===================================================================
509 --- new.orig/hmp.c 2013-12-06 10:04:18.000000000 +0100
510 +++ new/hmp.c 2013-12-06 10:06:44.000000000 +0100
511 @@ -133,6 +133,44 @@
512 qapi_free_MouseInfoList(mice_list);
513 }
514
515 +void hmp_info_backup(Monitor *mon, const QDict *qdict)
516 +{
517 + BackupStatus *info;
518 +
519 + info = qmp_query_backup(NULL);
520 + if (info->has_status) {
521 + if (info->has_errmsg) {
522 + monitor_printf(mon, "Backup status: %s - %s\n",
523 + info->status, info->errmsg);
524 + } else {
525 + monitor_printf(mon, "Backup status: %s\n", info->status);
526 + }
527 + }
528 +
529 + if (info->has_backup_file) {
530 + monitor_printf(mon, "Start time: %s", ctime(&info->start_time));
531 + if (info->end_time) {
532 + monitor_printf(mon, "End time: %s", ctime(&info->end_time));
533 + }
534 +
535 + int per = (info->has_total && info->total &&
536 + info->has_transferred && info->transferred) ?
537 + (info->transferred * 100)/info->total : 0;
538 + int zero_per = (info->has_total && info->total &&
539 + info->has_zero_bytes && info->zero_bytes) ?
540 + (info->zero_bytes * 100)/info->total : 0;
541 + monitor_printf(mon, "Backup file: %s\n", info->backup_file);
542 + monitor_printf(mon, "Backup uuid: %s\n", info->uuid);
543 + monitor_printf(mon, "Total size: %zd\n", info->total);
544 + monitor_printf(mon, "Transferred bytes: %zd (%d%%)\n",
545 + info->transferred, per);
546 + monitor_printf(mon, "Zero bytes: %zd (%d%%)\n",
547 + info->zero_bytes, zero_per);
548 + }
549 +
550 + qapi_free_BackupStatus(info);
551 +}
552 +
553 void hmp_info_migrate(Monitor *mon, const QDict *qdict)
554 {
555 MigrationInfo *info;
556 @@ -1193,6 +1231,29 @@
557
558 hmp_handle_error(mon, &error);
559 }
560 +
561 +void hmp_backup_cancel(Monitor *mon, const QDict *qdict)
562 +{
563 + Error *error = NULL;
564 +
565 + qmp_backup_cancel(&error);
566 +
567 + hmp_handle_error(mon, &error);
568 +}
569 +
570 +void hmp_backup(Monitor *mon, const QDict *qdict)
571 +{
572 + Error *error = NULL;
573 +
574 + const char *backup_file = qdict_get_str(qdict, "backupfile");
575 + const char *devlist = qdict_get_try_str(qdict, "devlist");
576 + int64_t speed = qdict_get_try_int(qdict, "speed", 0);
577 +
578 + qmp_backup(backup_file, true, BACKUP_FORMAT_VMA, false, NULL, !!devlist,
579 + devlist, qdict_haskey(qdict, "speed"), speed, &error);
580 +
581 + hmp_handle_error(mon, &error);
582 +}
583
584 void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict)
585 {
586 Index: new/hmp.h
587 ===================================================================
588 --- new.orig/hmp.h 2013-12-03 06:36:18.000000000 +0100
589 +++ new/hmp.h 2013-12-06 10:04:22.000000000 +0100
590 @@ -28,6 +28,7 @@
591 void hmp_info_migrate(Monitor *mon, const QDict *qdict);
592 void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
593 void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict);
594 +void hmp_info_backup(Monitor *mon, const QDict *qdict);
595 void hmp_info_cpus(Monitor *mon, const QDict *qdict);
596 void hmp_info_block(Monitor *mon, const QDict *qdict);
597 void hmp_info_blockstats(Monitor *mon, const QDict *qdict);
598 @@ -69,6 +70,8 @@
599 void hmp_change(Monitor *mon, const QDict *qdict);
600 void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict);
601 void hmp_block_stream(Monitor *mon, const QDict *qdict);
602 +void hmp_backup(Monitor *mon, const QDict *qdict);
603 +void hmp_backup_cancel(Monitor *mon, const QDict *qdict);
604 void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict);
605 void hmp_block_job_cancel(Monitor *mon, const QDict *qdict);
606 void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
607 Index: new/monitor.c
608 ===================================================================
609 --- new.orig/monitor.c 2013-12-03 06:36:18.000000000 +0100
610 +++ new/monitor.c 2013-12-06 10:04:22.000000000 +0100
611 @@ -2880,6 +2880,13 @@
612 },
613 #endif
614 {
615 + .name = "backup",
616 + .args_type = "",
617 + .params = "",
618 + .help = "show backup status",
619 + .mhandler.cmd = hmp_info_backup,
620 + },
621 + {
622 .name = "migrate",
623 .args_type = "",
624 .params = "",
625 Index: new/qapi-schema.json
626 ===================================================================
627 --- new.orig/qapi-schema.json 2013-12-06 10:04:18.000000000 +0100
628 +++ new/qapi-schema.json 2013-12-06 10:06:44.000000000 +0100
629 @@ -547,6 +547,95 @@
630 ##
631 { 'command': 'query-events', 'returns': ['EventInfo'] }
632
633 +# @BackupStatus:
634 +#
635 +# Detailed backup status.
636 +#
637 +# @status: #optional string describing the current backup status.
638 +# This can be 'active', 'done', 'error'. If this field is not
639 +# returned, no backup process has been initiated
640 +#
641 +# @errmsg: #optional error message (only returned if status is 'error')
642 +#
643 +# @total: #optional total amount of bytes involved in the backup process
644 +#
645 +# @transferred: #optional amount of bytes already backed up.
646 +#
647 +# @zero-bytes: #optional amount of 'zero' bytes detected.
648 +#
649 +# @start-time: #optional time (epoch) when backup job started.
650 +#
651 +# @end-time: #optional time (epoch) when backup job finished.
652 +#
653 +# @backupfile: #optional backup file name
654 +#
655 +# @uuid: #optional uuid for this backup job
656 +#
657 +##
658 +{ 'type': 'BackupStatus',
659 + 'data': {'*status': 'str', '*errmsg': 'str', '*total': 'int',
660 + '*transferred': 'int', '*zero-bytes': 'int',
661 + '*start-time': 'int', '*end-time': 'int',
662 + '*backup-file': 'str', '*uuid': 'str' } }
663 +
664 +##
665 +# @BackupFormat
666 +#
667 +# An enumeration of supported backup formats.
668 +#
669 +# @vma: Proxmox vma backup format
670 +##
671 +{ 'enum': 'BackupFormat',
672 + 'data': [ 'vma' ] }
673 +
674 +##
675 +# @backup:
676 +#
677 +# Starts a VM backup.
678 +#
679 +# @backup-file: the backup file name
680 +#
681 +# @format: format of the backup file
682 +#
683 +# @config-filename: #optional name of a configuration file to include into
684 +# the backup archive.
685 +#
686 +# @speed: #optional the maximum speed, in bytes per second
687 +#
688 +# @devlist: #optional list of block device names (separated by ',', ';'
689 +# or ':'). By default the backup includes all writable block devices.
690 +#
691 +# Returns: the uuid of the backup job
692 +#
693 +##
694 +{ 'command': 'backup', 'data': { 'backup-file': 'str',
695 + '*format': 'BackupFormat',
696 + '*config-file': 'str',
697 + '*devlist': 'str', '*speed': 'int' },
698 + 'returns': 'str' }
699 +
700 +##
701 +# @query-backup
702 +#
703 +# Returns information about current/last backup task.
704 +#
705 +# Returns: @BackupStatus
706 +#
707 +##
708 +{ 'command': 'query-backup', 'returns': 'BackupStatus' }
709 +
710 +##
711 +# @backup-cancel
712 +#
713 +# Cancel the current executing backup process.
714 +#
715 +# Returns: nothing on success
716 +#
717 +# Notes: This command succeeds even if there is no backup process running.
718 +#
719 +##
720 +{ 'command': 'backup-cancel' }
721 +
722 ##
723 # @MigrationStats
724 #
725 Index: new/qmp-commands.hx
726 ===================================================================
727 --- new.orig/qmp-commands.hx 2013-12-06 10:04:18.000000000 +0100
728 +++ new/qmp-commands.hx 2013-12-06 10:04:22.000000000 +0100
729 @@ -966,6 +966,24 @@
730 EQMP
731
732 {
733 + .name = "backup",
734 + .args_type = "backup-file:s,format:s?,config-file:F?,speed:o?,devlist:s?",
735 + .mhandler.cmd_new = qmp_marshal_input_backup,
736 + },
737 +
738 + {
739 + .name = "backup-cancel",
740 + .args_type = "",
741 + .mhandler.cmd_new = qmp_marshal_input_backup_cancel,
742 + },
743 +
744 + {
745 + .name = "query-backup",
746 + .args_type = "",
747 + .mhandler.cmd_new = qmp_marshal_input_query_backup,
748 + },
749 +
750 + {
751 .name = "block-job-set-speed",
752 .args_type = "device:B,speed:o",
753 .mhandler.cmd_new = qmp_marshal_input_block_job_set_speed,