From 0268c0c6a1b96d65f2fa8c0b341129121fb47230 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 28 Nov 2012 08:12:19 +0000 Subject: [PATCH] modifying 'rscan -u' to append the 'groups' attribute rather than overwrite it git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14456 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index c9862d45c..ec24bbaf9 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -1610,10 +1610,23 @@ sub rscan { my ($k3,$u3); $k3->{node} = $name; + my $append; if ($type eq "ppcblade") { - $u3->{groups} = "blade,all"; + $append = "blade"; } else { - $u3->{groups} = $type.",all"; + $append = $type; + } + $u3->{groups} = $append.",all"; + my $tmp_groups = $db{nodelist}->getNodeAttribs($name,['groups']); + if (defined($tmp_groups) and defined($tmp_groups->{groups})) { + $u3->{groups} =$tmp_groups->{groups}; + my @groups_array = split /,/,$tmp_groups->{groups}; + if (!grep(/^$append$/, @groups_array)) { + $u3->{groups} .= ",$append"; + } + if (!grep(/^all$/, @groups_array)) { + $u3->{groups} .= ",all"; + } } $db{nodelist}->setAttribs($k3,$u3); $db{nodelist}{commit} = 1;