From 3e82a8a696c423ac09daea1bc7cf934b8f1279d2 Mon Sep 17 00:00:00 2001 From: vallard Date: Thu, 28 Jan 2010 06:55:49 +0000 Subject: [PATCH] plugin to be able to set a node to be offline git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5068 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/offline.pm | 63 +++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 xCAT-server/lib/xcat/plugins/offline.pm diff --git a/xCAT-server/lib/xcat/plugins/offline.pm b/xCAT-server/lib/xcat/plugins/offline.pm new file mode 100644 index 000000000..5602f441b --- /dev/null +++ b/xCAT-server/lib/xcat/plugins/offline.pm @@ -0,0 +1,63 @@ +package xCAT_plugin::offline; +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; +use xCAT::Table; +use Getopt::Long; +use File::Basename; +use File::Path; +use File::Copy; +use File::Find; +use Cwd; +use File::Temp; +use xCAT::SvrUtils; +use Data::Dumper; +Getopt::Long::Configure("bundling"); +Getopt::Long::Configure("pass_through"); + +my $verbose = "0"; + +sub handled_commands { + return { + "offline" => "offline" + } +} + + +# function to handle request. Basically, get the information +# about the image and then do the action on it. Is that vague enough? +sub process_request { + my $request = shift; + my $callback = shift; + my $doreq = shift; + + GetOptions( + "version|v" => \$version, + ); + + if ($version) { + my $version = xCAT::Utils->Version(); + $callback->({info=>[$version]}); + return; + } + if ($help) { + $callback->({info=>["This command really doesn't do anything"]}); + return; + } + + if($request->{node}){ + $noderange = $request->{node}; + }else{ + $callback->({error=>["No nodes specified in request for offline"]}); + } + + + my @nodes = @{$noderange}; + foreach my $n (@nodes){ + $callback->({info=>["$n: offline"]}); + } +} + +1;