[pve-devel] [PATCH v2 qemu] fix #1534: vma: Add extract filter for disk images

Fiona Ebner f.ebner at proxmox.com
Wed Aug 9 13:06:43 CEST 2023


Am 08.08.23 um 14:00 schrieb Filip Schauer:
> @@ -1772,7 +1772,7 @@ index 0000000000..304f02bc84
>  +        "vma list <filename>\n"
>  +        "vma config <filename> [-c config]\n"
>  +        "vma create <filename> [-c config] pathname ...\n"
> -+        "vma extract <filename> [-r <fifo>] <targetdir>\n"
> ++        "vma extract <filename> [-f <filter>] [-r <fifo>] <targetdir>\n"

Not sure about calling it "filter" now, I feel like "drive-list" or
similar would be more obvious to a user, except...

>  +        "vma verify <filename> [-v]\n"
>  +        ;
>  +

(...)

> ++
> ++                    if (strncmp(token, di->devname, comma - token) == 0) {

...you actually make it a list of prefixes that should match, not a list
of drive names by using "comma - token" ;) E.g. -f "drive" will match
all those that start with "drive" and the empty one will match all.

> ++                        skip = true;

This is the wrong way around: skip should be true iff none of the given
file names match.

> ++                        filter_bitmap[i] = true;

This is fine, it should indicate what is included.

You only set the filter bitmap if a filter option is given...

(...)

> @@ -2190,7 +2216,7 @@ index 0000000000..304f02bc84
>  +    if (!readmap) {
>  +        for (i = 1; i < 255; i++) {
>  +            VmaDeviceInfo *di = vma_reader_get_device_info(vmar, i);
> -+            if (di && (i != vmstate_stream)) {
> ++            if (di && filter_bitmap[i]) {

...so the renaming will not happen anymore when extracting everything,
without a filter.

Maybe it's better called rename_bitmap or rename_required, because that
is the only use.

>  +                char *tmpfn = g_strdup_printf("%s/tmp-disk-%s.raw",
>  +                                              dirname, di->devname);
>  +                char *fn = g_strdup_printf("%s/disk-%s.raw",





More information about the pve-devel mailing list