Skip to content
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
7 changes: 7 additions & 0 deletions package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri May 23 08:06:05 UTC 2025 - Ancor Gonzalez Sosa <ancor@suse.com>

- Reorganize public methods of DiskAnalyzer (needed by
gh#agama-project/agama#2388).
- 5.0.32

-------------------------------------------------------------------
Tue May 13 15:01:47 UTC 2025 - Stefan Schubert <schubi@suse.de>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-storage-ng.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 5.0.31
Version: 5.0.32
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
37 changes: 22 additions & 15 deletions src/lib/y2storage/disk_analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,36 @@ def candidate_disks
@candidate_disks
end

# Checks whether a device can be used as candidate for installation
# Checks whether a device can be used for the installation
#
# A device is candidate for installation if no filesystem belonging to the device is mounted and the
# device does not contain a repository for installation.
# A device is visible for installation purposes if no filesystem belonging to the device is
# mounted and the device does not contain a repository for installation.
#
# Moreover, RAM disks are also discarded.
#
# @param device [BlkDevice]
# @return [Boolean]
def candidate_device?(device)
def available_device?(device)
!contain_mounted_filesystem?(device) &&
!contain_installation_repository?(device) &&
!device.name.match?(/^\/dev\/ram\d+$/)
end

# Checks whether it makes sense to create the boot-related partitions at the given device
#
# Apart from the disk devices, some software RAIDs are considered as acceptable under some
# circumstances. See {#candidate_disks} for extra explanations (e.g. the relevance of EFI) and for
# Fate/Bugzilla references.
#
# @param device [BlkDevice]
# @return [Boolean]
def supports_boot_partitions?(device)
return true if device.is?(:disk_device)
return false unless arch.efiboot?

device.is?(:software_raid) && (device.partition_table? || device.children.empty?)
end

# Look up devicegraph element by device name.
#
# @return [Device]
Expand Down Expand Up @@ -259,19 +274,11 @@ def all_linux_suitable_filesystems

# Finds software RAIDs that are considered valid candidates for a Linux installation
#
# Apart from matching conditions of #candidate_device?, a valid software RAID candidate must
# either, have a partition table or do not have children.
#
# See {#candidate_disks} for extra explanations (e.g. the relevance of EFI) and for
# Fate/Bugzilla references.
# @see #candidate_software_raid?
#
# @return [Array<Md>]
def candidate_software_raids
return [] unless arch.efiboot?

devicegraph.software_raids.select do |md|
(md.partition_table? || md.children.empty?) && candidate_device?(md)
end
devicegraph.software_raids.select { |md| available_device?(md) && supports_boot_partitions?(md) }
end

# Finds disk devices that are considered valid candidates
Expand All @@ -281,7 +288,7 @@ def candidate_software_raids
# @return [Array<BlkDevice>]
def candidate_disk_devices
rejected_disk_devices = candidate_software_raids.map(&:ancestors).flatten
candidate_disk_devices = devicegraph.disk_devices.select { |d| candidate_device?(d) }
candidate_disk_devices = devicegraph.disk_devices.select { |d| available_device?(d) }

candidate_disk_devices - rejected_disk_devices
end
Expand Down