From e819282af8ceb34c048d50d88ddb9ff2d060ff5f Mon Sep 17 00:00:00 2001 From: daniceexi Date: Sun, 5 Feb 2012 07:17:54 +0000 Subject: [PATCH] to support the solcfg enable/disable for cmm/blades git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11478 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 56 ++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index fe9888abe..b793807f8 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -641,6 +641,13 @@ sub mpaconfig { push @cfgtext,"Unable to get alert configuration (is SNMP enabled?)"; next; } + } elsif ($parameter =~ /^solcfg/i) { + my $data = $session->get(['.1.3.6.1.4.1.2.3.51.2.4.10.1.1',0]); + if ($data) { + push @cfgtext,"solcfg: enabled on mm"; + } else { + push @cfgtext,"solcfg: disabled on mm"; + } } else { $returncode |= 1; push(@cfgtext,"Unrecognized argument $parameter"); @@ -3986,7 +3993,7 @@ sub telnetcmds { my @unhandled; my %handled = (); my $result; - my @tcmds = qw(snmpcfg sshcfg network swnet pd1 pd2 textid network_reset rscanfsp initnetwork); + my @tcmds = qw(snmpcfg sshcfg network swnet pd1 pd2 textid network_reset rscanfsp initnetwork solcfg); # most of these commands should be able to be done # through SNMP, but they produce various errors. @@ -4063,6 +4070,7 @@ sub telnetcmds { elsif (/^pd1|pd2$/) { $result = pd($t,$_,$handled{$_}); } elsif (/^textid$/) { $result = mmtextid($t,$mpa,$handled{$_},$mm); } elsif (/^rscanfsp$/) { $result = rscanfsp($t,$mpa,$handled{$_},$mm); } + elsif (/^solcfg$/) { $result = solcfg($t,$handled{$_},$mm); } elsif (/^network_reset$/) { $result = network($t,$handled{$_},$mpa,$mm,$node,$nodeid,1); } push @data, "$_: @$result"; $Rc |= shift(@$result); @@ -4072,6 +4080,52 @@ sub telnetcmds { return([$Rc,\@unhandled,\@data]); } +# Enable/Disable the sol against the mm and blades +# The target node is mm, but all the blade servers belongs to this mm will be +# handled implicated +sub solcfg { + my $t = shift; + my $value = shift; + my $mm = shift; + + if ($value !~ /^enable|disable$/i) { + return([1,"Invalid argument '$value' (enable|disable)"]); + } + + my $setval; + if ($value eq "enable") { + $setval = "enabled"; + } else { + $setval = "disabled"; + } + + my @output; + my $rc = 0; + my @data = $t->cmd("sol -status $setval -T system:$mm"); + if (grep (/OK/, @data)) { + push @output, "$value: succeeded on $mm"; + } else { + push @output, "$value: failed on $mm"; + $rc = 1; + } + + # Get the component list + my @data = $t->cmd("list -l 2"); + foreach (@data) { + if (/^\s*(blade\[\d+\])\s+/) { + my @ret = $t->cmd("sol -status $setval -T $1"); + if (grep (/OK/, @ret)) { + push @output, "$value: succeeded on $1"; + } else { + push @output, "$value: failed on $1"; + $rc = 1; + } + } + } + + return ([$rc, @output]); +} + # Scan the fsp for the NGP ppc nodes sub rscanfsp { my $t = shift;