From 1b04aa06244e6226ce9e4e68e6d12230c2ec196d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Thu, 5 Dec 2024 18:03:27 +0100 Subject: [PATCH] disk: introduce a constant for bios-based PReP partition type --- cmd/otk/osbuild-gen-partition-table/main_test.go | 4 ++-- pkg/disk/disk.go | 3 +++ pkg/disk/partition.go | 2 +- pkg/distro/fedora/partition_tables.go | 2 +- pkg/distro/rhel/rhel10/partition_tables.go | 2 +- pkg/distro/rhel/rhel8/partition_tables.go | 2 +- pkg/distro/rhel/rhel9/partition_tables.go | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cmd/otk/osbuild-gen-partition-table/main_test.go b/cmd/otk/osbuild-gen-partition-table/main_test.go index 5788551510..136507d961 100644 --- a/cmd/otk/osbuild-gen-partition-table/main_test.go +++ b/cmd/otk/osbuild-gen-partition-table/main_test.go @@ -343,7 +343,7 @@ func TestGenPartitionTableIntegrationPPC(t *testing.T) { Name: "ppc-boot", Bootable: true, Size: "4 MiB", - PartType: "41", + PartType: disk.DosPRePID, PartUUID: "", }, { @@ -373,7 +373,7 @@ func TestGenPartitionTableIntegrationPPC(t *testing.T) { Bootable: true, Start: 1048576, Size: 4194304, - Type: "41", + Type: disk.DosPRePID, }, { Start: 5242880, diff --git a/pkg/disk/disk.go b/pkg/disk/disk.go index 576687f06a..2c64d402e5 100644 --- a/pkg/disk/disk.go +++ b/pkg/disk/disk.go @@ -75,6 +75,9 @@ const ( // Partition type ID for swap DosSwapID = "82" + + // Partition type ID for PRep on dos + DosPRePID = "41" ) // pt type -> type -> ID mapping for convenience diff --git a/pkg/disk/partition.go b/pkg/disk/partition.go index 3e945bca5c..7b45e62f46 100644 --- a/pkg/disk/partition.go +++ b/pkg/disk/partition.go @@ -95,7 +95,7 @@ func (p *Partition) IsPReP() bool { return false } - return p.Type == "41" || p.Type == PRePartitionGUID + return p.Type == DosPRePID || p.Type == PRePartitionGUID } func (p *Partition) MarshalJSON() ([]byte, error) { diff --git a/pkg/distro/fedora/partition_tables.go b/pkg/distro/fedora/partition_tables.go index 60582877da..98e5530c8c 100644 --- a/pkg/distro/fedora/partition_tables.go +++ b/pkg/distro/fedora/partition_tables.go @@ -112,7 +112,7 @@ var defaultBasePartitionTables = distro.BasePartitionTableMap{ Partitions: []disk.Partition{ { Size: 4 * datasizes.MebiByte, - Type: "41", + Type: disk.DosPRePID, Bootable: true, }, { diff --git a/pkg/distro/rhel/rhel10/partition_tables.go b/pkg/distro/rhel/rhel10/partition_tables.go index 4769d3d1b1..d282830a58 100644 --- a/pkg/distro/rhel/rhel10/partition_tables.go +++ b/pkg/distro/rhel/rhel10/partition_tables.go @@ -90,7 +90,7 @@ func defaultBasePartitionTables(t *rhel.ImageType) (disk.PartitionTable, bool) { Partitions: []disk.Partition{ { Size: 4 * datasizes.MebiByte, - Type: "41", + Type: disk.DosPRePID, Bootable: true, }, { diff --git a/pkg/distro/rhel/rhel8/partition_tables.go b/pkg/distro/rhel/rhel8/partition_tables.go index 88008333ae..ee3208daeb 100644 --- a/pkg/distro/rhel/rhel8/partition_tables.go +++ b/pkg/distro/rhel/rhel8/partition_tables.go @@ -91,7 +91,7 @@ func defaultBasePartitionTables(t *rhel.ImageType) (disk.PartitionTable, bool) { Partitions: []disk.Partition{ { Size: 4 * datasizes.MebiByte, - Type: "41", + Type: disk.DosPRePID, Bootable: true, }, { diff --git a/pkg/distro/rhel/rhel9/partition_tables.go b/pkg/distro/rhel/rhel9/partition_tables.go index 03959ea627..b80643338b 100644 --- a/pkg/distro/rhel/rhel9/partition_tables.go +++ b/pkg/distro/rhel/rhel9/partition_tables.go @@ -173,7 +173,7 @@ func defaultBasePartitionTables(t *rhel.ImageType) (disk.PartitionTable, bool) { Partitions: []disk.Partition{ { Size: 4 * datasizes.MebiByte, - Type: "41", + Type: disk.DosPRePID, Bootable: true, }, {