mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	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
This commit is contained in:
		
							
								
								
									
										63
									
								
								xCAT-server/lib/xcat/plugins/offline.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								xCAT-server/lib/xcat/plugins/offline.pm
									
									
									
									
									
										Normal file
									
								
							| @@ -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; | ||||
		Reference in New Issue
	
	Block a user