From b3a7b2ce12a93970763483d7e35ec17831d41931 Mon Sep 17 00:00:00 2001 From: thomas Date: Mon, 6 Aug 2018 09:09:05 +0200 Subject: [PATCH 1/3] mxraid_assemble: defer load Don't perform the db load when conjuring a ConfData object, this gives the opportunity to set the verbose mode also for load :) --- mxraid/mxraid_assemble | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mxraid/mxraid_assemble b/mxraid/mxraid_assemble index 66d4b95..b665761 100755 --- a/mxraid/mxraid_assemble +++ b/mxraid/mxraid_assemble @@ -87,7 +87,7 @@ my $MDADM_CONF_BASE = '/dev/shm/mdadm.conf'; # config for mdadm, created with in my $MDADM_ASSEMBLE_OPTIONS = ''; -my $cd = MxRaid::ConfData->new($MDADMCONF_DB); $cd->verbose($VERBOSE); +my $cd = MxRaid::ConfData->new($MDADMCONF_DB); $cd->verbose($VERBOSE); $cd->load(); my $hd = MxRaid::HostData->new($cd); $hd->verbose($VERBOSE); my $utils = MxRaid::Utils->new(); @@ -365,7 +365,6 @@ exit; $self->{verbose} = 0; $self->{db} = {}; $self->{lookup} = undef; - $self->load(); return $self; } From 4409581a382d1ce05d3757c51e024c1565b6fa85 Mon Sep 17 00:00:00 2001 From: thomas Date: Mon, 6 Aug 2018 09:15:21 +0200 Subject: [PATCH 2/3] mxraid_assemble: Add confidential RAIDs (C) Note: this makes reported successor labels even more bogus ... --- mxraid/mxraid_assemble | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mxraid/mxraid_assemble b/mxraid/mxraid_assemble index b665761..18cae2f 100755 --- a/mxraid/mxraid_assemble +++ b/mxraid/mxraid_assemble @@ -151,7 +151,7 @@ if ($opts{n}) { } # warn "# NOTE: got $cnt disk(s), default is 16.\n" if $cnt != 16; - # warn "# NOTE: label '$opts{n}' doesn't look good.\n" unless $opts{n} =~ m/^[DM][\da-f]\d{3}$/; + # warn "# NOTE: label '$opts{n}' doesn't look good.\n" unless $opts{n} =~ m/^[CDM][\da-f]\d{3}$/; if ($cnt != 16) { my $msg = "got $cnt disk(s), default is 16."; $msg = $color->t_red($msg) unless $opts{m}; @@ -159,7 +159,7 @@ if ($opts{n}) { } - if ($opts{n} !~ m/^[DM][\da-f]\d{3}$/) { + if ($opts{n} !~ m/^[CDM][\da-f]\d{3}$/) { my $msg = "label '$opts{n}' doesn't look good."; $msg = $color->t_red($msg) unless $opts{m}; print "# NOTE: $msg\n"; @@ -386,7 +386,7 @@ exit; @rec = split m/\s+/, $_; - if ($rec[0] !~ m/[DM][\da-f]\d{3}:/) { + if ($rec[0] !~ m/[CDM][\da-f]\d{3}:/) { warn "# NOTE: raid name not in expected format (bad key '$rec[0]' at line $lines).\n" if $self->{verbose} >= 1; next; } @@ -454,7 +454,7 @@ exit; my $self = shift; my %tmp; for (keys %{$self->{db}}) { - my ($cat,$size,$num) = $_ =~ m/([DM])([\da-f])(\d{3})/; + my ($cat,$size,$num) = $_ =~ m/([CDM])([\da-f])(\d{3})/; next unless defined $cat and defined $num; if (exists $tmp{"$cat$size"} and $tmp{"$cat$size"} > $num) { $num = $tmp{"$cat$size"}; From f70da1ddc000cf72438512d40add5a447f5af894 Mon Sep 17 00:00:00 2001 From: thomas Date: Mon, 6 Aug 2018 09:35:24 +0200 Subject: [PATCH 3/3] mxraid_assemble: enumerate over C *and* M RAIDs Note: a proper check against mxmounts is still missing. --- mxraid/mxraid_assemble | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mxraid/mxraid_assemble b/mxraid/mxraid_assemble index 18cae2f..03b5f40 100755 --- a/mxraid/mxraid_assemble +++ b/mxraid/mxraid_assemble @@ -455,7 +455,8 @@ exit; my %tmp; for (keys %{$self->{db}}) { my ($cat,$size,$num) = $_ =~ m/([CDM])([\da-f])(\d{3})/; - next unless defined $cat and defined $num; + next unless defined $num; + $cat = '(C/M)' if $cat ne 'D'; if (exists $tmp{"$cat$size"} and $tmp{"$cat$size"} > $num) { $num = $tmp{"$cat$size"}; }