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 <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2021-09-10 10:24:40 -07:00
parent 90c23bff6e
commit ce84310d2e

View File

@ -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)