Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug when formatting a full disk as Btrfs with snapshots #1385

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
-------------------------------------------------------------------
Fri Jun 14 12:41:07 UTC 2024 - Ancor Gonzalez Sosa <ancor@suse.com>

- Fixed a problem when trying to locate a Btrfs root file-system
directly on top of a disk (gh#openSUSE/agama#1339).
- 5.0.15

-------------------------------------------------------------------
Thu Jun 13 15:16:24 UTC 2024 - José Iván López González <jlopez@suse.com>

- Fix device description for encrypted PV
(gh#yast/yast-storage-ng#1384).
- 5.0.15

-------------------------------------------------------------------
Tue May 7 14:38:42 UTC 2024 - Ancor Gonzalez Sosa <ancor@suse.com>
Expand Down
2 changes: 1 addition & 1 deletion package/yast2-storage-ng.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 5.0.14
Version: 5.0.15
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
1 change: 1 addition & 0 deletions src/lib/y2storage/proposal/devices_planner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def adjust_btrfs(planned_device, volume)
# @param volume [VolumeSpecification]
def adjust_btrfs_sizes(planned_device, volume)
return if volume.ignore_snapshots_sizes?
return unless planned_device.respond_to?(:min_size)

if volume.snapshots_size > DiskSize.zero
planned_device.min_size += volume.snapshots_size
Expand Down
21 changes: 20 additions & 1 deletion test/y2storage/proposal_agama_reuse_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
# Let's define some volumes to shuffle them around among the disks
let(:volumes) { [root_vol, srv_vol, swap_vol] }
let(:root_vol) do
{ "mount_point" => "/", "fs_type" => "xfs", "min_size" => "5 GiB", "max_size" => "30 GiB" }
{
"mount_point" => "/", "fs_type" => "btrfs", "min_size" => "5 GiB", "max_size" => "30 GiB",
"snapshots" => true, "snapshots_percentage" => 160
}
end
let(:srv_vol) do
{ "mount_point" => "/srv", "fs_type" => "xfs", "min_size" => "5 GiB", "max_size" => "10 GiB" }
Expand Down Expand Up @@ -269,6 +272,22 @@
expect(filesystem.type.is?(:xfs)).to eq true
end
end

context "if the relocated volume is the root Btrfs with snapshots" do
before do
srv = settings.volumes.find { |v| v.mount_point == "/" }
srv.reuse_name = "/dev/sdc"
end

# The proposal used to throw an exception when adjusting the Btrfs-related sizes
# if the target device was a disk (so no sizes could actually be adjusted)
it "makes the proposal and assigns the mount point" do
proposal.propose
filesystem = proposal.devices.filesystems.find { |i| i.mount_path == "/" }
expect(filesystem.blk_devices.first.name).to eq "/dev/sdc"
expect(filesystem.type.is?(:btrfs)).to eq true
end
end
end

context "when using the existing filesystem from a disk" do
Expand Down
Loading