Add tabgrep command.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@294 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
andywray 2008-01-18 16:47:26 +00:00
parent c3544c1a6f
commit 2b9029c713
2 changed files with 22 additions and 1 deletions

View File

@ -72,6 +72,7 @@ ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/mkvm
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/rmvm
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/lsvm
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/chvm
ln -sf ../bin/xcatclient $RPM_BUILD_ROOT/%{prefix}/bin/tabgrep
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsslp
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/tabdump
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/sbin/makedns

View File

@ -59,7 +59,8 @@ sub handled_commands {
addattr => "tabutils",
delattr => "tabutils",
chtype => "tabutils",
nr => "tabutils"
nr => "tabutils",
tabgrep => "tabutils"
}
}
@ -130,6 +131,8 @@ sub process_request {
return tabdump($args,$callback);
} elsif ($command eq "gettab") {
return gettab($request,$callback);
} elsif ($command eq "tabgrep") {
return tabgrep($nodes,$callback);
} else {
print "$command not implemented yet\n";
return (1,"$command not written yet");
@ -446,6 +449,23 @@ sub chnode {
}
}
sub tabgrep {
my $node=shift;
my @tablist;
my $callback=shift;
foreach (keys %{xCAT::Schema::tabspec}) {
if (grep /^node$/,@{$xCAT::Schema::tabspec{$_}->{cols}}) {
push @tablist,$_;
}
}
foreach (@tablist) {
my $tab=xCAT::Table->new($_);
if ($tab->getNodeAttribs($node->[0],["node"])) {
$callback->({data=>[$_]});
}
}
}