Skip to content

Commit

Permalink
Remove restriction on ISO partition types
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
carbonin committed Jan 16, 2025
1 parent 19cf7f6 commit 5913bff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
9 changes: 0 additions & 9 deletions src/inventory/disks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
24 changes: 3 additions & 21 deletions src/inventory/disks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
{
Expand All @@ -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)
Expand Down

0 comments on commit 5913bff

Please sign in to comment.