From 306e85ec84340312fed43e31dc0b4c66a564318a Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Mon, 17 Jun 2024 11:57:46 +0300 Subject: [PATCH] storage: Move to "r6" of the Stratis D-Bus API As a preparation to support file size limits. --- pkg/storaged/client.js | 20 ++++++++------------ pkg/storaged/stratis/create-dialog.jsx | 4 +++- pkg/storaged/stratis/pool.jsx | 18 +++++++++--------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/pkg/storaged/client.js b/pkg/storaged/client.js index a9af0759e62d..d5d7af5e0705 100644 --- a/pkg/storaged/client.js +++ b/pkg/storaged/client.js @@ -1378,7 +1378,7 @@ client.stratis_start = () => { // not allowed. If we need to bump it, it should be bumped here for all // of them at the same time. // -const stratis3_interface_revision = "r5"; +const stratis3_interface_revision = "r6"; function stratis3_start() { const stratis = cockpit.dbus("org.storage.stratis3", { superuser: "try" }); @@ -1399,17 +1399,13 @@ function stratis3_start() { .input(passphrase); }; - client.stratis_set_overprovisioning = (pool, flag) => { - // DBusProxy is smart enough to allow - // "pool.Overprovisioning = flag" to just work, - // but we want to catch any error ourselves, and - // we want to wait for the method call to - // complete. - return stratis.call(pool.path, "org.freedesktop.DBus.Properties", "Set", - ["org.storage.stratis3.pool." + stratis3_interface_revision, - "Overprovisioning", - cockpit.variant("b", flag) - ]); + client.stratis_set_property = (proxy, prop, sig, value) => { + // DBusProxy is smart enough to allow "proxy.Prop + // = value" to just work, but we want to catch any + // error ourselves, and we want to wait for the + // method call to complete. + return stratis.call(proxy.path, "org.freedesktop.DBus.Properties", "Set", + [proxy.iface, prop, cockpit.variant(sig, value)]); }; client.features.stratis = true; diff --git a/pkg/storaged/stratis/create-dialog.jsx b/pkg/storaged/stratis/create-dialog.jsx index 29d6b1a25183..f4a60a440457 100644 --- a/pkg/storaged/stratis/create-dialog.jsx +++ b/pkg/storaged/stratis/create-dialog.jsx @@ -134,7 +134,9 @@ export function create_stratis_pool() { const path = result[1][0]; return client.wait_for(() => client.stratis_pools[path]) .then(pool => { - return client.stratis_set_overprovisioning(pool, false); + return client.stratis_set_property(pool, + "Overprovisioning", + "b", false); }); } }); diff --git a/pkg/storaged/stratis/pool.jsx b/pkg/storaged/stratis/pool.jsx index eb0586621acd..75be9abc625a 100644 --- a/pkg/storaged/stratis/pool.jsx +++ b/pkg/storaged/stratis/pool.jsx @@ -115,15 +115,15 @@ function create_fs(pool) { update: update_at_boot_input, Action: { Variants: action_variants, - action: function (vals) { - return pool.CreateFilesystems([[vals.name, vals.size ? [true, vals.size.toString()] : [false, ""]]]) - .then(std_reply) - .then(result => { - if (result[0]) - return set_mount_options(result[1][0][0], vals, forced_options); - else - return Promise.resolve(); - }); + action: async function (vals) { + let size_spec = [false, ""]; + + if (managed_fsys_sizes) + size_spec = [true, vals.size.toString()]; + + const result = await pool.CreateFilesystems([[vals.name, size_spec, [false, ""]]]).then(std_reply); + if (result[0]) + await set_mount_options(result[1][0][0], vals, forced_options); } } });