diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm
index 94f4874d2..64f182926 100644
--- a/xCAT-server/lib/xcat/plugins/tabutils.pm
+++ b/xCAT-server/lib/xcat/plugins/tabutils.pm
@@ -54,10 +54,10 @@ sub handled_commands
nr => "tabutils", # not implemented yet
rnoderange => "tabutils", # not implemented yet
tabgrep => "tabutils",
- getAllEntries => "tabutils",
- getNodesAttribs => "tabutils",
- setNodesAttribs1 => "tabutils",
- setNodesAttribs2 => "tabutils",
+ getAllEntries => "tabutils",
+ getNodesAttribs => "tabutils",
+ setNodesAttribs1 => "tabutils",
+ delEntries => "tabutils",
gennr => "tabutils"
};
}
@@ -156,6 +156,10 @@ sub process_request
{
return setNodesAttribs1($request,$callback);
}
+ elsif ($command eq "delEntries")
+ {
+ return delEntries($request,$callback);
+ }
else
{
print "$command not implemented yet\n";
@@ -2339,7 +2343,7 @@ sub getNodesAttribs
#
# nodelist
#
-# lissa
+# test
# This is a another testx
#
#
@@ -2357,7 +2361,7 @@ sub setNodesAttribs1
{
my $request = shift;
my $cb = shift;
- my $node = $request->{node};
+ my $node = $request->{node}; # added by Client.pm
my $noderange = $request->{noderange};
my $command = $request->{command}->[0];
my %rsp;
@@ -2369,6 +2373,8 @@ sub setNodesAttribs1
$newrequest->{command}->[0] = "nodech";
foreach my $table (@$tables) {
my $tablename = $table->{name}->[0];
+ my $tab=xCAT::Table->new($tablename);
+ my %keyhash;
my $attrs = $table->{attrs};
foreach my $attrhash (@$attrs) {
foreach my $key (keys %$attrhash) {
@@ -2387,3 +2393,70 @@ sub setNodesAttribs1
}
return;
}
+#
+# delEntries
+# Deletes the table entry based on the input attributes
+# The attributes and AND'd to together to form the delete request
+# DELETE FROM nodelist WHERE ("groups" = "compute1,test" AND "status" = "down")
+# Example of XML in for this routine
+#
+#
+#PCM
+#delEntries
+#
+# nodelist
+#
+# compute1,test
+# down
+#
+#
+# .
+# .
+#
+#
+#
+# To delete all entries in a table, input no attributes
+#
+#PCM
+#delEntries
+#
+#
+
+
+sub delEntries
+{
+ my $request = shift;
+ my $cb = shift;
+ # my $node = $request->{node}; # added by Client.pm
+ # my $noderange = $request->{noderange};
+ my $command = $request->{command}->[0];
+ my %rsp;
+ # my $args = $request->{arg};
+ # my $tables= $args->[0]->{table};
+ # my $tables= $request->{table}->{name};
+ my $tables= $request->{table};
+ foreach my $table (@$tables) {
+ my $tablename = $table->{name}->[0];
+ my $tab=xCAT::Table->new($tablename);
+ my %keyhash;
+ my $attrs = $table->{attrs};
+ foreach my $attrhash (@$attrs) {
+ foreach my $key (keys %$attrhash) {
+ $keyhash{$key} = $attrhash->{$key}->[0];
+ }
+ }
+ if (%keyhash) { # delete based on requested attributes
+ $tab->delEntries(\%keyhash); #Yes, delete *all* entries
+ } else { # delete all entries
+ $tab->delEntries(); #delete *all* entries
+ }
+ $tab->commit; # commit
+ }
+ return;
+}