pipeline/assembler/qemu: rework partition table handling
Move to the new options format, allowing more flexible partition tables. The pipeline changes, but the result should be the same. This requires a yet-to-be-released version of osbuild. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
dbdac222a5
commit
4c892d6d32
20 changed files with 283 additions and 84 deletions
|
|
@ -523,18 +523,26 @@ func (r *Fedora30) selinuxStageOptions() *pipeline.SELinuxStageOptions {
|
|||
}
|
||||
|
||||
func (r *Fedora30) qemuAssembler(format string, filename string) *pipeline.Assembler {
|
||||
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
}
|
||||
return pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: format,
|
||||
Filename: filename,
|
||||
PTUUID: "0x14fc63d2",
|
||||
RootFilesystemUUDI: id,
|
||||
Size: 3222274048,
|
||||
})
|
||||
Format: format,
|
||||
Filename: filename,
|
||||
Size: 3222274048,
|
||||
PTUUID: "0x14fc63d2",
|
||||
PTType: "mbr",
|
||||
Partitions: []pipeline.QEMUPartition{
|
||||
{
|
||||
Start: 2048,
|
||||
Bootable: true,
|
||||
Filesystem: pipeline.QEMUFilesystem{
|
||||
Type: "ext4",
|
||||
UUID: "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
Mountpoint: "/",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func (r *Fedora30) tarAssembler(filename, compression string) *pipeline.Assembler {
|
||||
|
|
|
|||
|
|
@ -600,19 +600,26 @@ func (r *RHEL82) selinuxStageOptions() *pipeline.SELinuxStageOptions {
|
|||
}
|
||||
|
||||
func (r *RHEL82) qemuAssembler(format string, filename string, size uint64) *pipeline.Assembler {
|
||||
id, err := uuid.Parse("0bd700f8-090f-4556-b797-b340297ea1bd")
|
||||
if err != nil {
|
||||
panic("invalid UUID")
|
||||
}
|
||||
return pipeline.NewQEMUAssembler(
|
||||
&pipeline.QEMUAssemblerOptions{
|
||||
Format: format,
|
||||
Filename: filename,
|
||||
PTUUID: "0x14fc63d2",
|
||||
RootFilesystemUUDI: id,
|
||||
Size: size,
|
||||
RootFilesystemType: "xfs",
|
||||
})
|
||||
Format: format,
|
||||
Filename: filename,
|
||||
Size: size,
|
||||
PTUUID: "0x14fc63d2",
|
||||
PTType: "mbr",
|
||||
Partitions: []pipeline.QEMUPartition{
|
||||
{
|
||||
Start: 2048,
|
||||
Bootable: true,
|
||||
Filesystem: pipeline.QEMUFilesystem{
|
||||
Type: "xfs",
|
||||
UUID: "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
Mountpoint: "/",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func (r *RHEL82) tarAssembler(filename, compression string) *pipeline.Assembler {
|
||||
|
|
|
|||
|
|
@ -4,34 +4,36 @@ import "github.com/google/uuid"
|
|||
|
||||
// QEMUAssemblerOptions desrcibe how to assemble a tree into an image using qemu.
|
||||
//
|
||||
// The assembler creates an image of a the given size, adds a GRUB2 bootloader
|
||||
// and a DOS partition table to it with the given PTUUID containing one ext4
|
||||
// root partition with the given filesystem UUID and installs the filesystem
|
||||
// tree into it. Finally, the image is converted into the target format and
|
||||
// stored with the given filename.
|
||||
// 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 {
|
||||
Format string `json:"format"`
|
||||
Filename string `json:"filename"`
|
||||
PTUUID string `json:"ptuuid"`
|
||||
RootFilesystemUUDI uuid.UUID `json:"root_fs_uuid"`
|
||||
RootFilesystemType string `json:"root_fs_type"`
|
||||
Size uint64 `json:"size"`
|
||||
Format string `json:"format"`
|
||||
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 *uuid.UUID `json:"type,omitempty"`
|
||||
Bootable bool `json:"bootable,omitempty"`
|
||||
Filesystem QEMUFilesystem `json:"filesystem"`
|
||||
}
|
||||
|
||||
type QEMUFilesystem struct {
|
||||
Type string `json:"type"`
|
||||
UUID string `json:"uuid"`
|
||||
Label string `json:"label,omitempty"`
|
||||
Mountpoint string `json:"mountpoint"`
|
||||
}
|
||||
|
||||
func (QEMUAssemblerOptions) isAssemblerOptions() {}
|
||||
|
||||
// NewQEMUAssemblerOptions creates a now QEMUAssemblerOptions object, with all the mandatory
|
||||
// fields set.
|
||||
func NewQEMUAssemblerOptions(format string, ptUUID string, filename string, rootFilesystemUUID uuid.UUID, size uint64) *QEMUAssemblerOptions {
|
||||
return &QEMUAssemblerOptions{
|
||||
Format: format,
|
||||
PTUUID: ptUUID,
|
||||
Filename: filename,
|
||||
RootFilesystemUUDI: rootFilesystemUUID,
|
||||
Size: size,
|
||||
}
|
||||
}
|
||||
|
||||
// NewQEMUAssembler creates a new QEMU Assembler object.
|
||||
func NewQEMUAssembler(options *QEMUAssemblerOptions) *Assembler {
|
||||
return &Assembler{
|
||||
|
|
|
|||
|
|
@ -127,9 +127,20 @@
|
|||
"options": {
|
||||
"format": "raw.xz",
|
||||
"filename": "image.raw.xz",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -112,9 +112,20 @@
|
|||
"options": {
|
||||
"format": "raw",
|
||||
"filename": "disk.img",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -165,9 +165,20 @@
|
|||
"options": {
|
||||
"format": "raw",
|
||||
"filename": "disk.img",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,9 +116,20 @@
|
|||
"options": {
|
||||
"format": "qcow2",
|
||||
"filename": "image.qcow2",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -166,9 +166,20 @@
|
|||
"options": {
|
||||
"format": "qcow2",
|
||||
"filename": "image.qcow2",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,9 +117,20 @@
|
|||
"options": {
|
||||
"format": "qcow2",
|
||||
"filename": "disk.qcow2",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -167,9 +167,20 @@
|
|||
"options": {
|
||||
"format": "qcow2",
|
||||
"filename": "disk.qcow2",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,10 +170,20 @@
|
|||
"options": {
|
||||
"format": "raw.xz",
|
||||
"filename": "image.raw.xz",
|
||||
"size": 6442450944,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"root_fs_type": "xfs",
|
||||
"size": 6442450944
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "xfs",
|
||||
"uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,10 +128,20 @@
|
|||
"options": {
|
||||
"format": "qcow2",
|
||||
"filename": "image.qcow2",
|
||||
"size": 3221225472,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"root_fs_type": "xfs",
|
||||
"size": 3221225472
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "xfs",
|
||||
"uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,9 +145,20 @@
|
|||
"format": "raw",
|
||||
"filename": "disk.img",
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"root_fs_type": "xfs",
|
||||
"size": 3221225472
|
||||
"size": 3221225472,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "xfs",
|
||||
"uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,10 +155,20 @@
|
|||
"options": {
|
||||
"format": "qcow2",
|
||||
"filename": "disk.qcow2",
|
||||
"size": 3221225472,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"root_fs_type": "xfs",
|
||||
"size": 3221225472
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "xfs",
|
||||
"uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,10 +143,20 @@
|
|||
"options": {
|
||||
"format": "vpc",
|
||||
"filename": "image.vhd",
|
||||
"size": 3221225472,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"root_fs_type": "xfs",
|
||||
"size": 3221225472
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "xfs",
|
||||
"uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,10 +148,20 @@
|
|||
"options": {
|
||||
"format": "vmdk",
|
||||
"filename": "disk.vmdk",
|
||||
"size": 3221225472,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"root_fs_type": "xfs",
|
||||
"size": 3221225472
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "xfs",
|
||||
"uuid": "0bd700f8-090f-4556-b797-b340297ea1bd",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,9 +115,20 @@
|
|||
"options": {
|
||||
"format": "vpc",
|
||||
"filename": "image.vhd",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -165,9 +165,20 @@
|
|||
"options": {
|
||||
"format": "qcow2",
|
||||
"filename": "image.vhd",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,9 +113,20 @@
|
|||
"options": {
|
||||
"format": "vmdk",
|
||||
"filename": "disk.vmdk",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -163,9 +163,20 @@
|
|||
"options": {
|
||||
"format": "vmdk",
|
||||
"filename": "disk.vmdk",
|
||||
"size": 3222274048,
|
||||
"ptuuid": "0x14fc63d2",
|
||||
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"size": 3222274048
|
||||
"pttype": "mbr",
|
||||
"partitions": [
|
||||
{
|
||||
"start": 2048,
|
||||
"bootable": true,
|
||||
"filesystem": {
|
||||
"type": "ext4",
|
||||
"uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
|
||||
"mountpoint": "/"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue