| |
@@ -3066,7 +3066,7 @@
|
| |
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', 'vagrant-virtualbox', 'vagrant-libvirt', 'vagrant-vmware-fusion', 'vpc')
|
| |
+ supported = ('raw', 'raw-xz', 'liveimg-squashfs', 'vmdk', 'qcow', 'qcow2', 'vdi', 'rhevm-ova', 'vsphere-ova', 'docker', 'vagrant-virtualbox', 'vagrant-libvirt', 'vagrant-vmware-fusion', 'vpc')
|
| |
for f in formats:
|
| |
if f not in supported:
|
| |
raise koji.ApplianceError('Invalid format: %s' % f)
|
| |
@@ -3092,6 +3092,7 @@
|
| |
"""
|
| |
fcalls = {'raw': self._buildBase,
|
| |
'raw-xz': self._buildXZ,
|
| |
+ 'liveimg-squashfs': self._buildSquashfs,
|
| |
'vmdk': self._buildConvert,
|
| |
'vdi': self._buildConvert,
|
| |
'qcow': self._buildConvert,
|
| |
@@ -3249,6 +3250,37 @@
|
| |
logerror=1)
|
| |
return {'image': newimg}
|
| |
|
| |
+ def _buildSquashfs(self, format):
|
| |
+ """
|
| |
+ Use squashfs to wrap a raw disk image into liveimg compatible image.
|
| |
+ This can be used by dracut for booting or anaconda to install.
|
| |
+
|
| |
+ @args:
|
| |
+ format - a string representing the image format, "liveimg-squashfs"
|
| |
+ @returns:
|
| |
+ a dict with some metadata about the image
|
| |
+ """
|
| |
+ newimg = os.path.join(self.workdir, self.imgname + '.squashfs')
|
| |
+ fsimg = os.path.join(self.workdir, 'squashfs-root/LiveOS/rootfs.img')
|
| |
+
|
| |
+ os.makedirs(os.path.join(self.workdir, 'squashfs-root/LiveOS'))
|
| |
+
|
| |
+ cmd = ['/bin/dd', 'conv=sparse', 'bs=1M',
|
| |
+ 'skip=1', # FIXME Hack to strip the disklabel
|
| |
+ 'if=%s' % self.base_img.base_image.data,
|
| |
+ 'of=%s' % fsimg]
|
| |
+ conlog = os.path.join(self.workdir,
|
| |
+ 'squashfs-dd-%s-%s.log' % (format, self.arch))
|
| |
+ log_output(self.session, cmd[0], cmd, conlog, self.getUploadDir(),
|
| |
+ logerror=1)
|
| |
+ cmd = ['/usr/sbin/mksquashfs', os.path.join(self.workdir, 'squashfs-root'),
|
| |
+ newimg, '-comp', 'xz', '-noappend']
|
| |
+ conlog = os.path.join(self.workdir,
|
| |
+ 'squashfs-mksquashfs-%s-%s.log' % (format, self.arch))
|
| |
+ log_output(self.session, cmd[0], cmd, conlog, self.getUploadDir(),
|
| |
+ logerror=1)
|
| |
+ return {'image': newimg}
|
| |
+
|
| |
def _buildOVA(self, format):
|
| |
"""
|
| |
Build an OVA target image. This is a format supported by RHEV and
|
| |
@@ -3453,7 +3485,8 @@
|
| |
# upload the results
|
| |
for format in (f for f in self.formats.keys() if self.formats[f]):
|
| |
newimg = images[format]['image']
|
| |
- if 'ova' in format or format == 'raw-xz':
|
| |
+ if ('ova' in format or format == 'raw-xz' or
|
| |
+ format == 'liveimg-squashfs'):
|
| |
newname = self.imgname + '.' + format.replace('-', '.')
|
| |
elif 'vagrant' in format:
|
| |
# This embeds the vagrant target and the ".box" format in the name
|
| |