From 64c713177d5ba6c56e6f87f3bf7b3cb3e409e786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Fri, 11 Nov 2016 12:58:34 +0000 Subject: [PATCH] Revert FATE#320342 and FATE#317775 (#242) * Revert these commits: - "FileSystems is responsible for setting default_subvol" (f1b7098c078341040962993c881da316d49f616c) - "Add cheetah and abstract_method to Travis configuration" (130d95b110d48849d13382b7d3a87b3d3cce0e86) - "Improve btrfs_subvol_name_for" (a8d9f09588cb4668b780a0441b152c322627e33e) - "Break circular dependency between Storage and FileSystems" (32a1399c42728744e919c47dd78a40ffdecf17ab) - "Improve FileSystems module tests" (1b58758063e19eff51c04538b8967a39cd0cc153) - "Rename default_subvol_from_{filesystem,target}" (84eebbd7a85212a9065bbfbec606459838f5b60f) - "Add a method to read/store the default subvolume name" (a8317123ae030888351b0d3732a977a3b20337a3) - "Add a method to find the Btrfs default_subvol" (b745e190920abb42cd16a8f2ad02511f339a4988) - "Add a method to change Btrfs default subvolume" (00aa17f403d0df91c6cbfb8018e41c4aa6d8a4e8) * Bump version and update changes file --- .travis.yml | 2 +- package/yast2-storage.changes | 8 + package/yast2-storage.spec | 2 +- src/modules/FileSystems.rb | 89 +----------- src/modules/Storage.rb | 6 +- test/filesystems_test.rb | 103 ------------- test/fixtures/btrfs_list_data_no_at.out | 3 - test/fixtures/btrfs_list_root.out | 28 ---- test/fixtures/btrfs_list_root_no_at.out | 27 ---- test/fixtures/btrfs_list_srv.out | 5 - test/fixtures/btrfs_list_srv_no_at.out | 5 - test/fixtures/subvolumes-no-root.yml | 180 ----------------------- test/fixtures/subvolumes.yml | 185 ------------------------ test/storage_test.rb | 13 +- 14 files changed, 20 insertions(+), 636 deletions(-) delete mode 100644 test/filesystems_test.rb delete mode 100644 test/fixtures/btrfs_list_data_no_at.out delete mode 100644 test/fixtures/btrfs_list_root.out delete mode 100644 test/fixtures/btrfs_list_root_no_at.out delete mode 100644 test/fixtures/btrfs_list_srv.out delete mode 100644 test/fixtures/btrfs_list_srv_no_at.out delete mode 100644 test/fixtures/subvolumes-no-root.yml delete mode 100644 test/fixtures/subvolumes.yml diff --git a/.travis.yml b/.travis.yml index fddd36443..62d878530 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/package/yast2-storage.changes b/package/yast2-storage.changes index d0750cbd4..560a366ad 100644 --- a/package/yast2-storage.changes +++ b/package/yast2-storage.changes @@ -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 diff --git a/package/yast2-storage.spec b/package/yast2-storage.spec index 82254e9ed..416c050d1 100644 --- a/package/yast2-storage.spec +++ b/package/yast2-storage.spec @@ -17,7 +17,7 @@ Name: yast2-storage -Version: 3.1.103.2 +Version: 3.1.103.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff --git a/src/modules/FileSystems.rb b/src/modules/FileSystems.rb index 75645f9e5..abecb09f2 100644 --- a/src/modules/FileSystems.rb +++ b/src/modules/FileSystems.rb @@ -31,18 +31,9 @@ # $Id$ require "storage" require "yast" -require "yast2/execute" module Yast class FileSystemsClass < Module - include Yast::Logger - - # @return [Array] Supported default subvolume names - SUPPORTED_DEFAULT_SUBVOLUME_NAMES = ["", "@"].freeze - - # @return [String] Default subvolume name. - attr_reader :default_subvol - def main textdomain "storage" @@ -53,7 +44,6 @@ def main Yast.import "Encoding" Yast.import "Stage" Yast.import "StorageInit" - Yast.import "ProductFeatures" @conv_fs = { "def_sym" => :unknown, @@ -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 = [] @@ -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 @@ -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 " publish :variable => :possible_root_fs, :type => "const list " publish :function => :system_m_points, :type => "list ()" publish :function => :crypt_m_points, :type => "list ()" publish :variable => :swap_m_points, :type => "const list " publish :variable => :tmp_m_points, :type => "const list " + 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 ()" publish :function => :SuggestTmpfsMPoints, :type => "list ()" publish :function => :GetGeneralFstabOptions, :type => "list > ()" diff --git a/src/modules/Storage.rb b/src/modules/Storage.rb index 55a726187..c490c3730 100644 --- a/src/modules/Storage.rb +++ b/src/modules/Storage.rb @@ -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) @@ -371,7 +375,7 @@ def FinishLibstorage def default_subvolume_name() - FileSystems.default_subvol + return @sint.getDefaultSubvolName() end diff --git a/test/filesystems_test.rb b/test/filesystems_test.rb deleted file mode 100644 index 2ed72d313..000000000 --- a/test/filesystems_test.rb +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env rspec - -require_relative "spec_helper" - -Yast.import "FileSystems" -Yast.import "Storage" - -describe Yast::FileSystems do - subject { Yast::FileSystems } - - def btrfs_list_fixture(name) - fixture_name = "btrfs_list_#{name}.out" - File.read(File.join(FIXTURES_PATH, fixture_name)) - end - - let(:default_subvol) { "@" } - let(:libstorage) do - double("libstorage", getDefaultSubvolName: default_subvol, setDefaultSubvolName: default_subvol) - end - - before do - subject.InitSlib(libstorage) - end - - describe "#default_subvol_from_target" do - before do - allow(Yast::Storage).to receive(:GetTargetMap).and_return(target_map) - allow(Yast::ProductFeatures).to receive(:GetStringFeature) - .with("partitioning", "btrfs_default_subvolume").and_return(default_subvol) - end - - context "when root partition uses the default subvolume name (@)" do - let(:target_map) { YAML.load_file(File.join(FIXTURES_PATH, "subvolumes.yml")) } - - before do - allow(Yast::Execute).to receive(:on_target).with("btrfs", "subvol", "list", "/", anything) - .and_return(btrfs_list_fixture("root")) - allow(Yast::Execute).to receive(:on_target).with("btrfs", "subvol", "list", "/srv", anything) - .and_return(btrfs_list_fixture("root_no_at")) - end - - it "returns the default subvolume name" do - expect(subject.default_subvol_from_target).to eq(default_subvol) - end - end - - context "when root partitions does not use btrfs" do - let(:target_map) { YAML.load_file(File.join(FIXTURES_PATH, "subvolumes-no-root.yml")) } - - before do - allow(Yast::Execute).to receive(:on_target).with("btrfs", "subvol", "list", "/", anything) - .and_return(btrfs_list_fixture("root_no_at")) - end - - context "but all btrfs partitions uses the same subvolume name" do - before do - allow(Yast::Execute).to receive(:on_target).with("btrfs", "subvol", "list", "/srv", anything) - .and_return(btrfs_list_fixture("srv_no_at")) - allow(Yast::Execute).to receive(:on_target).with("btrfs", "subvol", "list", "/data", anything) - .and_return(btrfs_list_fixture("data_no_at")) - end - - it "returns the used name ('' in this case)" do - expect(subject.default_subvol_from_target).to eq("") - end - end - - context "and btrfs partitions uses different subvolume names" do - before do - allow(Yast::Execute).to receive(:on_target).with("btrfs", "subvol", "list", "/srv", anything) - .and_return(btrfs_list_fixture("srv")) - allow(Yast::Execute).to receive(:on_target).with("btrfs", "subvol", "list", "/data", anything) - .and_return(btrfs_list_fixture("data_no_at")) - end - - it "returns the distribution default" do - expect(subject.default_subvol_from_target).to eq(default_subvol) - end - end - end - end - - describe "#read_default_subvol_from_target" do - it "sets the default_subvol using the value from target" do - subject.default_subvol = "" - expect(subject).to receive(:default_subvol_from_target).and_return("@") - expect { subject.read_default_subvol_from_target }.to change { subject.default_subvol } - .from("").to("@") - end - end - - describe "#default_subvol=" do - it "sets the default_subvol if a valid value is given" do - expect(libstorage).to receive(:setDefaultSubvolName).with("@") - subject.default_subvol = "@" - end - - it "refuses to set default_subvol if an invalid value is given" do - expect(libstorage).to_not receive(:setDefaultSubvolName) - subject.default_subvol = "UNDEFINED" - end - end -end diff --git a/test/fixtures/btrfs_list_data_no_at.out b/test/fixtures/btrfs_list_data_no_at.out deleted file mode 100644 index 27370336a..000000000 --- a/test/fixtures/btrfs_list_data_no_at.out +++ /dev/null @@ -1,3 +0,0 @@ -ID 257 gen 16 top level 5 path shared -ID 258 gen 16 top level 5 path private - diff --git a/test/fixtures/btrfs_list_root.out b/test/fixtures/btrfs_list_root.out deleted file mode 100644 index e34107063..000000000 --- a/test/fixtures/btrfs_list_root.out +++ /dev/null @@ -1,28 +0,0 @@ -ID 257 gen 34 top level 5 path @ -ID 258 gen 51 top level 257 path @/.snapshots -ID 259 gen 88 top level 258 path @/.snapshots/1/snapshot -ID 260 gen 44 top level 257 path @/boot/grub2/i386-pc -ID 261 gen 15 top level 257 path @/boot/grub2/x86_64-efi -ID 262 gen 44 top level 257 path @/home -ID 263 gen 51 top level 257 path @/opt -ID 264 gen 50 top level 257 path @/srv -ID 265 gen 88 top level 257 path @/tmp -ID 266 gen 64 top level 257 path @/usr/local -ID 267 gen 38 top level 257 path @/var/crash -ID 268 gen 22 top level 257 path @/var/lib/mailman -ID 269 gen 88 top level 257 path @/var/lib/named -ID 270 gen 24 top level 257 path @/var/lib/pgsql -ID 271 gen 88 top level 257 path @/var/log -ID 272 gen 38 top level 257 path @/var/opt -ID 273 gen 84 top level 257 path @/var/spool -ID 274 gen 51 top level 257 path @/var/tmp -ID 275 gen 30 top level 257 path @/mysubvol -ID 276 gen 47 top level 275 path @/mysubvol/mysubsubvol -ID 277 gen 32 top level 257 path @/myothersubvol -ID 278 gen 47 top level 277 path @/myothersubvol/myothersubsubvol -ID 279 gen 33 top level 257 path @/nocow -ID 280 gen 35 top level 257 path @/myvol -ID 282 gen 40 top level 259 path var/lib/machines -ID 283 gen 48 top level 258 path @/.snapshots/2/snapshot -ID 284 gen 49 top level 258 path @/.snapshots/3/snapshot -ID 285 gen 50 top level 258 path @/.snapshots/4/snapshot diff --git a/test/fixtures/btrfs_list_root_no_at.out b/test/fixtures/btrfs_list_root_no_at.out deleted file mode 100644 index 9f539ddca..000000000 --- a/test/fixtures/btrfs_list_root_no_at.out +++ /dev/null @@ -1,27 +0,0 @@ -ID 257 gen 48 top level 5 path .snapshots -ID 258 gen 92 top level 257 path .snapshots/1/snapshot -ID 259 gen 41 top level 5 path boot/grub2/i386-pc -ID 260 gen 12 top level 5 path boot/grub2/x86_64-efi -ID 261 gen 41 top level 5 path home -ID 262 gen 49 top level 5 path opt -ID 263 gen 47 top level 5 path srv -ID 264 gen 91 top level 5 path tmp -ID 265 gen 61 top level 5 path usr/local -ID 266 gen 35 top level 5 path var/crash -ID 267 gen 19 top level 5 path var/lib/mailman -ID 268 gen 89 top level 5 path var/lib/named -ID 269 gen 21 top level 5 path var/lib/pgsql -ID 270 gen 90 top level 5 path var/log -ID 271 gen 35 top level 5 path var/opt -ID 272 gen 91 top level 5 path var/spool -ID 273 gen 48 top level 5 path var/tmp -ID 274 gen 27 top level 5 path mysubvol -ID 275 gen 44 top level 274 path mysubvol/mysubsubvol -ID 276 gen 29 top level 5 path @/myothersubvol -ID 277 gen 44 top level 276 path @/myothersubvol/myothersubsubvol -ID 278 gen 30 top level 5 path nocow -ID 279 gen 32 top level 5 path myvol -ID 281 gen 37 top level 258 path var/lib/machines -ID 282 gen 45 top level 257 path .snapshots/2/snapshot -ID 283 gen 46 top level 257 path .snapshots/3/snapshot -ID 284 gen 47 top level 257 path .snapshots/4/snapshot diff --git a/test/fixtures/btrfs_list_srv.out b/test/fixtures/btrfs_list_srv.out deleted file mode 100644 index 5e21e125a..000000000 --- a/test/fixtures/btrfs_list_srv.out +++ /dev/null @@ -1,5 +0,0 @@ -ID 257 gen 16 top level 5 path @ -ID 258 gen 16 top level 257 path www -ID 259 gen 16 top level 257 path mirror -ID 260 gen 16 top level 257 path ftp -ID 261 gen 16 top level 257 path tftpboot diff --git a/test/fixtures/btrfs_list_srv_no_at.out b/test/fixtures/btrfs_list_srv_no_at.out deleted file mode 100644 index a84572a69..000000000 --- a/test/fixtures/btrfs_list_srv_no_at.out +++ /dev/null @@ -1,5 +0,0 @@ -ID 257 gen 16 top level 5 path www -ID 258 gen 16 top level 5 path mirror -ID 259 gen 16 top level 5 path ftp -ID 260 gen 16 top level 5 path tftpboot - diff --git a/test/fixtures/subvolumes-no-root.yml b/test/fixtures/subvolumes-no-root.yml deleted file mode 100644 index fd889edf6..000000000 --- a/test/fixtures/subvolumes-no-root.yml +++ /dev/null @@ -1,180 +0,0 @@ ---- -"/dev/vda": - unique: KSbE.Fxp0d3BezAE - bus: None - device: "/dev/vda" - bios_id: '0x80' - driver: virtio-pci - driver_module: virtio_pci - partitions: - - device: "/dev/vda1" - name: vda1 - used_by_type: :UB_NONE - used_by_device: '' - size_k: 264192 - used_fs: :swap - detected_fs: :swap - mount: swap - mountby: :uuid - fstopt: defaults - uuid: 559e2279-4012-4174-a746-e4664031851d - nr: 1 - fsid: 130 - fstype: Linux swap - region: - - 0 - - 34 - type: :primary - - device: "/dev/vda2" - name: vda2 - used_by_type: :UB_NONE - used_by_device: '' - size_k: 5244928 - used_fs: :ext4 - detected_fs: :ext4 - mount: "/" - mountby: :uuid - fstopt: acl,user_xattr - uuid: 323a8681-4229-4e3f-ac67-c0b70b148ecd - nr: 2 - fsid: 131 - fstype: Linux native - region: - - 33 - - 653 - type: :primary - boot: true - - device: "/dev/vda3" - name: vda3 - used_by: - - type: :UB_BTRFS - device: e71f8bec-08b6-441c-a2d0-b25cc7bc856a - used_by_type: :UB_BTRFS - used_by_device: e71f8bec-08b6-441c-a2d0-b25cc7bc856a - size_k: 2618368 - used_fs: :btrfs - detected_fs: :btrfs - fstopt: defaults - nr: 3 - fsid: 131 - fstype: Linux native - region: - - 685 - - 327 - type: :primary - subvol: - - name: "@/www" - - name: "@/ftp" - - name: "@/mirror" - uuid: e71f8bec-08b6-441c-a2d0-b25cc7bc856a - mount: "/srv" - mountby: :uuid - - device: "/dev/vda4" - name: vda4 - used_by: - - type: :UB_BTRFS - device: aa2af2cd-d43e-44b1-8025-e3d119070d47 - used_by_type: :UB_BTRFS - used_by_device: aa2af2cd-d43e-44b1-8025-e3d119070d47 - size_k: 2357248 - used_fs: :btrfs - detected_fs: :btrfs - fstopt: defaults - nr: 4 - fsid: 131 - fstype: Linux native - region: - - 1011 - - 294 - type: :primary - uuid: aa2af2cd-d43e-44b1-8025-e3d119070d47 - mount: "/data" - mountby: :uuid - size_k: 10485760 - cyl_size: 8225280 - cyl_count: 1305 - sector_size: 512 - label: msdos - name: vda - max_logical: 255 - max_primary: 4 - type: :CT_DISK - transport: :unknown - used_by_type: :UB_NONE - used_by_device: '' - dasd_format: 0 - dasd_type: 0 -"/dev/btrfs": - device: "/dev/btrfs" - name: btrfs - used_by_type: :UB_NONE - used_by_device: '' - type: :CT_BTRFS - partitions: [] -"/dev/tmpfs": - device: "/dev/tmpfs" - name: tmpfs - used_by_type: :UB_NONE - used_by_device: '' - type: :CT_TMPFS - partitions: - - device: tmpfs - name: none - used_by_type: :UB_NONE - used_by_device: '' - size_k: 507800 - used_fs: :tmpfs - detected_fs: :tmpfs - mount: "/dev/shm" - mountby: :uuid - ignore_fstab: true - type: :tmpfs - fstype: TMPFS - - device: tmpfs - name: none - used_by_type: :UB_NONE - used_by_device: '' - size_k: 507800 - used_fs: :tmpfs - detected_fs: :tmpfs - mount: "/run" - mountby: :uuid - ignore_fstab: true - type: :tmpfs - fstype: TMPFS - - device: tmpfs - name: none - used_by_type: :UB_NONE - used_by_device: '' - size_k: 507800 - used_fs: :tmpfs - detected_fs: :tmpfs - mount: "/sys/fs/cgroup" - mountby: :uuid - ignore_fstab: true - type: :tmpfs - fstype: TMPFS - - device: tmpfs - name: none - used_by_type: :UB_NONE - used_by_device: '' - size_k: 101564 - used_fs: :tmpfs - detected_fs: :tmpfs - mount: "/run/user/483" - mountby: :uuid - ignore_fstab: true - type: :tmpfs - fstype: TMPFS - - device: tmpfs - name: none - used_by_type: :UB_NONE - used_by_device: '' - size_k: 101564 - used_fs: :tmpfs - detected_fs: :tmpfs - mount: "/run/user/0" - mountby: :uuid - ignore_fstab: true - type: :tmpfs - fstype: TMPFS diff --git a/test/fixtures/subvolumes.yml b/test/fixtures/subvolumes.yml deleted file mode 100644 index 308ecdb0c..000000000 --- a/test/fixtures/subvolumes.yml +++ /dev/null @@ -1,185 +0,0 @@ ---- -"/dev/vda": - unique: KSbE.Fxp0d3BezAE - bus: None - device: "/dev/vda" - bios_id: '0x80' - driver: virtio-pci - driver_module: virtio_pci - partitions: - - device: "/dev/vda1" - name: vda1 - used_by: - - type: :UB_BTRFS - device: 8e6e04a4-758f-4d43-bab8-6b3dca3d31e2 - used_by_type: :UB_BTRFS - used_by_device: 8e6e04a4-758f-4d43-bab8-6b3dca3d31e2 - size_k: 13925376 - used_fs: :btrfs - detected_fs: :btrfs - fstopt: defaults - nr: 2 - fsid: 131 - fstype: Linux native - region: - - 93 - - 1734 - type: :primary - boot: true - subvol: - - name: "@" - - name: "@/.snapshots" - - name: "@/.snapshots/1/snapshot" - - name: "@/home" - - name: "@/var/log" - - name: "@/var/lib/pgsql" - - name: "@/myvol" - nocow: true - - name: "@/.snapshots/1/snapshot/var/lib/machines" - - name: "@/.snapshots/2/snapshot" - - name: "@/.snapshots/3/snapshot" - - name: "@/.snapshots/4/snapshot" - uuid: 8e6e04a4-758f-4d43-bab8-6b3dca3d31e2 - mount: "/" - mountby: :uuid - size_k: 14680064 - cyl_size: 8225280 - cyl_count: 1827 - sector_size: 512 - label: msdos - name: vda - max_logical: 255 - max_primary: 4 - type: :CT_DISK - transport: :unknown - used_by_type: :UB_NONE - used_by_device: '' - dasd_format: 0 - dasd_type: 0 -"/dev/vdb": - unique: KSbE.Fxp0d3BezAE - bus: None - device: "/dev/vdb" - bios_id: '0x80' - driver: virtio-pci - driver_module: virtio_pci - partitions: - - device: "/dev/vdb1" - name: vdb1 - used_by_type: :UB_NONE - used_by_device: '' - size_k: 753664 - used_fs: :swap - detected_fs: :swap - mount: swap - mountby: :uuid - fstopt: defaults - uuid: 3fc06e37-d6b6-4411-baf3-2920cdf19fa4 - nr: 1 - fsid: 130 - fstype: Linux swap - region: - - 0 - - 94 - type: :primary - - device: "/dev/vdb2" - name: vdb2 - used_by: - - type: :UB_BTRFS - device: 862e2cbf-0501-48a1-85a3-142bfe3ab51b - used_by_type: :UB_BTRFS - used_by_device: 862e2cbf-0501-48a1-85a3-142bfe3ab51b - size_k: 13925376 - used_fs: :btrfs - detected_fs: :btrfs - fstopt: defaults - nr: 2 - fsid: 131 - fstype: Linux native - region: - - 93 - - 1734 - type: :primary - boot: true - subvol: - - name: shared - - name: www - uuid: 862e2cbf-0501-48a1-85a3-142bfe3ab51b - mount: "/srv" - mountby: :uuid - size_k: 14680064 - cyl_size: 8225280 - cyl_count: 1827 - sector_size: 512 - label: msdos - name: vdb - max_logical: 255 - max_primary: 4 - type: :CT_DISK - transport: :unknown - used_by_type: :UB_NONE - used_by_device: '' - dasd_format: 0 - dasd_type: 0 -"/dev/btrfs": - device: "/dev/btrfs" - name: btrfs - used_by_type: :UB_NONE - used_by_device: '' - type: :CT_BTRFS - partitions: [] -"/dev/tmpfs": - device: "/dev/tmpfs" - name: tmpfs - used_by_type: :UB_NONE - used_by_device: '' - type: :CT_TMPFS - partitions: - - device: tmpfs - name: none - used_by_type: :UB_NONE - used_by_device: '' - size_k: 233312 - used_fs: :tmpfs - detected_fs: :tmpfs - mount: "/dev/shm" - mountby: :uuid - ignore_fstab: true - type: :tmpfs - fstype: TMPFS - - device: tmpfs - name: none - used_by_type: :UB_NONE - used_by_device: '' - size_k: 233312 - used_fs: :tmpfs - detected_fs: :tmpfs - mount: "/run" - mountby: :uuid - ignore_fstab: true - type: :tmpfs - fstype: TMPFS - - device: tmpfs - name: none - used_by_type: :UB_NONE - used_by_device: '' - size_k: 233312 - used_fs: :tmpfs - detected_fs: :tmpfs - mount: "/sys/fs/cgroup" - mountby: :uuid - ignore_fstab: true - type: :tmpfs - fstype: TMPFS - - device: tmpfs - name: none - used_by_type: :UB_NONE - used_by_device: '' - size_k: 46664 - used_fs: :tmpfs - detected_fs: :tmpfs - mount: "/run/user/0" - mountby: :uuid - ignore_fstab: true - type: :tmpfs - fstype: TMPFS \ No newline at end of file diff --git a/test/storage_test.rb b/test/storage_test.rb index 46ac8305a..54de027c2 100755 --- a/test/storage_test.rb +++ b/test/storage_test.rb @@ -8,23 +8,14 @@ Yast.import "StorageInit" describe "Yast::Storage" do - subject { Yast::Storage } - before do - subject.InitLibstorage(false) + Yast::Storage.InitLibstorage(false) end describe "#SetUserdata" do it "sets given user data for a given device" do # non-zero error for device that does not exist - expect(subject.SetUserdata("/dev/ice/does/not/exist", { "/" => "snapshots" })).not_to eq(0) - end - end - - describe "#default_subvolume_name" do - it "returns the default subvolume name according to FileSystems" do - expect(Yast::FileSystems).to receive(:default_subvol).and_return("SOME-VALUE") - expect(subject.default_subvolume_name).to eq("SOME-VALUE") + expect(Yast::Storage.SetUserdata("/dev/ice/does/not/exist", { "/" => "snapshots" })).not_to eq(0) end end end