Skip to content
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
3 changes: 2 additions & 1 deletion rust/agama-lib/share/storage.model.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
"reuse": { "type": "boolean" },
"default": { "type": "boolean" },
"type": { "$ref": "#/$defs/filesystemType" },
"snapshots": { "type": "boolean" }
"snapshots": { "type": "boolean" },
"label": { "type": "string" }
}
},
"filesystemType": {
Expand Down
6 changes: 6 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Feb 26 06:52:52 UTC 2025 - José Iván López González <jlopez@suse.com>

- Extend storage model schema to support file system label (needed
for jsc#AGM-122 and bsc#1237165).

-------------------------------------------------------------------
Wed Feb 26 06:51:37 UTC 2025 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# Copyright (c) [2024] SUSE LLC
# Copyright (c) [2024-2025] SUSE LLC
#
# All Rights Reserved.
#
Expand Down Expand Up @@ -43,7 +43,8 @@ def conversions
{
reuse: model_json.dig(:filesystem, :reuse),
path: model_json[:mountPath],
type: convert_type
type: convert_type,
label: model_json.dig(:filesystem, :label)
}
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# Copyright (c) [2024] SUSE LLC
# Copyright (c) [2024-2025] SUSE LLC
#
# All Rights Reserved.
#
Expand Down Expand Up @@ -41,7 +41,8 @@ def conversions
reuse: config.reuse?,
default: convert_default,
type: convert_type,
snapshots: convert_snapshots
snapshots: convert_snapshots,
label: config.label
}
end

Expand Down
6 changes: 6 additions & 0 deletions service/package/rubygem-agama-yast.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Feb 26 06:52:45 UTC 2025 - José Iván López González <jlopez@suse.com>

- Add file system label to the config model (needed for jsc#AGM-122
and bsc#1237165).

-------------------------------------------------------------------
Wed Feb 26 06:51:36 UTC 2025 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
79 changes: 51 additions & 28 deletions service/test/agama/storage/config_conversions/from_model_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,23 @@
end

shared_examples "with filesystem" do |config_proc|
let(:filesystem) do
{
reuse: reuse,
default: default,
type: type,
snapshots: true,
label: label
}
end

let(:reuse) { false }
let(:default) { false }
let(:type) { nil }
let(:label) { "test" }

context "if the filesystem is default" do
let(:filesystem) do
{
default: true,
type: type,
snapshots: true
}
end
let(:default) { true }

context "and the type is 'btrfs'" do
let(:type) { "btrfs" }
Expand All @@ -193,7 +202,7 @@
expect(filesystem.type.fs_type).to eq(Y2Storage::Filesystems::Type::BTRFS)
expect(filesystem.type.btrfs).to be_a(Agama::Storage::Configs::Btrfs)
expect(filesystem.type.btrfs.snapshots?).to eq(true)
expect(filesystem.label).to be_nil
expect(filesystem.label).to eq("test")
expect(filesystem.path).to be_nil
expect(filesystem.mount_by).to be_nil
expect(filesystem.mkfs_options).to be_empty
Expand All @@ -212,7 +221,7 @@
expect(filesystem.type.default?).to eq(true)
expect(filesystem.type.fs_type).to eq(Y2Storage::Filesystems::Type::XFS)
expect(filesystem.type.btrfs).to be_nil
expect(filesystem.label).to be_nil
expect(filesystem.label).to eq("test")
expect(filesystem.path).to be_nil
expect(filesystem.mount_by).to be_nil
expect(filesystem.mkfs_options).to be_empty
Expand All @@ -222,13 +231,7 @@
end

context "if the filesystem is not default" do
let(:filesystem) do
{
default: false,
type: type,
snapshots: true
}
end
let(:default) { false }

context "and the type is 'btrfs'" do
let(:type) { "btrfs" }
Expand All @@ -242,7 +245,7 @@
expect(filesystem.type.fs_type).to eq(Y2Storage::Filesystems::Type::BTRFS)
expect(filesystem.type.btrfs).to be_a(Agama::Storage::Configs::Btrfs)
expect(filesystem.type.btrfs.snapshots?).to eq(true)
expect(filesystem.label).to be_nil
expect(filesystem.label).to eq("test")
expect(filesystem.path).to be_nil
expect(filesystem.mount_by).to be_nil
expect(filesystem.mkfs_options).to be_empty
Expand All @@ -261,7 +264,7 @@
expect(filesystem.type.default?).to eq(false)
expect(filesystem.type.fs_type).to eq(Y2Storage::Filesystems::Type::XFS)
expect(filesystem.type.btrfs).to be_nil
expect(filesystem.label).to be_nil
expect(filesystem.label).to eq("test")
expect(filesystem.path).to be_nil
expect(filesystem.mount_by).to be_nil
expect(filesystem.mkfs_options).to be_empty
Expand All @@ -270,8 +273,27 @@
end
end

context "if the filesystem specifies 'reuse'" do
let(:reuse) { true }

it "sets #filesystem to the expected value" do
config = config_proc.call(subject.convert)
filesystem = config.filesystem
expect(filesystem).to be_a(Agama::Storage::Configs::Filesystem)
expect(filesystem.reuse?).to eq(true)
expect(filesystem.type.default?).to eq(false)
expect(filesystem.type.fs_type).to be_nil
expect(filesystem.type.btrfs).to be_nil
expect(filesystem.label).to eq("test")
expect(filesystem.path).to be_nil
expect(filesystem.mount_by).to be_nil
expect(filesystem.mkfs_options).to be_empty
expect(filesystem.mount_options).to be_empty
end
end

context "if the filesystem does not specify 'type'" do
let(:filesystem) { { default: false } }
let(:type) { nil }

it "sets #filesystem to the expected value" do
config = config_proc.call(subject.convert)
Expand All @@ -281,30 +303,30 @@
expect(filesystem.type.default?).to eq(false)
expect(filesystem.type.fs_type).to be_nil
expect(filesystem.type.btrfs).to be_nil
expect(filesystem.label).to be_nil
expect(filesystem.label).to eq("test")
expect(filesystem.path).to be_nil
expect(filesystem.mount_by).to be_nil
expect(filesystem.mkfs_options).to eq([])
expect(filesystem.mount_options).to eq([])
end
end

context "if the filesystem specifies 'reuse'" do
let(:filesystem) { { reuse: true } }
context "if the filesystem does not specify 'label'" do
let(:label) { nil }

it "sets #filesystem to the expected value" do
config = config_proc.call(subject.convert)
filesystem = config.filesystem
expect(filesystem).to be_a(Agama::Storage::Configs::Filesystem)
expect(filesystem.reuse?).to eq(true)
expect(filesystem.type.default?).to eq(true)
expect(filesystem.reuse?).to eq(false)
expect(filesystem.type.default?).to eq(false)
expect(filesystem.type.fs_type).to be_nil
expect(filesystem.type.btrfs).to be_nil
expect(filesystem.label).to be_nil
expect(filesystem.path).to be_nil
expect(filesystem.mount_by).to be_nil
expect(filesystem.mkfs_options).to be_empty
expect(filesystem.mount_options).to be_empty
expect(filesystem.mkfs_options).to eq([])
expect(filesystem.mount_options).to eq([])
end
end
end
Expand All @@ -316,7 +338,8 @@
{
default: false,
type: "btrfs",
snapshots: true
snapshots: true,
label: "test"
}
end

Expand All @@ -329,7 +352,7 @@
expect(filesystem.type.fs_type).to eq(Y2Storage::Filesystems::Type::BTRFS)
expect(filesystem.type.btrfs).to be_a(Agama::Storage::Configs::Btrfs)
expect(filesystem.type.btrfs.snapshots?).to eq(true)
expect(filesystem.label).to be_nil
expect(filesystem.label).to eq("test")
expect(filesystem.path).to eq("/test")
expect(filesystem.mount_by).to be_nil
expect(filesystem.mkfs_options).to be_empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
{
reuse: true,
default: false,
type: "xfs"
type: "xfs",
label: "test"
}
)
end
Expand Down
6 changes: 6 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Feb 27 11:21:45 UTC 2025 - José Iván López González <jlopez@suse.com>

- Allow setting the file system label (related to jsc#AGM-122
and bsc#1237165).

-------------------------------------------------------------------
Thu Feb 27 10:21:45 UTC 2025 - José Iván López González <jlopez@suse.com>

Expand Down
1 change: 1 addition & 0 deletions web/src/api/storage/types/config-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface Filesystem {
default: boolean;
type?: FilesystemType;
snapshots?: boolean;
label?: string;
}
export interface Partition {
name?: string;
Expand Down
13 changes: 12 additions & 1 deletion web/src/components/storage/PartitionPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,16 @@ describe("PartitionPage", () => {
const size = screen.getByRole("button", { name: "Size" });
// File system and size fields disabled until valid mount point selected
expect(filesystem).toBeDisabled();
expect(screen.queryByRole("textbox", { name: "File system label" })).not.toBeInTheDocument();
expect(size).toBeDisabled();

await user.click(mountPoint);
const mountPointOptions = screen.getByRole("listbox", { name: "Suggested mount points" });
const homeMountPoint = within(mountPointOptions).getByRole("option", { name: "/home" });
await user.click(homeMountPoint);
// Valid mount point selected, enable file system and size fields
expect(filesystem).toBeEnabled();
expect(screen.queryByRole("textbox", { name: "File system label" })).toBeInTheDocument();
expect(size).toBeEnabled();
// Display mount point options
await user.click(mountPointMode);
Expand Down Expand Up @@ -206,6 +209,7 @@ describe("PartitionPage", () => {
await user.click(homeMountPoint);
expect(mountPoint).toHaveValue("/home");
expect(filesystem).toBeEnabled();
expect(screen.queryByRole("textbox", { name: "File system label" })).toBeInTheDocument();
expect(size).toBeEnabled();
const clearMountPointButton = screen.getByRole("button", {
name: "Clear selected mount point",
Expand All @@ -214,6 +218,7 @@ describe("PartitionPage", () => {
expect(mountPoint).toHaveValue("");
// File system and size fields disabled until valid mount point selected
expect(filesystem).toBeDisabled();
expect(screen.queryByRole("textbox", { name: "File system label" })).not.toBeInTheDocument();
expect(size).toBeDisabled();
});

Expand All @@ -227,7 +232,11 @@ describe("PartitionPage", () => {
min: gib(5),
max: gib(15),
},
filesystem: { default: false, type: "xfs" },
filesystem: {
default: false,
type: "xfs",
label: "HOME",
},
});
});

Expand All @@ -239,6 +248,8 @@ describe("PartitionPage", () => {
within(targetButton).getByText(/As a new partition/);
const filesystemButton = screen.getByRole("button", { name: "File system" });
within(filesystemButton).getByText("XFS");
const label = screen.getByRole("textbox", { name: "File system label" });
expect(label).toHaveValue("HOME");
const sizeOptionButton = screen.getByRole("button", { name: "Size" });
within(sizeOptionButton).getByText("Custom");
const minSizeInput = screen.getByRole("textbox", { name: "Minimum size value" });
Expand Down
Loading