diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm
index 8eced0363..9e6532167 100644
--- a/xCAT-server/lib/xcat/plugins/tabutils.pm
+++ b/xCAT-server/lib/xcat/plugins/tabutils.pm
@@ -57,6 +57,7 @@ sub handled_commands
getAllEntries => "tabutils",
getNodesAttribs => "tabutils",
getTablesAllNodeAttribs => "tabutils",
+ getTablesNodeAttribs => "tabutils",
setNodesAttribs => "tabutils",
delEntries => "tabutils",
getAttribs => "tabutils",
@@ -160,6 +161,10 @@ sub process_request
{
return getTablesAllNodeAttribs($request,$callback);
}
+ elsif ($command eq "getTablesNodeAttribs")
+ {
+ return getTablesNodeAttribs($request,$callback);
+ }
elsif ($command eq "setNodesAttribs")
{
return setNodesAttribs($request,$callback);
@@ -2368,7 +2373,9 @@ sub getNodesAttribs
my %datseg=();
$datseg{name} = [$node];
foreach my $key (keys %$rec) {
+ if ($key ne "node") { # do not put in the added node attribute
$datseg{$key} = [$rec->{$key}];
+ }
}
push @{$noderecs{$node}}, \%datseg;
}
@@ -2468,6 +2475,99 @@ sub getTablesAllNodeAttribs
$cb->(\%rsp);
return;
}
+# getTablesNodeAttribs
+# Read the nodes in the noderange from the input tables
+# and get the input attributes
+# or get ALL attributes, if the word ALL is used.
+# If the ALL is input then read all the attributes
+#
+#PCM
+#getTablesAllNodeAttribs
+#blade01-blade10
+#
+#nodelist
+#groups
+#status
+#
+#
+# .
+# .
+# .
+#
+#
+#
+#
+#tablename1
+#
+#n1
+#value1
+#value1
+#.
+#valueN
+#
+#
+# .
+# .
+# .
+#
+#
+sub getTablesNodeAttribs
+{
+ my $request = shift;
+ my $cb = shift;
+ my $command = $request->{command}->[0];
+ my %rsp;
+
+ # process each table in the request
+ my $tables = $request->{table};
+ my $node = $request->{node};
+ my @nodes=@$node;
+ foreach my $tabhash (@$tables) {
+
+ my $tablename = $tabhash->{tablename}->[0];
+ my $attr = $tabhash->{attr};
+ my @attrs=@$attr;
+ my $tab=xCAT::Table->new($tablename);
+ my %noderecs;
+ my $recs;
+ # build the table name record
+ @{$noderecs{table}->[0]->{tablename}} = $tablename;
+ # if request for ALL attributes
+ if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
+ @attrs=();
+ my $schema = xCAT::Table->getTableSchema($tablename);
+ my $desc = $schema->{descriptions};
+ foreach my $c (@{$schema->{cols}}) {
+ # my $space = (length($c)<7 ? "\t\t" : "\t");
+ push @attrs, $c;
+ }
+ }
+ # read the nodes and their attributes in this table
+ my $rechash = $tab->getNodesAttribs(\@nodes,\@attrs);
+ foreach my $node (@nodes){
+ my $recs = $rechash->{$node};
+ foreach my $rec (@$recs) {
+ my %datseg=();
+ $datseg{name} = [$node];
+ foreach my $key (keys %$rec) {
+ if ($key ne "node") { # do not put in the added node attribute
+ $datseg{$key} = [$rec->{$key}];
+ }
+ }
+ push @{$noderecs{table}->[0]->{node}}, \%datseg;
+ }
+
+ }
+ push @{$rsp{"table"}}, @{$noderecs{table}};
+ } # end of all table processing
+# for checkin XML created
+#my $xmlrec=XMLout(\%rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
+ $cb->(\%rsp);
+ return;
+}
#
# setNodesAttribs
# Sets Nodes attributes for noderange for each of the tables supplied