Author: fapeeler
Date: Wed Dec 17 20:24:54 2014
New Revision: 1646332

URL: http://svn.apache.org/r1646332
Log:
VCL-678

for tomaintenance request, set currentimage to noimage

Modified:
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
    vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm?rev=1646332&r1=1646331&r2=1646332&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm 
(original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Wed 
Dec 17 20:24:54 2014
@@ -1485,14 +1485,6 @@ sub remove_existing_vms {
                return;
        }
        
-       # Set the computer current image in the database to 'noimage'
-       if (update_computer_imagename($computer_id, 'noimage')) {
-               notify($ERRORS{'DEBUG'}, 0, "set computer $computer_name 
current image to 'noimage'");
-       }
-       else {
-               notify($ERRORS{'WARNING'}, 0, "failed to set computer 
$computer_name current image to 'noimage'");
-       }
-       
        return 1;
 }
 
@@ -6622,10 +6614,12 @@ sub post_maintenance_action {
                return;
        }
 
-       if (switch_vmhost_id($computer_id, 'NULL')) {
-               notify($ERRORS{'OK'}, 0, "set vmhostid to NULL for for VM 
$computer_short_name");
+       # Set the computer current image in the database to 'noimage'
+       if (!update_computer_imagename($computer_id, 'noimage')) {
+               notify($ERRORS{'WARNING'}, 0, "failed to set computer 
$computer_short_name current image to 'noimage'");
        }
-       else {
+       
+       if (!switch_vmhost_id($computer_id, 'NULL')) {
                notify($ERRORS{'WARNING'}, 0, "failed to set the vmhostid to 
NULL for VM $computer_short_name");
                return;
        }

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm?rev=1646332&r1=1646331&r2=1646332&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm Wed Dec 17 
20:24:54 2014
@@ -813,20 +813,23 @@ sub post_maintenance_action {
        }
        
        my $domain_name = shift || $self->get_domain_name();
-       my $node_name = $self->data->get_vmhost_short_name();
        my $computer_id = $self->data->get_computer_id();
+       my $computer_short_name = $self->data->get_computer_short_name();
+       my $vmhost_name = $self->data->get_vmhost_short_name();
        
        # Delete the domains on the node which were created for the computer 
being put into maintenance
        if (!$self->delete_existing_domains()) {
-               notify($ERRORS{'WARNING'}, 0, "failed to delete existing 
$domain_name domains on $node_name");
+               notify($ERRORS{'WARNING'}, 0, "failed to delete existing 
$domain_name domains on $vmhost_name");
                return;
        }
+
+       # Set the computer current image in the database to 'noimage'
+       if (!update_computer_imagename($computer_id, 'noimage')) {
+               notify($ERRORS{'WARNING'}, 0, "failed to set computer 
$computer_short_name current image to 'noimage'");
+       }
        
        # Unassign the VM from the VM host, change computer.vmhostid to NULL
-       if (switch_vmhost_id($computer_id, 'NULL')) {
-               notify($ERRORS{'OK'}, 0, "set vmhostid to NULL for for 
$domain_name");
-       }
-       else {
+       if (!switch_vmhost_id($computer_id, 'NULL')) {
                notify($ERRORS{'WARNING'}, 0, "failed to set the vmhostid to 
NULL for $domain_name");
                return;
        }

Modified: vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm
URL: 
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm?rev=1646332&r1=1646331&r2=1646332&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/vbox.pm Wed Dec 17 
20:24:54 2014
@@ -1089,16 +1089,18 @@ sub post_maintenance_action {
        my $computer_id = $self->data->get_computer_id();
        my $vmhost_hostname = $self->data->get_vmhost_hostname;
 
-       if ($self->control_vm("remove")) {
-               notify($ERRORS{'OK'}, 0, "removed node $computer_short_name 
from vmhost $vmhost_hostname");
+       if (!$self->control_vm("remove")) {
+               notify($ERRORS{'WARNING'}, 0, "failed to remove node 
$computer_short_name from vmhost $vmhost_hostname");
+               return;
        }
 
-       if (switch_vmhost_id($computer_id, 'NULL')) {
-               notify($ERRORS{'OK'}, 0, "set vmhostid to NULL for for VM 
$computer_short_name");
+       # Set the computer current image in the database to 'noimage'
+       if (!update_computer_imagename($computer_id, 'noimage')) {
+               notify($ERRORS{'WARNING'}, 0, "failed to set computer 
$computer_short_name current image to 'noimage'");
        }
-       else {
+       
+       if (!switch_vmhost_id($computer_id, 'NULL')) {
                notify($ERRORS{'WARNING'}, 0, "failed to set the vmhostid to 
NULL for VM $computer_short_name");
-               return;
        }
 
        return 1;


Reply via email to