blockDevices() raid added label, uuid (linux)

This commit is contained in:
Sebastian Hildebrandt
2023-02-27 17:30:19 +01:00
parent 3c58a18f24
commit 0120a93a8e
5 changed files with 17 additions and 3 deletions
+8
View File
@@ -382,6 +382,8 @@ function parseBlk(lines) {
function decodeMdabmData(lines) {
const raid = util.getValue(lines, 'md_level', '=');
const label = util.getValue(lines, 'md_name', '='); // <- get label info
const uuid = util.getValue(lines, 'md_uuid', '='); // <- get uuid info
const members = [];
lines.forEach(line => {
if (line.toLowerCase().startsWith('md_device_dev') && line.toLowerCase().indexOf('/dev/') > 0) {
@@ -390,6 +392,8 @@ function decodeMdabmData(lines) {
});
return {
raid,
label,
uuid,
members
};
}
@@ -402,6 +406,10 @@ function raidMatchLinux(data) {
if (element.type.startsWith('raid')) {
const lines = execSync(`mdadm --export --detail /dev/${element.name}`).toString().split('\n');
const mdData = decodeMdabmData(lines);
element.label = mdData.label; // <- assign label info
element.uuid = mdData.uuid; // <- assign uuid info
if (mdData.members && mdData.members.length && mdData.raid === element.type) {
result = result.map(blockdevice => {
if (blockdevice.fsType === 'linux_raid_member' && mdData.members.indexOf(blockdevice.name) >= 0) {