Hello community, here is the log from the commit of package yast2-storage-ng for openSUSE:Factory checked in at 2018-03-18 21:43:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-storage-ng (Old) and /work/SRC/openSUSE:Factory/.yast2-storage-ng.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-storage-ng" Sun Mar 18 21:43:43 2018 rev:13 rq:587870 version:4.0.135 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-storage-ng/yast2-storage-ng.changes 2018-03-14 19:35:03.889669100 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-storage-ng.new/yast2-storage-ng.changes 2018-03-18 21:43:44.584094803 +0100 @@ -1,0 +2,22 @@ +Thu Mar 15 16:29:56 UTC 2018 - [email protected] + +- Warn if user creates too big PReP partition which firmware can + have problem to load (bsc#1081979) +- 4.0.135 + +------------------------------------------------------------------- +Thu Mar 15 15:37:51 UTC 2018 - [email protected] + +- Partitioner: Check if resize is possible based on filesystem type + (fate#318196) +- 4.0.134 + +------------------------------------------------------------------- +Thu Mar 15 09:57:41 UTC 2018 - [email protected] + +- Partitioner: do not allow to remove implicit partitions. +- Partitioner: allow to remove any disk device (not only disks). +- Part of fate#318196. +- 4.0.133 + +------------------------------------------------------------------- Old: ---- yast2-storage-ng-4.0.132.tar.bz2 New: ---- yast2-storage-ng-4.0.135.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-storage-ng.spec ++++++ --- /var/tmp/diff_new_pack.tBbdHa/_old 2018-03-18 21:43:45.548060075 +0100 +++ /var/tmp/diff_new_pack.tBbdHa/_new 2018-03-18 21:43:45.556059787 +0100 @@ -17,7 +17,7 @@ Name: yast2-storage-ng -Version: 4.0.132 +Version: 4.0.135 Release: 0 BuildArch: noarch @@ -27,12 +27,12 @@ # Yast2::FsSnapshots.configure_on_install= Requires: yast2 >= 4.0.24 Requires: yast2-ruby-bindings -# ActivateCallbacks::multipath signature -Requires: libstorage-ng-ruby >= 3.3.181 +# BlkFilesystem::supports_shrink() / _grow() +Requires: libstorage-ng-ruby >= 3.3.191 BuildRequires: update-desktop-files -# ActivateCallbacks::multipath signature -BuildRequires: libstorage-ng-ruby >= 3.3.181 +# BlkFilesystem::supports_shrink() / _grow() +BuildRequires: libstorage-ng-ruby >= 3.3.191 BuildRequires: yast2-devtools BuildRequires: yast2-ruby-bindings # yast2-xml dependency is added by yast2 but ignored in the ++++++ yast2-storage-ng-4.0.132.tar.bz2 -> yast2-storage-ng-4.0.135.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/doc/boot-requirements.md new/yast2-storage-ng-4.0.135/doc/boot-requirements.md --- old/yast2-storage-ng-4.0.132/doc/boot-requirements.md 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/doc/boot-requirements.md 2018-03-16 11:43:38.000000000 +0100 @@ -135,10 +135,10 @@ - **requires no particular position for it in the disk (since there is no evidence of such so far)** - when aiming for the recommended size - **requires it to be at least 4 MiB (Grub2 stages 1+2, needed Grub modules and extra space)** - - **requires it to be at most 8 MiB (since it will be mapped to RAM)** + - **requires it to be at most 8 MiB (some firmwares will fail to load bigger ones)** - when aiming for the minimal size - **requires it to be at least 2 MiB (Grub2 stages 1+2 and needed Grub modules)** - - **requires it to be at most 8 MiB (since it will be mapped to RAM)** + - **requires it to be at most 8 MiB (some firmwares will fail to load bigger ones)** ## needed partitions in an aarch64 system - with a partitions-based proposal @@ -208,3 +208,5 @@ - **requires /boot/zipl to be at least 200 MiB (Grub2, one kernel+initrd and extra space)** - when aiming for the minimal size - **requires /boot/zipl to be at least 100 MiB (Grub2 and one kernel+initrd)** + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/doc/old_and_new_proposal.md new/yast2-storage-ng-4.0.135/doc/old_and_new_proposal.md --- old/yast2-storage-ng-4.0.132/doc/old_and_new_proposal.md 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/doc/old_and_new_proposal.md 2018-03-16 11:43:38.000000000 +0100 @@ -72,8 +72,6 @@ the proposal's behavior. It also contains some options to influence other aspect of YaST, mainly the installer. - * `root_subvolume_read_only` - Whether the installer should set readonly for `/` at the end of installation. * `proposal_settings_editable` Whether the user can change the proposal settings in the UI. * `expert_partitioner_warning` @@ -556,8 +554,6 @@ <windows_delete_mode config:type="symbol">all</windows_delete_mode> <linux_delete_mode config:type="symbol">all</linux_delete_mode> <other_delete_mode config:type="symbol">all</other_delete_mode> - <!-- Make '/' volume read-only --> - <root_subvolume_read_only config:type="boolean">true</root_subvolume_read_only> <!-- Don't allow the user to use the Guided Setup --> <proposal_settings_editable config:type="boolean">false</proposal_settings_editable> </proposal> @@ -581,6 +577,9 @@ <btrfs_default_subvolume>@</btrfs_default_subvolume> + <!-- Make '/' volume read-only --> + <btrfs_read_only config:type="boolean">true</btrfs_read_only> + <subvolumes config:type="list"> <!-- This would be the same than the <subvolumes> list in the current @@ -683,8 +682,6 @@ Specifies the predefined size of the LVM volume group if `lvm_vg_strategy` is `use_vg_size`. * `proposal_settings_editable` If `false`, the user is not allowed to change the proposal settings. - * `root_subvolume_read_only` - If `true`, the "/"-volume is set read-only (mainly for CaaSP). ### The `volumes` subsection @@ -771,6 +768,11 @@ Equivalent to the previous option that used to apply only to "/". * `btrfs_default_subvolume` Same than before. + * `btrfs_read_only` + Whether the root subvolume should be mounted read-only in /etc/fstab and + its 'ro' Btrfs property should be set to _true_. This works only for Btrfs + root filesystems. If another root filesystem type is chosen, this property + is ignored. Its default value is _false_. And finally there is an option that deserves a slightly more detailed explanation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/package/yast2-storage-ng.changes new/yast2-storage-ng-4.0.135/package/yast2-storage-ng.changes --- old/yast2-storage-ng-4.0.132/package/yast2-storage-ng.changes 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/package/yast2-storage-ng.changes 2018-03-16 11:43:38.000000000 +0100 @@ -1,4 +1,26 @@ ------------------------------------------------------------------- +Thu Mar 15 16:29:56 UTC 2018 - [email protected] + +- Warn if user creates too big PReP partition which firmware can + have problem to load (bsc#1081979) +- 4.0.135 + +------------------------------------------------------------------- +Thu Mar 15 15:37:51 UTC 2018 - [email protected] + +- Partitioner: Check if resize is possible based on filesystem type + (fate#318196) +- 4.0.134 + +------------------------------------------------------------------- +Thu Mar 15 09:57:41 UTC 2018 - [email protected] + +- Partitioner: do not allow to remove implicit partitions. +- Partitioner: allow to remove any disk device (not only disks). +- Part of fate#318196. +- 4.0.133 + +------------------------------------------------------------------- Tue Mar 13 15:04:59 UTC 2018 - [email protected] - Post a warning if reusing an existing system mount point without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/package/yast2-storage-ng.spec new/yast2-storage-ng-4.0.135/package/yast2-storage-ng.spec --- old/yast2-storage-ng-4.0.132/package/yast2-storage-ng.spec 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/package/yast2-storage-ng.spec 2018-03-16 11:43:38.000000000 +0100 @@ -16,7 +16,7 @@ # Name: yast2-storage-ng -Version: 4.0.132 +Version: 4.0.135 Release: 0 BuildArch: noarch @@ -26,12 +26,12 @@ # Yast2::FsSnapshots.configure_on_install= Requires: yast2 >= 4.0.24 Requires: yast2-ruby-bindings -# ActivateCallbacks::multipath signature -Requires: libstorage-ng-ruby >= 3.3.181 +# BlkFilesystem::supports_shrink() / _grow() +Requires: libstorage-ng-ruby >= 3.3.191 BuildRequires: update-desktop-files -# ActivateCallbacks::multipath signature -BuildRequires: libstorage-ng-ruby >= 3.3.181 +# BlkFilesystem::supports_shrink() / _grow() +BuildRequires: libstorage-ng-ruby >= 3.3.191 BuildRequires: yast2-ruby-bindings BuildRequires: yast2-devtools # yast2-xml dependency is added by yast2 but ignored in the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_device.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_device.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_device.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_device.rb 2018-03-16 11:43:38.000000000 +0100 @@ -21,14 +21,12 @@ require "yast" require "yast/i18n" +require "yast2/popup" require "y2partitioner/device_graphs" require "y2partitioner/confirm_recursive_delete" require "y2storage/filesystems/btrfs" require "abstract_method" -Yast.import "Popup" -Yast.import "HTML" - module Y2Partitioner module Actions # Base class for the action to delete a device @@ -82,17 +80,36 @@ # Validations before performing the delete action # + # @note The action can be performed is there are no errors (see #errors). + # Only the first error is shown. + # # @return [Boolean] def validate - true + current_errors = errors + return true if current_errors.empty? + + Yast2::Popup.show(current_errors.first, headline: :error) + false + end + + # List of errors that avoid to delete the device + # + # @note Derived classes should overload this method. + # + # @return [Array<String>] + def errors + [] end - # Confirmation message before performing the delete action + # Confirmation before performing the delete action + # + # @return [Boolean] def confirm - Yast::Popup.YesNo( - # TRANSLATORS %s is the name of the device to be deleted (e.g., /dev/sda1) - format(_("Really delete %s?"), device.name) - ) + # TRANSLATORS %s is the name of the device to be deleted (e.g., /dev/sda1) + message = format(_("Really delete %s?"), device.name) + + result = Yast2::Popup.show(message, buttons: :yes_no) + result == :yes end # Checks whether the device is used as physical volume diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_disk.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_disk.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_disk.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_disk.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,77 +0,0 @@ -# encoding: utf-8 - -# Copyright (c) [2017] SUSE LLC -# -# 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 "y2partitioner/ui_state" -require "y2partitioner/actions/delete_device" - -module Y2Partitioner - module Actions - # Action for deleting a disk device - # - # @see DeleteDevice - class DeleteDisk < DeleteDevice - def initialize(*args) - super - textdomain "storage" - end - - # Checks whether there is any partition for deleting - # - # @note An error popup is shown when there is no partition. - # - # @return [Boolean] - def validate - partition_table = device.partition_table - if partition_table.nil? || partition_table.partitions.empty? - Yast::Popup.Error(_("There are no partitions to delete on this disk")) - return false - end - - true - end - - # Confirmation message before performing the delete action - # - # It shows all partitions (and dependent devices) that will be deleted. - # - # @see DeleteDevice#confirm_recursive_delete - def confirm - confirm_recursive_delete( - device, - _("Confirm Deleting of All Partitions"), - # TRANSLATORS: name is the name of the disk to be deleted (e.g., /dev/sda) - format(_("The disk \"%{name}\" contains at least one partition.\n" \ - "If you proceed, the following devices will be deleted:"), name: device.name), - # TRANSLATORS: name is the name of the disk to be deleted (e.g., /dev/sda) - format(_("Really delete all partitions on \"%{name}\"?"), name: device.name) - ) - end - - # Deletes all partitions of a disk device (see {DeleteDevice#device}) - def delete - log.info "deleting partitions for #{device}" - device.partition_table.delete_all_partitions unless device.partition_table.nil? - UIState.instance.select_row(device) - end - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_disk_device.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_disk_device.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_disk_device.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_disk_device.rb 2018-03-16 11:43:38.000000000 +0100 @@ -0,0 +1,94 @@ +# encoding: utf-8 + +# Copyright (c) [2017] SUSE LLC +# +# 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 "y2partitioner/ui_state" +require "y2partitioner/actions/delete_device" + +module Y2Partitioner + module Actions + # Action for deleting a disk device + # + # @see DeleteDevice + class DeleteDiskDevice < DeleteDevice + def initialize(*args) + super + textdomain "storage" + end + + private + + # Deletes all partitions of a disk device (see {DeleteDevice#device}) + def delete + log.info "deleting partitions from #{device}" + device.partition_table.delete_all_partitions unless device.partition_table.nil? + UIState.instance.select_row(device) + end + + # @see DeleteDevice#errors + def errors + errors = super + [ + empty_partition_table_error, + implicit_partition_table_error + ] + + errors.compact + end + + # Error when there is no partition for deleting + # + # @return [String, nil] nil if the partition table is not empty + def empty_partition_table_error + return nil unless device.partitions.empty? + + _("There are no partitions to delete on this disk") + end + + # Error when the device contains an implicit partitition table + # + # @return [String, nil] nil if the device has no implicit partition table + def implicit_partition_table_error + return nil if !device.implicit_partition_table? + + _("This device only contains an implicit partition that cannot be deleted.") + end + + # Confirmation before performing the delete action + # + # @note It shows all partitions (and dependent devices) that will be deleted. + # + # @see ConfirmRecursiveDelete#confirm_recursive_delete + # + # @return [Boolean] + def confirm + confirm_recursive_delete( + device, + _("Confirm Deleting of All Partitions"), + # TRANSLATORS: name is the name of the disk to be deleted (e.g., /dev/sda) + format(_("The disk \"%{name}\" contains at least one partition.\n" \ + "If you proceed, the following devices will be deleted:"), name: device.name), + # TRANSLATORS: name is the name of the disk to be deleted (e.g., /dev/sda) + format(_("Really delete all partitions on \"%{name}\"?"), name: device.name) + ) + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_lvm_lv.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_lvm_lv.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_lvm_lv.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_lvm_lv.rb 2018-03-16 11:43:38.000000000 +0100 @@ -33,10 +33,7 @@ textdomain "storage" end - # Confirmation message before performing the delete action - def confirm - used_pool? ? confirm_for_used_pool : confirm_for_lv - end + private # Deletes the indicated logical volume (see {DeleteDevice#device}) # @@ -48,7 +45,12 @@ vg.delete_lvm_lv(device) end - private + # Confirmation before performing the delete action + # + # @return [Boolean] + def confirm + used_pool? ? confirm_for_used_pool : confirm_for_lv + end # Whether the device is a LVM thin pool and it contains any thin volume # @@ -58,17 +60,22 @@ end # Confirmation when the device is not a LVM thin pool, or the pool is not used yet + # + # @return [Boolean] def confirm_for_lv - Yast::Popup.YesNo( - # TRANSLATORS: Confirmation message when a LVM logical volume is going to be deleted, - # where %{name} is replaced by the name of the logical volume (e.g., /dev/system/lv1) - format(_("Remove the logical volume %{name}?"), name: device.name) - ) + # TRANSLATORS: Confirmation message when a LVM logical volume is going to be deleted, + # where %{name} is replaced by the name of the logical volume (e.g., /dev/system/lv1) + message = format(_("Remove the logical volume %{name}?"), name: device.name) + + result = Yast2::Popup.show(message, buttons: :yes_no) + result == :yes end # Confirmation when the device is a LVM thin pool and there is any thin volume over it # - # @see DeleteDevice#confirm_recursive_delete + # @see ConfirmRecursiveDelete#confirm_recursive_delete + # + # @return [Boolean] def confirm_for_used_pool confirm_recursive_delete( device, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_lvm_vg.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_lvm_vg.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_lvm_vg.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_lvm_vg.rb 2018-03-16 11:43:38.000000000 +0100 @@ -33,14 +33,7 @@ textdomain "storage" end - # Confirmation message before performing the delete action - def confirm - if device.lvm_lvs.empty? - super - else - confirm_for_used - end - end + private # Deletes the indicated LVM volume group (see {DeleteDevice#device}) def delete @@ -48,11 +41,22 @@ device_graph.remove_lvm_vg(device) end - private + # Confirmation before performing the delete action + # + # @return [Boolean] + def confirm + if device.lvm_lvs.empty? + super + else + confirm_for_used + end + end # Confirmation when the device contains logical volumes # - # @see DeleteDevice#confirm_recursive_delete + # @see ConfirmRecursiveDelete#confirm_recursive_delete + # + # @return [Boolean] def confirm_for_used confirm_recursive_delete( device, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_md.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_md.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_md.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_md.rb 2018-03-16 11:43:38.000000000 +0100 @@ -33,14 +33,7 @@ textdomain "storage" end - # Confirmation message before performing the delete action - def confirm - if used_by_lvm? - confirm_for_used_by_lvm - else - super - end - end + private # Deletes the indicated md raid (see {DeleteDevice#device}) def delete @@ -48,12 +41,23 @@ device_graph.remove_md(device) end - private + # Confirmation before performing the delete action + # + # @return [Boolean] + def confirm + if used_by_lvm? + confirm_for_used_by_lvm + else + super + end + end # Confirmation when the device belongs to a volume group # - # @see DeleteDevice#confirm_recursive_delete + # @see ConfirmRecursiveDelete#confirm_recursive_delete # @see DeleteDevice#lvm_vg + # + # @return [Boolean] def confirm_for_used_by_lvm confirm_recursive_delete( device, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_partition.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_partition.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/delete_partition.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/delete_partition.rb 2018-03-16 11:43:38.000000000 +0100 @@ -34,16 +34,7 @@ textdomain "storage" end - # Confirmation message before performing the delete action - def confirm - if used_by_lvm? - confirm_for_used_by_lvm - elsif used_by_md? - confirm_for_used_by_md - else - super - end - end + private # Deletes the indicated partition (see {DeleteDevice#device}) def delete @@ -53,12 +44,40 @@ UIState.instance.select_row(disk_device) end - private + # @see DeleteDevice#errors + def errors + errors = super + [implicit_partition_error] + errors.compact + end + + # Error when the partition is implicit + # + # @return [String, nil] nil if the partition is not implicit + def implicit_partition_error + return nil if !device.implicit? + + _("This is an implicit partition and cannot be deleted.") + end + + # @see DeleteDevices#confirm + # + # @return [Boolean] + def confirm + if used_by_lvm? + confirm_for_used_by_lvm + elsif used_by_md? + confirm_for_used_by_md + else + super + end + end # Confirmation when the partition belongs to a volume group # - # @see DeleteDevice#confirm_recursive_delete + # @see ConfirmRecursiveDelete#confirm_recursive_delete # @see DeleteDevice#lvm_vg + # + # @return [Boolean] def confirm_for_used_by_lvm confirm_recursive_delete( device, @@ -77,8 +96,10 @@ # Confirmation when the partition belongs to a md raid # - # @see DeleteDevice#confirm_recursive_delete + # @see ConfirmRecursiveDelete#confirm_recursive_delete # @see DeleteDevice#md + # + # @return [Boolean] def confirm_for_used_by_md confirm_recursive_delete( device, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/resize_blk_device.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/resize_blk_device.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/actions/resize_blk_device.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/actions/resize_blk_device.rb 2018-03-16 11:43:38.000000000 +0100 @@ -85,7 +85,9 @@ # # @return [Array<Strings>] def errors - [used_device_error, cannot_be_resized_error].compact + [used_device_error, + fstype_resize_support_error, + cannot_be_resized_error].compact end # Error when trying to resize an used device @@ -104,6 +106,16 @@ ) end + # Error when the filesystem type cannot be resized + # + # @return [String, nil] nil if the filesystem can be resized. + def fstype_resize_support_error + return nil unless device.formatted? + return nil if device.blk_filesystem.supports_resize? + + _("This filesystem type cannot be resized.") + end + # Error when the device cannot be resized # # TODO: Distinguish the reason why it is not possible to resize, for example: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/confirm_recursive_delete.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/confirm_recursive_delete.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/confirm_recursive_delete.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/confirm_recursive_delete.rb 2018-03-16 11:43:38.000000000 +0100 @@ -21,6 +21,8 @@ require "yast" +Yast.import "HTML" + module Y2Partitioner # Mixin for confimation when recursive deletion is performed module ConfirmRecursiveDelete diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/widgets/device_delete_button.rb new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/widgets/device_delete_button.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2partitioner/widgets/device_delete_button.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2partitioner/widgets/device_delete_button.rb 2018-03-16 11:43:38.000000000 +0100 @@ -21,7 +21,7 @@ require "yast" require "y2partitioner/widgets/device_button" -require "y2partitioner/actions/delete_disk" +require "y2partitioner/actions/delete_disk_device" require "y2partitioner/actions/delete_partition" require "y2partitioner/actions/delete_lvm_vg" require "y2partitioner/actions/delete_lvm_lv" @@ -47,7 +47,7 @@ # Returns the proper Actions class to perform the delete action # # @see Actions::DeleteDevice - # @see Actions::DeleteDisk + # @see Actions::DeleteDiskDevice # @see Actions::DeletePartition # @see Actions::DeleteLvmVg # @see Actions::DeleteLvmLv @@ -55,8 +55,8 @@ # # @return [Actions::DeleteDevice] def actions_class - if device.is?(:disk) - Actions::DeleteDisk + if device.is?(:disk_device) + Actions::DeleteDiskDevice elsif device.is?(:partition) Actions::DeletePartition elsif device.is?(:lvm_vg) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2storage/boot_requirements_strategies/analyzer.rb new/yast2-storage-ng-4.0.135/src/lib/y2storage/boot_requirements_strategies/analyzer.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2storage/boot_requirements_strategies/analyzer.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2storage/boot_requirements_strategies/analyzer.rb 2018-03-16 11:43:38.000000000 +0100 @@ -223,6 +223,16 @@ return raid.md_level.is?(:raid1) end + # Method to return all prep partitions - newly created and also reused from graph. + # It is useful to do checks on top of that partitions + # @note to get all prep partition, from graph and planned use + # `graph_prep_partitions + planned_prep_partitions` + def graph_prep_partitions + devicegraph.partitions.select do |partition| + partition.id.is?(:prep) + end + end + protected attr_reader :devicegraph diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2storage/boot_requirements_strategies/legacy.rb new/yast2-storage-ng-4.0.135/src/lib/y2storage/boot_requirements_strategies/legacy.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2storage/boot_requirements_strategies/legacy.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2storage/boot_requirements_strategies/legacy.rb 2018-03-16 11:43:38.000000000 +0100 @@ -141,7 +141,7 @@ errors end - # Boor errors when partition table is msdos + # Boot errors when partition table is msdos # # @return [Array<SetupError>] def errors_on_msdos diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2storage/boot_requirements_strategies/prep.rb new/yast2-storage-ng-4.0.135/src/lib/y2storage/boot_requirements_strategies/prep.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2storage/boot_requirements_strategies/prep.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2storage/boot_requirements_strategies/prep.rb 2018-03-16 11:43:38.000000000 +0100 @@ -26,6 +26,15 @@ module BootRequirementsStrategies # Strategy to calculate boot requirements in systems using PReP class PReP < Base + # Maximum size for which we are sure firmware can load prep + # see https://bugzilla.suse.com/show_bug.cgi?id=1081979 + MAX_PREP_SIZE = DiskSize.MiB(8) + + def initialize(*args) + super + textdomain "storage" + end + # @see Base#needed_partitions def needed_partitions(target) planned_partitions = super @@ -42,9 +51,7 @@ def warnings res = super - if prep_partition_needed? && missing_partition_for?(prep_volume) - res << SetupError.new(missing_volume: prep_volume) - end + res.concat(prep_warnings) if prep_partition_needed? if boot_partition_needed? && missing_partition_for?(boot_volume) res << SetupError.new(missing_volume: boot_volume) @@ -55,6 +62,36 @@ protected + # PReP partition is needed, so return any warning related to it. + def prep_warnings + res = [] + big_preps = too_big_preps + + if missing_partition_for?(prep_volume) + res << SetupError.new(missing_volume: prep_volume) + elsif !big_preps.empty? + res << SetupError.new(message: big_prep_warning(big_preps)) + end + + res + end + + def big_prep_warning(big_partitions) + # TRANSLATORS: %s is single or list of partitions that are too big. + msg = + format( + n_( + "The following PReP partition is too big: %s. ", + "The following PReP partitions are too big: %s.", + big_partitions.size + ), + big_partitions.map(&:name).join(", ") + ) + # TRANSLATORS: %s is human readable partition size like 8 MiB. + msg + format(_("Some firmwares can fail to load PReP partitions " \ + "bigger than %s and thus prevent booting."), MAX_PREP_SIZE) + end + def boot_partition_needed? # PowerNV uses it's own firmware instead of Grub stage 1, but other # PPC systems use regular Grub. Just use the default logic for those. @@ -77,6 +114,13 @@ current_devices.none? { |d| d.match_volume?(prep_volume) } end + # Select all prep partitions that are too big. + def too_big_preps + analyzer.graph_prep_partitions.select do |partition| + partition.size > MAX_PREP_SIZE + end + end + # @return [VolumeSpecification] def prep_volume @prep_volume ||= volume_specification_for("prep") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2storage/filesystems/blk_filesystem.rb new/yast2-storage-ng-4.0.135/src/lib/y2storage/filesystems/blk_filesystem.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2storage/filesystems/blk_filesystem.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2storage/filesystems/blk_filesystem.rb 2018-03-16 11:43:38.000000000 +0100 @@ -58,6 +58,14 @@ storage_forward :uuid storage_forward :uuid= + # @!method supports_shrink? + # @return [Boolean] whether the filesystem supports shrinking + storage_forward :supports_shrink?, to: :supports_shrink + + # @!method supports_grow? + # @return [Boolean] whether the filesystem supports growing + storage_forward :supports_grow?, to: :supports_grow + # @!attribute mkfs_options # Options to use when calling mkfs during devicegraph commit (if the # filesystem needs to be created in the system). @@ -111,6 +119,14 @@ disks.any?(&:in_network?) end + # Check if this filesystem type supports any kind of resize at all, + # either shrinking or growing. + # + # @return [Boolean] + def supports_resize? + supports_shrink? || supports_grow? + end + protected def types_for_is diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/src/lib/y2storage/partition.rb new/yast2-storage-ng-4.0.135/src/lib/y2storage/partition.rb --- old/yast2-storage-ng-4.0.132/src/lib/y2storage/partition.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/src/lib/y2storage/partition.rb 2018-03-16 11:43:38.000000000 +0100 @@ -244,6 +244,15 @@ min end + # Whether it is an implicit partition + # + # @see Y2Storage::PartitionTables::ImplicitPt + # + # @return [Boolean] + def implicit? + partition_table.type.is?(:implicit) + end + protected # Values for volume specification matching diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/data/control_files/volumes_ng/control.CAASP.xml new/yast2-storage-ng-4.0.135/test/data/control_files/volumes_ng/control.CAASP.xml --- old/yast2-storage-ng-4.0.132/test/data/control_files/volumes_ng/control.CAASP.xml 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/data/control_files/volumes_ng/control.CAASP.xml 2018-03-16 11:43:38.000000000 +0100 @@ -138,7 +138,6 @@ <proposal> <lvm config:type="boolean">false</lvm> <proposal_settings_editable config:type="boolean">false</proposal_settings_editable> - <root_subvolume_read_only config:type="boolean">true</root_subvolume_read_only> </proposal> <volumes config:type="list"> @@ -161,6 +160,9 @@ <!-- the default subvolume "@" was requested by product management --> <btrfs_default_subvolume>@</btrfs_default_subvolume> + <!-- root filesystem should be read-only --> + <btrfs_read_only config:type="boolean">true</btrfs_read_only> + <!-- Subvolumes to be created for a Btrfs root file system --> <!-- copy_on_write is true by default --> <!-- The XML parser is very simplistic, thus not using attributes, but sub-elements --> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/data/devicegraphs/prep_big.yml new/yast2-storage-ng-4.0.135/test/data/devicegraphs/prep_big.yml --- old/yast2-storage-ng-4.0.132/test/data/devicegraphs/prep_big.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/data/devicegraphs/prep_big.yml 2018-03-16 11:43:38.000000000 +0100 @@ -0,0 +1,20 @@ +--- +- disk: + name: /dev/sda + size: 1 TiB + partition_table: gpt + partitions: + + - partition: + size: 50 MiB + name: /dev/sda1 + id: prep + + - partition: + size: 900 GiB + name: /dev/sda2 + file_system: ext4 + label: root + mount_point: "/" + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/support/proposed_partitions_examples.rb new/yast2-storage-ng-4.0.135/test/support/proposed_partitions_examples.rb --- old/yast2-storage-ng-4.0.132/test/support/proposed_partitions_examples.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/support/proposed_partitions_examples.rb 2018-03-16 11:43:38.000000000 +0100 @@ -156,7 +156,8 @@ expect(prep_part.min).to eq 4.MiB end - it "requires it to be at most 8 MiB (since it will be mapped to RAM)" do + # https://bugzilla.suse.com/show_bug.cgi?id=1081979 + it "requires it to be at most 8 MiB (some firmwares will fail to load bigger ones)" do expect(prep_part.max).to eq 8.MiB end end @@ -168,7 +169,8 @@ expect(prep_part.min).to eq 2.MiB end - it "requires it to be at most 8 MiB (since it will be mapped to RAM)" do + # https://bugzilla.suse.com/show_bug.cgi?id=1081979 + it "requires it to be at most 8 MiB (some firmwares will fail to load bigger ones)" do expect(prep_part.max).to eq 8.MiB end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_disk_device_test.rb new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_disk_device_test.rb --- old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_disk_device_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_disk_device_test.rb 2018-03-16 11:43:38.000000000 +0100 @@ -0,0 +1,124 @@ +#!/usr/bin/env rspec +# encoding: utf-8 + +# Copyright (c) [2017] SUSE LLC +# +# 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_relative "../test_helper" + +require "cwm/rspec" +require "y2partitioner/actions/delete_disk_device" + +describe Y2Partitioner::Actions::DeleteDiskDevice do + before do + devicegraph_stub(scenario) + end + + let(:device) { Y2Storage::BlkDevice.find_by_name(device_graph, device_name) } + + let(:device_graph) { Y2Partitioner::DeviceGraphs.instance.current } + + subject { described_class.new(device) } + + describe "#run" do + before do + allow(Yast2::Popup).to receive(:show) + allow(Yast::UI).to receive(:UserInput).and_return(accept) + end + + let(:scenario) { "mixed_disks_btrfs.yml" } + + let(:device_name) { "/dev/sda" } + + let(:accept) { :yes } + + context "when the device does not have partitions" do + let(:device_name) { "/dev/sdc" } + + it "shows an error message" do + expect(Yast2::Popup).to receive(:show) + subject.run + end + + it "returns :back" do + expect(subject.run).to eq(:back) + end + end + + context "when the device has an implicit partition table" do + let(:scenario) { "several-dasds" } + + let(:device_name) { "/dev/dasda" } + + it "shows an error message" do + expect(Yast2::Popup).to receive(:show) + subject.run + end + + it "returns :back" do + expect(subject.run).to eq(:back) + end + end + + context "when the device has partitions and the partition table is not implicit" do + let(:device_name) { "/dev/sda" } + + it "shows a confirm message" do + expect(subject).to receive(:confirm_recursive_delete) + .with(device, anything, anything, anything) + .and_call_original + + subject.run + end + + context "and the confirm message is not accepted" do + let(:accept) { :no } + + it "does not delete the disk partitions" do + previous_partitions = device.partitions + subject.run + expect(device.partitions).to eq(previous_partitions) + end + + it "returns :back" do + expect(subject.run).to eq(:back) + end + end + + context "when the confirm message is accepted" do + let(:accept) { :yes } + + it "deletes all its partitions" do + expect(device.partitions).to_not be_empty + subject.run + expect(device.partitions).to be_empty + end + + it "refreshes btrfs subvolumes shadowing" do + expect(Y2Storage::Filesystems::Btrfs).to receive(:refresh_subvolumes_shadowing) + subject.run + end + + it "returns :finish" do + expect(subject.run).to eq(:finish) + end + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_disk_test.rb new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_disk_test.rb --- old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_disk_test.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_disk_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,107 +0,0 @@ -#!/usr/bin/env rspec -# encoding: utf-8 - -# Copyright (c) [2017] SUSE LLC -# -# 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_relative "../test_helper" - -require "cwm/rspec" -require "y2partitioner/actions/delete_disk" - -describe Y2Partitioner::Actions::DeleteDisk do - before do - devicegraph_stub("mixed_disks_btrfs.yml") - end - - let(:device) { Y2Storage::BlkDevice.find_by_name(device_graph, device_name) } - - let(:device_graph) { Y2Partitioner::DeviceGraphs.instance.current } - - subject { described_class.new(device) } - - describe "#run" do - before do - # allow(Yast::Popup).to receive(:YesNo).and_return(accept) - allow(Yast::UI).to receive(:UserInput).and_return(accept) - end - - let(:device_name) { "/dev/sda" } - - let(:accept) { :yes } - - context "when the device does not have partitions" do - let(:device_name) { "/dev/sdc" } - - it "shows an error message" do - expect(Yast::Popup).to receive(:Error) - subject.run - end - - it "returns :back" do - expect(subject.run).to eq(:back) - end - end - - context "when the device has partitions" do - let(:device_name) { "/dev/sda" } - - it "shows a confirm message" do - expect(subject).to receive(:confirm_recursive_delete) - .with(device, anything, anything, anything) - .and_call_original - - subject.run - end - - context "and the confirm message is not accepted" do - let(:accept) { :no } - - it "does not delete the disk partitions" do - previous_partitions = device.partitions - subject.run - expect(device.partitions).to eq(previous_partitions) - end - - it "returns :back" do - expect(subject.run).to eq(:back) - end - end - - context "when the confirm message is accepted" do - let(:accept) { :yes } - - it "deletes all its partitions" do - expect(device.partitions).to_not be_empty - subject.run - expect(device.partitions).to be_empty - end - - it "refreshes btrfs subvolumes shadowing" do - expect(Y2Storage::Filesystems::Btrfs).to receive(:refresh_subvolumes_shadowing) - subject.run - end - - it "returns :finish" do - expect(subject.run).to eq(:finish) - end - end - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_lvm_lv_test.rb new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_lvm_lv_test.rb --- old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_lvm_lv_test.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_lvm_lv_test.rb 2018-03-16 11:43:38.000000000 +0100 @@ -41,8 +41,8 @@ vg = Y2Storage::LvmVg.find_by_vg_name(current_graph, "vg1") create_thin_provisioning(vg) - allow(Yast::Popup).to receive(:YesNo).and_return(accept) - allow(subject).to receive(:confirm_recursive_delete).and_return(accept) + allow(Yast2::Popup).to receive(:show).and_return(accept) + allow(subject).to receive(:confirm_recursive_delete).and_return(accept == :yes) end let(:accept) { nil } @@ -51,7 +51,7 @@ let(:device_name) { "/dev/vg1/lv1" } it "shows a confirmation message with the device name" do - expect(Yast::Popup).to receive(:YesNo) do |string| + expect(Yast2::Popup).to receive(:show) do |string, _anything| expect(string).to include(device_name) end subject.run @@ -71,7 +71,7 @@ end context "when the confirm message is not accepted" do - let(:accept) { false } + let(:accept) { :no } let(:device_name) { "/dev/vg1/lv1" } @@ -97,7 +97,7 @@ end context "when the confirm message is accepted" do - let(:accept) { true } + let(:accept) { :yes } let(:device_name) { "/dev/vg1/lv1" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_lvm_vg_test.rb new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_lvm_vg_test.rb --- old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_lvm_vg_test.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_lvm_vg_test.rb 2018-03-16 11:43:38.000000000 +0100 @@ -42,7 +42,7 @@ before { device.remove_descendants } it "shows a confirmation message with the device name" do - expect(Yast::Popup).to receive(:YesNo) do |string| + expect(Yast2::Popup).to receive(:show) do |string, _anything| expect(string).to include device_name end action.run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_md_test.rb new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_md_test.rb --- old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_md_test.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_md_test.rb 2018-03-16 11:43:38.000000000 +0100 @@ -38,7 +38,7 @@ describe "#run" do before do - allow(Yast::Popup).to receive(:YesNo).and_return(accept) + allow(Yast2::Popup).to receive(:show).and_return(accept) end let(:device_name) { "/dev/md/md0" } @@ -47,7 +47,7 @@ context "when deleting a regular md raid" do it "shows a confirm message" do - expect(Yast::Popup).to receive(:YesNo) + expect(Yast2::Popup).to receive(:show) subject.run end end @@ -72,7 +72,7 @@ end context "when the confirm message is not accepted" do - let(:accept) { false } + let(:accept) { :no } it "does not delete the md raid" do subject.run @@ -85,7 +85,7 @@ end context "when the confirm message is accepted" do - let(:accept) { true } + let(:accept) { :yes } it "deletes the md raid" do subject.run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_partition_test.rb new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_partition_test.rb --- old/yast2-storage-ng-4.0.132/test/y2partitioner/actions/delete_partition_test.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2partitioner/actions/delete_partition_test.rb 2018-03-16 11:43:38.000000000 +0100 @@ -38,7 +38,7 @@ describe "#run" do before do - allow(Yast::Popup).to receive(:YesNo).and_return(accept) + allow(Yast2::Popup).to receive(:show).and_return(accept) end let(:scenario) { "lvm-two-vgs.yml" } @@ -51,11 +51,26 @@ let(:device_name) { "/dev/sda2" } it "shows a confirm message" do - expect(Yast::Popup).to receive(:YesNo) + expect(Yast2::Popup).to receive(:show) subject.run end end + context "when deleting a partition from an implicit partition table" do + let(:scenario) { "several-dasds" } + + let(:device_name) { "/dev/dasda1" } + + it "shows an error message" do + expect(Yast2::Popup).to receive(:show) + subject.run + end + + it "returns :back" do + expect(subject.run).to eq(:back) + end + end + context "when deleting a partition used by LVM" do let(:device_name) { "/dev/sda5" } @@ -83,7 +98,7 @@ end context "when the confirm message is not accepted" do - let(:accept) { false } + let(:accept) { :no } it "does not delete the partition" do subject.run @@ -96,7 +111,7 @@ end context "when the confirm message is accepted" do - let(:accept) { true } + let(:accept) { :yes } it "deletes the partition" do subject.run diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2partitioner/widgets/device_delete_button_test.rb new/yast2-storage-ng-4.0.135/test/y2partitioner/widgets/device_delete_button_test.rb --- old/yast2-storage-ng-4.0.132/test/y2partitioner/widgets/device_delete_button_test.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2partitioner/widgets/device_delete_button_test.rb 2018-03-16 11:43:38.000000000 +0100 @@ -78,12 +78,12 @@ expect(subject.handle).to be_nil end - context "and the device is a disk" do - let(:device_type) { :disk } + context "and the device is a disk device" do + let(:device_type) { :disk_device } - let(:action_class) { Y2Partitioner::Actions::DeleteDisk } + let(:action_class) { Y2Partitioner::Actions::DeleteDiskDevice } - it "performs the action for deleting a disk" do + it "performs the action for deleting a disk device" do expect(action_class).to receive(:new).with(device).and_return(action) expect(action).to receive(:run) subject.handle diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2storage/boot_requirements_errors_test.rb new/yast2-storage-ng-4.0.135/test/y2storage/boot_requirements_errors_test.rb --- old/yast2-storage-ng-4.0.132/test/y2storage/boot_requirements_errors_test.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2storage/boot_requirements_errors_test.rb 2018-03-16 11:43:38.000000000 +0100 @@ -355,6 +355,18 @@ include_examples "no errors" end + context "there is too big PReP partition" do + let(:scenario) { "prep_big" } + + it "contains a warning for too big PReP partition" do + expect(checker.warnings.size).to eq(1) + expect(checker.warnings).to all(be_a(Y2Storage::SetupError)) + + message = checker.warnings.first.message + expect(message).to match(/partition is too big/) + end + end + context "PReP partition missing" do let(:scenario) { "trivial" } include_examples "missing prep partition" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2storage/filesystems/blk_filesystem_test.rb new/yast2-storage-ng-4.0.135/test/y2storage/filesystems/blk_filesystem_test.rb --- old/yast2-storage-ng-4.0.132/test/y2storage/filesystems/blk_filesystem_test.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2storage/filesystems/blk_filesystem_test.rb 2018-03-16 11:43:38.000000000 +0100 @@ -30,25 +30,80 @@ end let(:scenario) { "mixed_disks_btrfs" } let(:blk_device) { Y2Storage::BlkDevice.find_by_name(fake_devicegraph, dev_name) } + let(:btrfs_part) { "/dev/sdb2" } + let(:xfs_part) { "/dev/sdb5" } + let(:ntfs_part) { "/dev/sda1" } subject(:filesystem) { blk_device.blk_filesystem } describe "#supports_btrfs_subvolumes?" do context "for a Btrfs filesystem" do - let(:dev_name) { "/dev/sdb2" } + let(:dev_name) { btrfs_part } it "returns true" do expect(filesystem.supports_btrfs_subvolumes?).to eq true end end - context "for a no-Btrfs filesystem" do - let(:dev_name) { "/dev/sdb5" } + context "for a non-Btrfs filesystem" do + let(:dev_name) { xfs_part } it "returns false" do expect(filesystem.supports_btrfs_subvolumes?).to eq false end end end + + describe "#supports_grow?" do + context "for a Btrfs filesystem" do + let(:dev_name) { btrfs_part } + + it "returns true" do + expect(filesystem.supports_grow?).to eq true + end + end + + context "for an XFS filesystem" do + let(:dev_name) { xfs_part } + + it "returns false" do + expect(filesystem.supports_grow?).to eq true + end + end + + context "for an NTFS filesystem" do + let(:dev_name) { ntfs_part } + + it "returns true" do + expect(filesystem.supports_grow?).to eq true + end + end + end + + describe "#supports_shrink?" do + context "for a Btrfs filesystem" do + let(:dev_name) { btrfs_part } + + it "returns true" do + expect(filesystem.supports_shrink?).to eq true + end + end + + context "for an XFS filesystem" do + let(:dev_name) { xfs_part } + + it "returns true" do + expect(filesystem.supports_shrink?).to eq false + end + end + + context "for an NTFS filesystem" do + let(:dev_name) { ntfs_part } + + it "returns true" do + expect(filesystem.supports_shrink?).to eq true + end + end + end describe "#mount_path" do context "when filesystem has no mount point" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-storage-ng-4.0.132/test/y2storage/partition_test.rb new/yast2-storage-ng-4.0.135/test/y2storage/partition_test.rb --- old/yast2-storage-ng-4.0.132/test/y2storage/partition_test.rb 2018-03-14 15:20:08.000000000 +0100 +++ new/yast2-storage-ng-4.0.135/test/y2storage/partition_test.rb 2018-03-16 11:43:38.000000000 +0100 @@ -482,4 +482,26 @@ end end end + + describe "#implicit?" do + subject { fake_devicegraph.find_by_name(device_name) } + + let(:scenario) { "several-dasds" } + + context "when the partition belongs to an implicit partition table" do + let(:device_name) { "/dev/dasda1" } + + it "returns true" do + expect(subject.implicit?).to eq(true) + end + end + + context "when the partition does not belong to an implicit partition table" do + let(:device_name) { "/dev/dasdc1" } + + it "returns false" do + expect(subject.implicit?).to eq(false) + end + end + end end
