commit autoyast2 for openSUSE:Factory
Hello community, here is the log from the commit of package autoyast2 for openSUSE:Factory checked in at 2016-11-12 12:59:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/autoyast2 (Old) and /work/SRC/openSUSE:Factory/.autoyast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "autoyast2" Changes: -------- --- /work/SRC/openSUSE:Factory/autoyast2/autoyast2.changes 2016-10-04 15:43:01.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.autoyast2.new/autoyast2.changes 2016-11-12 12:59:48.000000000 +0100 @@ -1,0 +2,9 @@ +Mon Oct 24 09:04:25 UTC 2016 - igonzalezsosa@suse.com + +- Add support to enable copy-on-write for Btrfs subvolumes + (FATE#320342) +- Add support to omit the Btrfs default subvolume name + (FATE#317775) +- 3.2.0 + +------------------------------------------------------------------- Old: ---- autoyast2-3.1.152.tar.bz2 New: ---- autoyast2-3.2.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ autoyast2.spec ++++++ --- /var/tmp/diff_new_pack.vP8tGZ/_old 2016-11-12 12:59:49.000000000 +0100 +++ /var/tmp/diff_new_pack.vP8tGZ/_new 2016-11-12 12:59:49.000000000 +0100 @@ -17,7 +17,7 @@ Name: autoyast2 -Version: 3.1.152 +Version: 3.2.0 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -33,14 +33,15 @@ # xsltproc for AutoinstClass BuildRequires: libxslt BuildRequires: yast2 +BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) +# FileSystems.read_default_subvol_from_target BuildRequires: yast2-packager BuildRequires: yast2-services-manager BuildRequires: yast2-slp -BuildRequires: yast2-storage >= 3.1.59 +BuildRequires: yast2-storage >= 3.2.0 BuildRequires: yast2-transfer BuildRequires: yast2-update >= 3.1.36 BuildRequires: yast2-xml -BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) # %%{_unitdir} macro definition is in a separate package since 13.1 %if 0%{?suse_version} >= 1310 ++++++ autoyast2-3.1.152.tar.bz2 -> autoyast2-3.2.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/.travis.yml new/autoyast2-3.2.0/.travis.yml --- old/autoyast2-3.1.152/.travis.yml 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/.travis.yml 2016-11-11 15:12:47.000000000 +0100 @@ -5,7 +5,7 @@ # disable rvm, use system Ruby - rvm reset - wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/tra... - - sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2 yast2-storage yast2-xml yast2-transfer yast2-services-manager yast2-installation yast2-installation-control yast2-packager yast2-slp trang" -g "rspec:3.3.0 yast-rake gettext" + - sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2 yast2-storage yast2-xml yast2-transfer yast2-services-manager yast2-installation yast2-installation-control yast2-packager yast2-slp trang" -g "rspec:3.3.0 yast-rake gettext cheetah" script: - rake check:syntax - rake check:pot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/package/autoyast2.changes new/autoyast2-3.2.0/package/autoyast2.changes --- old/autoyast2-3.1.152/package/autoyast2.changes 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/package/autoyast2.changes 2016-11-11 15:12:47.000000000 +0100 @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Mon Oct 24 09:04:25 UTC 2016 - igonzalezsosa@suse.com + +- Add support to enable copy-on-write for Btrfs subvolumes + (FATE#320342) +- Add support to omit the Btrfs default subvolume name + (FATE#317775) +- 3.2.0 + +------------------------------------------------------------------- Fri Sep 30 10:21:45 CEST 2016 - schubi@suse.de - Adding missed desktop file for "clone_system" in order to show diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/package/autoyast2.spec new/autoyast2-3.2.0/package/autoyast2.spec --- old/autoyast2-3.1.152/package/autoyast2.spec 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/package/autoyast2.spec 2016-11-11 15:12:47.000000000 +0100 @@ -17,7 +17,7 @@ Name: autoyast2 -Version: 3.1.152 +Version: 3.2.0 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -34,7 +34,8 @@ BuildRequires: libxslt BuildRequires: rubygem(%{rb_default_ruby_abi}:rspec) BuildRequires: yast2 -BuildRequires: yast2-storage >= 3.1.59 +# FileSystems.read_default_subvol_from_target +BuildRequires: yast2-storage >= 3.2.0 BuildRequires: yast2-xml BuildRequires: yast2-transfer BuildRequires: yast2-services-manager diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/src/autoyast-rnc/general.rnc new/autoyast2-3.2.0/src/autoyast-rnc/general.rnc --- old/autoyast2-3.1.152/src/autoyast-rnc/general.rnc 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/src/autoyast-rnc/general.rnc 2016-11-11 15:12:47.000000000 +0100 @@ -26,7 +26,9 @@ }? & element storage { element partition_alignment { SYMBOL }? & - element start_multipath { BOOLEAN }? + element start_multipath { BOOLEAN }? & + # FATE#317775: support for arbitraty Btrfs subvolume structure + element btrfs_set_default_subvolume_name { BOOLEAN }? }? & element wait { element pre-modules { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/src/autoyast-rnc/partitioning.rnc new/autoyast2-3.2.0/src/autoyast-rnc/partitioning.rnc --- old/autoyast2-3.1.152/src/autoyast-rnc/partitioning.rnc 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/src/autoyast-rnc/partitioning.rnc 2016-11-11 15:12:47.000000000 +0100 @@ -110,9 +110,20 @@ subvolumes = element subvolumes { LIST, - element listentry { text }* + subvolume* } +# by default, AutoYaST exports list entries as 'listentry' +subvolume = + element subvolume { text } | element listentry { text } | subvolume_full + +subvolume_full = + element subvolume { + element path { text } & + # FATE#320342: add support to enable copy-on-write for Btrfs subvolumes + element copy_on_write { BOOLEAN }? + } + part_fstopt = element fstopt { text } part_label = element label { text } part_loop_fs = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/src/clients/inst_autoinit.rb new/autoyast2-3.2.0/src/clients/inst_autoinit.rb --- old/autoyast2-3.1.152/src/clients/inst_autoinit.rb 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/src/clients/inst_autoinit.rb 2016-11-11 15:12:47.000000000 +0100 @@ -200,8 +200,6 @@ Builtins.y2milestone("Initial Configuration") Report.Import(Profile.current.fetch("report",{})) AutoinstGeneral.Import(Profile.current.fetch("general",{})) - AutoinstGeneral.SetSignatureHandling - AutoinstGeneral.SetMultipathing # # Copy the control file for easy access by user to a pre-defined diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/src/include/autoinstall/autopart.rb new/autoyast2-3.2.0/src/include/autoinstall/autopart.rb --- old/autoyast2-3.1.152/src/include/autoinstall/autopart.rb 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/src/include/autoinstall/autopart.rb 2016-11-11 15:12:47.000000000 +0100 @@ -35,13 +35,9 @@ Ops.set( ret, "subvol", - Builtins.maplist(Ops.get_list(xml_map, "subvolumes", [])) do |s| - if !Builtins.isempty(sv_prep) && - Builtins.substring(s, 0, Builtins.size(sv_prep)) != sv_prep - s = Ops.add(sv_prep, s) - end - { "name" => s, "create" => true } - end + # Convert from "vol" or {"name" => "vol", "copy_on_write" => false } + # to { "name" => "vol", "nocow" => true} + xml_map.fetch("subvolumes", []).map { |s| import_subvolume(s, sv_prep) }.compact ) end if Builtins.haskey(ret, "subvolumes") @@ -52,6 +48,53 @@ deep_copy(ret) end + # Build a subvolume representation from a definition + # + # This method is suitable to import an AutoYaST profile. + # It supports two kind of subvolume specification: + # + # * just a path + # * or a hash containing a "path" and an optional "copy_on_write" + # key + # + # @param spec_or_name [Hash,String] Subvolume specification + # @param prefix [String] Subvolume prefix (usually default subvolume + '/') + # @return [Hash,nil] Internal representation of a subvolume or nil if not valid + def import_subvolume(spec_or_path, prefix = "") + # Support strings or hashes + name = spec_or_path.is_a?(::String) ? spec_or_path : spec_or_path["path"] + + if name.nil? + log.info "Subvolume path/name is undefined: #{spec_or_path.inspect}" + return nil + end + + spec = { + "name" => name.start_with?(prefix) ? name : "#{prefix}#{name}", + "create" => true + } + + if spec_or_path.is_a?(Hash) && spec_or_path.has_key?("copy_on_write") + spec["nocow"] = !spec_or_path["copy_on_write"] + end + spec + end + + # Build a subvolume specification from the current definition + # + # The result is suitable to be used to generate an AutoYaST profile. + # + # @param subvolume [Hash] Subvolume definition (internal storage layer definition) + # @param prefix [String] Subvolume prefix (usually default subvolume + '/') + # @return [Hash] External representation of a subvolume (e.g. to be used by AutoYaST) + def export_subvolume(subvolume, prefix = "") + spec = { + "path" => subvolume["name"].sub(/\A#{prefix}/, "") + } + spec["copy_on_write"] = !subvolume["nocow"] + spec + end + def AddFilesysData(st_map, xml_map) st_map = deep_copy(st_map) xml_map = deep_copy(xml_map) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/src/modules/AutoinstGeneral.rb new/autoyast2-3.2.0/src/modules/AutoinstGeneral.rb --- old/autoyast2-3.1.152/src/modules/AutoinstGeneral.rb 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/src/modules/AutoinstGeneral.rb 2016-11-11 15:12:47.000000000 +0100 @@ -10,6 +10,8 @@ module Yast class AutoinstGeneralClass < Module + include Yast::Logger + def main Yast.import "Pkg" textdomain "autoinst" @@ -185,6 +187,10 @@ @proposals = Ops.get_list(settings, "proposals", []) @storage = Ops.get_map(settings, "storage", {}) + SetSignatureHandling() + SetMultipathing() + set_btrfs_default_subvolume_name + true end @@ -198,6 +204,11 @@ Ops.set(general, "signature-handling", @signature_handling) Ops.set(general, "ask-list", @askList) Ops.set(general, "proposals", @proposals) + + btrfs_set_default_subvol = btrfs_default_subvol_to_profile + unless btrfs_set_default_subvol.nil? + Ops.set(@storage, "btrfs_set_default_subvolume_name", btrfs_set_default_subvol) + end Ops.set(general, "storage", @storage) if Yast::Arch.s390 @@ -410,6 +421,21 @@ Storage.SetMultipathStartup(val) end + # Set Btrfs default subvolume name + # + # Check "general/storage/btrfs_set_default_subvolume_name" in the profile. + # It does nothing if that element does not exist. + # + # @return ["@","",nil] Default subvolume name to use. + # + # @see FileSystems.default_subvol + def set_btrfs_default_subvolume_name + return unless @storage.has_key?("btrfs_set_default_subvolume_name") + value = @storage["btrfs_set_default_subvolume_name"] ? "@" : "" + log.info "Setting default subvolume to: '#{value}'" + FileSystems.default_subvol = value + end + # NTP syncing def NtpSync ntp_server = @mode["ntp_sync_time_before_installation"] @@ -489,6 +515,22 @@ nil end + protected + + # Return the value to use as 'btrfs_set_default_subvolume_name' in the profile + # + # In case it matches the product's default, it should not be exported. + # + # @return [Boolean,nil] Value to use (true or false). If nil, no value + # should be exported. + def btrfs_default_subvol_to_profile + if FileSystems.default_subvol != FileSystems.default_subvol_from_product + return FileSystems.default_subvol == "" ? false : true + end + nil + end + + publish :variable => :Confirm, :type => "boolean" publish :variable => :second_stage, :type => "boolean" publish :variable => :mode, :type => "map" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/src/modules/AutoinstPartPlan.rb new/autoyast2-3.2.0/src/modules/AutoinstPartPlan.rb --- old/autoyast2-3.1.152/src/modules/AutoinstPartPlan.rb 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/src/modules/AutoinstPartPlan.rb 2016-11-11 15:12:47.000000000 +0100 @@ -14,6 +14,7 @@ Yast.import "UI" textdomain "autoinst" + Yast.include self, "autoinstall/autopart.rb" Yast.include self, "autoinstall/types.rb" Yast.include self, "autoinstall/common.rb" Yast.include self, "autoinstall/tree.rb" @@ -345,6 +346,7 @@ Mode.SetMode("normal") StorageDevices.InitDone _StorageMap = Builtins.eval(Storage.GetTargetMap) + FileSystems.read_default_subvol_from_target _StorageMap = _StorageMap.select do |d, p| ok = true @@ -530,30 +532,13 @@ end # Subvolumes # Save possibly existing subvolumes - if !Builtins.isempty(Ops.get_list(pe, "subvol", [])) + if !pe.fetch("subvol", []).empty? defsub = "" - if !Builtins.isempty(FileSystems.default_subvol) - defsub = Ops.add(FileSystems.default_subvol, "/") + if !FileSystems.default_subvol.empty? + defsub = FileSystems.default_subvol + "/" end - Ops.set( - new_pe, - "subvolumes", - Builtins.maplist(Ops.get_list(pe, "subvol", [])) do |p| - if Ops.greater_than(Builtins.size(defsub), 0) && - Builtins.substring( - Ops.get_string(p, "name", ""), - 0, - Builtins.size(defsub) - ) == defsub - next Builtins.substring( - Ops.get_string(p, "name", ""), - Builtins.size(defsub) - ) - else - next Ops.get_string(p, "name", "") - end - end - ) + new_pe["subvolumes"] = pe.fetch("subvol", []).map { |s| export_subvolume(s, defsub) } + Ops.set( new_pe, "subvolumes", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/src/modules/AutoinstPartition.rb new/autoyast2-3.2.0/src/modules/AutoinstPartition.rb --- old/autoyast2-3.1.152/src/modules/AutoinstPartition.rb 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/src/modules/AutoinstPartition.rb 2016-11-11 15:12:47.000000000 +0100 @@ -276,7 +276,9 @@ end if !Builtins.isempty(Ops.get_list(part, "subvolumes", [])) #Filtering out all snapper subvolumes - newPart["subvolumes"] = part["subvolumes"].reject { |s| s.start_with?(".snapshots") } + newPart["subvolumes"] = part["subvolumes"].reject do |subvolume| + subvolume["path"].start_with?(".snapshots") + end else newPart = Builtins.remove(newPart, "subvolumes") end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/test/AutoinstGeneral_test.rb new/autoyast2-3.2.0/test/AutoinstGeneral_test.rb --- old/autoyast2-3.1.152/test/AutoinstGeneral_test.rb 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/test/AutoinstGeneral_test.rb 2016-11-11 15:12:47.000000000 +0100 @@ -8,6 +8,17 @@ describe Yast::AutoinstGeneral do FIXTURES_PATH = File.join(File.dirname(__FILE__), 'fixtures') + let(:default_subvol) { "@" } + let(:filesystems) do + double("filesystems", + default_subvol: default_subvol, read_default_subvol_from_target: default_subvol) + end + + before do + allow(Yast).to receive(:import).with("FileSystems").and_return(nil) + stub_const("Yast::FileSystems", filesystems) + end + describe "#ntp syncing in Write call" do let(:profile_sync) { File.join(FIXTURES_PATH, 'profiles', 'general_with_time_sync.xml') } let(:profile_no_sync) { File.join(FIXTURES_PATH, 'profiles', 'general_without_time_sync.xml') } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/test/AutoinstPartPlan_test.rb new/autoyast2-3.2.0/test/AutoinstPartPlan_test.rb --- old/autoyast2-3.1.152/test/AutoinstPartPlan_test.rb 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/test/AutoinstPartPlan_test.rb 2016-11-11 15:12:47.000000000 +0100 @@ -5,11 +5,21 @@ Yast.import "AutoinstPartPlan" Yast.import "Profile" +Yast.import "ProductFeatures" describe Yast::AutoinstPartPlan do - FIXTURES_PATH = File.join(File.dirname(__FILE__), 'fixtures') - let(:target_map_path) { File.join(FIXTURES_PATH, 'storage', "nfs_root.yml") } - let(:target_map_clone) { File.join(FIXTURES_PATH, 'storage', "target_clone.yml") } + let(:target_map_path) { File.join(FIXTURES_PATH, "storage", "nfs_root.yml") } + let(:target_map_clone) { File.join(FIXTURES_PATH, "storage", "target_clone.yml") } + let(:default_subvol) { "@" } + let(:filesystems) do + double("filesystems", + default_subvol: default_subvol, read_default_subvol_from_target: default_subvol) + end + + before do + allow(Yast).to receive(:import).with("FileSystems").and_return(nil) + stub_const("Yast::FileSystems", filesystems) + end describe "#read partition target" do @@ -44,7 +54,33 @@ ] ) end - end + describe "#Export" do + let(:target_map) { YAML.load_file(File.join(FIXTURES_PATH, "storage", "subvolumes.yml")) } + + before do + allow(Yast::Storage).to receive(:GetTargetMap).and_return(target_map) + Yast::AutoinstPartPlan.Read + end + + it "includes found subvolumes" do + exported = Yast::AutoinstPartPlan.Export + subvolumes = exported.first["partitions"].first["subvolumes"] + expect(subvolumes).to eq([ + { "path" => "@", "copy_on_write" => true}, + { "path" => "home", "copy_on_write" => true }, + { "path" => "var/log", "copy_on_write" => true }, + { "path" => "var/lib/pgsql", "copy_on_write" => true }, + { "path" => "myvol", "copy_on_write" => false }, + ]) + end + + it "does not include snapshots" do + exported = Yast::AutoinstPartPlan.Export + subvolumes = exported.first["partitions"].first["subvolumes"] + snapshots = subvolumes.select { |s| s.include?("snapshot") } + expect(snapshots).to be_empty + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/test/Makefile.am new/autoyast2-3.2.0/test/Makefile.am --- old/autoyast2-3.1.152/test/Makefile.am 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/test/Makefile.am 2016-11-11 15:12:47.000000000 +0100 @@ -9,9 +9,11 @@ AutoinstConfig_tests.rb \ AutoinstFunctions_test.rb \ AutoinstGeneral_test.rb \ + AutoinstPartPlan_test.rb \ AutoinstSoftware_test.rb \ profile_test.rb \ Y2ModuleConfig_test.rb \ + include/autopart_test.rb \ include/ask_test.rb \ lib/module_config_builder_test.rb \ lib/pkg_gpg_check_handler_test.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/test/fixtures/storage/subvolumes.yml new/autoyast2-3.2.0/test/fixtures/storage/subvolumes.yml --- old/autoyast2-3.1.152/test/fixtures/storage/subvolumes.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/autoyast2-3.2.0/test/fixtures/storage/subvolumes.yml 2016-11-11 15:12:47.000000000 +0100 @@ -0,0 +1,185 @@ +--- +"/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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/test/include/autopart_test.rb new/autoyast2-3.2.0/test/include/autopart_test.rb --- old/autoyast2-3.1.152/test/include/autopart_test.rb 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/test/include/autopart_test.rb 2016-11-11 15:12:47.000000000 +0100 @@ -1,8 +1,6 @@ #!/usr/bin/env rspec - require_relative "../test_helper" require "yaml" -require "yast" Yast.import "Profile" Yast.import "Arch" @@ -13,6 +11,8 @@ module DummyYast class AutoinstallAutopartClient < Yast::Client + include Yast::Logger + def main Yast.include self, "autoinstall/autopart.rb" @planHasBoot=false @@ -26,7 +26,7 @@ end def plan_has_boot_or_prep_partition=(v) @planHasBoot = v - end + end end end @@ -108,5 +108,66 @@ end end end + + describe "#AddSubvolData" do + before do + subject.main + stub_const("Yast::FileSystems", double("filesystems", default_subvol: default_subvol)) + end + + let(:default_subvol) { "" } + + let(:target) do + { + "create" => true, "device" => "/dev/sda2", "format" => true, "fstopt" => "subvol=@", + "mount" => "/", "mountby" => :uuid, "nr" => 2, "region" => [94, 1733], "type" => :primary, + "used_fs" => :btrfs + } + end + + context "when subvolumes specification are just paths" do + it "adds subvolumes with default options" do + new_target = client.AddSubvolData(target, "subvolumes" => ["home", "var/lib/pgsql"]) + expect(new_target["subvol"]).to eq([ + {"name" => "home", "create" => true }, + {"name" => "var/lib/pgsql", "create" => true} + ]) + end + end + + context "when a default subvolme is specified" do + let(:default_subvol) { "@" } + + it "prepends the default subvolume" do + new_target = client.AddSubvolData(target, "subvolumes" => ["home"]) + expect(new_target["subvol"]).to eq([{"name" => "@/home", "create" => true}]) + end + end + + context "when copy-on-write is defined" do + let(:subvolumes) do + [ { "path" => "home" }, { "path" => "var/lib/pgsql", "copy_on_write" => false } ] + end + + it "includes the 'nocow' option" do + new_target = client.AddSubvolData(target, "subvolumes" => subvolumes) + expect(new_target["subvol"]).to eq([ + { "name" => "home", "create" => true }, + { "name" => "var/lib/pgsql", "create" => true, "nocow" => true } + ]) + end + end + + context "when path is not defined" do + let(:subvolumes) do + [ { "name" => "home" } ] + end + + it "does not add the subvolume" do + new_target = client.AddSubvolData(target, "subvolumes" => subvolumes) + expect(new_target["subvol"]).to be_empty + end + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autoyast2-3.1.152/test/test_helper.rb new/autoyast2-3.2.0/test/test_helper.rb --- old/autoyast2-3.1.152/test/test_helper.rb 2016-09-30 10:54:58.000000000 +0200 +++ new/autoyast2-3.2.0/test/test_helper.rb 2016-11-11 15:12:47.000000000 +0100 @@ -10,3 +10,4 @@ "errors are raised in other YaST components." end +FIXTURES_PATH = File.join(File.dirname(__FILE__), 'fixtures')
participants (1)
-
root@hilbert.suse.de