Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
ccdd718
storage: add vgs and lvs to model schema
joseivanlopez Feb 27, 2025
8b545a1
storage: add conversion to model for LVM
joseivanlopez Feb 28, 2025
851d33d
feat(storage): make vg name mandatory
joseivanlopez Mar 3, 2025
f2bdb8c
fix(storage): drive model includes the searching name
joseivanlopez Mar 5, 2025
e99fb73
fix(storage): only exclude skipped devices from model
joseivanlopez Mar 5, 2025
6970c14
fix(storage): model always generates a min size
joseivanlopez Mar 5, 2025
4be9c6a
storage: add checker for model support
joseivanlopez Mar 3, 2025
e70204a
storage: use model support checker
joseivanlopez Mar 5, 2025
5983925
web: Extract repeated code to a new DeviceMenu component
ancorgs Mar 1, 2025
4016485
web: First real implementation of hasPV
ancorgs Mar 3, 2025
451637c
web: Refresh types/config-model.ts
ancorgs Mar 3, 2025
eb08eb0
web: First version of VolumeGroupEditor
ancorgs Mar 3, 2025
c0764ff
web: Add list of logical volumes
ancorgs Mar 3, 2025
552352d
web: add initial storage model hook
joseivanlopez Mar 6, 2025
8555ca7
web: use model hook
joseivanlopez Mar 6, 2025
4c46f93
web: add basic test for config editor
joseivanlopez Mar 6, 2025
e6cf582
storage: make global encryption to work with LVM
joseivanlopez Mar 7, 2025
8668a57
service: changelog
joseivanlopez Mar 7, 2025
0dd659f
rust: changelog
joseivanlopez Mar 7, 2025
7d64c00
web: changelog
joseivanlopez Mar 7, 2025
2dfb8d2
web: rename utils file
joseivanlopez Mar 10, 2025
44a7bb6
web: extract components
joseivanlopez Mar 10, 2025
8fefec1
feat(ui): show volume groups (#2089)
joseivanlopez Mar 10, 2025
09da914
Merge branch 'after-release-beta2' into sync-branch
joseivanlopez Mar 10, 2025
404a07d
Sync storage-lvm branch (#2136)
joseivanlopez Mar 10, 2025
e98047d
fix(web): enable auto-width for popups without a variant
dgdavid Mar 10, 2025
34b3f69
fix(web): improve login page layout
dgdavid Mar 10, 2025
4149d43
fix(web): accept a ReactNode as Page/Section#title
dgdavid Mar 10, 2025
e2d44c6
fix(web): layout improvements (#2137)
dgdavid Mar 10, 2025
ad1bc9e
fix(web): prevent PF/FormGroup from filling full width
dgdavid Mar 6, 2025
9192daf
fix(web): remove obsolete layout form hacks
dgdavid Mar 6, 2025
d4ec9b7
feat(web): override checkboxes size
dgdavid Mar 6, 2025
f38e90e
feat(web): overrides some PF/Checkbox styles
dgdavid Mar 6, 2025
1b4275b
feat(web): add non-functional version of LVM form
dgdavid Mar 6, 2025
16b73f8
web: recover styles
joseivanlopez Mar 10, 2025
9e9a642
web: adapt storage paths
joseivanlopez Mar 10, 2025
1ca34bd
fix(storage): improve boot config solver
joseivanlopez Mar 11, 2025
590be11
fix(storage): adapt message of boot error
joseivanlopez Mar 11, 2025
5b1dfe7
fix(storage): export device name to model if possible
joseivanlopez Mar 11, 2025
f3aedab
refactor(storage): move methods to config
joseivanlopez Mar 11, 2025
822b4c4
feat(storage): do not use aliases in the model
joseivanlopez Mar 12, 2025
b5b4703
feat(storage): improve code to generate config from model
joseivanlopez Mar 12, 2025
b3ad225
feat(storage): generate lvm config from model
joseivanlopez Mar 12, 2025
9a87a49
fix(storage): use vgName and lvName in model
joseivanlopez Mar 13, 2025
6bc9c6d
fix(storage): do not generate keep action partition from model
joseivanlopez Mar 14, 2025
b8926ca
web: update config-model types
joseivanlopez Mar 13, 2025
4169c38
web: adapt model hooks
joseivanlopez Mar 13, 2025
eab7a22
web: adapt components
joseivanlopez Mar 13, 2025
f1a034f
web: do not remove target pv drive
joseivanlopez Mar 14, 2025
26be7cd
web: add references to the model
joseivanlopez Mar 18, 2025
ebb881a
fix(web): show name of the volume group
joseivanlopez Mar 18, 2025
66decfe
web: mark config-model hooks as deprecated
joseivanlopez Mar 18, 2025
c01f85c
fix(web): do not offer to create existing mount points from logical v…
joseivanlopez Mar 18, 2025
fd360fe
chore(web): rename configModel as apiModel
joseivanlopez Mar 18, 2025
08ef220
chore(web): rename file
joseivanlopez Mar 18, 2025
99a6cce
web: improve how model is exported and imported
joseivanlopez Mar 18, 2025
768ea04
web: add hooks for api model
joseivanlopez Mar 18, 2025
035290a
web: add hook for adding a volume group
joseivanlopez Mar 18, 2025
1f50898
web: add menu option for adding a volume group
joseivanlopez Mar 18, 2025
e6b987d
web: adapt lvm page to create a volume group
joseivanlopez Mar 18, 2025
c99d36d
web: add validations to volume group form
joseivanlopez Mar 19, 2025
96996b6
web: fix assignment of default vg name
joseivanlopez Mar 20, 2025
0971c64
Fix typo
joseivanlopez Mar 21, 2025
c61249f
web: small code improvement
joseivanlopez Mar 21, 2025
fb381fe
web: improve wording
joseivanlopez Mar 21, 2025
24a169f
feat(web): allow creation of LVM volume group (#2123)
joseivanlopez Mar 21, 2025
e5f0ef0
web: add #isUsed to model drives
joseivanlopez Mar 19, 2025
ca4e1d0
web: add hook for editing a volume group
joseivanlopez Mar 19, 2025
e3c2238
web: reorganize storage paths
joseivanlopez Mar 20, 2025
1fb8f6d
web: allow editing a volume group
joseivanlopez Mar 20, 2025
a47f1a6
web: improvements in the storage hooks
joseivanlopez Mar 21, 2025
2c3eef8
web: fix helper for editing a volume group
joseivanlopez Mar 21, 2025
164757f
Merge branch 'master' into merge-master
joseivanlopez Mar 21, 2025
8579583
Sync with master (#2188)
joseivanlopez Mar 21, 2025
0ffc48a
Merge branch 'storage-lvm' into edit-vg
joseivanlopez Mar 21, 2025
0136416
web: add basic unit test for LVM form
dgdavid Mar 21, 2025
13cc747
fix(web): drop repeated lines
dgdavid Mar 21, 2025
77a435f
fix(web): improve error messages
dgdavid Mar 22, 2025
235fc0b
web: add hook for deleting a volume group
joseivanlopez Mar 21, 2025
5f79c37
web: allow deleting a volume group
joseivanlopez Mar 21, 2025
8a585ad
web: add empty state for config editor
joseivanlopez Mar 24, 2025
ff0b31c
fix(web): suggestion from code review
dgdavid Mar 24, 2025
235e38f
doc(web): drop repeated word
dgdavid Mar 24, 2025
10526e8
feat(web): edit volume group (#2177)
dgdavid Mar 24, 2025
7330c03
Merge branch 'storage-lvm' into delete-vg
joseivanlopez Mar 24, 2025
429fde7
web: fix typo
joseivanlopez Mar 24, 2025
0633d14
fix(web): use Alert instead of EmptyState
dgdavid Mar 24, 2025
3676217
refactor(web): update behavior of "use disk" menu
dgdavid Mar 24, 2025
eee368d
refactor(web): swap order of config editor actions
dgdavid Mar 24, 2025
738ea2f
fix(web): adjust the no configuration alert
dgdavid Mar 25, 2025
2837138
fix(web): use imperative mode in button wording
dgdavid Mar 26, 2025
293b4fc
refactor(web): improve the menu for adding storage devices
dgdavid Mar 26, 2025
a37893a
fix(web): add missing "s" to a button label
dgdavid Mar 26, 2025
c799408
fix(web): rename component rendering configure devices menu
dgdavid Mar 26, 2025
37077e3
feat(web): delete volume group (#2186)
joseivanlopez Mar 26, 2025
edc4b6d
web: reorganize hooks and helpers
joseivanlopez Mar 24, 2025
d54548e
web: add data types
joseivanlopez Mar 24, 2025
80e0b28
web: adapt lvm page to use data types
joseivanlopez Mar 25, 2025
9e59996
web: helpers reoganization
joseivanlopez Mar 25, 2025
5257973
web: add hooks for managing logical volumes
joseivanlopez Mar 26, 2025
619651a
web: add logical volume management
joseivanlopez Mar 26, 2025
8b26586
web: use AutoSizeText in PartitionPage
joseivanlopez Mar 26, 2025
6473471
refactor(web): change the alerts look and feel
dgdavid Mar 26, 2025
8616c05
web: add lv name when creating from partition
joseivanlopez Mar 27, 2025
4b6b623
web: preselect disks for system volume group
joseivanlopez Mar 27, 2025
beef8b3
web: fix test
joseivanlopez Mar 27, 2025
f145f01
web: Align grids of multi-line checkboxes
ancorgs Mar 26, 2025
53e05e8
web: Handle more recoverable errors
ancorgs Mar 26, 2025
8688842
web: Reword some ConfigEditor buttons
ancorgs Mar 26, 2025
7cc76e2
web: Clarify wording about boot partitions
ancorgs Mar 27, 2025
88c40d5
refactor(web): change the alerts look and feel (#2212)
imobachgs Mar 27, 2025
53a79c6
Merge pull request #7 from ancorgs/manage-lvs-fixes
joseivanlopez Mar 27, 2025
0be7cd3
feat(web): manage logical volumes (#2200)
joseivanlopez Mar 27, 2025
90bac81
Merge branch 'master' into storage-lvm
joseivanlopez Mar 27, 2025
15eda6b
service: changelog
joseivanlopez Mar 27, 2025
36911f7
web: changelog
joseivanlopez Mar 27, 2025
138cb18
fix(web): do not add styles to plain alerts
dgdavid Mar 27, 2025
157d436
web: fix mount path regex
joseivanlopez Mar 27, 2025
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
28 changes: 27 additions & 1 deletion rust/agama-lib/share/examples/storage/model.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"drives": [
{
"name": "/dev/vda",
"alias": "root",
"mountPath": "/",
"filesystem": {
"default": true,
Expand Down Expand Up @@ -75,6 +74,33 @@
}
}
]
},
{
"name": "/dev/vdc",
"spacePolicy": "delete"
}
],
"volumeGroups": [
{
"vgName": "vg0",
"extentSize": 1024,
"targetDevices": ["/dev/vdc"],
"logicalVolumes": [
{
"lvName": "lv0",
"mountPath": "/data",
"filesystem": {
"default": false,
"type": "ext4"
},
"size": {
"default": true,
"min": 1111
},
"stripes": 8,
"stripeSize": 1204
}
]
}
]
}
37 changes: 32 additions & 5 deletions rust/agama-lib/share/storage.model.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"drives": {
"type": "array",
"items": { "$ref": "#/$defs/drive" }
},
"volumeGroups": {
"type": "array",
"items": { "$ref": "#/$defs/volumeGroup" }
}
},
"$defs": {
Expand Down Expand Up @@ -52,7 +56,6 @@
"required": ["name"],
"properties": {
"name": { "type": "string" },
"alias": { "$ref": "#/$defs/alias" },
"mountPath": { "type": "string" },
"filesystem": { "$ref": "#/$defs/filesystem" },
"spacePolicy": { "$ref": "#/$defs/spacePolicy" },
Expand All @@ -68,7 +71,6 @@
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"alias": { "$ref": "#/$defs/alias" },
"id": { "$ref": "#/$defs/partitionId" },
"mountPath": { "type": "string" },
"filesystem": { "$ref": "#/$defs/filesystem" },
Expand All @@ -79,9 +81,34 @@
"resizeIfNeeded": { "type": "boolean" }
}
},
"alias": {
"description": "Alias used to reference a device.",
"type": "string"
"volumeGroup": {
"type": "object",
"additionalProperties": false,
"required": ["vgName"],
"properties": {
"vgName": { "type": "string" },
"extentSize": { "type": "integer" },
"targetDevices": {
"type": "array",
"items": { "type": "string" }
},
"logicalVolumes": {
"type": "array",
"items": { "$ref": "#/$defs/logicalVolume" }
}
}
},
"logicalVolume": {
"type": "object",
"additionalProperties": false,
"properties": {
"lvName": { "type": "string" },
"mountPath": { "type": "string" },
"filesystem": { "$ref": "#/$defs/filesystem" },
"size": { "$ref": "#/$defs/size" },
"stripes": { "type": "integer" },
"stripeSize": { "type": "integer" }
}
},
"spacePolicy": {
"enum": ["delete", "resize", "keep", "custom"]
Expand Down
1 change: 1 addition & 0 deletions rust/agama-lib/share/storage.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
"description": "LVM volume group.",
"type": "object",
"additionalProperties": false,
"required": ["name"],
"properties": {
"name": {
"description": "Volume group name.",
Expand Down
5 changes: 5 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ Mon Mar 10 12:13:19 UTC 2025 - José Iván López González <jlopez@suse.com>
- Package and install the storage model schema
(gh#agama-project/agama#2135).

-------------------------------------------------------------------
Fri Mar 7 11:40:56 UTC 2025 - José Iván López González <jlopez@suse.com>

- Extend storage model schema with LVM (gh#agama-project/agama#2089).

-------------------------------------------------------------------
Thu Mar 6 12:51:42 UTC 2025 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
39 changes: 31 additions & 8 deletions service/lib/agama/storage/config.rb
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 @@ -60,16 +60,39 @@ def initialize
@nfs_mounts = []
end

# Name of the device that will be used to boot the target system, if any.
#
# @note The config has to be solved.
#
# @return [String, nil]
# @return [Configs::Drive, nil]
def boot_device
return unless boot.configure? && boot.device.device_alias

boot_drive = drives.find { |d| d.alias?(boot.device.device_alias) }
boot_drive&.found_device&.name
drives.find { |d| d.alias?(boot.device.device_alias) }
end

# Device config containing root.
#
# @return [Configs::Drive, Configs::VolumeGroup, nil]
def root_device
root_drive || root_volume_group
end

# Drive config containing root.
#
# @return [Configs::Drive, nil]
def root_drive
drives.find { |d| d.root? || d.partitions.any?(&:root?) }
end

# Volume group config containing a logical volume for root.
#
# @return [Configs::LogicalVolume, nil]
def root_volume_group
volume_groups.find { |v| v.logical_volumes.any?(&:root?) }
end

# Drive with the given alias.
#
# @return [Configs::Drive, nil]
def drive(device_alias)
drives.find { |d| d.alias?(device_alias) }
end

# @return [Array<Configs::Partition>]
Expand Down
11 changes: 6 additions & 5 deletions service/lib/agama/storage/config_checkers/boot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ def device_alias
storage_config.boot.device.device_alias
end

# Error if a boot device is required and unknown.
#
# This happens when the config solver is not able to infer a boot device, see
# {ConfigSolvers::Boot}.
#
# @return [Issue, nil]
def missing_alias_issue
return unless configure? && device_alias.nil?

# Currently this situation only happens because the config solver was not able to find
# a device config containing a root volume. The message could become inaccurate if the
# solver logic changes.
error(
_("The boot device cannot be automatically selected because there is no root (/) " \
"file system"),
_("The boot device cannot be automatically selected"),
kind: :no_root
)
end
Expand Down
16 changes: 13 additions & 3 deletions service/lib/agama/storage/config_checkers/volume_group.rb
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,23 +41,33 @@ def initialize(config, storage_config, product_config)
@config = config
end

# Volume group config issues.
# Issues from a volume group config.
#
# @return [Array<Issue>]
def issues
[
name_issue,
logical_volumes_issues,
physical_volumes_issues,
physical_volumes_devices_issues,
physical_volumes_encryption_issues
].flatten
].compact.flatten
end

private

# @return [Configs::VolumeGroup]
attr_reader :config

# Issue if the volume group name is missing.
#
# @return [Issue, nil]
def name_issue
return if config.name && !config.name.empty?

error(_("There is a volume group without name"))
end

# Issues from logical volumes.
#
# @return [Array<Issue>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
require "agama/storage/config_conversions/from_model_conversions/encryption"
require "agama/storage/config_conversions/from_model_conversions/filesystem"
require "agama/storage/config_conversions/from_model_conversions/filesystem_type"
require "agama/storage/config_conversions/from_model_conversions/logical_volume"
require "agama/storage/config_conversions/from_model_conversions/partition"
require "agama/storage/config_conversions/from_model_conversions/search"
require "agama/storage/config_conversions/from_model_conversions/size"
require "agama/storage/config_conversions/from_model_conversions/volume_group"

module Agama
module Storage
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 @@ -29,8 +29,18 @@ module ConfigConversions
module FromModelConversions
# Boot conversion from model according to the JSON schema.
class Boot < Base
# @param model_json [Hash] Boot model.
# @param drives [Array<Configs::Drive>]
def initialize(model_json, drives)
super(model_json)
@drives = drives
end

private

# @return [Array<Configs::Drive>]
attr_reader :drives

# @see Base
# @return [Configs::Boot]
def default_config
Expand All @@ -51,7 +61,7 @@ def convert_device
boot_device_model = model_json[:device]
return if boot_device_model.nil?

FromModelConversions::BootDevice.new(boot_device_model).convert
FromModelConversions::BootDevice.new(boot_device_model, drives).convert
end
end
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 @@ -28,8 +28,18 @@ module ConfigConversions
module FromModelConversions
# Boot device conversion from model according to the JSON schema.
class BootDevice < Base
# @param model_json [Hash] Boot device model.
# @param drives [Array<Configs::Drive>]
def initialize(model_json, drives)
super(model_json)
@drives = drives
end

private

# @return [Array<Configs::Drive>]
attr_reader :drives

# @see Base
# @return [Configs::Boot]
def default_config
Expand All @@ -40,9 +50,24 @@ def default_config
# @return [Hash]
def conversions
{
default: model_json[:default]
default: model_json[:default],
device_alias: convert_device_alias
}
end

# @return [String, nil]
def convert_device_alias
# Avoid setting an alias if using the default boot device.
return if model_json[:default]

name = model_json[:name]
return unless name

drive = drives.find { |d| d.device_name == name }
return unless drive

drive.ensure_alias
end
end
end
end
Expand Down
Loading
Loading