blockDevices() raid added label, uuid (linux)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user