Skip to content

Commit

Permalink
Merge branch 'SLE-12-SP2' into no_subvol_casp
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Jan 10, 2017
2 parents 560ebc4 + 3a5911b commit 4a13123
Show file tree
Hide file tree
Showing 20 changed files with 63 additions and 751 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before_install:
# disable rvm, use system Ruby
- rvm reset
- wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh
- sh ./travis_setup.sh -p "rake yast2-core-dev yast2 yast2-devtools doxygen yast2-testsuite libstorage5-dev libstorage5-ruby ruby-dbus" -g "rspec:3.3.0 yast-rake gettext cheetah abstract_method"
- sh ./travis_setup.sh -p "rake yast2-core-dev yast2 yast2-devtools doxygen yast2-testsuite libstorage5-dev libstorage5-ruby ruby-dbus" -g "rspec:3.3.0 yast-rake gettext"
script:
- rake check:syntax
- rake check:pot
Expand Down
25 changes: 24 additions & 1 deletion package/yast2-storage.changes
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
-------------------------------------------------------------------
Tue Jan 10 14:41:54 UTC 2017 - ancor@suse.com

- Avoid recurring error pop-up in the expert partitioner when the
user has removed all the Btrfs subvolumes (bsc#1008740)
- 3.1.106.1

-------------------------------------------------------------------
Tue Jan 10 14:35:18 UTC 2017 - ancor@suse.com

- fixed installing required storage packages for unmounted
filesystems (bsc#907331)
- Backport (cherry-pick) of the original change done by
aschnell@suse.com in version 3.1.105

-------------------------------------------------------------------
Tue Jan 10 14:26:32 UTC 2017 - ancor@suse.com

- removed displaying /var/log/messages (bsc#933517)
- Backport (cherry-pick) of the original change done by
aschnell@suse.com in version 3.1.104

-------------------------------------------------------------------
Thu Nov 17 13:40:37 CET 2016 - shundhammer@suse.de

- Don't show [Edit Proposal Settings] button if disabled
in control.xml (Fate#321736)
- Added warning popup for expert partitioner if configured
in control.xml
- 3.1.103.3
- 3.1.103.3 (wrong version, was conflicting with the same
one in the SLE-12-SP2 branch)

-------------------------------------------------------------------
Mon Oct 31 13:11:04 UTC 2016 - igonzalezsosa@suse.com
Expand Down
2 changes: 1 addition & 1 deletion package/yast2-storage.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-storage
Version: 3.1.103.3
Version: 3.1.106.1
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
1 change: 0 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ ynclude_DATA = \
include/partitioning/custom_part_check_generated.rb \
include/partitioning/auto_part_ui.rb \
include/partitioning/ep-hd-dialogs.rb \
include/partitioning/ep-log.rb \
include/partitioning/ep-loop.rb \
include/partitioning/lvm_pv_lib.rb \
include/partitioning/ep-loop-lib.rb \
Expand Down
92 changes: 0 additions & 92 deletions src/include/partitioning/ep-log.rb

This file was deleted.

19 changes: 0 additions & 19 deletions src/include/partitioning/ep-main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def initialize_partitioning_ep_main(include_target)
Yast.include include_target, "partitioning/ep-graph.rb"
Yast.include include_target, "partitioning/ep-summary.rb"
Yast.include include_target, "partitioning/ep-settings.rb"
Yast.include include_target, "partitioning/ep-log.rb"
end

def UpdateTableFocus(device)
Expand Down Expand Up @@ -171,11 +170,6 @@ def MakeNavigationTree(open_items)
:create => fun_ref(method(:CreateSettingsPanel), "void (any)"),
:handle => fun_ref(method(:HandleSettingsPanel), "void (any, map)"),
:destroy => fun_ref(method(:DestroySettingsPanel), "void (any)")
},
:log => {
:create => fun_ref(method(:CreateLogPanel), "void (any)"),
:handle => fun_ref(method(:HandleLogPanel), "void (any, map)"),
:destroy => fun_ref(method(:DestroyLogPanel), "void (any)")
}
}

Expand Down Expand Up @@ -483,19 +477,6 @@ def MakeNavigationTree(open_items)
)
)

if Mode.normal
# tree node label
tree = Builtins.add(
tree,
Item(
Id(:log),
term(:icon, StorageIcons.log_icon),
_("Log"),
open.call(:log)
)
)
end

return tree, data

end
Expand Down
4 changes: 3 additions & 1 deletion src/lib/storage/shadowed_vol_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ def restore_aborted_subvols(target_part)
name = subvol["name"]
log.info "Restore subvol #{name}?"
log.debug "subvol: #{subvol}"
existing_subvol = target_part["subvol"].detect { |s| s["name"] == name}
subvols = target_part["subvol"] || []
existing_subvol = subvols.detect { |s| s["name"] == name}
if existing_subvol.nil?
log.info "Restoring subvol"
target_part["subvol"] ||= []
target_part["subvol"] << subvol
elsif existing_subvol["delete"]
log.info "Rejecting subvol deletion"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/storage/used_storage_features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ def collect_volume_features(vol)
feature_check(features, "Volume", name) { USED_BY_FEATURES[u.type] }
end

feature_check(features, "Volume", name, "filesystem") { FILESYSTEM_FEATURES[vol.fs] }
feature_check(features, "Volume", name, "encryption") { ENCRYPTION_FEATURES[vol.encryption] }

if !vol.mount.empty?
feature_check(features, "Volume", name, "filesystem") { FILESYSTEM_FEATURES[vol.fs] }
feature_check(features, "Volume", name) { snapshots?(vol) ? :FT_SNAPSHOTS : nil }
feature_check(features, "Root FS", name) { root_btrfs?(vol) ? :FT_BTRFS_ROOT : nil }

Expand Down
89 changes: 3 additions & 86 deletions src/modules/FileSystems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,9 @@
# $Id$
require "storage"
require "yast"
require "yast2/execute"

module Yast
class FileSystemsClass < Module
include Yast::Logger

# @return [Array<String>] Supported default subvolume names
SUPPORTED_DEFAULT_SUBVOLUME_NAMES = ["", "@"].freeze

# @return [String] Default subvolume name.
attr_reader :default_subvol

def main

textdomain "storage"
Expand All @@ -53,7 +44,6 @@ def main
Yast.import "Encoding"
Yast.import "Stage"
Yast.import "StorageInit"
Yast.import "ProductFeatures"

@conv_fs = {
"def_sym" => :unknown,
Expand Down Expand Up @@ -84,8 +74,7 @@ def main
@possible_root_fs = [:ext2, :ext3, :ext4, :btrfs, :reiser, :xfs]
@swap_m_points = ["swap"]
@tmp_m_points = ["/tmp", "/var/tmp"]
self.default_subvol = ProductFeatures.GetStringFeature("partitioning", "btrfs_default_subvolume")

@default_subvol = "UNDEFINED"

@suggest_m_points = []
@suggest_tmp_points = []
Expand Down Expand Up @@ -1450,7 +1439,7 @@ def FileSystems
def InitSlib(value)
@sint = value
if @sint != nil
@sint.setDefaultSubvolName(@default_subvol)
@default_subvol = @sint.getDefaultSubvolName()
Builtins.y2milestone(
"InitSlib used default_subvol:\"%1\"",
@default_subvol
Expand Down Expand Up @@ -2041,86 +2030,14 @@ def AddQuotaOpts(part, fst_opts)
ret
end

# Set the default subvolume name
#
# @param [String] Default subvolume name. Only "" and "@" are supported.
# @return [Boolean] True if subvolume was changed; false otherwise.
def default_subvol=(name)
if SUPPORTED_DEFAULT_SUBVOLUME_NAMES.include?(name)
@default_subvol = name
@sint.setDefaultSubvolName(name) unless @sint.nil?
true
else
log.warn "Unsupported default subvolume name='#{name}'. Ignoring."
false
end
end

# Try to find the default subvolume name in the target system
#
# * Root partition takes precedence
# * Not supported: more than 1 Btrfs filesystems, one using
# a '@' default subvolume and the other using ''. In that case,
# default_subvolume is set to product's default.
#
# @return [String,nil] Default subvolume from the target system
def default_subvol_from_target
Yast.import "Storage"
parts = Storage.GetTargetMap.map { |_k, d| d.fetch("partitions") }.flatten.compact
btrfs_parts = parts.select { |p| p["used_fs"] == :btrfs }
default_subvol_names = btrfs_parts.reduce({}) do |memo, part|
memo[part["mount"]] = btrfs_subvol_name_for(part["mount"]) unless part["mount"].nil?
memo
end

# Root takes precedence
return default_subvol_names["/"] if default_subvol_names.has_key?("/")

# If all has the same default subvolume name
found_names = default_subvol_names.values.uniq
return found_names.first if found_names.size == 1

# If there are different values, fallback to product's default
default_subvol_from_product
end

# Default subvol name from product
#
# @return [String] Default subvolume name
def default_subvol_from_product
ProductFeatures.GetStringFeature("partitioning", "btrfs_default_subvolume")
end

# Read the default subvolume from the filesystem and stores the value
#
# @return [String,nil] Default subvolume from the target system
# @see default_subvol_from_target
def read_default_subvol_from_target
self.default_subvol = default_subvol_from_target
end

protected

# Find the default subvolume name
#
# Only "" and "@" are supported.
#
# @param mount [String] Mount point.
# @return ["@", ""] Default subvolume name for the given mount point.
def btrfs_subvol_name_for(mount)
ret = Yast::Execute.on_target("btrfs", "subvol", "list", mount, stdout: :capture)
ret.split("\n").first =~ /.+ @\z/ ? "@" : ""
end

publish :variable => :conv_fs, :type => "map <string, any>"
publish :variable => :possible_root_fs, :type => "const list <symbol>"
publish :function => :system_m_points, :type => "list <string> ()"
publish :function => :crypt_m_points, :type => "list <string> ()"
publish :variable => :swap_m_points, :type => "const list <string>"
publish :variable => :tmp_m_points, :type => "const list <string>"
publish :variable => :default_subvol, :type => "string"
publish :variable => :nchars, :type => "string"
publish :function => :default_subvol, :type => "string ()"
publish :function => :default_subvol=, :type => "string (string)"
publish :function => :SuggestMPoints, :type => "list <string> ()"
publish :function => :SuggestTmpfsMPoints, :type => "list <string> ()"
publish :function => :GetGeneralFstabOptions, :type => "list <map <symbol, any>> ()"
Expand Down
6 changes: 5 additions & 1 deletion src/modules/Storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ def InitLibstorage(readonly)

StorageClients.InstallCallbacks(@sint)

btrfs_default_subvolume = ProductFeatures.GetStringFeature("partitioning",
"btrfs_default_subvolume")
@sint.setDefaultSubvolName(btrfs_default_subvolume) if btrfs_default_subvolume

if Stage.initial
@sint.setDetectMountedVolumes(false)
@sint.setRootPrefix(Installation.destdir)
Expand Down Expand Up @@ -371,7 +375,7 @@ def FinishLibstorage


def default_subvolume_name()
FileSystems.default_subvol
return @sint.getDefaultSubvolName()
end


Expand Down
Loading

0 comments on commit 4a13123

Please sign in to comment.