tools/image-info: don't convert raw images

After change to image-info [1], which shows the format version for qcow2
images, the `image-format` changed from string to a dictionary. However
the `open_image()` function still compares it with string. This causes
`raw` images to be converted by the script again to `raw` format. This
change fixes the issue, so that `raw` images are not converted, but used
as they are.

[1] 5937b9adca

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2021-04-20 18:14:27 +02:00 committed by Tomas Hozza
parent 140ae9f75d
commit f570cf51b7

View file

@ -64,7 +64,7 @@ def loop_open(ctl, image, *, offset=None, size=None):
@contextlib.contextmanager
def open_image(ctl, image, fmt):
with tempfile.TemporaryDirectory(dir="/var/tmp") as tmp:
if fmt != "raw":
if fmt["type"] != "raw":
target = os.path.join(tmp, "image.raw")
# A bug exists in qemu that causes the conversion to raw to fail
# on aarch64 systems with a LOT of CPUs. A workaround is to use