From ce84310d2e1f6dd665bdc79c9d83ddd9db8503c6 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 10 Sep 2021 10:24:40 -0700 Subject: [PATCH] Use '.qcow2' not '.img' as the extension for virt-install images They're qcow2 images, so this is more correct, and will make os-autoinst's new backing format autodetection work correctly. We make the `check` function rename existing images, for convenience. NOTE: this requires a matching change to the templates in os-autoinst, and you will want to run the check function to rename all existing images to avoid wasting a ton of time recreating them. Signed-off-by: Adam Williamson --- createhdds.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/createhdds.py b/createhdds.py index 758ea7e..3b1de80 100755 --- a/createhdds.py +++ b/createhdds.py @@ -214,7 +214,7 @@ class VirtInstallImage(object): self.filename = "disk_f{0}_{1}".format(str(release), name) if imgver: self.filename = "{0}_{1}".format(self.filename, imgver) - self.filename = "{0}_{1}.img".format(self.filename, arch) + self.filename = "{0}_{1}.qcow2".format(self.filename, arch) self.release = release self.variant = variant self.arch = arch @@ -614,7 +614,14 @@ def check(hdds, nextrel=None): # Now determine if images are absent or outdated for img in expected: if img.arch in supported_arches() and not os.path.isfile(img.filename): - missing.append(img) + # handle renaming qcow2 images from old ('.img') to new ('.qcow2') + oldfn = img.filename.replace(".qcow2", ".img") + if os.path.isfile(oldfn): + os.rename(olfdn, img.filename) + if img.outdated: + outdated.append(img) + else: + missing.append(img) continue if img.outdated: outdated.append(img)