image-info: show format version for qcow2

Change the "image-format" from a string to a dict, with a "type":
$value entry, where $value contains the previous plain string
data.
Additionally, include the qcow2 format version, if the given
image is indeed a qcow2.
Adapt all manifest test accordingly (partly done by Ondřej)

Python 3 script used for conversion of manifest tests:
import os
import json

for name in os.listdir(os.getcwd()):
    if not name.endswith(".json"):
        continue
    print(name)
    with open(name, "r") as old:
        data = json.load(old)
        info = data.get("image-info", {})
        format = info.get("image-format")
        if not format:
            continue
        info["image-format"] = {
            "type": format
        }
        if format != "qcow2":
            continue
        info["image-format"]["compat"] = "1.1"
        with open(name + ".new", "w") as new:
            json.dump(data, new, indent=2)
            new.write("\n")
            new.flush()
    os.rename(name+".new", name)

test: use the new image-info format in all test manifests

The previous commit converted only qcow2 and openstack manifests but this change
is actually needed for all manifests produced by the qemu assembler.

Co-Developed-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Christian Kellner 2021-04-07 17:35:25 +00:00 committed by Ondřej Budai
parent 41fdfbd168
commit 5937b9adca
49 changed files with 179 additions and 50 deletions

View file

@ -9141,7 +9141,10 @@
"video:x:39:",
"wheel:x:10:"
],
"image-format": "qcow2",
"image-format": {
"type": "qcow2",
"compat": "1.1"
},
"os-release": {
"ANSI_COLOR": "0;31",
"BUG_REPORT_URL": "https://bugzilla.redhat.com/",