From 23fbaf4dd396f9dc6a8bdbfd3f047579b2f82cc5 Mon Sep 17 00:00:00 2001 From: yinle Date: Mon, 10 Jan 2011 09:12:35 +0000 Subject: [PATCH] fsp/bpa redundancy: add -H flag to lsdef for avoiding to list of fsp/bpa nodes. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8587 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 30 ++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index e11d17498..81cb792da 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -240,7 +240,8 @@ sub processArgs 'w=s@' => \$::opt_w, 'x|xml' => \$::opt_x, 'z|stanza' => \$::opt_z, - 'nocache' => \$::opt_c + 'nocache' => \$::opt_c, + 'H' => \$::opt_H, ) ) { @@ -2901,6 +2902,31 @@ sub defls } # end - for each object } # end - for each type + #delete the fsp and bpa node from the hash + my $newrsp; + my $listtab = xCAT::Table->new( 'nodelist' ); + if ($listtab and (!defined($::opt_H)) ) { + foreach my $n (@{$rsp_info->{data}}) { + if ( $n =~ /node/ ) { + $_= $n; + s/ +\(node\)//; + my ($hidhash) = $listtab->getNodeAttribs($_ ,['hidden']); + if ( $hidhash->{hidden} ne 0) { + push (@{$newrsp->{data}}, $n); + } + } + } + if (defined($newrsp->{data}) && scalar(@{$newrsp->{data}}) > 0) { + xCAT::MsgUtils->message("I", $newrsp, $::callback); + return 0; + } + }else { + my $rsp; + $rsp->{data}->[0] = + "Could not open nodelist table."; + xCAT::MsgUtils->message("I", $rsp, $::callback); + } + # Display the definition of objects if (defined($rsp_info->{data}) && scalar(@{$rsp_info->{data}}) > 0) { xCAT::MsgUtils->message("I", $rsp_info, $::callback); @@ -3334,7 +3360,7 @@ sub defls_usage $rsp->{data}->[2] = " lsdef [-V | --verbose] [-t object-types] [-o object-names]"; $rsp->{data}->[3] = - " [ -l | --long] [-s | --short] [-a | --all] [-z | --stanza ]"; + " [ -l | --long] [-s | --short] [-a | --all] [-z | --stanza ] [-H]"; $rsp->{data}->[4] = " [-i attr-list] [-w attr==val [-w attr=~val] ...] [noderange]\n"; $rsp->{data}->[5] =