-Allow standalone hosts in specified datacenters

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7505 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2010-09-17 16:58:57 +00:00
parent 803fefc867
commit 36e22f9ced

View File

@ -2621,6 +2621,7 @@ sub addhosttovcenter {
$running_tasks{$task}->{data} = { depfun => $depfun, depargs=> $depargs, conn=> $hyphash{$hyp}->{vcenter}->{conn}, connspec=>$connspec, cluster=>$cluster, hypname=>$hyp, vcenter=>$vcenter };
} else {
my $datacenter = validate_datacenter_prereqs($hyp);
unless ($datacenter) { return; }
my $hfolder = $datacenter->hostFolder; #$hyphash{$hyp}->{vcenter}->{conn}->find_entity_view(view_type=>'Datacenter',properties=>['hostFolder'])->hostFolder;
$hfolder = $hyphash{$hyp}->{vcenter}->{conn}->get_view(mo_ref=>$hfolder);
$task = $hfolder->AddStandaloneHost_Task(spec=>$connspec,addConnected=>1);
@ -2636,7 +2637,16 @@ sub addhosttovcenter {
sub validate_datacenter_prereqs {
my ($hyp) = @_;
my $datacenter = $hyphash{$hyp}->{vcenter}->{conn}->find_entity_view(view_type => 'Datacenter', properties=>['hostFolder']);
my $datacenter;
if ($tablecfg{hypervisor}->{$hyp}->[0]->{datacenter}) {
$datacenter = $hyphash{$hyp}->{vcenter}->{conn}->find_entity_view(view_type => 'Datacenter', properties=>['hostFolder'],filter=>{name=>$tablecfg{hypervisor}->{$hyp}->[0]->{datacenter}});
unless ($datacenter) {
xCAT::SvrUtils::sendmsg([1,": Unable to find requested datacenter (hypervisor.datacenter for $hyp is ".$tablecfg{hypervisor}->{$hyp}->[0]->{datacenter}.")"], $output_handler);
return;
}
} else {
$datacenter = $hyphash{$hyp}->{vcenter}->{conn}->find_entity_view(view_type => 'Datacenter', properties=>['hostFolder']);
}
if (!defined $datacenter) {
my $vconn = $hyphash{$hyp}->{vcenter}->{conn};