Skip to content

Commit

Permalink
Removed cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Jan 26, 2016
1 parent 5bfd143 commit b76d3e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/lib/storage/partition_creator.rb
Expand Up @@ -64,9 +64,7 @@ def initialize(settings:,
# device graph which is a clone of "proposal_base".
#
def create_partitions(volumes, strategy, free_space)

# FIXME: TO DO
# FIXME: TO DO
create(volumes, strategy, free_space)
end

# Sum up the sizes of all slots in free_space.
Expand Down
18 changes: 9 additions & 9 deletions src/lib/storage/space_maker.rb
Expand Up @@ -89,7 +89,6 @@ def provide_space(method, strategy)
raise ArgumentError, "Bad strategy name #{strategy}" unless [:desired, :min_size].include?(strategy)

required_size = strategy == :desired ? total_desired_sizes : total_vol_sizes(strategy)
# required_size = total_vol_sizes(:min_size)
log.info("Providing space with method \"#{method}\" and strategy \"#{strategy}\" - required: #{required_size}")
@strategy = strategy
self.send(method, required_size)
Expand All @@ -99,7 +98,7 @@ def provide_space(method, strategy)
# Try to detect empty (unpartitioned) space.
#
def find_space(*unused)
update_free_space
update_free_space
end

# Use force to create space (up to 'required_size'): Delete partitions
Expand All @@ -118,7 +117,6 @@ def make_space(required_size)
next unless part
log.info("Deleting partition #{part_name} in device graph")
part.partition_table.delete_partition(part_name)
find_space
free_size = update_free_space
end
end
Expand All @@ -129,9 +127,11 @@ def make_space(required_size)
# @param required_size [DiskSize]
#
def resize_windows(required_size)
@tried_resize_windows = true
return if @tried_resize_windows
return if @windows_partitions.empty?
return unless @linux_partitions.empty?

@tried_resize_windows = true
log.info("Resizing Windows partition")
#
# TO DO: Resize windows partition (not available in libstorage-bgl yet)
Expand Down Expand Up @@ -187,7 +187,7 @@ def delete_partition(disk_name, partition_name)
#
def total_vol_sizes(size_method)
raise ArgumentError, "Bad method name #{size_method}" unless [:min_size, :max_size].include?(size_method)
total = @volumes.reduce(DiskSize.zero) do |sum, vol|
@volumes.reduce(DiskSize.zero) do |sum, vol|
sum + vol.send(size_method)
end
end
Expand Down Expand Up @@ -223,22 +223,22 @@ def total_free_size
#
def update_free_space
@free_space = []
free_size = DiskSize.zero
free_size = DiskSize.zero
@candidate_disks.each do |disk_name|
begin
# log.info("Collecting unpartitioned space on #{disk_name}")
disk = ::Storage::Disk.find(@devicegraph, disk_name)
disk.partition_table.unused_partition_slots.each do |slot|
free_slot = FreeDiskSpace.new(disk, slot)
free_slot = FreeDiskSpace.new(disk, slot)
@free_space << free_slot
free_size += free_slot.size
free_size += free_slot.size
end
rescue RuntimeError => ex # FIXME: rescue ::Storage::Exception when SWIG bindings are fixed
log.info("CAUGHT exception #{ex}")
# FIXME: Handle completely empty disks (no partition table) as empty space
end
end
free_size
free_size
end

# Return all partition names from all candidate disks.
Expand Down
1 change: 0 additions & 1 deletion src/lib/storage/storage_proposal.rb
Expand Up @@ -80,7 +80,6 @@ def propose
create_partitions(space_maker)
proposal_to_staging
action_text = proposal_text

rescue NotEnoughDiskSpace => ex
action_text = "No proposal possible."
log.warn(action_text)
Expand Down

0 comments on commit b76d3e3

Please sign in to comment.