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