From 7368174669dbaf064032e7df45a9211ca817b6d7 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 28 Nov 2012 08:05:01 +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/branches/2.7@14455 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 4a80b2511..7adf9a734 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -1563,10 +1563,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;