Add "real" Vagrant format options to image building.
We originally added Vagrant support by tweaking options sent to the existing RHEV-M and vSphere OVA generation code. This was a bit of a hack and resulted in confusing filenames. This adds "vagrant-libvirt" and "vagrant-virtualbox" image types, passes in the correct options to Image Factory and produces output files with the conventional ".box" extension and more descriptive and less confusing vagrant name suffixes.
This commit is contained in:
parent
a80ab75b32
commit
52a01883d6
3 changed files with 21 additions and 2 deletions
|
|
@ -3051,7 +3051,7 @@ class BaseImageTask(OzImageTask):
|
|||
Some image formats require others to be processed first, which is why
|
||||
we have to do this. raw files in particular may not be kept.
|
||||
"""
|
||||
supported = ('raw', 'raw-xz', 'vmdk', 'qcow', 'qcow2', 'vdi', 'rhevm-ova', 'vsphere-ova', 'docker')
|
||||
supported = ('raw', 'raw-xz', 'vmdk', 'qcow', 'qcow2', 'vdi', 'rhevm-ova', 'vsphere-ova', 'docker', 'vagrant-virtualbox', 'vagrant-libvirt')
|
||||
for f in formats:
|
||||
if f not in supported:
|
||||
raise koji.ApplianceError('Invalid format: %s' % f)
|
||||
|
|
@ -3083,6 +3083,8 @@ class BaseImageTask(OzImageTask):
|
|||
'qcow2': self._buildConvert,
|
||||
'rhevm-ova': self._buildOVA,
|
||||
'vsphere-ova': self._buildOVA,
|
||||
'vagrant-virtualbox': self._buildOVA,
|
||||
'vagrant-libvirt': self._buildOVA,
|
||||
'docker': self._buildDocker
|
||||
}
|
||||
# add a handler to the logger so that we capture ImageFactory's logging
|
||||
|
|
@ -3221,6 +3223,17 @@ class BaseImageTask(OzImageTask):
|
|||
img_opts = {}
|
||||
if self.opts.get('ova_option'):
|
||||
img_opts = dict([o.split('=') for o in self.opts.get('ova_option')])
|
||||
# As far as Image Factory is concerned, vagrant boxes are just another type of OVA
|
||||
# We communicate the desire for vagrant-specific formatting by adding the *_ova_format
|
||||
# options and turning the underlying format option back into one of the two target
|
||||
# image types ('vsphere-ova' or 'rhevm-ova') that are used to generate the intermediate
|
||||
# disk image
|
||||
if format == 'vagrant-virtualbox':
|
||||
format = 'vsphere-ova'
|
||||
img_opts['vsphere_ova_format'] = 'vagrant-virtualbox'
|
||||
if format == 'vagrant-libvirt':
|
||||
format = 'rhevm-ova'
|
||||
img_opts['rhevm_ova_format'] = 'vagrant-libvirt'
|
||||
targ = self._do_target_image(self.base_img.base_image.identifier,
|
||||
format.replace('-ova', ''))
|
||||
targ2 = self._do_target_image(targ.target_image.identifier, 'OVA',
|
||||
|
|
@ -3381,6 +3394,11 @@ class BaseImageTask(OzImageTask):
|
|||
newimg = images[format]['image']
|
||||
if 'ova' in format or format == 'raw-xz':
|
||||
newname = self.imgname + '.' + format.replace('-', '.')
|
||||
elif 'vagrant' in format:
|
||||
# This embeds the vagrant target and the ".box" format in the name
|
||||
# Previously, based on filename, these looked like OVAs
|
||||
# This was confusing to many people
|
||||
newname = self.imgname + '.' + format + '.box'
|
||||
elif format == 'docker':
|
||||
newname = self.imgname + '.' + 'tar.xz'
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue