Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
commit
73d269c8c1
@ -77,8 +77,8 @@ sub recursion_copy {
|
||||
} else {
|
||||
copy($tempsource,$tempdestination) or die "failed copy from $tempsource to $tempdestination, $!";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sub lockbyname {
|
||||
my $name = shift;
|
||||
my $lckh;
|
||||
@ -128,6 +128,7 @@ sub handled_commands{
|
||||
rmvm => 'nodehm:mgt',
|
||||
clonevm => 'nodehm:mgt',
|
||||
createvcluster => 'esx',
|
||||
lsvcluster => 'esx',
|
||||
rinv => 'nodehm:mgt',
|
||||
chvm => 'nodehm:mgt',
|
||||
rshutdown => "nodetype:os=(esxi.*)",
|
||||
@ -145,7 +146,7 @@ sub handled_commands{
|
||||
sub preprocess_request {
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
if ($request->{command}->[0] eq 'createvcluster') {
|
||||
if ($request->{command}->[0] eq 'createvcluster' or $request->{command}->[0] eq 'lsvcluster') {
|
||||
return [$request];
|
||||
}
|
||||
#if already preprocessed, go straight to request
|
||||
@ -347,6 +348,10 @@ sub process_request {
|
||||
create_new_cluster($request);
|
||||
return;
|
||||
}
|
||||
if ($command eq 'lsvcluster') {
|
||||
list_clusters($request);
|
||||
return;
|
||||
}
|
||||
|
||||
my $moreinfo;
|
||||
my $noderange = $request->{node};
|
||||
@ -3379,6 +3384,29 @@ sub create_new_cluster {
|
||||
my $cfgspec = ClusterConfigSpecEx->new();
|
||||
$hfolder->CreateClusterEx(name=>$clustername, spec=>$cfgspec);
|
||||
}
|
||||
sub list_clusters {
|
||||
my $req = shift;
|
||||
@ARGV = @{$req->{arg}};
|
||||
my $vcenter;
|
||||
my $password;
|
||||
my $user;
|
||||
my $datacenter;
|
||||
GetOptions(
|
||||
'vcenter=s' => \$vcenter,
|
||||
'password=s' => \$password,
|
||||
'datacenter=s' => \$datacenter,
|
||||
'username=s' => \$user,
|
||||
);
|
||||
my $clustername = shift @ARGV;
|
||||
my $conn = Vim->new(service_url=>"https://$vcenter/sdk");
|
||||
$conn->login(user_name=>$user, password=>$password);
|
||||
use Data::Dumper;
|
||||
my $clustviews = $conn->find_entity_views(view_type=> 'ClusterComputeResource');
|
||||
foreach (@$clustviews) {
|
||||
xCAT::SvrUtils::sendmsg($_->{name}, $output_handler);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub validate_vcenter_prereqs { #Communicate with vCenter and ensure this host is added correctly to a vCenter instance when an operation requires it
|
||||
my $hyp = shift;
|
||||
|
Loading…
Reference in New Issue
Block a user