From 298668b022532727b685a121246682651470c1d8 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Fri, 20 Oct 2023 13:47:12 +0300 Subject: [PATCH] storage: Don't show LV structure for device-mapper PVs. See https://github.com/storaged-project/udisks/pull/1206 for why this is unfortunately broken right now. --- pkg/storaged/client.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkg/storaged/client.js b/pkg/storaged/client.js index dc31ccc12153..99aaba59c424 100644 --- a/pkg/storaged/client.js +++ b/pkg/storaged/client.js @@ -283,14 +283,24 @@ function update_indices() { client.vgnames_vgroup[vgroup.Name] = vgroup; } + const vgroups_with_dm_pvs = { }; + client.vgroups_pvols = { }; for (path in client.vgroups) { client.vgroups_pvols[path] = []; } for (path in client.blocks_pvol) { pvol = client.blocks_pvol[path]; - if (client.vgroups_pvols[pvol.VolumeGroup] !== undefined) + if (client.vgroups_pvols[pvol.VolumeGroup] !== undefined) { client.vgroups_pvols[pvol.VolumeGroup].push(pvol); + { + // HACK - this is needed below to deal with a UDisks2 bug. + // https://github.com/storaged-project/udisks/pull/1206 + const block = client.blocks[path]; + if (block && utils.decode_filename(block.Device).indexOf("/dev/dm-") == 0) + vgroups_with_dm_pvs[pvol.VolumeGroup] = true; + } + } } function cmp_pvols(a, b) { return utils.block_cmp(client.blocks[a.path], client.blocks[b.path]); @@ -351,6 +361,14 @@ function update_indices() { const struct = client.lvols[path].Structure; const lvol = client.lvols[path]; + // HACK - UDisks2 can't find the PVs of a segment when they + // are on a device mapper device. + // + // https://github.com/storaged-project/udisks/pull/1206 + + if (vgroups_with_dm_pvs[lvol.VolumeGroup]) + continue; + let summary; let status = ""; if (lvol.Layout != "thin" && struct && struct.segments) {