From 255062580aa4fc0eae9f356e369fc62fcd22c539 Mon Sep 17 00:00:00 2001 From: bybai Date: Tue, 11 Jul 2017 03:52:45 -0400 Subject: [PATCH 1/3] enhance makehosts support regex in nicips --- xCAT-server/lib/xcat/plugins/hosts.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index bf0cd10ec..bb6ede0b6 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -72,7 +72,6 @@ sub addnode # if this ip was already added then just update the entry while ($idx <= $#hosts) { - if ($hosts[$idx] =~ /^${ip}\s/ or $hosts[$idx] =~ /^\d+\.\d+\.\d+\.\d+\s+${node}[\s\.\r]/) { @@ -661,7 +660,12 @@ sub donics if (!$nicip) { next; } - + #If there is one nicip in nicips, and it is regular expression + #for example: eth0!|\D+(\d+)\D+|10.80.1.($1*2+103)| + #Does not support: there is regular expression in multple nicips + if ($nicip =~ /^\|\S*\|$/) { + $nicip = xCAT::Table::transRegexAttrs($node, $nicip); + } if ($nicip =~ /\|/) { my @ips = split(/\|/, $nicip); foreach my $ip (@ips) { From d273135b37c682696bffc571af918d2806994ead Mon Sep 17 00:00:00 2001 From: bybai Date: Wed, 12 Jul 2017 02:11:50 -0400 Subject: [PATCH 2/3] polished --- xCAT-server/lib/xcat/plugins/hosts.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index bb6ede0b6..11dbaade2 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -660,9 +660,7 @@ sub donics if (!$nicip) { next; } - #If there is one nicip in nicips, and it is regular expression - #for example: eth0!|\D+(\d+)\D+|10.80.1.($1*2+103)| - #Does not support: there is regular expression in multple nicips + #Only format for nicips:!||... or ! if ($nicip =~ /^\|\S*\|$/) { $nicip = xCAT::Table::transRegexAttrs($node, $nicip); } From 14c1e0c1b1809f195a702bdc0e7215621a0d7c34 Mon Sep 17 00:00:00 2001 From: bybai Date: Wed, 12 Jul 2017 02:30:52 -0400 Subject: [PATCH 3/3] polished --- xCAT-server/lib/xcat/plugins/hosts.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 11dbaade2..f2a8f3327 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -660,7 +660,7 @@ sub donics if (!$nicip) { next; } - #Only format for nicips:!||... or ! + #Only support format for nicips is :!||... or ! if ($nicip =~ /^\|\S*\|$/) { $nicip = xCAT::Table::transRegexAttrs($node, $nicip); }