From b84ff83b2328af2acb4bf871d2b36eb9aff01e42 Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 15 Mar 2018 15:14:10 +0100 Subject: [PATCH] mxmirror: stricter assembly regexes After some discussion, the name of assemblies is a capital letter followed by four digits, where the first digit resembles the single disk size in Gb. A 10Gb disk will get an 'a', so we can steal away with hex-digits at the first place. Thus /[XCMD][\da-f]\d\d\d/ should be used at every place, where assemblies are handled. --- mxmirror/mxmirror | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mxmirror/mxmirror b/mxmirror/mxmirror index 0297b879..712d39ea 100755 --- a/mxmirror/mxmirror +++ b/mxmirror/mxmirror @@ -646,7 +646,7 @@ sub convert_to_sourcepath { my ($jbod, $path, $host, $hostpath, $partition); - if(($jbod, $path) = $string =~ /^([XCMD]\d+)(.*?)$/) { + if(($jbod, $path) = $string =~ /^([XCMD][\da-f]\d\d\d)(.*?)$/) { unless(defined $jbodmap->{$jbod}) { printf STDERR "**ERROR: unknown jbod: $string"; next; @@ -712,7 +712,7 @@ sub convert_to_destinationpath { my ($jbod, $path, $host, $hostpath, $partition); - if(($jbod, $path) = $string =~ /^([XCMD]\d+)(.*?)$/) { + if(($jbod, $path) = $string =~ /^([XCMD][\da-f]\d\d\d)(.*?)$/) { unless(defined $jbodmap->{$jbod}) { printf STDERR "**ERROR: unknown jbod: $string"; next; @@ -882,7 +882,7 @@ sub read_jbodmap { my $map = {}; foreach() { - next unless (m(/amd/(.*?)/[XCMD]/([XCMD]\d+))); + next unless (m(/amd/(.*?)/[XCMD]/([XCMD][\da-f]\d\d\d))); $map->{$2} = $1; }