Skip to content

Commit

Permalink
Merge 2f7501d into 286d6d1
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Jul 12, 2019
2 parents 286d6d1 + 2f7501d commit a158a1a
Show file tree
Hide file tree
Showing 43 changed files with 3,009 additions and 515 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -20,5 +20,5 @@ require "yast/rake"

Yast::Tasks.configuration do |conf|
conf.skip_license_check << /.*/
conf.documentation_minimal = 87
conf.documentation_minimal = 89
end
9 changes: 9 additions & 0 deletions package/yast2-storage-ng.changes
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Jul 12 12:24:36 UTC 2019 - David Diaz <dgonzalez@suse.com>

- Guided Setup: added support for the new control file option
"allocate_volume_mode". When set to "device", this option allows
the user to specify a device per each volume (part of
jsc#SLE-7238).
- 4.2.27

-------------------------------------------------------------------
Wed Jul 10 11:31:18 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
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 4.2.26
Version: 4.2.27
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
68 changes: 51 additions & 17 deletions src/lib/y2storage/dialogs/guided_setup.rb
Expand Up @@ -21,7 +21,9 @@
require "y2storage/disk_analyzer"
require "y2storage/proposal_settings"
require "y2storage/dialogs/guided_setup/select_disks"
require "y2storage/dialogs/guided_setup/select_volumes_disks"
require "y2storage/dialogs/guided_setup/select_root_disk"
require "y2storage/dialogs/guided_setup/select_partition_actions"
require "y2storage/dialogs/guided_setup/select_scheme"
require "y2storage/dialogs/guided_setup/select_filesystem"
require "y2storage/partitioning_features"
Expand Down Expand Up @@ -85,23 +87,6 @@ def initialize(settings, analyzer)
#
# @return [Symbol] Last step result
def run
aliases = {
"select_disks" => -> { run_dialog(SelectDisks) },
"select_root_disk" => -> { run_dialog(SelectRootDisk) },
"select_scheme" => -> { run_dialog(SelectScheme) },
"select_filesystem" => -> { run_dialog(select_filesystem_class) }
}

common_actions = { back: :back, cancel: :cancel, abort: :abort }

sequence = {
"ws_start" => "select_disks",
"select_disks" => common_actions.merge(next: "select_root_disk"),
"select_root_disk" => common_actions.merge(next: "select_scheme"),
"select_scheme" => common_actions.merge(next: "select_filesystem"),
"select_filesystem" => common_actions.merge(next: :next)
}

Yast::Wizard.OpenNextBackDialog
Yast::Wizard.SetAbortButton(:cancel, Yast::Label.CancelButton)

Expand All @@ -121,6 +106,55 @@ def allowed?

private

def aliases
{
"select_disks" => -> { run_dialog(SelectDisks) },
"select_volumes_disks" => -> { run_dialog(SelectVolumesDisks) },
"select_root_disk" => -> { run_dialog(SelectRootDisk) },
"select_scheme" => -> { run_dialog(SelectScheme) },
"select_filesystem" => -> { run_dialog(select_filesystem_class) },
"select_partition_actions" => -> { run_dialog(SelectPartitionActions) }
}
end

def sequence
steps =
case settings.allocate_volume_mode
when :auto
["select_disks", "select_root_disk", "select_scheme", "select_filesystem"]
when :device
["select_scheme", "select_filesystem", "select_volumes_disks",
"select_partition_actions"]
end

sequence_for(steps)
end

# Generates the sequence based on given steps
#
# @example
# sequence_for(["first_step", "second_step", "third_step"]) #=> {
# "ws_start" => "first_step",
# "first_step" => { back: back, cancel: :cancel, abort: :abort, next: "second_step" }
# "second_step" => { back: back, cancel: :cancel, abort: :abort, next: "third_step" }
# "third_step" => { back: back, cancel: :cancel, abort: :abort, next: :next }
# }
#
# @param steps [Array<String>]
# @return [Hash] generated sequence
def sequence_for(steps)
common_actions = { back: :back, cancel: :cancel, abort: :abort }

sequence = { "ws_start" => steps.first }

steps.each_with_index do |step, idx|
next_step = steps[idx + 1] || :next
sequence[step] = common_actions.merge(next: next_step)
end

sequence
end

# Run the dialog or skip when necessary.
def run_dialog(dialog_class)
dialog = dialog_class.new(self)
Expand Down
111 changes: 111 additions & 0 deletions src/lib/y2storage/dialogs/guided_setup/helpers/candidate_disks.rb
@@ -0,0 +1,111 @@
# Copyright (c) [2019] SUSE LLjkkC#
# 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.

require "yast"
require "y2storage"

module Y2Storage
module Dialogs
class GuidedSetup
module Helpers
# Helper that provides a handful of methods to query information related to candidate disks,
# mainly about partitions.
class CandidateDisks
# Constructor
#
# @param settings [ProposalSettings]
# @param analyzer [Y2Storage::DiskAnalayzer]
def initialize(settings, analyzer)
@settings = settings
@analyzer = analyzer
end

# Candidate disks to perform the installation
#
# @return
def candidate_disks
return @candidate_disks if @candidate_disks

candidates = settings.candidate_devices || []
@candidate_disks = candidates.map { |d| analyzer.device_by_name(d) }
end

# Candidate disks names
#
# @return [Array<String>]
def candidate_disks_names
candidate_disks.map(&:name)
end

# Whether there is only one candidate disk
#
# @return [Boolean]
def single_candidate_disk?
candidate_disks.size == 1
end

# All partitions from the candidate disks
#
# @return [Array<Y2Storage::Partition>]
def partitions
@partitions ||= candidate_disks.map(&:partitions).flatten
end

# Whether the actions (delete or resize) over Windows partitions are configurable
#
# @return [Boolean]
def windows_partitions?
!windows_partitions.empty?
end

# Whether the actions (delete) over Linux partitions are configurable
#
# @return [Boolean]
def linux_partitions?
!linux_partitions.empty?
end

# Whether the actions (delete) over other kind of partitions are configurable
#
# @return [Boolean]
def other_partitions?
partitions.size > linux_partitions.size + windows_partitions.size
end

# Windows partitions from the candidate disks
#
# @return [Array<Y2Storage::Partition>]
def windows_partitions
analyzer.windows_partitions(*candidate_disks)
end

# Linux partitions from the candidate disks
#
# @return [Array<Y2Storage::Partition>]
def linux_partitions
analyzer.linux_partitions(*candidate_disks)
end

private

attr_reader :settings, :analyzer
end
end
end
end
end
11 changes: 2 additions & 9 deletions src/lib/y2storage/dialogs/guided_setup/select_filesystem/base.rb
Expand Up @@ -38,15 +38,8 @@ def dialog_title
end

def help_text
settings.lvm ? help_text_for_volumes : help_text_for_partitions
end

def help_text_for_volumes
_("Select the filesystem type for each of the volumes.")
end

def help_text_for_partitions
_("Select the filesystem type for each of the partitions.")
_("Select the filesystem type for each LVM Volume Group, " \
"LVM Logical Volume, and/or partition.")
end
end
end
Expand Down

0 comments on commit a158a1a

Please sign in to comment.