Default image creation to qcow2 type

It is described in the docs, that nodepool will build image only if it
is referred in one of the clouds, but it is possible to force that
creation: `nodepool image-build fedora-28`.

This leads to inability to define image types and an empty "-t"
argument to DIB; which causes the command invocation to fail.

Default the type value to qcow2.  This matches the default type that
dib will create and keeps with the general principle of nodepool
figuring out what type of image to make for you.

Change-Id: I27f8f45ba62e5ee0cca0ea7cd27893092b726ebd
Story: 2001963
This commit is contained in:
Artem Goncharov 2018-05-05 16:24:36 +02:00 committed by Ian Wienand
parent 9e5df7325b
commit 483e51ed82
1 changed files with 3 additions and 0 deletions

View File

@ -95,6 +95,9 @@ class Config(ConfigValue):
if not isinstance(d.env_vars, dict):
d.env_vars = {}
d.image_types = set(diskimage.get('formats', []))
# Ensure at least qcow2 is set to be passed to qemu-img
if not d.image_types:
d.image_types.add('qcow2')
d.pause = bool(diskimage.get('pause', False))
d.username = diskimage.get('username', 'zuul')
self.diskimages[d.name] = d