Merge "Just set qcow2 version"

This commit is contained in:
Jenkins 2015-04-16 23:02:26 +00:00 committed by Gerrit Code Review
commit 8dd0818caf
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; "