Skip to content

Commit

Permalink
Revert FATE#320342 and FATE#317775 (#242)
Browse files Browse the repository at this point in the history
* Revert these commits:
- "FileSystems is responsible for setting default_subvol" (f1b7098)
- "Add cheetah and abstract_method to Travis configuration" (130d95b)
- "Improve btrfs_subvol_name_for" (a8d9f09)
- "Break circular dependency between Storage and FileSystems" (32a1399)
- "Improve FileSystems module tests" (1b58758)
- "Rename default_subvol_from_{filesystem,target}" (84eebbd)
- "Add a method to read/store the default subvolume name" (a831712)
- "Add a method to find the Btrfs default_subvol" (b745e19)
- "Add a method to change Btrfs default subvolume" (00aa17f)

* Bump version and update changes file
  • Loading branch information
imobachgs committed Nov 11, 2016
1 parent a29db9b commit 64c7131
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 636 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
8 changes: 8 additions & 0 deletions package/yast2-storage.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Nov 11 11:28:31 UTC 2016 - igonzalezsosa@suse.com

- Remove support to redefine/detect Btrfs default subvolume
using AutoYaST as this feature won't be available in SLE 12 SP2
(FATE#320342 and FATE#317775).
- 3.1.103.3

-------------------------------------------------------------------
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.2
Version: 3.1.103.3
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
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
103 changes: 0 additions & 103 deletions test/filesystems_test.rb

This file was deleted.

3 changes: 0 additions & 3 deletions test/fixtures/btrfs_list_data_no_at.out

This file was deleted.

28 changes: 0 additions & 28 deletions test/fixtures/btrfs_list_root.out

This file was deleted.

27 changes: 0 additions & 27 deletions test/fixtures/btrfs_list_root_no_at.out

This file was deleted.

5 changes: 0 additions & 5 deletions test/fixtures/btrfs_list_srv.out

This file was deleted.

5 changes: 0 additions & 5 deletions test/fixtures/btrfs_list_srv_no_at.out

This file was deleted.

0 comments on commit 64c7131

Please sign in to comment.