Verify that we get the necessary "luks2.format" and "lvm2.create" stages for a partition table that has LVM2 on top of LUKS2. Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
264 lines
6.2 KiB
Go
264 lines
6.2 KiB
Go
package osbuild2
|
|
|
|
import "github.com/osbuild/osbuild-composer/internal/disk"
|
|
|
|
// This is a copy of `internal/disk/disk_test.go`:
|
|
var testPartitionTables = map[string]disk.PartitionTable{
|
|
|
|
"plain": {
|
|
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
|
Type: "gpt",
|
|
Partitions: []disk.Partition{
|
|
{
|
|
Size: 1048576, // 1MB
|
|
Bootable: true,
|
|
Type: disk.BIOSBootPartitionGUID,
|
|
UUID: disk.BIOSBootPartitionUUID,
|
|
},
|
|
{
|
|
Size: 209715200, // 200 MB
|
|
Type: disk.EFISystemPartitionGUID,
|
|
UUID: disk.EFISystemPartitionUUID,
|
|
Payload: &disk.Filesystem{
|
|
Type: "vfat",
|
|
UUID: disk.EFIFilesystemUUID,
|
|
Mountpoint: "/boot/efi",
|
|
Label: "EFI-SYSTEM",
|
|
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 2,
|
|
},
|
|
},
|
|
{
|
|
Size: 1024000, // 500 MB
|
|
Type: disk.FilesystemDataGUID,
|
|
UUID: disk.FilesystemDataUUID,
|
|
Payload: &disk.Filesystem{
|
|
Type: "xfs",
|
|
Mountpoint: "/boot",
|
|
Label: "boot",
|
|
FSTabOptions: "defaults",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 0,
|
|
},
|
|
},
|
|
{
|
|
Type: disk.FilesystemDataGUID,
|
|
UUID: disk.RootPartitionUUID,
|
|
Payload: &disk.Filesystem{
|
|
Type: "xfs",
|
|
Label: "root",
|
|
Mountpoint: "/",
|
|
FSTabOptions: "defaults",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 0,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
"luks": {
|
|
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
|
Type: "gpt",
|
|
Partitions: []disk.Partition{
|
|
{
|
|
Size: 1048576, // 1MB
|
|
Bootable: true,
|
|
Type: disk.BIOSBootPartitionGUID,
|
|
UUID: disk.BIOSBootPartitionUUID,
|
|
},
|
|
{
|
|
Size: 209715200, // 200 MB
|
|
Type: disk.EFISystemPartitionGUID,
|
|
UUID: disk.EFISystemPartitionUUID,
|
|
Payload: &disk.Filesystem{
|
|
Type: "vfat",
|
|
UUID: disk.EFIFilesystemUUID,
|
|
Mountpoint: "/boot/efi",
|
|
Label: "EFI-SYSTEM",
|
|
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 2,
|
|
},
|
|
},
|
|
{
|
|
Size: 1024000, // 500 MB
|
|
Type: disk.FilesystemDataGUID,
|
|
UUID: disk.FilesystemDataUUID,
|
|
Payload: &disk.Filesystem{
|
|
Type: "xfs",
|
|
Mountpoint: "/boot",
|
|
Label: "boot",
|
|
FSTabOptions: "defaults",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 0,
|
|
},
|
|
},
|
|
{
|
|
Type: disk.FilesystemDataGUID,
|
|
UUID: disk.RootPartitionUUID,
|
|
Payload: &disk.LUKSContainer{
|
|
Label: "crypt-root",
|
|
Passphrase: "osbuild",
|
|
PBKDF: disk.Argon2id{
|
|
Memory: 32,
|
|
Iterations: 4,
|
|
Parallelism: 1,
|
|
},
|
|
Payload: &disk.Filesystem{
|
|
Type: "xfs",
|
|
Label: "root",
|
|
Mountpoint: "/",
|
|
FSTabOptions: "defaults",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 0,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
"luks+lvm": {
|
|
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
|
Type: "gpt",
|
|
Partitions: []disk.Partition{
|
|
{
|
|
Size: 1048576, // 1MB
|
|
Bootable: true,
|
|
Type: disk.BIOSBootPartitionGUID,
|
|
UUID: disk.BIOSBootPartitionUUID,
|
|
},
|
|
{
|
|
Size: 209715200, // 200 MB
|
|
Type: disk.EFISystemPartitionGUID,
|
|
UUID: disk.EFISystemPartitionUUID,
|
|
Payload: &disk.Filesystem{
|
|
Type: "vfat",
|
|
UUID: disk.EFIFilesystemUUID,
|
|
Mountpoint: "/boot/efi",
|
|
Label: "EFI-SYSTEM",
|
|
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 2,
|
|
},
|
|
},
|
|
{
|
|
Size: 1024000, // 500 MB
|
|
Type: disk.FilesystemDataGUID,
|
|
UUID: disk.FilesystemDataUUID,
|
|
Payload: &disk.Filesystem{
|
|
Type: "xfs",
|
|
Mountpoint: "/boot",
|
|
Label: "boot",
|
|
FSTabOptions: "defaults",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 0,
|
|
},
|
|
},
|
|
{
|
|
Type: disk.FilesystemDataGUID,
|
|
UUID: disk.RootPartitionUUID,
|
|
Size: 5 * 1024 * 1024 * 1024,
|
|
Payload: &disk.LUKSContainer{
|
|
Label: "crypt-root",
|
|
Passphrase: "osbuild",
|
|
PBKDF: disk.Argon2id{
|
|
Memory: 32,
|
|
Iterations: 4,
|
|
Parallelism: 1,
|
|
},
|
|
Payload: &disk.LVMVolumeGroup{
|
|
Name: "root",
|
|
Description: "root volume group",
|
|
LogicalVolumes: []disk.LVMLogicalVolume{
|
|
{
|
|
Size: 2 * 1024 * 1024 * 1024,
|
|
Name: "rootlv",
|
|
Payload: &disk.Filesystem{
|
|
Type: "xfs",
|
|
Label: "root",
|
|
Mountpoint: "/",
|
|
FSTabOptions: "defaults",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 0,
|
|
},
|
|
},
|
|
{
|
|
Size: 2 * 1024 * 1024 * 1024,
|
|
Name: "homelv",
|
|
Payload: &disk.Filesystem{
|
|
Type: "xfs",
|
|
Label: "root",
|
|
Mountpoint: "/home",
|
|
FSTabOptions: "defaults",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 0,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
"btrfs": {
|
|
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
|
Type: "gpt",
|
|
Partitions: []disk.Partition{
|
|
{
|
|
Size: 1048576, // 1MB
|
|
Bootable: true,
|
|
Type: disk.BIOSBootPartitionGUID,
|
|
UUID: disk.BIOSBootPartitionUUID,
|
|
},
|
|
{
|
|
Size: 209715200, // 200 MB
|
|
Type: disk.EFISystemPartitionGUID,
|
|
UUID: disk.EFISystemPartitionUUID,
|
|
Payload: &disk.Filesystem{
|
|
Type: "vfat",
|
|
UUID: disk.EFIFilesystemUUID,
|
|
Mountpoint: "/boot/efi",
|
|
Label: "EFI-SYSTEM",
|
|
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 2,
|
|
},
|
|
},
|
|
{
|
|
Size: 1024000, // 500 MB
|
|
Type: disk.FilesystemDataGUID,
|
|
UUID: disk.FilesystemDataUUID,
|
|
Payload: &disk.Filesystem{
|
|
Type: "xfs",
|
|
Mountpoint: "/boot",
|
|
Label: "boot",
|
|
FSTabOptions: "defaults",
|
|
FSTabFreq: 0,
|
|
FSTabPassNo: 0,
|
|
},
|
|
},
|
|
{
|
|
Type: disk.FilesystemDataGUID,
|
|
UUID: disk.RootPartitionUUID,
|
|
Size: 10 * 1024 * 1024 * 1024,
|
|
Payload: &disk.Btrfs{
|
|
Label: "rootfs",
|
|
Subvolumes: []disk.BtrfsSubvolume{
|
|
{
|
|
Size: 0,
|
|
Mountpoint: "/",
|
|
GroupID: 0,
|
|
},
|
|
{
|
|
Size: 5 * 1024 * 1024 * 1024,
|
|
Mountpoint: "/var",
|
|
GroupID: 0,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|