From ded356cf98062d971cf14c029c94fdebe30b411b Mon Sep 17 00:00:00 2001 From: Itxaka Date: Tue, 24 Sep 2024 10:08:34 +0200 Subject: [PATCH] Fix mkfs using the wrong label for the fs label (#556) --- pkg/elemental/elemental.go | 2 +- pkg/elemental/elemental_test.go | 4 ++-- pkg/partitioner/disk.go | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/elemental/elemental.go b/pkg/elemental/elemental.go index 95359dcc..d37c309f 100644 --- a/pkg/elemental/elemental.go +++ b/pkg/elemental/elemental.go @@ -110,7 +110,7 @@ func (e *Elemental) PartitionAndFormatDevice(i v1.SharedInstallSpec) error { continue } // we have to match the Fs it was asked with the partition in the system - if p.(*gpt.Partition).Name == configPart.FilesystemLabel { + if p.(*gpt.Partition).Name == configPart.Name { e.config.Logger.Debugf("Formatting partition: %s", configPart.FilesystemLabel) err = partitioner.FormatDevice(e.config.Runner, fmt.Sprintf("%s%d", i.GetTarget(), index+1), configPart.FS, configPart.FilesystemLabel) if err != nil { diff --git a/pkg/elemental/elemental_test.go b/pkg/elemental/elemental_test.go index 78fb5724..dc764851 100644 --- a/pkg/elemental/elemental_test.go +++ b/pkg/elemental/elemental_test.go @@ -398,7 +398,7 @@ var _ = Describe("Elemental", Label("elemental"), func() { // Should be efi type Expect(partition.Type).To(Equal(gpt.EFISystemPartition)) // should have boot label - Expect(partition.Name).To(Equal(cnst.EfiLabel)) + Expect(partition.Name).To(Equal(cnst.EfiPartName)) // Should have predictable UUID Expect(strings.ToLower(partition.UUID())).To(Equal(strings.ToLower(uuid.NewV5(uuid.NamespaceURL, cnst.EfiLabel).String()))) // Check the rest have the proper types @@ -431,7 +431,7 @@ var _ = Describe("Elemental", Label("elemental"), func() { // Should be BIOS boot type Expect(partition.Type).To(Equal(gpt.BIOSBoot)) // should have boot label - Expect(partition.Name).To(Equal(cnst.EfiLabel)) + Expect(partition.Name).To(Equal(cnst.BiosPartName)) // Should have predictable UUID Expect(strings.ToLower(partition.UUID())).To(Equal(strings.ToLower(uuid.NewV5(uuid.NamespaceURL, cnst.EfiLabel).String()))) for i := 1; i < len(disk.Table.GetPartitions()); i++ { diff --git a/pkg/partitioner/disk.go b/pkg/partitioner/disk.go index 0a28adf3..1f0bac5d 100644 --- a/pkg/partitioner/disk.go +++ b/pkg/partitioner/disk.go @@ -88,7 +88,7 @@ func kairosPartsToDiskfsGPTParts(parts sdkTypes.PartitionList, diskSize int64) [ Type: gpt.EFISystemPartition, Size: size, // partition size in bytes GUID: uuid.NewV5(uuid.NamespaceURL, part.FilesystemLabel).String(), // set know predictable UUID - Name: part.FilesystemLabel, + Name: part.Name, Attributes: 0x1, // system partition flag }) } else if part.Name == cnst.BiosPartName { @@ -99,7 +99,7 @@ func kairosPartsToDiskfsGPTParts(parts sdkTypes.PartitionList, diskSize int64) [ Type: gpt.BIOSBoot, Size: size, // partition size in bytes GUID: uuid.NewV5(uuid.NamespaceURL, part.FilesystemLabel).String(), // set know predictable UUID - Name: part.FilesystemLabel, + Name: part.Name, Attributes: 0x4, // legacy bios bootable flag }) } else { @@ -110,7 +110,7 @@ func kairosPartsToDiskfsGPTParts(parts sdkTypes.PartitionList, diskSize int64) [ Type: gpt.LinuxFilesystem, Size: size, GUID: uuid.NewV5(uuid.NamespaceURL, part.FilesystemLabel).String(), - Name: part.FilesystemLabel, + Name: part.Name, }) } }