Just set qcow2 version

Simplify the diskimage-builder config options in the nodepool config by
removing qemu-img-options from nodepool's configuration. Instead we
hardcode a qcow2 version compat setting of 0.10. This is necessary for
HPCloud and possibly other clouds, and keeps things simple in nodepool.

Change-Id: Icbbb92e22e5cab1332c17291392162d3d86de6b5
This commit is contained in:
Clark Boylan 2015-03-31 08:38:50 -07:00 committed by Monty Taylor
parent 86610b50b5
commit caf01c43c2
2 changed files with 12 additions and 13 deletions

View File

@ -170,7 +170,6 @@ will be built using the provider snapshot approach::
- puppet
- node-devstack
release: precise
qemu-img-options: compat=0.10
env-vars:
DIB_DISTRIBUTION_MIRROR: http://archive.ubuntu.com
DIB_IMAGE_CACHE: /opt/dib_cache
@ -179,12 +178,9 @@ For diskimages, the `name` is required. The `elements` section
enumerates all the elements that will be included when building the
image, and will point to the `elements-dir` path referenced in the
same config file. `release` specifies the distro to be used as a base
image to build the image using diskimage-builder. `qemu-img-options`
allows to specify custom settings that qemu will be using to build the
final image. Settings there have to be separated by commas, and must
follow qemu syntax. `env-vars` is an optional dictionary of arbitrary
environment variables that will be available in the spawned
diskimage-builder child process.
image to build the image using diskimage-builder. `env-vars` is an
optional dictionary of arbitrary environment variables that will be
available in the spawned diskimage-builder child process.
providers
---------

View File

@ -54,6 +54,10 @@ IMAGE_CLEANUP = 8 * HOURS # When to start deleting an image that is not
DELETE_DELAY = 1 * MINS # Delay before deleting a node that has completed
# its job.
# HP Cloud requires qemu compat with 0.10. That version works elsewhere,
# so just hardcode it for all qcow2 building
DEFAULT_QEMU_IMAGE_COMPAT_OPTIONS = "--qemu-img-options 'compat=0.10'"
class LaunchNodepoolException(Exception):
statsd_key = 'error.nodepool'
@ -763,20 +767,20 @@ class DiskImageBuilder(threading.Thread):
for k, v in image.env_vars.items():
env[k] = v
extra_options = ''
if image.qemu_img_options:
extra_options = ('--qemu-img-options %s' %
image.qemu_img_options)
img_elements = image.elements
img_types = ",".join(image.image_types)
qemu_img_options = ''
if 'qcow2' in img_types:
qemu_img_options = DEFAULT_QEMU_IMAGE_COMPAT_OPTIONS
if 'fake-' in filename:
dib_cmd = 'nodepool/tests/fake-image-create'
else:
dib_cmd = 'disk-image-create'
cmd = ('%s -x -t %s --no-tmpfs %s -o %s %s' %
(dib_cmd, img_types, extra_options, filename, img_elements))
(dib_cmd, img_types, qemu_img_options, filename, img_elements))
log = logging.getLogger("nodepool.image.build.%s" %
(image_name,))
@ -1308,7 +1312,6 @@ class NodePool(threading.Thread):
# d-i-b, but might be untyped in the yaml and
# interpreted as a number (e.g. "21" for fedora)
d.release = str(diskimage.get('release', ''))
d.qemu_img_options = diskimage.get('qemu-img-options', '')
d.env_vars = diskimage.get('env-vars', {})
if not isinstance(d.env_vars, dict):
self.log.error("%s: ignoring env-vars; "