Skip to content

Commit

Permalink
Several improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Nov 7, 2018
1 parent 37e230a commit c130fc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/lib/y2storage/devicegraph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def blk_devices
BlkDevice.sorted_by_name(self)
end

# All Encryption devicces in the devicegraph, sorted by name
# All Encryption devices in the devicegraph, sorted by name
#
# @return [Array<Encryption>]
def encryptions
Expand Down Expand Up @@ -600,14 +600,15 @@ def alternative_names(device_name)
#
# @return [Device, nil] the found device, nil if no device matches the name
def deep_find(name)
log.info "Trying to find a device by name: #{name}"

# First check using the device name
device = find_by_name(name)
# If not found, check udev names directly handled by libstorage-ng
device ||= blk_devices.find { |dev| dev.udev_full_all.include?(name) }
log.info "Device #{device.inspect} found by its libstorage-ng name #{name}"
return device if device

if device
log.info "Device #{device.inspect} found by its libstorage-ng name #{name}"
return device
end

# If no device yet, there is still a chance using the slower
# BlkDevice.find_by_any_name. Unfortunatelly this only works in the
Expand Down
4 changes: 2 additions & 2 deletions src/lib/y2storage/encryption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def auto_dm_name=(value)
# See {Luks#match_crypttab_spec?}.
#
# This method checks whether the underlying device of the encryption is the
# device indicated in the second column of an crypttab entry.
# device indicated in the second column of a crypttab entry.
#
# Take into account that libstorage-ng discards during probing all the
# udev names not considered reliable or stable enough. This method only
Expand All @@ -140,7 +140,7 @@ def crypttab_name?
#
# @note This relies on the userdata mechanism, see {#userdata_value}.
#
# @return [String, nil] nil if rypttab name is not known
# @return [String, nil] nil if crypttab name is not known
def crypttab_name
userdata_value(:crypttab_name)
end
Expand Down

0 comments on commit c130fc7

Please sign in to comment.