Author: arkurth
Date: Thu Jun 6 14:21:13 2013
New Revision: 1490295
URL: http://svn.apache.org/r1490295
Log:
VCL-702
Updated Module.pm::create_provisioning_object to check if the os, vmhost_os,
and mn_os objects exist and pass them to the constructor if they do.
Updated libvirt.pm to pass the vmhost_os object to the driver object's
constructor.
Modified:
vcl/trunk/managementnode/lib/VCL/Module.pm
vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
vcl/trunk/managementnode/lib/VCL/utils.pm
Modified: vcl/trunk/managementnode/lib/VCL/Module.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module.pm?rev=1490295&r1=1490294&r2=1490295&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module.pm Thu Jun 6 14:21:13 2013
@@ -492,20 +492,12 @@ sub create_provisioning_object {
notify($ERRORS{'DEBUG'}, 0, "$provisioning_perl_package module loaded");
# Attempt to provisioner the object, pass it the mn_os object if it has
already been created
- my $provisioner;
- my $mn_os = $self->mn_os(0);
- my $vmhost_os = $self->vmhost_os(0);
- if ($mn_os) {
- if ($vmhost_os) {
- $provisioner =
($provisioning_perl_package)->new({data_structure => $self->data, mn_os =>
$mn_os, vmhost_os => $vmhost_os});
- }
- else {
- $provisioner =
($provisioning_perl_package)->new({data_structure => $self->data, mn_os =>
$mn_os});
- }
- }
- else {
- $provisioner =
($provisioning_perl_package)->new({data_structure => $self->data})
- }
+ my $constructor_arguments = {};
+ $constructor_arguments->{data_structure} = $self->data();
+ $constructor_arguments->{os} = $self->os(0) if $self->os(0);
+ $constructor_arguments->{mn_os} = $self->mn_os(0) if $self->mn_os(0);
+ $constructor_arguments->{vmhost_os} = $self->vmhost_os(0) if
$self->vmhost_os(0);
+ my $provisioner =
($provisioning_perl_package)->new($constructor_arguments);
if ($provisioner) {
my $provisioner_address = sprintf('%x', $provisioner);
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=1490295&r1=1490294&r2=1490295&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/Provisioning/libvirt.pm Thu Jun 6
14:21:13 2013
@@ -100,7 +100,7 @@ sub initialize {
# Get a list of all *.pm files in the libvirt drivers directory
my @driver_module_paths =
$self->mn_os->find_files($driver_directory_path, '*.pm');
-
+
# Attempt to create an initialize an object for each driver module
# Use the first driver module successfully initialized
DRIVER: for my $driver_module_path (sort { lc($a) cmp lc($b) }
@driver_module_paths) {
@@ -114,7 +114,7 @@ sub initialize {
next DRIVER;
}
my $driver;
- eval { $driver = ($driver_perl_package)->new({data_structure =>
$self->data, os => $self->os}) };
+ eval { $driver = ($driver_perl_package)->new({data_structure =>
$self->data, os => $self->os, vmhost_os => $self->vmhost_os}) };
if ($driver) {
notify($ERRORS{'OK'}, 0, "libvirt $driver_name driver
object created and initialized to control $node_name");
$self->{driver} = $driver;
Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1490295&r1=1490294&r2=1490295&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Thu Jun 6 14:21:13 2013
@@ -4905,7 +4905,7 @@ sub run_ssh_command {
# ssh exits with the exit status of the remote command or with
255 if an error occurred.
# Check for vmware-cmd usage message, it returns 255 if the
vmware-cmd usage output is returned
if ($ssh_output_formatted =~ /ssh:.*(lost connection|reset by
peer|no route to host|connection refused|connection timed out|resource
temporarily unavailable|connection reset)/i) {
- notify($ERRORS{'WARNING'}, 0, "attempt
$attempts/$max_attempts: failed to execute SSH command on $node: '$command',
exit status: $exit_status, output:\n$ssh_output_formatted");
+ notify($ERRORS{'WARNING'}, 0, "attempt
$attempts/$max_attempts: failed to execute SSH command on $node: '$command',
exit status: $exit_status, output:\n$ssh_output_formatted") if $output_level;
next;
}
elsif ($exit_status == 255 && $ssh_command !~
/(vmware-cmd|vim-cmd|vmkfstools|vmrun)/i) {
@@ -6920,7 +6920,7 @@ sub switch_state {
$computer_state_name_new = 'inuse';
}
}
-
+
# Check if new request state was passed
if (!$request_state_name_new) {
notify($ERRORS{'DEBUG'}, 0, "request state was not specified,
state not changed");