Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial guided proposal: multidisks first #953

Merged
merged 8 commits into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 5 additions & 0 deletions doc/old_and_new_proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ Besides these, there is another element:

* `lvm` *(boolean, default: `false`)*
* `allocate_volume_mode` *(`auto`, `device`, default: `auto`)*
* `multidisk_first` *(boolean, default: `false`)*
* `delete_resize_configurable` *(boolean, default: `true`)*
* `resize_windows` *(boolean, default: `true`)*
* `windows_delete_mode` *(`none`, `ondemand`, `all`, default: `ondemand`)*
Expand Down Expand Up @@ -660,6 +661,10 @@ following options.
consequence, the interface presented to the user by default will be
different (containing different questions) depending of the value of this
property.
* `multidisk_first`
When set to `true`, the initial proposal will be performed over all
available candidate disks, which means that the proposal will try to use
several disks before jumping to adjust the settings.
dgdavid marked this conversation as resolved.
Show resolved Hide resolved
* ~~`encrypt`
Whether encryption should be used by default.~~
* `delete_resize_configurable`
Expand Down
9 changes: 9 additions & 0 deletions package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sat Aug 10 22:00:06 UTC 2019 - David Diaz <dgonzalez@suse.com>

- Initial Guided Proposal: added support to make the proposal
using all candidates devices, without trying all possible set
of settings for each individual device first (related to
jsc#SLE-7238).
- 4.2.33

-------------------------------------------------------------------
Thu Aug 8 10:37:33 UTC 2019 - José Iván López González <jlopez@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: 4.2.32
Version: 4.2.33
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
29 changes: 23 additions & 6 deletions src/lib/y2storage/initial_guided_proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,19 +220,36 @@ def assign_next_settings

# Candidate devices grouped for different proposal attempts
#
# Different proposal attempts are performed by using different sets of candidate devices.
# First, each candidate device is used individually, and if no proposal was possible with
# any individual disk, a last attempt is done by using all available candidate devices.
# Different proposal attempts are performed by using different sets of candidate devices, which
# will depend on the given settings:
#
# * single disk first (by default, no option needed): each candidate device is used individually
# first and, if no proposal was possible with any individual disk, a last attempt is done by
# using all available candidate devices.
#
# * multidisk first (multidisk_first => true): the proposal is tried using all available
# candidate devices.
#
# NOTE: when multidisk first, it makes no sense to include also each candidate device as an
# individual group at the end because if the proposal fails using all devices it also will fail
# using them individually.
#
# @example
#
# settings.candidate_devices #=> ["/dev/sda", "/dev/sdb"]
# settings.groups_of_candidate_devices #=> [["/dev/sda"], ["/dev/sdb"], ["/dev/sda", "/dev/sdb"]]
# settings.multidisk_first #=> false
# settings.candidate_devices #=> ["/dev/sda", "/dev/sdb"]
# settings.groups_of_candidate_devices #=> [["/dev/sda"], ["/dev/sdb"], ["/dev/sda", "/dev/sdb"]]
#
# settings.multidisk_first #=> true
# settings.candidate_devices #=> ["/dev/sda", "/dev/sdb"]
# settings.groups_of_candidate_devices #=> [["/dev/sda", "/dev/sdb"]]
#
# @return [Array<Array<String>>]
def groups_of_candidate_devices
candidates = candidate_devices

return [candidates] if settings.multidisk_first

candidates.zip.append(candidates).uniq
end

Expand All @@ -246,7 +263,7 @@ def groups_of_candidate_devices
def candidate_roots
return [settings.root_device] if settings.explicit_root_device

disk_names = settings.candidate_devices
disk_names = settings.explicit_candidate_devices

candidates = disk_names.map { |n| initial_devicegraph.find_by_name(n) }.compact
candidates = candidates.sort_by(&:size).reverse
Expand Down
12 changes: 12 additions & 0 deletions src/lib/y2storage/proposal_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ class ProposalSettings # rubocop:disable ClassLength
# @return [:auto, :device] :auto by default
attr_accessor :allocate_volume_mode

# Whether the initial proposal should use a multidisk approach first
#
# @note :ng format
#
# @return [Boolean] if true, the initial proposal will be tried using all
# available candidate disk before jumping to a single disk approach.
dgdavid marked this conversation as resolved.
Show resolved Hide resolved
attr_accessor :multidisk_first

# @note :legacy format
# @return [Filesystems::Type] type to use for the root filesystem
attr_accessor :root_filesystem_type
Expand Down Expand Up @@ -488,6 +496,7 @@ def apply_ng_defaults
self.delete_resize_configurable ||= true
self.lvm_vg_strategy ||= :use_available
self.allocate_volume_mode ||= :auto
self.multidisk_first ||= false
self.volumes ||= []
end

Expand All @@ -503,6 +512,7 @@ def load_ng_features
load_feature(:proposal, :delete_resize_configurable)
load_feature(:proposal, :lvm_vg_strategy)
load_feature(:proposal, :allocate_volume_mode)
load_feature(:proposal, :multidisk_first)
load_size_feature(:proposal, :lvm_vg_size)
load_volumes_feature(:volumes)
end
Expand All @@ -525,6 +535,7 @@ def apply_legacy_defaults
self.other_delete_mode ||= :ondemand
self.root_space_percent ||= 40
self.allocate_volume_mode ||= :auto
self.multidisk_first ||= false
joseivanlopez marked this conversation as resolved.
Show resolved Hide resolved
self.btrfs_increase_percentage ||= 300.0
self.btrfs_default_subvolume ||= "@"
self.subvolumes ||= SubvolSpecification.fallback_list
Expand Down Expand Up @@ -644,6 +655,7 @@ def ng_string_representation
" delete_resize_configurable: #{delete_resize_configurable}\n" \
" lvm_vg_strategy: #{lvm_vg_strategy}\n" \
" lvm_vg_size: #{lvm_vg_size}\n" \
" multidisk_first: #{multidisk_first}\n" \
joseivanlopez marked this conversation as resolved.
Show resolved Hide resolved
" volumes:\n" \
" #{volumes}"
end
Expand Down
Loading