iotests: Make _filter_img_create more active
commit57ee95ed4ee7b4c039ec5f0705c45734c56706bc
authorMax Reitz <mreitz@redhat.com>
Thu, 25 Jun 2020 12:55:30 +0000 (25 14:55 +0200)
committerMax Reitz <mreitz@redhat.com>
Mon, 6 Jul 2020 06:33:06 +0000 (6 08:33 +0200)
tree21d7b6f879308ff47a5a15f5f6c1d405252a9a5a
parenta5675f390116a927e320984f02f473a6affc9fcd
iotests: Make _filter_img_create more active

Right now, _filter_img_create just filters out everything that looks
format-dependent, and applies some filename filters.  That means that we
have to add another filter line every time some format gets a new
creation option.  This can be avoided by instead discarding everything
and just keeping what we know is format-independent (format, size,
backing file, encryption information[1], preallocation) or just
interesting to have in the reference output (external data file path).

Furthermore, we probably want to sort these options.  Format drivers are
not required to define them in any specific order, so the output is
effectively random (although this has never bothered us until now).  We
need a specific order for our reference outputs, though.  Unfortunately,
just using a plain "sort" would change a lot of existing reference
outputs, so we have to pre-filter the option keys to keep our existing
order (fmt, size, backing*, data, encryption info, preallocation).

Finally, this makes it difficult for _filter_img_create to automagically
work for QMP output.  Thus, this patch adds a separate
_filter_img_create_for_qmp function that echos every line verbatim that
does not start with "Formatting", and pipes those "Formatting" lines to
_filter_img_create.

[1] Actually, the only thing that is really important is whether
    encryption is enabled or not.  A patch by Maxim thus removes all
    other "encrypt.*" options from the output:
    https://lists.nongnu.org/archive/html/qemu-block/2020-06/msg00339.html
    But that patch needs to come later so we can get away with changing
    as few reference outputs in this patch here as possible.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200625125548.870061-2-mreitz@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
tests/qemu-iotests/112.out
tests/qemu-iotests/141
tests/qemu-iotests/153
tests/qemu-iotests/common.filter