debian-forge-composer/internal/osbuild1/qemu_assembler.go
Ondřej Budai 973b4b2714 distro/rhel84: build qcow2 images with compat=0.10
By default, `qemu-img convert` creates qcow2 images usable in qemu 1.1 and
newer. RHEL 8 guest images are meant to be bootable on RHEL 6 though.
Unfortunately, RHEL 6 has qemu 0.12, therefore these images cannot be used
there.

To fix this, we need to use the new qcow2_compat option in qemu assembler
to override the default compat version and make qcow2 images that can be used
in qemu 0.10 and newer.

For this, we need osbuild 28 that isn't yet available in of any of
downstreams, therefore we need to pin it everywhere.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
2021-04-10 19:18:13 +01:00

49 lines
1.7 KiB
Go

package osbuild1
// QEMUAssemblerOptions desrcibe how to assemble a tree into an image using qemu.
//
// The assembler creates an image of the given size, adds a GRUB2 bootloader
// and if necessary and a partition table to it with the given PTUUID
// containing the indicated partitions. Finally, the image is converted into
// the target format and stored with the given filename.
type QEMUAssemblerOptions struct {
Bootloader *QEMUBootloader `json:"bootloader,omitempty"`
Format string `json:"format"`
Qcow2Compat string `json:"qcow2_compat,omitempty"`
Filename string `json:"filename"`
Size uint64 `json:"size"`
PTUUID string `json:"ptuuid"`
PTType string `json:"pttype"`
Partitions []QEMUPartition `json:"partitions"`
}
type QEMUPartition struct {
Start uint64 `json:"start"`
Size uint64 `json:"size,omitempty"`
Type string `json:"type,omitempty"`
Bootable bool `json:"bootable,omitempty"`
UUID string `json:"uuid,omitempty"`
Filesystem *QEMUFilesystem `json:"filesystem,omitempty"`
}
type QEMUFilesystem struct {
Type string `json:"type"`
UUID string `json:"uuid"`
Label string `json:"label,omitempty"`
Mountpoint string `json:"mountpoint"`
}
type QEMUBootloader struct {
Type string `json:"type,omitempty"`
Platform string `json:"platform,omitempty"`
}
func (QEMUAssemblerOptions) isAssemblerOptions() {}
// NewQEMUAssembler creates a new QEMU Assembler object.
func NewQEMUAssembler(options *QEMUAssemblerOptions) *Assembler {
return &Assembler{
Name: "org.osbuild.qemu",
Options: options,
}
}