Skip to content

Commit

Permalink
storage: Move to "r6" of the Stratis D-Bus API
Browse files Browse the repository at this point in the history
As a preparation to support file size limits.
  • Loading branch information
mvollmer committed Jun 17, 2024
1 parent 259fc2d commit 306e85e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
20 changes: 8 additions & 12 deletions pkg/storaged/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" });
Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion pkg/storaged/stratis/create-dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
});
Expand Down
18 changes: 9 additions & 9 deletions pkg/storaged/stratis/pool.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
});
Expand Down

0 comments on commit 306e85e

Please sign in to comment.