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 @@
-------------------------------------------------------------------
Wed Aug 21 12:03:30 UTC 2024 - Ancor Gonzalez Sosa <ancor@suse.com>

- Tiny internal code reorganization to ease Agama development at
gh#openSUSE/agama#1448.
- 5.0.16

-------------------------------------------------------------------
Fri Jun 14 12:41:07 UTC 2024 - Ancor Gonzalez Sosa <ancor@suse.com>

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.15
Version: 5.0.16
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
1 change: 1 addition & 0 deletions src/lib/y2storage/proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ module Proposal
require "y2storage/proposal/space_maker"
require "y2storage/proposal/partition_table_creator"
require "y2storage/proposal/settings_generator"
require "y2storage/proposal/planned_devices_handler"
23 changes: 3 additions & 20 deletions src/lib/y2storage/proposal/autoinst_devices_planner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
require "y2storage/proposal/autoinst_nfs_planner"
require "y2storage/proposal/autoinst_btrfs_planner"
require "y2storage/proposal/autoinst_tmpfs_planner"
require "y2storage/proposal/planned_devices_handler"
require "y2storage/planned"

module Y2Storage
Expand All @@ -41,6 +42,7 @@ module Proposal
#
class AutoinstDevicesPlanner
include Yast::Logger
include PlannedDevicesHandler

# Constructor
#
Expand All @@ -62,7 +64,7 @@ def planned_devices(drives_map)
end

collection = Planned::DevicesCollection.new(devices)
remove_shadowed_subvols(collection.mountable_devices)
remove_shadowed_subvols(collection)
add_bcache_issues(collection)
collection
end
Expand Down Expand Up @@ -170,25 +172,6 @@ def planned_for_tmpfs(drive)
planner.planned_devices(drive)
end

# Removes shadowed subvolumes from each planned device that can be mounted
#
# @param planned_devices [Array<Planned::Device>]
def remove_shadowed_subvols(planned_devices)
planned_devices.each do |device|
# Some planned devices could be mountable but not formattable (e.g., {Planned::Nfs}).
# Those devices might shadow some subvolumes but they do not have any subvolume to
# be shadowed.
next unless device.respond_to?(:shadowed_subvolumes)

device.shadowed_subvolumes(planned_devices).each do |subvol|
# TODO: this should be reported to the user when the shadowed
# subvolumes was specified in the profile.
log.info "Subvolume #{subvol} would be shadowed. Removing it."
device.subvolumes.delete(subvol)
end
end
end

# Adds a bcache issue if needed
#
# @param collection [Planned::DevicesCollection] Planned devices
Expand Down
47 changes: 47 additions & 0 deletions src/lib/y2storage/proposal/planned_devices_handler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (c) [2024] SUSE LLC
#
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, contact SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.

module Y2Storage
module Proposal
# Mixin with methods to handle planned device collections
module PlannedDevicesHandler
include Yast::Logger

# Removes shadowed subvolumes from each planned device that can be mounted
#
# Note this does not alter the collection itself, but it modifies the attributes of
# some of the elements in the collection
#
# @param planned_devices [Planned::DevicesCollection]
def remove_shadowed_subvols(planned_devices)
planned_devices.mountable_devices.each do |device|
# Some planned devices could be mountable but not formattable (e.g., {Planned::Nfs}).
# Those devices might shadow some subvolumes but they do not have any subvolume to
# be shadowed.
next unless device.respond_to?(:shadowed_subvolumes)

device.shadowed_subvolumes(planned_devices.mountable_devices).each do |subvol|
log.info "Subvolume #{subvol} would be shadowed. Removing it."
device.subvolumes.delete(subvol)
end
end
end
end
end
end
4 changes: 0 additions & 4 deletions src/lib/y2storage/proposal/space_maker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,6 @@ def resize_and_delete(planned_partitions, lvm_helper, disk_name: nil)
end

def force_ptables(planned_partitions)
Y2Storage::Partitionable.all(new_graph).each do |dev|
dev.forced_ptable_type = nil
end

forced = planned_partitions.select { |part| part.disk && part.ptable_type }
forced.each do |part|
disk = new_graph.find_by_name(part.disk)
Expand Down