From 58dd01e0dcd4ff0dc36e931100e523b1f0c2e8df Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 2 Feb 2012 13:45:51 +0000 Subject: [PATCH] lsxcatd -t added to show whether we are a Management or Service Node git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11456 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/tabutils.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 9fb7eeb31..4fca926c2 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -667,6 +667,7 @@ sub lsxcatd my $HELP; my $VERSION; my $DATABASE; + my $NODETYPE; my $ALL; my $rc=0; @@ -676,6 +677,7 @@ sub lsxcatd push @{$rsp{data}}, " lsxcatd [-v|--version]"; push @{$rsp{data}}, " lsxcatd [-h|--help]"; push @{$rsp{data}}, " lsxcatd [-d|--database]"; + push @{$rsp{data}}, " lsxcatd [-t|--nodetype]"; push @{$rsp{data}}, " lsxcatd [-a|--all]"; if ($exitcode) { $rsp{errorcode} = $exitcode; } $cb->(\%rsp); @@ -689,6 +691,7 @@ sub lsxcatd if (!GetOptions('h|?|help' => \$HELP, 'v|version' => \$VERSION, 'a|all' => \$ALL, + 't|type' => \$NODETYPE, 'd|database' => \$DATABASE)) { $lsxcatd_usage->(1); return; } @@ -703,6 +706,21 @@ sub lsxcatd return; } } + # nodetype MN or SN + if ($NODETYPE || $ALL) { + my %rsp; + if (xCAT::Utils->isMN()) { # if on Management Node + $rsp{data}->[0] = "This is a Management Node"; + $cb->(\%rsp); + } + if (xCAT::Utils->isServiceNode()) { # if on Management Node + $rsp{data}->[0] = "This is a Service Node"; + $cb->(\%rsp); + } + if (!$ALL) { + return; + } + } # no arguments error my $xcatcfg; my %rsp;