Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mkfs using the wrong label for the fs label #556

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/elemental/elemental.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/elemental/elemental_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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++ {
Expand Down
6 changes: 3 additions & 3 deletions pkg/partitioner/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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,
})
}
}
Expand Down