From 5913bffe47ecb4ab47d45348994bed475107457e Mon Sep 17 00:00:00 2001 From: Nick Carboni Date: Fri, 25 Oct 2024 16:29:40 -0400 Subject: [PATCH] Remove restriction on ISO partition types This is not a valid way to detect installation media, but it is a way that config data can be provided to the host during a CAPI install. For a full ISO the current install media partitions look like this: ``` [root@localhost core]# fdisk -l /dev/sr0 Disk /dev/sr0: 1.16 GiB, 1244659712 bytes, 607744 sectors Disk model: QEMU DVD-ROM Units: sectors of 1 * 2048 = 2048 bytes Sector size (logical/physical): 2048 bytes / 2048 bytes I/O size (minimum/optimal): 2048 bytes / 2048 bytes Disklabel type: dos Disk identifier: 0x47ad035f Device Boot Start End Sectors Size Id Type /dev/sr0p1 * 0 2430975 2430976 4.6G 0 Empty /dev/sr0p2 180 10139 9960 19.5M ef EFI (FAT-12/16/32) ``` Neither of these partitions are of type iso9660 so this check is doing nothing but making CAPI installs more difficult. --- src/inventory/disks.go | 9 --------- src/inventory/disks_test.go | 24 +++--------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/inventory/disks.go b/src/inventory/disks.go index de8b950b8..a0b20e5bb 100644 --- a/src/inventory/disks.go +++ b/src/inventory/disks.go @@ -360,15 +360,6 @@ func (d *disks) checkEligibility(disk *ghw.Disk) (notEligibleReasons []string, i // Check disk partitions for type, name, and mount points: for _, partition := range disk.Partitions { - if partition.Type == "iso9660" { - notEligibleReasons = append( - notEligibleReasons, - "Disk appears to be an ISO installation media (has partition with "+ - "type iso9660)", - ) - isInstallationMedia = true - } - if strings.HasSuffix(partition.MountPoint, "iso") { notEligibleReasons = append( notEligibleReasons, diff --git a/src/inventory/disks_test.go b/src/inventory/disks_test.go index 0dbfa580d..694e3290d 100644 --- a/src/inventory/disks_test.go +++ b/src/inventory/disks_test.go @@ -550,7 +550,7 @@ var _ = Describe("Disks test", func() { }) It("filters ISO disks / marks them as installation media", func() { - blockInfo, expectedDisks := prepareDisksTest(dependencies, 3) + blockInfo, expectedDisks := prepareDisksTest(dependencies, 2) blockInfo.Disks[0].Partitions = []*ghw.Partition{ { @@ -569,27 +569,9 @@ var _ = Describe("Disks test", func() { } expectedDisks[0].IsInstallationMedia = true - blockInfo.Disks[1].Partitions = []*ghw.Partition{ - { - Disk: nil, - Name: "partition2", - Label: "partition2-label", - MountPoint: "/some/mount/point", - SizeBytes: 5555, - Type: "iso9660", - IsReadOnly: false, - }, - } - - expectedDisks[1].InstallationEligibility.Eligible = false - expectedDisks[1].InstallationEligibility.NotEligibleReasons = []string{ - "Disk appears to be an ISO installation media (has partition with type iso9660)", - } - expectedDisks[1].IsInstallationMedia = true - // Make sure regular disks don't get marked as installation media - expectedDisks[2].InstallationEligibility.Eligible = true - expectedDisks[2].IsInstallationMedia = false + expectedDisks[1].InstallationEligibility.Eligible = true + expectedDisks[1].IsInstallationMedia = false mockFetchDisks(dependencies, nil, blockInfo.Disks...) ret := GetDisks(&config.SubprocessConfig{}, dependencies)