From 7c6c9a1706d5d98f9d9427225cf60d69dd5a8e59 Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 23 Jun 2009 05:22:57 +0000 Subject: [PATCH] bug 2810670: defrm foreach logic error fix git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3616 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 50a2dce94..f81ad2971 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -2837,6 +2837,12 @@ sub defrm next; } + # Dynamic node group stores in nodegroup table + # do not need to update the nodelist table + if ($grphash{$obj}{'grouptype'} eq 'dynamic') + { + next; + } # get the members list # all groups are "static" for now $grphash{$obj}{'grouptype'} = "static"; @@ -2849,21 +2855,25 @@ sub defrm my @gprslist; foreach my $m (@members) { - - # need to update the "groups" attr of the node def - # get the def of this node $nhash{$m} = 'node'; + } + # Performance: Only call getobjdefs once %nodehash = xCAT::DBobjUtils->getobjdefs(\%nhash); if (!defined(%nodehash)) { my $rsp; + my @nodes = keys %nhash; + my $m = join ',', @nodes; $rsp->{data}->[0] = "Could not get xCAT object definition for \'$m\'."; xCAT::MsgUtils->message("I", $rsp, $::callback); next; } + foreach my $m (keys %nodehash) + { + # need to update the "groups" attr of the node def # split the "groups" to get a list @gprslist = split(',', $nodehash{$m}{groups});