From 0f6d150ea0a44c6b3800325ed50ec33ae865432d Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 1 Oct 2009 20:54:11 +0000 Subject: [PATCH] -Fix bug where cluster support could mistakenly wipe out a cluster completely mentioned in previous checkin git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4281 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/esx.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index c250ceb92..9adcacac6 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -1340,7 +1340,13 @@ sub validate_vcenter_prereqs { #Communicate with vCenter and ensure this host is $depfun->($depargs); return 1; } else { - my $task = $hyphash{$hyp}->{vcenter}->{conn}->get_view(mo_ref=>$_->parent)->Destroy_Task(); #THIS DESTROYS THE CLUSTER, FIX + my $ref_to_delete; + if ($_->parent->type eq 'ClusterComputeResource') { #We are allowed to specifically kill a host in a cluster + $ref_to_delete = $_->{mo_ref}; + } elsif ($_->parent->type eq 'ComputeResource') { #For some reason, we must delete the container instead + $ref_to_delete = $_->{parent}; + } + my $task = $hyphash{$hyp}->{vcenter}->{conn}->get_view(mo_ref=>$ref_to_delete)->Destroy_Task(); $running_tasks{$task}->{task} = $task; $running_tasks{$task}->{callback} = \&addhosttovcenter; $running_tasks{$task}->{conn} = $hyphash{$hyp}->{vcenter}->{conn}; @@ -1391,7 +1397,6 @@ sub addhosttovcenter { $hypready{$hyp}=-1; #Declare impossiblility to be ready return; } - sendmsg("Why yes, I was able to find ".$tablecfg{hypervisor}->{$hyp}->[0]->{cluster}); $task = $cluster->AddHost_Task(spec=>$connspec,asConnected=>1); $running_tasks{$task}->{task} = $task; $running_tasks{$task}->{callback} = \&connecthost_callback;