]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/pve/0027-backup-introduce-vma-archive-format.patch
bump version to 2.9.1-9
[pve-qemu.git] / debian / patches / pve / 0027-backup-introduce-vma-archive-format.patch
CommitLineData
23102ed6 1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
67af0fa4
WB
2From: Wolfgang Bumiller <w.bumiller@proxmox.com>
3Date: Wed, 2 Aug 2017 13:51:02 +0200
23102ed6 4Subject: [PATCH] backup: introduce vma archive format
67af0fa4
WB
5
6---
7 MAINTAINERS | 6 +
8 block/Makefile.objs | 3 +
9 block/vma.c | 424 +++++++++++++++++++++++++++++++++++++++++++
23102ed6 10 blockdev.c | 498 +++++++++++++++++++++++++++++++++++++++++++++++++++
67af0fa4
WB
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 ++-
23102ed6 18 11 files changed, 1180 insertions(+), 2 deletions(-)
67af0fa4
WB
19 create mode 100644 block/vma.c
20
21diff --git a/MAINTAINERS b/MAINTAINERS
ddbcf45e 22index 430efb0ab7..6a7d338aad 100644
67af0fa4
WB
23--- a/MAINTAINERS
24+++ b/MAINTAINERS
ddbcf45e 25@@ -1811,6 +1811,12 @@ L: qemu-block@nongnu.org
67af0fa4
WB
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
38diff --git a/block/Makefile.objs b/block/Makefile.objs
39index 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)
56diff --git a/block/vma.c b/block/vma.c
57new file mode 100644
58index 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);
486diff --git a/blockdev.c b/blockdev.c
23102ed6 487index 9b6cfafd33..534c00f5da 100644
67af0fa4
WB
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"
23102ed6 503@@ -2932,6 +2934,502 @@ out:
67af0fa4
WB
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;
67af0fa4
WB
668+ GList *next = g_list_nth(backup_state.di_list, backup_state.next_job);
669+ while (next) {
670+ PVEBackupDevInfo *di = (PVEBackupDevInfo *)next->data;
671+ backup_state.next_job++;
672+ if (!di->completed && di->bs && di->bs->job) {
673+ BlockJob *job = di->bs->job;
674+ if (cancel) {
675+ block_job_cancel(job);
676+ } else {
677+ block_job_resume(job);
678+ }
679+ return;
680+ }
681+ next = g_list_next(next);
682+ }
683+ pvebackup_cleanup();
684+}
685+
686+UuidInfo *qmp_backup(const char *backup_file, bool has_format,
687+ BackupFormat format,
688+ bool has_config_file, const char *config_file,
689+ bool has_firewall_file, const char *firewall_file,
690+ bool has_devlist, const char *devlist,
691+ bool has_speed, int64_t speed, Error **errp)
692+{
693+ BlockBackend *blk;
694+ BlockDriverState *bs = NULL;
695+ const char *backup_dir = NULL;
696+ Error *local_err = NULL;
697+ QemuUUID uuid;
698+ gchar **devs = NULL;
699+ GList *di_list = NULL;
700+ GList *l;
701+ UuidInfo *uuid_info;
702+ BlockJob *job;
703+
704+ if (backup_state.di_list || backup_state.vmaobj) {
705+ error_set(errp, ERROR_CLASS_GENERIC_ERROR,
706+ "previous backup not finished");
707+ return NULL;
708+ }
709+
710+ /* Todo: try to auto-detect format based on file name */
711+ format = has_format ? format : BACKUP_FORMAT_VMA;
712+
713+ if (has_devlist) {
714+ devs = g_strsplit_set(devlist, ",;:", -1);
715+
716+ gchar **d = devs;
717+ while (d && *d) {
718+ blk = blk_by_name(*d);
719+ if (blk) {
720+ bs = blk_bs(blk);
721+ if (bdrv_is_read_only(bs)) {
722+ error_setg(errp, "Node '%s' is read only", *d);
723+ goto err;
724+ }
725+ if (!bdrv_is_inserted(bs)) {
726+ error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, *d);
727+ goto err;
728+ }
729+ PVEBackupDevInfo *di = g_new0(PVEBackupDevInfo, 1);
730+ di->bs = bs;
731+ di_list = g_list_append(di_list, di);
732+ } else {
733+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
734+ "Device '%s' not found", *d);
735+ goto err;
736+ }
737+ d++;
738+ }
739+
740+ } else {
741+ BdrvNextIterator it;
742+
743+ bs = NULL;
744+ for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
745+ if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
746+ continue;
747+ }
748+
749+ PVEBackupDevInfo *di = g_new0(PVEBackupDevInfo, 1);
750+ di->bs = bs;
751+ di_list = g_list_append(di_list, di);
752+ }
753+ }
754+
755+ if (!di_list) {
756+ error_set(errp, ERROR_CLASS_GENERIC_ERROR, "empty device list");
757+ goto err;
758+ }
759+
760+ size_t total = 0;
761+
762+ l = di_list;
763+ while (l) {
764+ PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
765+ l = g_list_next(l);
766+ if (bdrv_op_is_blocked(di->bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
767+ goto err;
768+ }
769+
770+ ssize_t size = bdrv_getlength(di->bs);
771+ if (size < 0) {
772+ error_setg_errno(errp, -di->size, "bdrv_getlength failed");
773+ goto err;
774+ }
775+ di->size = size;
776+ total += size;
777+ }
778+
779+ qemu_uuid_generate(&uuid);
780+
781+ if (format == BACKUP_FORMAT_VMA) {
782+ char uuidstr[UUID_FMT_LEN+1];
783+ qemu_uuid_unparse(&uuid, uuidstr);
784+ uuidstr[UUID_FMT_LEN] = 0;
785+ backup_state.vmaobj =
786+ object_new_with_props("vma", object_get_objects_root(),
787+ "vma-backup-obj", &local_err,
788+ "filename", backup_file,
789+ "uuid", uuidstr,
790+ NULL);
791+ if (!backup_state.vmaobj) {
792+ if (local_err) {
793+ error_propagate(errp, local_err);
794+ }
795+ goto err;
796+ }
797+
798+ l = di_list;
799+ while (l) {
800+ QDict *options = qdict_new();
801+
802+ PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
803+ l = g_list_next(l);
804+
805+ const char *devname = bdrv_get_device_name(di->bs);
806+ snprintf(di->targetfile, PATH_MAX, "vma-backup-obj/%s.raw", devname);
807+
808+ qdict_put(options, "driver", qstring_from_str("vma-drive"));
809+ qdict_put(options, "size", qint_from_int(di->size));
810+ di->target = bdrv_open(di->targetfile, NULL, options, BDRV_O_RDWR, &local_err);
811+ if (!di->target) {
812+ error_propagate(errp, local_err);
813+ goto err;
814+ }
815+ }
816+ } else if (format == BACKUP_FORMAT_DIR) {
817+ if (mkdir(backup_file, 0640) != 0) {
818+ error_setg_errno(errp, errno, "can't create directory '%s'\n",
819+ backup_file);
820+ goto err;
821+ }
822+ backup_dir = backup_file;
823+
824+ l = di_list;
825+ while (l) {
826+ PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
827+ l = g_list_next(l);
828+
829+ const char *devname = bdrv_get_device_name(di->bs);
830+ snprintf(di->targetfile, PATH_MAX, "%s/%s.raw", backup_dir, devname);
831+
832+ int flags = BDRV_O_RDWR;
833+ bdrv_img_create(di->targetfile, "raw", NULL, NULL, NULL,
834+ di->size, flags, &local_err, false);
835+ if (local_err) {
836+ error_propagate(errp, local_err);
837+ goto err;
838+ }
839+
840+ di->target = bdrv_open(di->targetfile, NULL, NULL, flags, &local_err);
841+ if (!di->target) {
842+ error_propagate(errp, local_err);
843+ goto err;
844+ }
845+ }
846+ } else {
847+ error_set(errp, ERROR_CLASS_GENERIC_ERROR, "unknown backup format");
848+ goto err;
849+ }
850+
851+ /* add configuration file to archive */
852+ if (has_config_file) {
853+ if(config_to_vma(config_file, format, backup_state.vmaobj, backup_dir, errp) != 0) {
854+ goto err;
855+ }
856+ }
857+
858+ /* add firewall file to archive */
859+ if (has_firewall_file) {
860+ if(config_to_vma(firewall_file, format, backup_state.vmaobj, backup_dir, errp) != 0) {
861+ goto err;
862+ }
863+ }
864+ /* initialize global backup_state now */
865+
866+ backup_state.cancel = false;
867+
868+ if (backup_state.error) {
869+ error_free(backup_state.error);
870+ backup_state.error = NULL;
871+ }
872+
873+ backup_state.speed = (has_speed && speed > 0) ? speed : 0;
874+
875+ backup_state.start_time = time(NULL);
876+ backup_state.end_time = 0;
877+
878+ if (backup_state.backup_file) {
879+ g_free(backup_state.backup_file);
880+ }
881+ backup_state.backup_file = g_strdup(backup_file);
882+
883+ memcpy(&backup_state.uuid, &uuid, sizeof(uuid));
884+ qemu_uuid_unparse(&uuid, backup_state.uuid_str);
885+
886+ backup_state.di_list = di_list;
887+ backup_state.next_job = 0;
888+
889+ backup_state.total = total;
890+ backup_state.transferred = 0;
891+ backup_state.zero_bytes = 0;
892+
893+ /* start all jobs (paused state) */
894+ l = di_list;
895+ while (l) {
896+ PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
897+ l = g_list_next(l);
898+
899+ job = backup_job_create(NULL, di->bs, di->target, speed, MIRROR_SYNC_MODE_FULL, NULL,
900+ false, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT,
901+ BLOCK_JOB_DEFAULT,
902+ pvebackup_complete_cb, di, 2, NULL, &local_err);
903+ if (di->target) {
904+ bdrv_unref(di->target);
905+ di->target = NULL;
906+ }
907+ if (!job || local_err != NULL) {
908+ error_setg(&backup_state.error, "backup_job_create failed");
909+ pvebackup_cancel(NULL);
910+ } else {
911+ block_job_start(job);
912+ }
913+ }
914+
915+ if (!backup_state.error) {
916+ pvebackup_run_next_job(); // run one job
917+ }
918+
919+ uuid_info = g_malloc0(sizeof(*uuid_info));
920+ uuid_info->UUID = g_strdup(backup_state.uuid_str);
921+
922+ return uuid_info;
923+
924+err:
925+
926+ l = di_list;
927+ while (l) {
928+ PVEBackupDevInfo *di = (PVEBackupDevInfo *)l->data;
929+ l = g_list_next(l);
930+
931+ if (di->target) {
932+ bdrv_unref(di->target);
933+ }
934+
935+ if (di->targetfile[0]) {
936+ unlink(di->targetfile);
937+ }
938+ g_free(di);
939+ }
940+ g_list_free(di_list);
941+
942+ if (devs) {
943+ g_strfreev(devs);
944+ }
945+
946+ if (backup_state.vmaobj) {
947+ object_unparent(backup_state.vmaobj);
948+ backup_state.vmaobj = NULL;
949+ }
950+
951+ if (backup_dir) {
952+ rmdir(backup_dir);
953+ }
954+
955+ return NULL;
956+}
957+
958+BackupStatus *qmp_query_backup(Error **errp)
959+{
960+ BackupStatus *info = g_malloc0(sizeof(*info));
961+
962+ if (!backup_state.start_time) {
963+ /* not started, return {} */
964+ return info;
965+ }
966+
967+ info->has_status = true;
968+ info->has_start_time = true;
969+ info->start_time = backup_state.start_time;
970+
971+ if (backup_state.backup_file) {
972+ info->has_backup_file = true;
973+ info->backup_file = g_strdup(backup_state.backup_file);
974+ }
975+
976+ info->has_uuid = true;
977+ info->uuid = g_strdup(backup_state.uuid_str);
978+
979+ if (backup_state.end_time) {
980+ if (backup_state.error) {
981+ info->status = g_strdup("error");
982+ info->has_errmsg = true;
983+ info->errmsg = g_strdup(error_get_pretty(backup_state.error));
984+ } else {
985+ info->status = g_strdup("done");
986+ }
987+ info->has_end_time = true;
988+ info->end_time = backup_state.end_time;
989+ } else {
990+ info->status = g_strdup("active");
991+ }
992+
993+ info->has_total = true;
994+ info->total = backup_state.total;
995+ info->has_zero_bytes = true;
996+ info->zero_bytes = backup_state.zero_bytes;
997+ info->has_transferred = true;
998+ info->transferred = backup_state.transferred;
999+
1000+ return info;
1001+}
1002+
1003 void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
1004 bool has_base, const char *base,
1005 bool has_base_node, const char *base_node,
1006diff --git a/configure b/configure
1007index be4d326ae0..841f7a8fae 100755
1008--- a/configure
1009+++ b/configure
1010@@ -320,6 +320,7 @@ numa=""
1011 tcmalloc="no"
1012 jemalloc="no"
1013 replication="yes"
1014+vma=""
1015
1016 supported_cpu="no"
1017 supported_os="no"
1018@@ -1183,6 +1184,10 @@ for opt do
1019 ;;
1020 --enable-replication) replication="yes"
1021 ;;
1022+ --disable-vma) vma="no"
1023+ ;;
1024+ --enable-vma) vma="yes"
1025+ ;;
1026 *)
1027 echo "ERROR: unknown option $opt"
1028 echo "Try '$0 --help' for more information"
1029@@ -1427,6 +1432,7 @@ disabled with --disable-FEATURE, default is enabled if available:
1030 xfsctl xfsctl support
1031 qom-cast-debug cast debugging support
1032 tools build qemu-io, qemu-nbd and qemu-image tools
1033+ vma VMA archive backend
1034
1035 NOTE: The object files are built at the place where configure is launched
1036 EOF
1037@@ -3705,6 +3711,23 @@ EOF
1038 fi
1039
1040 ##########################################
1041+# vma probe
1042+if test "$vma" != "no" ; then
1043+ if $pkg_config --exact-version=0.1.0 vma; then
1044+ vma="yes"
1045+ vma_cflags=$($pkg_config --cflags vma)
1046+ vma_libs=$($pkg_config --libs vma)
1047+ else
1048+ if test "$vma" = "yes" ; then
1049+ feature_not_found "VMA Archive backend support" \
1050+ "Install libvma devel"
1051+ fi
1052+ vma="no"
1053+ fi
1054+fi
1055+
1056+
1057+##########################################
1058 # signalfd probe
1059 signalfd="no"
1060 cat > $TMPC << EOF
1061@@ -5146,6 +5169,7 @@ echo "tcmalloc support $tcmalloc"
1062 echo "jemalloc support $jemalloc"
1063 echo "avx2 optimization $avx2_opt"
1064 echo "replication support $replication"
1065+echo "VMA support $vma"
1066
1067 if test "$sdl_too_old" = "yes"; then
1068 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1069@@ -5703,6 +5727,12 @@ if test "$libssh2" = "yes" ; then
1070 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
1071 fi
1072
1073+if test "$vma" = "yes" ; then
1074+ echo "CONFIG_VMA=y" >> $config_host_mak
1075+ echo "VMA_CFLAGS=$vma_cflags" >> $config_host_mak
1076+ echo "VMA_LIBS=$vma_libs" >> $config_host_mak
1077+fi
1078+
1079 # USB host support
1080 if test "$libusb" = "yes"; then
1081 echo "HOST_USB=libusb legacy" >> $config_host_mak
1082diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
1083index 5fc57a2210..3b5a0f95e4 100644
1084--- a/hmp-commands-info.hx
1085+++ b/hmp-commands-info.hx
1086@@ -487,6 +487,19 @@ STEXI
1087 Show CPU statistics.
1088 ETEXI
1089
1090+ {
1091+ .name = "backup",
1092+ .args_type = "",
1093+ .params = "",
1094+ .help = "show backup status",
1095+ .cmd = hmp_info_backup,
1096+ },
1097+
1098+STEXI
1099+@item info backup
1100+show backup status
1101+ETEXI
1102+
1103 #if defined(CONFIG_SLIRP)
1104 {
1105 .name = "usernet",
1106diff --git a/hmp-commands.hx b/hmp-commands.hx
1107index 58940a762b..a2867b56f2 100644
1108--- a/hmp-commands.hx
1109+++ b/hmp-commands.hx
1110@@ -87,6 +87,37 @@ STEXI
1111 Copy data from a backing file into a block device.
1112 ETEXI
1113
1114+ {
1115+ .name = "backup",
1116+ .args_type = "directory:-d,backupfile:s,speed:o?,devlist:s?",
1117+ .params = "[-d] backupfile [speed [devlist]]",
1118+ .help = "create a VM Backup."
1119+ "\n\t\t\t Use -d to dump data into a directory instead"
1120+ "\n\t\t\t of using VMA format.",
1121+ .cmd = hmp_backup,
1122+ },
1123+
1124+STEXI
1125+@item backup
1126+@findex backup
1127+Create a VM backup.
1128+ETEXI
1129+
1130+ {
1131+ .name = "backup_cancel",
1132+ .args_type = "",
1133+ .params = "",
1134+ .help = "cancel the current VM backup",
1135+ .cmd = hmp_backup_cancel,
1136+ },
1137+
1138+STEXI
1139+@item backup_cancel
1140+@findex backup_cancel
1141+Cancel the current VM backup.
1142+
1143+ETEXI
1144+
1145 {
1146 .name = "block_job_set_speed",
1147 .args_type = "device:B,speed:o",
1148diff --git a/hmp.c b/hmp.c
1149index f725d061e6..12f1f46125 100644
1150--- a/hmp.c
1151+++ b/hmp.c
1152@@ -151,6 +151,44 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
1153 qapi_free_MouseInfoList(mice_list);
1154 }
1155
1156+void hmp_info_backup(Monitor *mon, const QDict *qdict)
1157+{
1158+ BackupStatus *info;
1159+
1160+ info = qmp_query_backup(NULL);
1161+ if (info->has_status) {
1162+ if (info->has_errmsg) {
1163+ monitor_printf(mon, "Backup status: %s - %s\n",
1164+ info->status, info->errmsg);
1165+ } else {
1166+ monitor_printf(mon, "Backup status: %s\n", info->status);
1167+ }
1168+ }
1169+
1170+ if (info->has_backup_file) {
1171+ monitor_printf(mon, "Start time: %s", ctime(&info->start_time));
1172+ if (info->end_time) {
1173+ monitor_printf(mon, "End time: %s", ctime(&info->end_time));
1174+ }
1175+
1176+ int per = (info->has_total && info->total &&
1177+ info->has_transferred && info->transferred) ?
1178+ (info->transferred * 100)/info->total : 0;
1179+ int zero_per = (info->has_total && info->total &&
1180+ info->has_zero_bytes && info->zero_bytes) ?
1181+ (info->zero_bytes * 100)/info->total : 0;
1182+ monitor_printf(mon, "Backup file: %s\n", info->backup_file);
1183+ monitor_printf(mon, "Backup uuid: %s\n", info->uuid);
1184+ monitor_printf(mon, "Total size: %zd\n", info->total);
1185+ monitor_printf(mon, "Transferred bytes: %zd (%d%%)\n",
1186+ info->transferred, per);
1187+ monitor_printf(mon, "Zero bytes: %zd (%d%%)\n",
1188+ info->zero_bytes, zero_per);
1189+ }
1190+
1191+ qapi_free_BackupStatus(info);
1192+}
1193+
1194 void hmp_info_migrate(Monitor *mon, const QDict *qdict)
1195 {
1196 MigrationInfo *info;
1197@@ -1613,6 +1651,31 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict)
1198 hmp_handle_error(mon, &error);
1199 }
1200
1201+void hmp_backup_cancel(Monitor *mon, const QDict *qdict)
1202+{
1203+ Error *error = NULL;
1204+
1205+ qmp_backup_cancel(&error);
1206+
1207+ hmp_handle_error(mon, &error);
1208+}
1209+
1210+void hmp_backup(Monitor *mon, const QDict *qdict)
1211+{
1212+ Error *error = NULL;
1213+
1214+ int dir = qdict_get_try_bool(qdict, "directory", 0);
1215+ const char *backup_file = qdict_get_str(qdict, "backupfile");
1216+ const char *devlist = qdict_get_try_str(qdict, "devlist");
1217+ int64_t speed = qdict_get_try_int(qdict, "speed", 0);
1218+
1219+ qmp_backup(backup_file, true, dir ? BACKUP_FORMAT_DIR : BACKUP_FORMAT_VMA,
1220+ false, NULL, false, NULL, !!devlist,
1221+ devlist, qdict_haskey(qdict, "speed"), speed, &error);
1222+
1223+ hmp_handle_error(mon, &error);
1224+}
1225+
1226 void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict)
1227 {
1228 Error *error = NULL;
1229diff --git a/hmp.h b/hmp.h
1230index 0497afbf65..8c1b4846b3 100644
1231--- a/hmp.h
1232+++ b/hmp.h
1233@@ -31,6 +31,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict);
1234 void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
1235 void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict);
1236 void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict);
1237+void hmp_info_backup(Monitor *mon, const QDict *qdict);
1238 void hmp_info_cpus(Monitor *mon, const QDict *qdict);
1239 void hmp_info_block(Monitor *mon, const QDict *qdict);
1240 void hmp_info_blockstats(Monitor *mon, const QDict *qdict);
1241@@ -80,6 +81,8 @@ void hmp_eject(Monitor *mon, const QDict *qdict);
1242 void hmp_change(Monitor *mon, const QDict *qdict);
1243 void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict);
1244 void hmp_block_stream(Monitor *mon, const QDict *qdict);
1245+void hmp_backup(Monitor *mon, const QDict *qdict);
1246+void hmp_backup_cancel(Monitor *mon, const QDict *qdict);
1247 void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict);
1248 void hmp_block_job_cancel(Monitor *mon, const QDict *qdict);
1249 void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
1250diff --git a/qapi-schema.json b/qapi-schema.json
1251index 5e82933ca1..b20020a054 100644
1252--- a/qapi-schema.json
1253+++ b/qapi-schema.json
1254@@ -571,6 +571,97 @@
1255 { 'command': 'query-events', 'returns': ['EventInfo'] }
1256
1257 ##
1258+# @BackupStatus:
1259+#
1260+# Detailed backup status.
1261+#
1262+# @status: string describing the current backup status.
1263+# This can be 'active', 'done', 'error'. If this field is not
1264+# returned, no backup process has been initiated
1265+#
1266+# @errmsg: error message (only returned if status is 'error')
1267+#
1268+# @total: total amount of bytes involved in the backup process
1269+#
1270+# @transferred: amount of bytes already backed up.
1271+#
1272+# @zero-bytes: amount of 'zero' bytes detected.
1273+#
1274+# @start-time: time (epoch) when backup job started.
1275+#
1276+# @end-time: time (epoch) when backup job finished.
1277+#
1278+# @backup-file: backup file name
1279+#
1280+# @uuid: uuid for this backup job
1281+#
1282+##
1283+{ 'struct': 'BackupStatus',
1284+ 'data': {'*status': 'str', '*errmsg': 'str', '*total': 'int',
1285+ '*transferred': 'int', '*zero-bytes': 'int',
1286+ '*start-time': 'int', '*end-time': 'int',
1287+ '*backup-file': 'str', '*uuid': 'str' } }
1288+
1289+##
1290+# @BackupFormat:
1291+#
1292+# An enumeration of supported backup formats.
1293+#
1294+# @vma: Proxmox vma backup format
1295+##
1296+{ 'enum': 'BackupFormat',
1297+ 'data': [ 'vma', 'dir' ] }
1298+
1299+##
1300+# @backup:
1301+#
1302+# Starts a VM backup.
1303+#
1304+# @backup-file: the backup file name
1305+#
1306+# @format: format of the backup file
1307+#
1308+# @config-file: a configuration file to include into
1309+# the backup archive.
1310+#
1311+# @speed: the maximum speed, in bytes per second
1312+#
1313+# @devlist: list of block device names (separated by ',', ';'
1314+# or ':'). By default the backup includes all writable block devices.
1315+#
1316+# Returns: the uuid of the backup job
1317+#
1318+##
1319+{ 'command': 'backup', 'data': { 'backup-file': 'str',
1320+ '*format': 'BackupFormat',
1321+ '*config-file': 'str',
1322+ '*firewall-file': 'str',
1323+ '*devlist': 'str', '*speed': 'int' },
1324+ 'returns': 'UuidInfo' }
1325+
1326+##
1327+# @query-backup:
1328+#
1329+# Returns information about current/last backup task.
1330+#
1331+# Returns: @BackupStatus
1332+#
1333+##
1334+{ 'command': 'query-backup', 'returns': 'BackupStatus' }
1335+
1336+##
1337+# @backup-cancel:
1338+#
1339+# Cancel the current executing backup process.
1340+#
1341+# Returns: nothing on success
1342+#
1343+# Notes: This command succeeds even if there is no backup process running.
1344+#
1345+##
1346+{ 'command': 'backup-cancel' }
1347+
1348+##
1349 # @MigrationStats:
1350 #
1351 # Detailed migration status.
1352diff --git a/qapi/block-core.json b/qapi/block-core.json
ddbcf45e 1353index 7ce90ec940..b0ffd3de4d 100644
67af0fa4
WB
1354--- a/qapi/block-core.json
1355+++ b/qapi/block-core.json
ddbcf45e 1356@@ -2118,7 +2118,7 @@
67af0fa4
WB
1357 'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',
1358 'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed',
1359 'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh',
1360- 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
1361+ 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vma-drive' ] }
1362
1363 ##
1364 # @BlockdevOptionsFile:
ddbcf45e 1365@@ -2895,6 +2895,21 @@
67af0fa4
WB
1366 'data': { '*offset': 'int', '*size': 'int' } }
1367
1368 ##
1369+# @BlockdevOptionsVMADrive:
1370+#
1371+# Driver specific block device options for VMA Drives
1372+#
1373+# @filename: vma-drive path
1374+#
1375+# @size: drive size in bytes
1376+#
1377+# Since: 2.9
1378+##
1379+{ 'struct': 'BlockdevOptionsVMADrive',
1380+ 'data': { 'filename': 'str',
1381+ 'size': 'int' } }
1382+
1383+##
1384 # @BlockdevOptions:
1385 #
1386 # Options for creating a block device. Many options are available for all
ddbcf45e 1387@@ -2956,7 +2971,8 @@
67af0fa4
WB
1388 'vhdx': 'BlockdevOptionsGenericFormat',
1389 'vmdk': 'BlockdevOptionsGenericCOWFormat',
1390 'vpc': 'BlockdevOptionsGenericFormat',
1391- 'vvfat': 'BlockdevOptionsVVFAT'
1392+ 'vvfat': 'BlockdevOptionsVVFAT',
1393+ 'vma-drive': 'BlockdevOptionsVMADrive'
1394 } }
1395
1396 ##
1397--
13982.11.0
1399