]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/pve/0027-backup-introduce-vma-archive-format.patch
bump version to 2.9.1-1
[pve-qemu.git] / debian / patches / pve / 0027-backup-introduce-vma-archive-format.patch
1 From fb4bcaaced8119f2b99d1621fdfe5fce159311f4 Mon Sep 17 00:00:00 2001
2 From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 Date: Wed, 2 Aug 2017 13:51:02 +0200
4 Subject: [PATCH 27/28] backup: introduce vma archive format
5
6 ---
7 MAINTAINERS | 6 +
8 block/Makefile.objs | 3 +
9 block/vma.c | 424 +++++++++++++++++++++++++++++++++++++++++++
10 blockdev.c | 499 +++++++++++++++++++++++++++++++++++++++++++++++++++
11 configure | 30 ++++
12 hmp-commands-info.hx | 13 ++
13 hmp-commands.hx | 31 ++++
14 hmp.c | 63 +++++++
15 hmp.h | 3 +
16 qapi-schema.json | 91 ++++++++++
17 qapi/block-core.json | 20 ++-
18 11 files changed, 1181 insertions(+), 2 deletions(-)
19 create mode 100644 block/vma.c
20
21 diff --git a/MAINTAINERS b/MAINTAINERS
22 index 430efb0ab7..6a7d338aad 100644
23 --- a/MAINTAINERS
24 +++ b/MAINTAINERS
25 @@ -1811,6 +1811,12 @@ L: qemu-block@nongnu.org
26 S: Supported
27 F: block/vvfat.c
28
29 +VMA
30 +M: Wolfgang Bumiller <w.bumiller@proxmox.com>.
31 +L: pve-devel@proxmox.com
32 +S: Supported
33 +F: block/vma.c
34 +
35 Image format fuzzer
36 M: Stefan Hajnoczi <stefanha@redhat.com>
37 L: qemu-block@nongnu.org
38 diff --git a/block/Makefile.objs b/block/Makefile.objs
39 index 8cdac08db5..6df5567dd3 100644
40 --- a/block/Makefile.objs
41 +++ b/block/Makefile.objs
42 @@ -21,6 +21,7 @@ block-obj-$(CONFIG_CURL) += curl.o
43 block-obj-$(CONFIG_RBD) += rbd.o
44 block-obj-$(CONFIG_GLUSTERFS) += gluster.o
45 block-obj-$(CONFIG_LIBSSH2) += ssh.o
46 +block-obj-$(CONFIG_VMA) += vma.o
47 block-obj-y += accounting.o dirty-bitmap.o
48 block-obj-y += write-threshold.o
49 block-obj-y += backup.o
50 @@ -45,3 +46,5 @@ block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
51 dmg-bz2.o-libs := $(BZIP2_LIBS)
52 qcow.o-libs := -lz
53 linux-aio.o-libs := -laio
54 +vma.o-cflags := $(VMA_CFLAGS)
55 +vma.o-libs := $(VMA_LIBS)
56 diff --git a/block/vma.c b/block/vma.c
57 new file mode 100644
58 index 0000000000..7151514f94
59 --- /dev/null
60 +++ b/block/vma.c
61 @@ -0,0 +1,424 @@
62 +/*
63 + * VMA archive backend for QEMU, container object
64 + *
65 + * Copyright (C) 2017 Proxmox Server Solutions GmbH
66 + *
67 + * This work is licensed under the terms of the GNU GPL, version 2 or later.
68 + * See the COPYING file in the top-level directory.
69 + *
70 + */
71 +#include <vma/vma.h>
72 +
73 +#include "qemu/osdep.h"
74 +#include "qemu/uuid.h"
75 +#include "qemu-common.h"
76 +#include "qapi/error.h"
77 +#include "qapi/qmp/qerror.h"
78 +#include "qapi/qmp/qstring.h"
79 +#include "qom/object.h"
80 +#include "qom/object_interfaces.h"
81 +#include "block/block_int.h"
82 +
83 +/* exported interface */
84 +void vma_object_add_config_file(Object *obj, const char *name,
85 + const char *contents, size_t len,
86 + Error **errp);
87 +
88 +#define TYPE_VMA_OBJECT "vma"
89 +#define VMA_OBJECT(obj) \
90 + OBJECT_CHECK(VMAObjectState, (obj), TYPE_VMA_OBJECT)
91 +#define VMA_OBJECT_GET_CLASS(obj) \
92 + OBJECT_GET_CLASS(VMAObjectClass, (obj), TYPE_VMA_OBJECT)
93 +
94 +typedef struct VMAObjectClass {
95 + ObjectClass parent_class;
96 +} VMAObjectClass;
97 +
98 +typedef struct VMAObjectState {
99 + Object parent;
100 +
101 + char *filename;
102 +
103 + QemuUUID uuid;
104 + bool blocked;
105 + VMAWriter *vma;
106 + QemuMutex mutex;
107 +} VMAObjectState;
108 +
109 +static VMAObjectState *vma_by_id(const char *name)
110 +{
111 + Object *container;
112 + Object *obj;
113 +
114 + container = object_get_objects_root();
115 + obj = object_resolve_path_component(container, name);
116 +
117 + return VMA_OBJECT(obj);
118 +}
119 +
120 +static void vma_object_class_complete(UserCreatable *uc, Error **errp)
121 +{
122 + int rc;
123 + VMAObjectState *vo = VMA_OBJECT(uc);
124 + VMAObjectClass *voc = VMA_OBJECT_GET_CLASS(uc);
125 + (void)!vo;
126 + (void)!voc;
127 +
128 + if (!vo->filename) {
129 + error_setg(errp, "Parameter 'filename' is required");
130 + return;
131 + }
132 +
133 + rc = VMAWriter_fopen(vo->filename, &vo->vma);
134 + if (rc < 0) {
135 + error_setg_errno(errp, -rc, "failed to create VMA archive");
136 + return;
137 + }
138 +
139 + rc = VMAWriter_set_uuid(vo->vma, vo->uuid.data, sizeof(vo->uuid.data));
140 + if (rc < 0) {
141 + error_setg_errno(errp, -rc, "failed to set UUID of VMA archive");
142 + return;
143 + }
144 +
145 + qemu_mutex_init(&vo->mutex);
146 +}
147 +
148 +static bool vma_object_can_be_deleted(UserCreatable *uc, Error **errp)
149 +{
150 + //VMAObjectState *vo = VMA_OBJECT(uc);
151 + //if (!vo->vma) {
152 + // return true;
153 + //}
154 + //return false;
155 + return true;
156 +}
157 +
158 +static void vma_object_class_init(ObjectClass *oc, void *data)
159 +{
160 + UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
161 +
162 + ucc->can_be_deleted = vma_object_can_be_deleted;
163 + ucc->complete = vma_object_class_complete;
164 +}
165 +
166 +static char *vma_object_get_filename(Object *obj, Error **errp)
167 +{
168 + VMAObjectState *vo = VMA_OBJECT(obj);
169 +
170 + return g_strdup(vo->filename);
171 +}
172 +
173 +static void vma_object_set_filename(Object *obj, const char *str, Error **errp)
174 +{
175 + VMAObjectState *vo = VMA_OBJECT(obj);
176 +
177 + if (vo->vma) {
178 + error_setg(errp, "filename cannot be changed after creation");
179 + return;
180 + }
181 +
182 + g_free(vo->filename);
183 + vo->filename = g_strdup(str);
184 +}
185 +
186 +static char *vma_object_get_uuid(Object *obj, Error **errp)
187 +{
188 + VMAObjectState *vo = VMA_OBJECT(obj);
189 +
190 + return qemu_uuid_unparse_strdup(&vo->uuid);
191 +}
192 +
193 +static void vma_object_set_uuid(Object *obj, const char *str, Error **errp)
194 +{
195 + VMAObjectState *vo = VMA_OBJECT(obj);
196 +
197 + if (vo->vma) {
198 + error_setg(errp, "uuid cannot be changed after creation");
199 + return;
200 + }
201 +
202 + qemu_uuid_parse(str, &vo->uuid);
203 +}
204 +
205 +static bool vma_object_get_blocked(Object *obj, Error **errp)
206 +{
207 + VMAObjectState *vo = VMA_OBJECT(obj);
208 +
209 + return vo->blocked;
210 +}
211 +
212 +static void vma_object_set_blocked(Object *obj, bool blocked, Error **errp)
213 +{
214 + VMAObjectState *vo = VMA_OBJECT(obj);
215 +
216 + (void)errp;
217 +
218 + vo->blocked = blocked;
219 +}
220 +
221 +void vma_object_add_config_file(Object *obj, const char *name,
222 + const char *contents, size_t len,
223 + Error **errp)
224 +{
225 + int rc;
226 + VMAObjectState *vo = VMA_OBJECT(obj);
227 +
228 + if (!vo || !vo->vma) {
229 + error_setg(errp, "not a valid vma object to add config files to");
230 + return;
231 + }
232 +
233 + rc = VMAWriter_addConfigFile(vo->vma, name, contents, len);
234 + if (rc < 0) {
235 + error_setg_errno(errp, -rc, "failed to add config file to VMA");
236 + return;
237 + }
238 +}
239 +
240 +static void vma_object_init(Object *obj)
241 +{
242 + VMAObjectState *vo = VMA_OBJECT(obj);
243 + (void)!vo;
244 +
245 + object_property_add_str(obj, "filename",
246 + vma_object_get_filename, vma_object_set_filename,
247 + NULL);
248 + object_property_add_str(obj, "uuid",
249 + vma_object_get_uuid, vma_object_set_uuid,
250 + NULL);
251 + object_property_add_bool(obj, "blocked",
252 + vma_object_get_blocked, vma_object_set_blocked,
253 + NULL);
254 +}
255 +
256 +static void vma_object_finalize(Object *obj)
257 +{
258 + VMAObjectState *vo = VMA_OBJECT(obj);
259 + VMAObjectClass *voc = VMA_OBJECT_GET_CLASS(obj);
260 + (void)!voc;
261 +
262 + qemu_mutex_destroy(&vo->mutex);
263 +
264 + VMAWriter_destroy(vo->vma, true);
265 + g_free(vo->filename);
266 +}
267 +
268 +static const TypeInfo vma_object_info = {
269 + .name = TYPE_VMA_OBJECT,
270 + .parent = TYPE_OBJECT,
271 + .class_size = sizeof(VMAObjectClass),
272 + .class_init = vma_object_class_init,
273 + .instance_size = sizeof(VMAObjectState),
274 + .instance_init = vma_object_init,
275 + .instance_finalize = vma_object_finalize,
276 + .interfaces = (InterfaceInfo[]) {
277 + { TYPE_USER_CREATABLE },
278 + { }
279 + }
280 +};
281 +
282 +static void register_types(void)
283 +{
284 + type_register_static(&vma_object_info);
285 +}
286 +
287 +type_init(register_types);
288 +
289 +typedef struct {
290 + VMAObjectState *vma_obj;
291 + char *name;
292 + size_t device_id;
293 + uint64_t byte_size;
294 +} BDRVVMAState;
295 +
296 +static void qemu_vma_parse_filename(const char *filename, QDict *options,
297 + Error **errp)
298 +{
299 + char *sep;
300 +
301 + sep = strchr(filename, '/');
302 + if (!sep || sep == filename) {
303 + error_setg(errp, "VMA filename should be <vma-object>/<device-name>");
304 + return;
305 + }
306 +
307 + qdict_put(options, "vma", qstring_from_substr(filename, 0, sep-filename-1));
308 +
309 + while (*sep && *sep == '/')
310 + ++sep;
311 + if (!*sep) {
312 + error_setg(errp, "missing device name\n");
313 + return;
314 + }
315 +
316 + qdict_put(options, "name", qstring_from_str(sep));
317 +}
318 +
319 +static QemuOptsList runtime_opts = {
320 + .name = "vma-drive",
321 + .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head),
322 + .desc = {
323 + {
324 + .name = "vma",
325 + .type = QEMU_OPT_STRING,
326 + .help = "VMA Object name",
327 + },
328 + {
329 + .name = "name",
330 + .type = QEMU_OPT_STRING,
331 + .help = "VMA device name",
332 + },
333 + {
334 + .name = BLOCK_OPT_SIZE,
335 + .type = QEMU_OPT_SIZE,
336 + .help = "Virtual disk size"
337 + },
338 + { /* end of list */ }
339 + },
340 +};
341 +static int qemu_vma_open(BlockDriverState *bs, QDict *options, int flags,
342 + Error **errp)
343 +{
344 + Error *local_err = NULL;
345 + BDRVVMAState *s = bs->opaque;
346 + QemuOpts *opts;
347 + const char *vma_id, *device_name;
348 + ssize_t dev_id;
349 + int64_t bytes = 0;
350 + int ret;
351 +
352 + opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
353 + qemu_opts_absorb_qdict(opts, options, &local_err);
354 + if (local_err) {
355 + error_propagate(errp, local_err);
356 + ret = -EINVAL;
357 + goto failed_opts;
358 + }
359 +
360 + bytes = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
361 + BDRV_SECTOR_SIZE);
362 +
363 + vma_id = qemu_opt_get(opts, "vma");
364 + device_name = qemu_opt_get(opts, "name");
365 +
366 + VMAObjectState *vma = vma_by_id(vma_id);
367 + if (!vma) {
368 + ret = -EINVAL;
369 + error_setg(errp, "no such VMA object: %s", vma_id);
370 + goto failed_opts;
371 + }
372 +
373 + dev_id = VMAWriter_findDevice(vma->vma, device_name);
374 + if (dev_id >= 0) {
375 + error_setg(errp, "drive already exists in VMA object");
376 + ret = -EIO;
377 + goto failed_opts;
378 + }
379 +
380 + dev_id = VMAWriter_addDevice(vma->vma, device_name, (uint64_t)bytes);
381 + if (dev_id < 0) {
382 + error_setg_errno(errp, -dev_id, "failed to add VMA device");
383 + ret = -EIO;
384 + goto failed_opts;
385 + }
386 +
387 + object_ref(OBJECT(vma));
388 + s->vma_obj = vma;
389 + s->name = g_strdup(device_name);
390 + s->device_id = (size_t)dev_id;
391 + s->byte_size = bytes;
392 +
393 + ret = 0;
394 +
395 +failed_opts:
396 + qemu_opts_del(opts);
397 + return ret;
398 +}
399 +
400 +static void qemu_vma_close(BlockDriverState *bs)
401 +{
402 + BDRVVMAState *s = bs->opaque;
403 +
404 + (void)VMAWriter_finishDevice(s->vma_obj->vma, s->device_id);
405 + object_unref(OBJECT(s->vma_obj));
406 +
407 + g_free(s->name);
408 +}
409 +
410 +static int64_t qemu_vma_getlength(BlockDriverState *bs)
411 +{
412 + BDRVVMAState *s = bs->opaque;
413 +
414 + return s->byte_size;
415 +}
416 +
417 +static coroutine_fn int qemu_vma_co_writev(BlockDriverState *bs,
418 + int64_t sector_num,
419 + int nb_sectors,
420 + QEMUIOVector *qiov)
421 +{
422 + size_t i;
423 + ssize_t rc;
424 + BDRVVMAState *s = bs->opaque;
425 + VMAObjectState *vo = s->vma_obj;
426 + off_t offset = sector_num * BDRV_SECTOR_SIZE;
427 +
428 + qemu_mutex_lock(&vo->mutex);
429 + if (vo->blocked) {
430 + return -EPERM;
431 + }
432 + for (i = 0; i != qiov->niov; ++i) {
433 + const struct iovec *v = &qiov->iov[i];
434 + size_t blocks = v->iov_len / VMA_BLOCK_SIZE;
435 + if (blocks * VMA_BLOCK_SIZE != v->iov_len) {
436 + return -EIO;
437 + }
438 + rc = VMAWriter_writeBlocks(vo->vma, s->device_id,
439 + v->iov_base, blocks, offset);
440 + if (errno) {
441 + return -errno;
442 + }
443 + if (rc != blocks) {
444 + return -EIO;
445 + }
446 + offset += v->iov_len;
447 + }
448 + qemu_mutex_unlock(&vo->mutex);
449 + return 0;
450 +}
451 +
452 +static int qemu_vma_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
453 +{
454 + bdi->cluster_size = VMA_CLUSTER_SIZE;
455 + bdi->unallocated_blocks_are_zero = true;
456 + bdi->can_write_zeroes_with_unmap = false;
457 + return 0;
458 +}
459 +
460 +static BlockDriver bdrv_vma_drive = {
461 + .format_name = "vma-drive",
462 + .instance_size = sizeof(BDRVVMAState),
463 +
464 +#if 0
465 + .bdrv_create = qemu_vma_create,
466 + .create_opts = &qemu_vma_create_opts,
467 +#endif
468 +
469 + .bdrv_parse_filename = qemu_vma_parse_filename,
470 + .bdrv_file_open = qemu_vma_open,
471 +
472 + .bdrv_close = qemu_vma_close,
473 + .bdrv_has_zero_init = bdrv_has_zero_init_1,
474 + .bdrv_getlength = qemu_vma_getlength,
475 + .bdrv_get_info = qemu_vma_get_info,
476 +
477 + .bdrv_co_writev = qemu_vma_co_writev,
478 +};
479 +
480 +static void bdrv_vma_init(void)
481 +{
482 + bdrv_register(&bdrv_vma_drive);
483 +}
484 +
485 +block_init(bdrv_vma_init);
486 diff --git a/blockdev.c b/blockdev.c
487 index 9b6cfafd33..e23eb16fc8 100644
488 --- a/blockdev.c
489 +++ b/blockdev.c
490 @@ -31,10 +31,12 @@
491 */
492
493 #include "qemu/osdep.h"
494 +#include "qemu/uuid.h"
495 #include "sysemu/block-backend.h"
496 #include "sysemu/blockdev.h"
497 #include "hw/block/block.h"
498 #include "block/blockjob.h"
499 +#include "block/blockjob_int.h"
500 #include "block/throttle-groups.h"
501 #include "monitor/monitor.h"
502 #include "qemu/error-report.h"
503 @@ -2932,6 +2934,503 @@ out:
504 aio_context_release(aio_context);
505 }
506
507 +/* PVE backup related function */
508 +
509 +static struct PVEBackupState {
510 + Error *error;
511 + bool cancel;
512 + QemuUUID uuid;
513 + char uuid_str[37];
514 + int64_t speed;
515 + time_t start_time;
516 + time_t end_time;
517 + char *backup_file;
518 + Object *vmaobj;
519 + GList *di_list;
520 + size_t next_job;
521 + size_t total;
522 + size_t transferred;
523 + size_t zero_bytes;
524 +} backup_state;
525 +
526 +typedef struct PVEBackupDevInfo {
527 + BlockDriverState *bs;
528 + size_t size;
529 + uint8_t dev_id;
530 + bool completed;
531 + char targetfile[PATH_MAX];
532 + BlockDriverState *target;
533 +} PVEBackupDevInfo;
534 +
535 +static void pvebackup_run_next_job(void);
536 +
537 +static void pvebackup_cleanup(void)
538 +{
539 + backup_state.end_time = time(NULL);
540 +
541 + if (backup_state.vmaobj) {
542 + object_unparent(backup_state.vmaobj);
543 + backup_state.vmaobj = NULL;
544 + }
545 +
546 + if (backup_state.di_list) {
547 + GList *l = backup_state.di_list;
548 + while (l) {
549 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
550 + l = g_list_next(l);
551 + g_free(di);
552 + }
553 + g_list_free(backup_state.di_list);
554 + backup_state.di_list = NULL;
555 + }
556 +}
557 +
558 +static void pvebackup_complete_cb(void *opaque, int ret)
559 +{
560 + PVEBackupDevInfo *di = opaque;
561 +
562 + di->completed = true;
563 +
564 + if (ret < 0 && !backup_state.error) {
565 + error_setg(&backup_state.error, "job failed with err %d - %s",
566 + ret, strerror(-ret));
567 + }
568 +
569 + di->bs = NULL;
570 + di->target = NULL;
571 +
572 + if (backup_state.vmaobj) {
573 + object_unparent(backup_state.vmaobj);
574 + backup_state.vmaobj = NULL;
575 + }
576 +
577 + if (!backup_state.cancel) {
578 + pvebackup_run_next_job();
579 + }
580 +}
581 +
582 +static void pvebackup_cancel(void *opaque)
583 +{
584 + backup_state.cancel = true;
585 +
586 + if (!backup_state.error) {
587 + error_setg(&backup_state.error, "backup cancelled");
588 + }
589 +
590 + if (backup_state.vmaobj) {
591 + Error *err;
592 + /* make sure vma writer does not block anymore */
593 + if (!object_set_props(backup_state.vmaobj, &err, "blocked", "yes", NULL)) {
594 + if (err) {
595 + error_report_err(err);
596 + }
597 + }
598 + }
599 +
600 + GList *l = backup_state.di_list;
601 + while (l) {
602 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
603 + l = g_list_next(l);
604 + if (!di->completed && di->bs) {
605 + BlockJob *job = di->bs->job;
606 + if (job) {
607 + if (!di->completed) {
608 + block_job_cancel_sync(job);
609 + }
610 + }
611 + }
612 + }
613 +
614 + pvebackup_cleanup();
615 +}
616 +
617 +void qmp_backup_cancel(Error **errp)
618 +{
619 + Coroutine *co = qemu_coroutine_create(pvebackup_cancel, NULL);
620 + qemu_coroutine_enter(co);
621 +
622 + while (backup_state.vmaobj) {
623 + /* FIXME: Find something better for this */
624 + aio_poll(qemu_get_aio_context(), true);
625 + }
626 +}
627 +
628 +void vma_object_add_config_file(Object *obj, const char *name,
629 + const char *contents, size_t len,
630 + Error **errp);
631 +static int config_to_vma(const char *file, BackupFormat format,
632 + Object *vmaobj,
633 + const char *backup_dir,
634 + Error **errp)
635 +{
636 + char *cdata = NULL;
637 + gsize clen = 0;
638 + GError *err = NULL;
639 + if (!g_file_get_contents(file, &cdata, &clen, &err)) {
640 + error_setg(errp, "unable to read file '%s'", file);
641 + return 1;
642 + }
643 +
644 + char *basename = g_path_get_basename(file);
645 +
646 + if (format == BACKUP_FORMAT_VMA) {
647 + vma_object_add_config_file(vmaobj, basename, cdata, clen, errp);
648 + } else if (format == BACKUP_FORMAT_DIR) {
649 + char config_path[PATH_MAX];
650 + snprintf(config_path, PATH_MAX, "%s/%s", backup_dir, basename);
651 + if (!g_file_set_contents(config_path, cdata, clen, &err)) {
652 + error_setg(errp, "unable to write config file '%s'", config_path);
653 + g_free(cdata);
654 + g_free(basename);
655 + return 1;
656 + }
657 + }
658 +
659 + g_free(basename);
660 + g_free(cdata);
661 +
662 + return 0;
663 +}
664 +
665 +static void pvebackup_run_next_job(void)
666 +{
667 + bool cancel = backup_state.error || backup_state.cancel;
668 +fprintf(stderr, "run next job: %zu\n", backup_state.next_job);
669 + GList *next = g_list_nth(backup_state.di_list, backup_state.next_job);
670 + while (next) {
671 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)next->data;
672 + backup_state.next_job++;
673 + if (!di->completed && di->bs && di->bs->job) {
674 + BlockJob *job = di->bs->job;
675 + if (cancel) {
676 + block_job_cancel(job);
677 + } else {
678 + block_job_resume(job);
679 + }
680 + return;
681 + }
682 + next = g_list_next(next);
683 + }
684 + pvebackup_cleanup();
685 +}
686 +
687 +UuidInfo *qmp_backup(const char *backup_file, bool has_format,
688 + BackupFormat format,
689 + bool has_config_file, const char *config_file,
690 + bool has_firewall_file, const char *firewall_file,
691 + bool has_devlist, const char *devlist,
692 + bool has_speed, int64_t speed, Error **errp)
693 +{
694 + BlockBackend *blk;
695 + BlockDriverState *bs = NULL;
696 + const char *backup_dir = NULL;
697 + Error *local_err = NULL;
698 + QemuUUID uuid;
699 + gchar **devs = NULL;
700 + GList *di_list = NULL;
701 + GList *l;
702 + UuidInfo *uuid_info;
703 + BlockJob *job;
704 +
705 + if (backup_state.di_list || backup_state.vmaobj) {
706 + error_set(errp, ERROR_CLASS_GENERIC_ERROR,
707 + "previous backup not finished");
708 + return NULL;
709 + }
710 +
711 + /* Todo: try to auto-detect format based on file name */
712 + format = has_format ? format : BACKUP_FORMAT_VMA;
713 +
714 + if (has_devlist) {
715 + devs = g_strsplit_set(devlist, ",;:", -1);
716 +
717 + gchar **d = devs;
718 + while (d && *d) {
719 + blk = blk_by_name(*d);
720 + if (blk) {
721 + bs = blk_bs(blk);
722 + if (bdrv_is_read_only(bs)) {
723 + error_setg(errp, "Node '%s' is read only", *d);
724 + goto err;
725 + }
726 + if (!bdrv_is_inserted(bs)) {
727 + error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, *d);
728 + goto err;
729 + }
730 + PVEBackupDevInfo *di = g_new0(PVEBackupDevInfo, 1);
731 + di->bs = bs;
732 + di_list = g_list_append(di_list, di);
733 + } else {
734 + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
735 + "Device '%s' not found", *d);
736 + goto err;
737 + }
738 + d++;
739 + }
740 +
741 + } else {
742 + BdrvNextIterator it;
743 +
744 + bs = NULL;
745 + for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
746 + if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
747 + continue;
748 + }
749 +
750 + PVEBackupDevInfo *di = g_new0(PVEBackupDevInfo, 1);
751 + di->bs = bs;
752 + di_list = g_list_append(di_list, di);
753 + }
754 + }
755 +
756 + if (!di_list) {
757 + error_set(errp, ERROR_CLASS_GENERIC_ERROR, "empty device list");
758 + goto err;
759 + }
760 +
761 + size_t total = 0;
762 +
763 + l = di_list;
764 + while (l) {
765 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
766 + l = g_list_next(l);
767 + if (bdrv_op_is_blocked(di->bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
768 + goto err;
769 + }
770 +
771 + ssize_t size = bdrv_getlength(di->bs);
772 + if (size < 0) {
773 + error_setg_errno(errp, -di->size, "bdrv_getlength failed");
774 + goto err;
775 + }
776 + di->size = size;
777 + total += size;
778 + }
779 +
780 + qemu_uuid_generate(&uuid);
781 +
782 + if (format == BACKUP_FORMAT_VMA) {
783 + char uuidstr[UUID_FMT_LEN+1];
784 + qemu_uuid_unparse(&uuid, uuidstr);
785 + uuidstr[UUID_FMT_LEN] = 0;
786 + backup_state.vmaobj =
787 + object_new_with_props("vma", object_get_objects_root(),
788 + "vma-backup-obj", &local_err,
789 + "filename", backup_file,
790 + "uuid", uuidstr,
791 + NULL);
792 + if (!backup_state.vmaobj) {
793 + if (local_err) {
794 + error_propagate(errp, local_err);
795 + }
796 + goto err;
797 + }
798 +
799 + l = di_list;
800 + while (l) {
801 + QDict *options = qdict_new();
802 +
803 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
804 + l = g_list_next(l);
805 +
806 + const char *devname = bdrv_get_device_name(di->bs);
807 + snprintf(di->targetfile, PATH_MAX, "vma-backup-obj/%s.raw", devname);
808 +
809 + qdict_put(options, "driver", qstring_from_str("vma-drive"));
810 + qdict_put(options, "size", qint_from_int(di->size));
811 + di->target = bdrv_open(di->targetfile, NULL, options, BDRV_O_RDWR, &local_err);
812 + if (!di->target) {
813 + error_propagate(errp, local_err);
814 + goto err;
815 + }
816 + }
817 + } else if (format == BACKUP_FORMAT_DIR) {
818 + if (mkdir(backup_file, 0640) != 0) {
819 + error_setg_errno(errp, errno, "can't create directory '%s'\n",
820 + backup_file);
821 + goto err;
822 + }
823 + backup_dir = backup_file;
824 +
825 + l = di_list;
826 + while (l) {
827 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
828 + l = g_list_next(l);
829 +
830 + const char *devname = bdrv_get_device_name(di->bs);
831 + snprintf(di->targetfile, PATH_MAX, "%s/%s.raw", backup_dir, devname);
832 +
833 + int flags = BDRV_O_RDWR;
834 + bdrv_img_create(di->targetfile, "raw", NULL, NULL, NULL,
835 + di->size, flags, &local_err, false);
836 + if (local_err) {
837 + error_propagate(errp, local_err);
838 + goto err;
839 + }
840 +
841 + di->target = bdrv_open(di->targetfile, NULL, NULL, flags, &local_err);
842 + if (!di->target) {
843 + error_propagate(errp, local_err);
844 + goto err;
845 + }
846 + }
847 + } else {
848 + error_set(errp, ERROR_CLASS_GENERIC_ERROR, "unknown backup format");
849 + goto err;
850 + }
851 +
852 + /* add configuration file to archive */
853 + if (has_config_file) {
854 + if(config_to_vma(config_file, format, backup_state.vmaobj, backup_dir, errp) != 0) {
855 + goto err;
856 + }
857 + }
858 +
859 + /* add firewall file to archive */
860 + if (has_firewall_file) {
861 + if(config_to_vma(firewall_file, format, backup_state.vmaobj, backup_dir, errp) != 0) {
862 + goto err;
863 + }
864 + }
865 + /* initialize global backup_state now */
866 +
867 + backup_state.cancel = false;
868 +
869 + if (backup_state.error) {
870 + error_free(backup_state.error);
871 + backup_state.error = NULL;
872 + }
873 +
874 + backup_state.speed = (has_speed && speed > 0) ? speed : 0;
875 +
876 + backup_state.start_time = time(NULL);
877 + backup_state.end_time = 0;
878 +
879 + if (backup_state.backup_file) {
880 + g_free(backup_state.backup_file);
881 + }
882 + backup_state.backup_file = g_strdup(backup_file);
883 +
884 + memcpy(&backup_state.uuid, &uuid, sizeof(uuid));
885 + qemu_uuid_unparse(&uuid, backup_state.uuid_str);
886 +
887 + backup_state.di_list = di_list;
888 + backup_state.next_job = 0;
889 +
890 + backup_state.total = total;
891 + backup_state.transferred = 0;
892 + backup_state.zero_bytes = 0;
893 +
894 + /* start all jobs (paused state) */
895 + l = di_list;
896 + while (l) {
897 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
898 + l = g_list_next(l);
899 +
900 + job = backup_job_create(NULL, di->bs, di->target, speed, MIRROR_SYNC_MODE_FULL, NULL,
901 + false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
902 + BLOCK_JOB_DEFAULT,
903 + pvebackup_complete_cb, di, 2, NULL, &local_err);
904 + if (di->target) {
905 + bdrv_unref(di->target);
906 + di->target = NULL;
907 + }
908 + if (!job || local_err != NULL) {
909 + error_setg(&backup_state.error, "backup_job_create failed");
910 + pvebackup_cancel(NULL);
911 + } else {
912 + block_job_start(job);
913 + }
914 + }
915 +
916 + if (!backup_state.error) {
917 + pvebackup_run_next_job(); // run one job
918 + }
919 +
920 + uuid_info = g_malloc0(sizeof(*uuid_info));
921 + uuid_info->UUID = g_strdup(backup_state.uuid_str);
922 +
923 + return uuid_info;
924 +
925 +err:
926 +
927 + l = di_list;
928 + while (l) {
929 + PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
930 + l = g_list_next(l);
931 +
932 + if (di->target) {
933 + bdrv_unref(di->target);
934 + }
935 +
936 + if (di->targetfile[0]) {
937 + unlink(di->targetfile);
938 + }
939 + g_free(di);
940 + }
941 + g_list_free(di_list);
942 +
943 + if (devs) {
944 + g_strfreev(devs);
945 + }
946 +
947 + if (backup_state.vmaobj) {
948 + object_unparent(backup_state.vmaobj);
949 + backup_state.vmaobj = NULL;
950 + }
951 +
952 + if (backup_dir) {
953 + rmdir(backup_dir);
954 + }
955 +
956 + return NULL;
957 +}
958 +
959 +BackupStatus *qmp_query_backup(Error **errp)
960 +{
961 + BackupStatus *info = g_malloc0(sizeof(*info));
962 +
963 + if (!backup_state.start_time) {
964 + /* not started, return {} */
965 + return info;
966 + }
967 +
968 + info->has_status = true;
969 + info->has_start_time = true;
970 + info->start_time = backup_state.start_time;
971 +
972 + if (backup_state.backup_file) {
973 + info->has_backup_file = true;
974 + info->backup_file = g_strdup(backup_state.backup_file);
975 + }
976 +
977 + info->has_uuid = true;
978 + info->uuid = g_strdup(backup_state.uuid_str);
979 +
980 + if (backup_state.end_time) {
981 + if (backup_state.error) {
982 + info->status = g_strdup("error");
983 + info->has_errmsg = true;
984 + info->errmsg = g_strdup(error_get_pretty(backup_state.error));
985 + } else {
986 + info->status = g_strdup("done");
987 + }
988 + info->has_end_time = true;
989 + info->end_time = backup_state.end_time;
990 + } else {
991 + info->status = g_strdup("active");
992 + }
993 +
994 + info->has_total = true;
995 + info->total = backup_state.total;
996 + info->has_zero_bytes = true;
997 + info->zero_bytes = backup_state.zero_bytes;
998 + info->has_transferred = true;
999 + info->transferred = backup_state.transferred;
1000 +
1001 + return info;
1002 +}
1003 +
1004 void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
1005 bool has_base, const char *base,
1006 bool has_base_node, const char *base_node,
1007 diff --git a/configure b/configure
1008 index be4d326ae0..841f7a8fae 100755
1009 --- a/configure
1010 +++ b/configure
1011 @@ -320,6 +320,7 @@ numa=""
1012 tcmalloc="no"
1013 jemalloc="no"
1014 replication="yes"
1015 +vma=""
1016
1017 supported_cpu="no"
1018 supported_os="no"
1019 @@ -1183,6 +1184,10 @@ for opt do
1020 ;;
1021 --enable-replication) replication="yes"
1022 ;;
1023 + --disable-vma) vma="no"
1024 + ;;
1025 + --enable-vma) vma="yes"
1026 + ;;
1027 *)
1028 echo "ERROR: unknown option $opt"
1029 echo "Try '$0 --help' for more information"
1030 @@ -1427,6 +1432,7 @@ disabled with --disable-FEATURE, default is enabled if available:
1031 xfsctl xfsctl support
1032 qom-cast-debug cast debugging support
1033 tools build qemu-io, qemu-nbd and qemu-image tools
1034 + vma VMA archive backend
1035
1036 NOTE: The object files are built at the place where configure is launched
1037 EOF
1038 @@ -3705,6 +3711,23 @@ EOF
1039 fi
1040
1041 ##########################################
1042 +# vma probe
1043 +if test "$vma" != "no" ; then
1044 + if $pkg_config --exact-version=0.1.0 vma; then
1045 + vma="yes"
1046 + vma_cflags=$($pkg_config --cflags vma)
1047 + vma_libs=$($pkg_config --libs vma)
1048 + else
1049 + if test "$vma" = "yes" ; then
1050 + feature_not_found "VMA Archive backend support" \
1051 + "Install libvma devel"
1052 + fi
1053 + vma="no"
1054 + fi
1055 +fi
1056 +
1057 +
1058 +##########################################
1059 # signalfd probe
1060 signalfd="no"
1061 cat > $TMPC << EOF
1062 @@ -5146,6 +5169,7 @@ echo "tcmalloc support $tcmalloc"
1063 echo "jemalloc support $jemalloc"
1064 echo "avx2 optimization $avx2_opt"
1065 echo "replication support $replication"
1066 +echo "VMA support $vma"
1067
1068 if test "$sdl_too_old" = "yes"; then
1069 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1070 @@ -5703,6 +5727,12 @@ if test "$libssh2" = "yes" ; then
1071 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
1072 fi
1073
1074 +if test "$vma" = "yes" ; then
1075 + echo "CONFIG_VMA=y" >> $config_host_mak
1076 + echo "VMA_CFLAGS=$vma_cflags" >> $config_host_mak
1077 + echo "VMA_LIBS=$vma_libs" >> $config_host_mak
1078 +fi
1079 +
1080 # USB host support
1081 if test "$libusb" = "yes"; then
1082 echo "HOST_USB=libusb legacy" >> $config_host_mak
1083 diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
1084 index 5fc57a2210..3b5a0f95e4 100644
1085 --- a/hmp-commands-info.hx
1086 +++ b/hmp-commands-info.hx
1087 @@ -487,6 +487,19 @@ STEXI
1088 Show CPU statistics.
1089 ETEXI
1090
1091 + {
1092 + .name = "backup",
1093 + .args_type = "",
1094 + .params = "",
1095 + .help = "show backup status",
1096 + .cmd = hmp_info_backup,
1097 + },
1098 +
1099 +STEXI
1100 +@item info backup
1101 +show backup status
1102 +ETEXI
1103 +
1104 #if defined(CONFIG_SLIRP)
1105 {
1106 .name = "usernet",
1107 diff --git a/hmp-commands.hx b/hmp-commands.hx
1108 index 58940a762b..a2867b56f2 100644
1109 --- a/hmp-commands.hx
1110 +++ b/hmp-commands.hx
1111 @@ -87,6 +87,37 @@ STEXI
1112 Copy data from a backing file into a block device.
1113 ETEXI
1114
1115 + {
1116 + .name = "backup",
1117 + .args_type = "directory:-d,backupfile:s,speed:o?,devlist:s?",
1118 + .params = "[-d] backupfile [speed [devlist]]",
1119 + .help = "create a VM Backup."
1120 + "\n\t\t\t Use -d to dump data into a directory instead"
1121 + "\n\t\t\t of using VMA format.",
1122 + .cmd = hmp_backup,
1123 + },
1124 +
1125 +STEXI
1126 +@item backup
1127 +@findex backup
1128 +Create a VM backup.
1129 +ETEXI
1130 +
1131 + {
1132 + .name = "backup_cancel",
1133 + .args_type = "",
1134 + .params = "",
1135 + .help = "cancel the current VM backup",
1136 + .cmd = hmp_backup_cancel,
1137 + },
1138 +
1139 +STEXI
1140 +@item backup_cancel
1141 +@findex backup_cancel
1142 +Cancel the current VM backup.
1143 +
1144 +ETEXI
1145 +
1146 {
1147 .name = "block_job_set_speed",
1148 .args_type = "device:B,speed:o",
1149 diff --git a/hmp.c b/hmp.c
1150 index f725d061e6..12f1f46125 100644
1151 --- a/hmp.c
1152 +++ b/hmp.c
1153 @@ -151,6 +151,44 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
1154 qapi_free_MouseInfoList(mice_list);
1155 }
1156
1157 +void hmp_info_backup(Monitor *mon, const QDict *qdict)
1158 +{
1159 + BackupStatus *info;
1160 +
1161 + info = qmp_query_backup(NULL);
1162 + if (info->has_status) {
1163 + if (info->has_errmsg) {
1164 + monitor_printf(mon, "Backup status: %s - %s\n",
1165 + info->status, info->errmsg);
1166 + } else {
1167 + monitor_printf(mon, "Backup status: %s\n", info->status);
1168 + }
1169 + }
1170 +
1171 + if (info->has_backup_file) {
1172 + monitor_printf(mon, "Start time: %s", ctime(&info->start_time));
1173 + if (info->end_time) {
1174 + monitor_printf(mon, "End time: %s", ctime(&info->end_time));
1175 + }
1176 +
1177 + int per = (info->has_total && info->total &&
1178 + info->has_transferred && info->transferred) ?
1179 + (info->transferred * 100)/info->total : 0;
1180 + int zero_per = (info->has_total && info->total &&
1181 + info->has_zero_bytes && info->zero_bytes) ?
1182 + (info->zero_bytes * 100)/info->total : 0;
1183 + monitor_printf(mon, "Backup file: %s\n", info->backup_file);
1184 + monitor_printf(mon, "Backup uuid: %s\n", info->uuid);
1185 + monitor_printf(mon, "Total size: %zd\n", info->total);
1186 + monitor_printf(mon, "Transferred bytes: %zd (%d%%)\n",
1187 + info->transferred, per);
1188 + monitor_printf(mon, "Zero bytes: %zd (%d%%)\n",
1189 + info->zero_bytes, zero_per);
1190 + }
1191 +
1192 + qapi_free_BackupStatus(info);
1193 +}
1194 +
1195 void hmp_info_migrate(Monitor *mon, const QDict *qdict)
1196 {
1197 MigrationInfo *info;
1198 @@ -1613,6 +1651,31 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict)
1199 hmp_handle_error(mon, &error);
1200 }
1201
1202 +void hmp_backup_cancel(Monitor *mon, const QDict *qdict)
1203 +{
1204 + Error *error = NULL;
1205 +
1206 + qmp_backup_cancel(&error);
1207 +
1208 + hmp_handle_error(mon, &error);
1209 +}
1210 +
1211 +void hmp_backup(Monitor *mon, const QDict *qdict)
1212 +{
1213 + Error *error = NULL;
1214 +
1215 + int dir = qdict_get_try_bool(qdict, "directory", 0);
1216 + const char *backup_file = qdict_get_str(qdict, "backupfile");
1217 + const char *devlist = qdict_get_try_str(qdict, "devlist");
1218 + int64_t speed = qdict_get_try_int(qdict, "speed", 0);
1219 +
1220 + qmp_backup(backup_file, true, dir ? BACKUP_FORMAT_DIR : BACKUP_FORMAT_VMA,
1221 + false, NULL, false, NULL, !!devlist,
1222 + devlist, qdict_haskey(qdict, "speed"), speed, &error);
1223 +
1224 + hmp_handle_error(mon, &error);
1225 +}
1226 +
1227 void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict)
1228 {
1229 Error *error = NULL;
1230 diff --git a/hmp.h b/hmp.h
1231 index 0497afbf65..8c1b4846b3 100644
1232 --- a/hmp.h
1233 +++ b/hmp.h
1234 @@ -31,6 +31,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict);
1235 void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
1236 void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
1237 void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict);
1238 +void hmp_info_backup(Monitor *mon, const QDict *qdict);
1239 void hmp_info_cpus(Monitor *mon, const QDict *qdict);
1240 void hmp_info_block(Monitor *mon, const QDict *qdict);
1241 void hmp_info_blockstats(Monitor *mon, const QDict *qdict);
1242 @@ -80,6 +81,8 @@ void hmp_eject(Monitor *mon, const QDict *qdict);
1243 void hmp_change(Monitor *mon, const QDict *qdict);
1244 void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict);
1245 void hmp_block_stream(Monitor *mon, const QDict *qdict);
1246 +void hmp_backup(Monitor *mon, const QDict *qdict);
1247 +void hmp_backup_cancel(Monitor *mon, const QDict *qdict);
1248 void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict);
1249 void hmp_block_job_cancel(Monitor *mon, const QDict *qdict);
1250 void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
1251 diff --git a/qapi-schema.json b/qapi-schema.json
1252 index 5e82933ca1..b20020a054 100644
1253 --- a/qapi-schema.json
1254 +++ b/qapi-schema.json
1255 @@ -571,6 +571,97 @@
1256 { 'command': 'query-events', 'returns': ['EventInfo'] }
1257
1258 ##
1259 +# @BackupStatus:
1260 +#
1261 +# Detailed backup status.
1262 +#
1263 +# @status: string describing the current backup status.
1264 +# This can be 'active', 'done', 'error'. If this field is not
1265 +# returned, no backup process has been initiated
1266 +#
1267 +# @errmsg: error message (only returned if status is 'error')
1268 +#
1269 +# @total: total amount of bytes involved in the backup process
1270 +#
1271 +# @transferred: amount of bytes already backed up.
1272 +#
1273 +# @zero-bytes: amount of 'zero' bytes detected.
1274 +#
1275 +# @start-time: time (epoch) when backup job started.
1276 +#
1277 +# @end-time: time (epoch) when backup job finished.
1278 +#
1279 +# @backup-file: backup file name
1280 +#
1281 +# @uuid: uuid for this backup job
1282 +#
1283 +##
1284 +{ 'struct': 'BackupStatus',
1285 + 'data': {'*status': 'str', '*errmsg': 'str', '*total': 'int',
1286 + '*transferred': 'int', '*zero-bytes': 'int',
1287 + '*start-time': 'int', '*end-time': 'int',
1288 + '*backup-file': 'str', '*uuid': 'str' } }
1289 +
1290 +##
1291 +# @BackupFormat:
1292 +#
1293 +# An enumeration of supported backup formats.
1294 +#
1295 +# @vma: Proxmox vma backup format
1296 +##
1297 +{ 'enum': 'BackupFormat',
1298 + 'data': [ 'vma', 'dir' ] }
1299 +
1300 +##
1301 +# @backup:
1302 +#
1303 +# Starts a VM backup.
1304 +#
1305 +# @backup-file: the backup file name
1306 +#
1307 +# @format: format of the backup file
1308 +#
1309 +# @config-file: a configuration file to include into
1310 +# the backup archive.
1311 +#
1312 +# @speed: the maximum speed, in bytes per second
1313 +#
1314 +# @devlist: list of block device names (separated by ',', ';'
1315 +# or ':'). By default the backup includes all writable block devices.
1316 +#
1317 +# Returns: the uuid of the backup job
1318 +#
1319 +##
1320 +{ 'command': 'backup', 'data': { 'backup-file': 'str',
1321 + '*format': 'BackupFormat',
1322 + '*config-file': 'str',
1323 + '*firewall-file': 'str',
1324 + '*devlist': 'str', '*speed': 'int' },
1325 + 'returns': 'UuidInfo' }
1326 +
1327 +##
1328 +# @query-backup:
1329 +#
1330 +# Returns information about current/last backup task.
1331 +#
1332 +# Returns: @BackupStatus
1333 +#
1334 +##
1335 +{ 'command': 'query-backup', 'returns': 'BackupStatus' }
1336 +
1337 +##
1338 +# @backup-cancel:
1339 +#
1340 +# Cancel the current executing backup process.
1341 +#
1342 +# Returns: nothing on success
1343 +#
1344 +# Notes: This command succeeds even if there is no backup process running.
1345 +#
1346 +##
1347 +{ 'command': 'backup-cancel' }
1348 +
1349 +##
1350 # @MigrationStats:
1351 #
1352 # Detailed migration status.
1353 diff --git a/qapi/block-core.json b/qapi/block-core.json
1354 index 7ce90ec940..b0ffd3de4d 100644
1355 --- a/qapi/block-core.json
1356 +++ b/qapi/block-core.json
1357 @@ -2118,7 +2118,7 @@
1358 'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
1359 'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed',
1360 'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh',
1361 - 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
1362 + 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vma-drive' ] }
1363
1364 ##
1365 # @BlockdevOptionsFile:
1366 @@ -2895,6 +2895,21 @@
1367 'data': { '*offset': 'int', '*size': 'int' } }
1368
1369 ##
1370 +# @BlockdevOptionsVMADrive:
1371 +#
1372 +# Driver specific block device options for VMA Drives
1373 +#
1374 +# @filename: vma-drive path
1375 +#
1376 +# @size: drive size in bytes
1377 +#
1378 +# Since: 2.9
1379 +##
1380 +{ 'struct': 'BlockdevOptionsVMADrive',
1381 + 'data': { 'filename': 'str',
1382 + 'size': 'int' } }
1383 +
1384 +##
1385 # @BlockdevOptions:
1386 #
1387 # Options for creating a block device. Many options are available for all
1388 @@ -2956,7 +2971,8 @@
1389 'vhdx': 'BlockdevOptionsGenericFormat',
1390 'vmdk': 'BlockdevOptionsGenericCOWFormat',
1391 'vpc': 'BlockdevOptionsGenericFormat',
1392 - 'vvfat': 'BlockdevOptionsVVFAT'
1393 + 'vvfat': 'BlockdevOptionsVVFAT',
1394 + 'vma-drive': 'BlockdevOptionsVMADrive'
1395 } }
1396
1397 ##
1398 --
1399 2.11.0
1400