Skip to content

Commit 0d087e9

Browse files
committed
storage: Full support for Stratis V2 pools
They can have multiple passphrases and keyservers per pool. This needs the "r8" API revision, and this commit changes Cockpit to use r8 in preference to r6 in general. We should only use a single Stratis API revision in a given session and this also makes it trivial to drop support for r6 when the time comes.
1 parent 1a0e82d commit 0d087e9

File tree

7 files changed

+877
-324
lines changed

7 files changed

+877
-324
lines changed

pkg/storaged/client.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -728,31 +728,13 @@ function update_indices() {
728728
}
729729

730730
client.blocks_stratis_stopped_pool = { };
731-
client.stratis_stopped_pool_key_description = { };
732-
client.stratis_stopped_pool_clevis_info = { };
733731
for (const uuid in client.stratis_manager.StoppedPools) {
734732
const devs = client.stratis_manager.StoppedPools[uuid].devs.v;
735733
for (const d of devs) {
736734
block = client.slashdevs_block[d.devnode];
737735
if (block)
738736
client.blocks_stratis_stopped_pool[block.path] = uuid;
739737
}
740-
const kinfo = client.stratis_manager.StoppedPools[uuid].key_description;
741-
if (kinfo &&
742-
kinfo.t == "(bv)" &&
743-
kinfo.v[0] &&
744-
kinfo.v[1].t == "(bs)" &&
745-
kinfo.v[1].v[0]) {
746-
client.stratis_stopped_pool_key_description[uuid] = kinfo.v[1].v[1];
747-
}
748-
const cinfo = client.stratis_manager.StoppedPools[uuid].clevis_info;
749-
if (cinfo &&
750-
cinfo.t == "(bv)" &&
751-
cinfo.v[0] &&
752-
cinfo.v[1].t == "(b(ss))" &&
753-
cinfo.v[1].v[0]) {
754-
client.stratis_stopped_pool_clevis_info[uuid] = cinfo.v[1].v[1];
755-
}
756738
}
757739

758740
client.stratis_pool_stats = { };
@@ -1432,7 +1414,7 @@ client.stratis_start = () => {
14321414
// not allowed. If we need to bump it, it should be bumped here for all
14331415
// of them at the same time.
14341416
//
1435-
const stratis3_interface_revisions = [6];
1417+
const stratis3_interface_revisions = [8, 6];
14361418

14371419
async function stratis3_start() {
14381420
const stratis = cockpit.dbus("org.storage.stratis3", { superuser: "try" });

pkg/storaged/stratis/create-dialog.jsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ import { validate_url, get_tang_adv } from "../crypto/tang.jsx";
2828

2929
const _ = cockpit.gettext;
3030

31+
function manager_create_pool(name, devs, key_desc, clevis_info) {
32+
if (client.stratis_interface_revision < 8) {
33+
return client.stratis_manager.CreatePool(name,
34+
devs,
35+
key_desc ? [true, key_desc] : [false, ""],
36+
clevis_info ? [true, clevis_info] : [false, ["", ""]]);
37+
} else {
38+
return client.stratis_manager.CreatePool(name,
39+
devs,
40+
key_desc ? [[[false, 0], key_desc]] : [],
41+
clevis_info ? [[[false, 0], clevis_info[0], clevis_info[1]]] : [],
42+
[false, 0], // journal_size
43+
[false, ""], // tag_spec
44+
[false, false]); // allocate_superblock
45+
}
46+
}
47+
3148
export function create_stratis_pool() {
3249
function find_pool(name) {
3350
for (const p in client.stratis_pools) {
@@ -124,10 +141,7 @@ export function create_stratis_pool() {
124141
let clevis_info = null;
125142
if (adv)
126143
clevis_info = ["tang", JSON.stringify({ url: vals.tang_url, adv })];
127-
return client.stratis_manager.CreatePool(vals.name,
128-
devs,
129-
key_desc ? [true, key_desc] : [false, ""],
130-
clevis_info ? [true, clevis_info] : [false, ["", ""]])
144+
return manager_create_pool(vals.name, devs, key_desc, clevis_info)
131145
.then(std_reply)
132146
.then(result => {
133147
if (vals.overprov && !vals.overprov.on && result[0]) {

0 commit comments

Comments
 (0)