From c262df1970b8560b80e79f3bee990174c5898a9a Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Fri, 8 Mar 2024 15:51:00 +0000 Subject: [PATCH 1/5] [Service] Export adjust_by_ram at D-Bus --- service/lib/agama/dbus/storage/volume_conversion/to_dbus.rb | 1 + .../dbus/storage/proposal_settings_conversion/to_dbus_test.rb | 1 + .../test/agama/dbus/storage/volume_conversion/to_dbus_test.rb | 3 +++ 3 files changed, 5 insertions(+) diff --git a/service/lib/agama/dbus/storage/volume_conversion/to_dbus.rb b/service/lib/agama/dbus/storage/volume_conversion/to_dbus.rb index dd03df6dd8..3f586f7d2e 100644 --- a/service/lib/agama/dbus/storage/volume_conversion/to_dbus.rb +++ b/service/lib/agama/dbus/storage/volume_conversion/to_dbus.rb @@ -70,6 +70,7 @@ def outline_conversion(target) "Required" => outline.required?, "FsTypes" => outline.filesystems.map(&:to_human_string), "SupportAutoSize" => outline.adaptive_sizes?, + "AdjustByRam" => outline.adjust_by_ram?, "SnapshotsConfigurable" => outline.snapshots_configurable?, "SnapshotsAffectSizes" => outline.snapshots_affect_sizes?, "SizeRelevantVolumes" => outline.size_relevant_volumes diff --git a/service/test/agama/dbus/storage/proposal_settings_conversion/to_dbus_test.rb b/service/test/agama/dbus/storage/proposal_settings_conversion/to_dbus_test.rb index 8cc085e5ff..44ef43b0ca 100644 --- a/service/test/agama/dbus/storage/proposal_settings_conversion/to_dbus_test.rb +++ b/service/test/agama/dbus/storage/proposal_settings_conversion/to_dbus_test.rb @@ -92,6 +92,7 @@ "SupportAutoSize" => false, "SnapshotsConfigurable" => false, "SnapshotsAffectSizes" => false, + "AdjustByRam" => false, "SizeRelevantVolumes" => [] } } diff --git a/service/test/agama/dbus/storage/volume_conversion/to_dbus_test.rb b/service/test/agama/dbus/storage/volume_conversion/to_dbus_test.rb index 5b412ce508..9fffa181a2 100644 --- a/service/test/agama/dbus/storage/volume_conversion/to_dbus_test.rb +++ b/service/test/agama/dbus/storage/volume_conversion/to_dbus_test.rb @@ -38,6 +38,7 @@ outline.snapshots_configurable = true outline.snapshots_size = Y2Storage::DiskSize.new(1000) outline.snapshots_percentage = 10 + outline.adjust_by_ram = true end Agama::Storage::Volume.new("/test").tap do |volume| @@ -70,6 +71,7 @@ "Required" => false, "FsTypes" => [], "SupportAutoSize" => false, + "AdjustByRam" => false, "SnapshotsConfigurable" => false, "SnapshotsAffectSizes" => false, "SizeRelevantVolumes" => [] @@ -90,6 +92,7 @@ "Outline" => { "Required" => true, "FsTypes" => ["Ext3", "Ext4"], + "AdjustByRam" => true, "SupportAutoSize" => true, "SnapshotsConfigurable" => true, "SnapshotsAffectSizes" => true, From 6a42917f167e7e0c423a9c2c55f1ebe50c2cd6df Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Fri, 8 Mar 2024 15:52:35 +0000 Subject: [PATCH 2/5] [Web] Display explanation about adjustByRam --- web/src/client/storage.js | 2 ++ web/src/client/storage.test.js | 6 ++++++ web/src/components/storage/ProposalVolumes.jsx | 8 +++++--- web/src/components/storage/VolumeForm.jsx | 4 ++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/web/src/client/storage.js b/web/src/client/storage.js index 66a92956bf..488862d9a1 100644 --- a/web/src/client/storage.js +++ b/web/src/client/storage.js @@ -300,6 +300,7 @@ class ProposalManager { * @property {boolean} required * @property {string[]} fsTypes * @property {boolean} supportAutoSize + * @property {boolean} adjustByRam * @property {boolean} snapshotsConfigurable * @property {boolean} snapshotsAffectSizes * @property {string[]} sizeRelevantVolumes @@ -543,6 +544,7 @@ class ProposalManager { required: dbusOutline.Required.v, fsTypes: dbusOutline.FsTypes.v.map(val => val.v), supportAutoSize: dbusOutline.SupportAutoSize.v, + adjustByRam: dbusOutline.AdjustByRam.v, snapshotsConfigurable: dbusOutline.SnapshotsConfigurable.v, snapshotsAffectSizes: dbusOutline.SnapshotsAffectSizes.v, sizeRelevantVolumes: dbusOutline.SizeRelevantVolumes.v.map(val => val.v) diff --git a/web/src/client/storage.test.js b/web/src/client/storage.test.js index 73610f9a1b..6b797556a2 100644 --- a/web/src/client/storage.test.js +++ b/web/src/client/storage.test.js @@ -329,6 +329,7 @@ const contexts = { SupportAutoSize: { t: "b", v: true }, SnapshotsConfigurable: { t: "b", v: true }, SnapshotsAffectSizes: { t: "b", v: true }, + AdjustByRam: { t: "b", v: false }, SizeRelevantVolumes: { t: "as", v: [{ t: "s", v: "/home" }] } } } @@ -349,6 +350,7 @@ const contexts = { SupportAutoSize: { t: "b", v: false }, SnapshotsConfigurable: { t: "b", v: false }, SnapshotsAffectSizes: { t: "b", v: false }, + AdjustByRam: { t: "b", v: false }, SizeRelevantVolumes: { t: "as", v: [] } } } @@ -1017,6 +1019,7 @@ describe("#proposal", () => { SupportAutoSize: { t: "b", v: false }, SnapshotsConfigurable: { t: "b", v: false }, SnapshotsAffectSizes: { t: "b", v: false }, + AdjustByRam: { t: "b", v: false }, SizeRelevantVolumes: { t: "as", v: [] } } } @@ -1037,6 +1040,7 @@ describe("#proposal", () => { SupportAutoSize: { t: "b", v: false }, SnapshotsConfigurable: { t: "b", v: false }, SnapshotsAffectSizes: { t: "b", v: false }, + AdjustByRam: { t: "b", v: false }, SizeRelevantVolumes: { t: "as", v: [] } } } @@ -1064,6 +1068,7 @@ describe("#proposal", () => { supportAutoSize: false, snapshotsConfigurable: false, snapshotsAffectSizes: false, + adjustByRam: false, sizeRelevantVolumes: [] } }); @@ -1084,6 +1089,7 @@ describe("#proposal", () => { supportAutoSize: false, snapshotsConfigurable: false, snapshotsAffectSizes: false, + adjustByRam: false, sizeRelevantVolumes: [] } }); diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index be080ece93..4015589800 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -46,10 +46,10 @@ import { noop } from "~/utils"; * @returns {(ReactComponent|null)} component to display (can be `null`) */ const AutoCalculatedHint = (volume) => { - // no hint, the size is not affected by snapshots or other volumes - const { snapshotsAffectSizes = false, sizeRelevantVolumes = [] } = volume.outline; + const { snapshotsAffectSizes = false, sizeRelevantVolumes = [], adjustByRam } = volume.outline; - if (!snapshotsAffectSizes && sizeRelevantVolumes.length === 0) { + // no hint, the size is not affected by known criteria + if (!snapshotsAffectSizes && !adjustByRam && sizeRelevantVolumes.length === 0) { return null; } @@ -65,6 +65,8 @@ const AutoCalculatedHint = (volume) => { // TRANSLATORS: list item, this affects the computed partition size limits // %s is replaced by a list of the volumes (like "/home, /boot") {sprintf(_("Presence of other volumes (%s)"), sizeRelevantVolumes.join(", "))}} + {adjustByRam && + {_("The amount of RAM in the system")}} ); diff --git a/web/src/components/storage/VolumeForm.jsx b/web/src/components/storage/VolumeForm.jsx index b93f3bae11..b106d9925d 100644 --- a/web/src/components/storage/VolumeForm.jsx +++ b/web/src/components/storage/VolumeForm.jsx @@ -310,6 +310,10 @@ const SizeAuto = ({ volume }) => { // TRANSLATORS: conjunction for merging two list items volume.outline.sizeRelevantVolumes.join(_(", ")))); + if (volume.outline.adjustByRam) + // TRANSLATORS: item which affects the final computed partition size + conditions.push(_("the amount of RAM in the system")); + // TRANSLATORS: the %s is replaced by the items which affect the computed size const conditionsText = sprintf(_("The final size depends on %s."), // TRANSLATORS: conjunction for merging two texts From 9f537c65cfd08cba670fcea809b5f454bdc60228 Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Fri, 8 Mar 2024 15:53:16 +0000 Subject: [PATCH 3/5] Tumbleweed configuration: enable adjust_by_ram for swap --- products.d/tumbleweed.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/products.d/tumbleweed.yaml b/products.d/tumbleweed.yaml index 6c5f0426a2..590008e631 100644 --- a/products.d/tumbleweed.yaml +++ b/products.d/tumbleweed.yaml @@ -154,10 +154,12 @@ storage: - mount_path: "swap" filesystem: swap size: - auto: false - min: 1 GiB - max: 2 GiB + auto: true outline: + auto_size: + base_min: 1 GiB + base_max: 2 GiB + adjust_by_ram: true required: false filesystems: - swap From d38a79d0121d3a25a2c05d88579fa8fb6af2a2f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Iv=C3=A1n=20L=C3=B3pez=20Gonz=C3=A1lez?= Date: Mon, 4 Mar 2024 16:12:04 +0000 Subject: [PATCH 4/5] service: Fix rubocop config - agama.gemspec was renamed, see https://github.com/openSUSE/agama/pull/1056. - The file name was not updated in the rubocop config. --- service/.rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/.rubocop.yml b/service/.rubocop.yml index 137ea30537..ada6a9f15e 100644 --- a/service/.rubocop.yml +++ b/service/.rubocop.yml @@ -8,7 +8,7 @@ AllCops: Exclude: - vendor/**/* - lib/agama/dbus/y2dir/**/* - - agama.gemspec + - agama-yast.gemspec - package/*.spec # a D-Bus method definition may take up more line lenght than usual From 133076d4c04e4f12f324cb1ae629776c0f95d9ec Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Mon, 11 Mar 2024 08:51:12 +0000 Subject: [PATCH 5/5] [web] Improve comment for translators --- web/src/components/storage/ProposalVolumes.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/components/storage/ProposalVolumes.jsx b/web/src/components/storage/ProposalVolumes.jsx index 4015589800..c7254ed6b5 100644 --- a/web/src/components/storage/ProposalVolumes.jsx +++ b/web/src/components/storage/ProposalVolumes.jsx @@ -55,7 +55,7 @@ const AutoCalculatedHint = (volume) => { return ( <> - {/* TRANSLATORS: header for a list of items */} + {/* TRANSLATORS: header for a list of items referring to size limits for file systems */} {_("These limits are affected by:")} {snapshotsAffectSizes && @@ -66,6 +66,8 @@ const AutoCalculatedHint = (volume) => { // %s is replaced by a list of the volumes (like "/home, /boot") {sprintf(_("Presence of other volumes (%s)"), sizeRelevantVolumes.join(", "))}} {adjustByRam && + // TRANSLATORS: list item, describes a factor that affects the computed size of a + // file system; eg. adjusting the size of the swap {_("The amount of RAM in the system")}}