Skip to content

Commit

Permalink
Fix y2storage usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed May 23, 2017
1 parent a158289 commit 17ccd36
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
12 changes: 3 additions & 9 deletions src/modules/Packages.rb
Expand Up @@ -530,7 +530,7 @@ def AddFailedMounts(summary)
) ? "<BR>" : ""
if Builtins.contains(
@basic_dirs,
fs_mountpoint(failed_mount)
failed_mount.mountpoint
)
Ops.set(
summary,
Expand All @@ -542,7 +542,7 @@ def AddFailedMounts(summary)
_(
"Error: Cannot check free space in basic directory %1 (device %2), cannot start installation."
),
fs_mountpoint(failed_mount),
failed_mount.mountpoint,
fs_dev_name(failed_mount)
)
)
Expand All @@ -562,7 +562,7 @@ def AddFailedMounts(summary)
_(
"Warning: Cannot check free space in directory %1 (device %2)."
),
fs_mountpoint(failed_mount),
failed_mount.mountpoint,
fs_dev_name(failed_mount)
)
)
Expand Down Expand Up @@ -2745,12 +2745,6 @@ def format_missing_resolvables(type, list)
end
end

# Mount point of the given filesystem, used to identify the filesystem in
# the log messages
def fs_mountpoint(filesystem)
filesystem.mountpoints[0] || ""
end

# Device name of the given filesystem, used to identify the filesystem in
# the log messages
def fs_dev_name(filesystem)
Expand Down
12 changes: 2 additions & 10 deletions src/modules/SpaceCalculation.rb
Expand Up @@ -695,7 +695,7 @@ def get_partition_info
# convert into KiB for TargetInitDU
free_size_kib = free_size / 1024
used_kib = used / 1024
mount_name = filesystem_mountpoint(filesystem)
mount_name = filesystem.mountpoint
log.info "partition: mount: #{mount_name}, free: #{free_size_kib}KiB, used: #{used_kib}KiB"

mount_name = mount_name[1..-1] if remove_slash && mount_name != "/"
Expand Down Expand Up @@ -1047,10 +1047,9 @@ def btrfs_used_size(directory)
# where unit can be one of: "" (none) or "B", "KiB", "MiB", "GiB", "TiB", "PiB"
# @return [Integer] size in bytes
def size_from_string(size_str)
classic_locale = true
# Assume bytes by default
size_str += "B" unless size_str =~ /[[:alpha:]]/
::Storage.humanstring_to_byte(size_str, classic_locale)
Y2Storage::DiskSize.parse(size_str).to_i
end

private
Expand Down Expand Up @@ -1080,13 +1079,6 @@ def filesystem_size(filesystem)
def filesystem_dev_name(filesystem)
filesystem.blk_devices[0].name
end

# storage-ng FIXME: revisit this after implementing subvolumes in btrfs. We
# are not sure whether 'mountpoints[0]' will be the right thing at that
# point in time.
def filesystem_mountpoint(filesystem)
filesystem.mountpoints[0] || ""
end
end

SpaceCalculation = SpaceCalculationClass.new
Expand Down

0 comments on commit 17ccd36

Please sign in to comment.