vcl-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arku...@apache.org
Subject svn commit: r1057312 - in /incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware: VIM_SSH.pm VMware.pm vSphere_SDK.pm
Date Mon, 10 Jan 2011 18:56:10 GMT
Author: arkurth
Date: Mon Jan 10 18:56:10 2011
New Revision: 1057312

URL: http://svn.apache.org/viewvc?rev=1057312&view=rev
Log:
VCL-394
Updated VMware code to detect if a datastore mounted on a VM host is not accessible.  A warning
is displayed when the VMware provisioning object is initialized if any datastores are inaccessible.
These datastores are not considered when attempting to determine various other paths.

Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm?rev=1057312&r1=1057311&r2=1057312&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VIM_SSH.pm Mon Jan
10 18:56:10 2011
@@ -453,6 +453,8 @@ sub _get_datastore_info {
 		return $self->{datastore};
 	}
 	
+	my $vmhost_hostname = $self->data->get_vmhost_hostname();
+	
 	my $vim_cmd_arguments = "hostsvc/datastore/listsummary";
 	my ($exit_status, $output) = $self->_run_vim_cmd($vim_cmd_arguments);
 	return if !$output;
@@ -512,10 +514,19 @@ sub _get_datastore_info {
 			}
 		}
 		
+		# Check if the accessible value was retrieved and is not false
+		my $datastore_accessible = $datastore_info->{$datastore_name}{accessible};
+		if (!$datastore_accessible || $datastore_accessible =~ /false/i) {
+			notify($ERRORS{'WARNING'}, 0, "datastore '$datastore_name' is mounted on $vmhost_hostname
but not accessible");
+			delete $datastore_info->{$datastore_name};
+			next;
+		}
+		
 		# Add a 'normal_path' key to the hash based on the datastore url
 		my $datastore_url = $datastore_info->{$datastore_name}{url};
 		if (!defined($datastore_url)) {
 			notify($ERRORS{'WARNING'}, 0, "failed to determine datastore url from 'vim-cmd $vim_cmd_arguments'
output section, datastore name: $datastore_name:\n$output_section");
+			delete $datastore_info->{$datastore_name};
 			next;
 		}
 		

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm?rev=1057312&r1=1057311&r2=1057312&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/VMware.pm Mon Jan
10 18:56:10 2011
@@ -5718,6 +5718,10 @@ sub _get_datastore_name {
 	# Loop through the datastores, check if the path begins with the datastore path
 	for my $datastore_name (keys(%{$datastore_info})) {
 		my $datastore_normal_path = $datastore_info->{$datastore_name}{normal_path};
+		if (!$datastore_normal_path) {
+			notify($ERRORS{'WARNING'}, 0, "normal path is not defined in the datastore info hash for
datastore $datastore_name:" . format_data($datastore_info->{$datastore_name}));
+			next;
+		}
 		$datastore_normal_path = normalize_file_path($datastore_normal_path);
 		
 		my $datastore_url = $datastore_info->{$datastore_name}{url};

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm?rev=1057312&r1=1057311&r2=1057312&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Provisioning/VMware/vSphere_SDK.pm Mon
Jan 10 18:56:10 2011
@@ -2109,6 +2109,8 @@ sub _get_datastore_info {
 		return;
 	}
 	
+	my $vmhost_hostname = $self->data->get_vmhost_hostname();
+	
 	# Get the host view
 	my $host_view = VIExt::get_host_view(1);
 	
@@ -2121,7 +2123,20 @@ sub _get_datastore_info {
 	for my $datastore_mo_ref (@datastore_mo_refs) {
 		my $datastore_view = Vim::get_view(mo_ref => $datastore_mo_ref);
 		my $datastore_name = $datastore_view->summary->name;
+		
+		# Make sure the datastore is accessible
+		# Don't return info for inaccessible datastores
+		my $datastore_accessible = $datastore_view->summary->accessible;
+		if (!$datastore_accessible) {
+			notify($ERRORS{'WARNING'}, 0, "datastore '$datastore_name' is mounted on $vmhost_hostname
but not accessible");
+			next;
+		}
+		
 		my $datastore_url = $datastore_view->summary->url;
+		if (!$datastore_url) {
+			notify($ERRORS{'WARNING'}, 0, "unable to retrieve URL for datastore '$datastore_name'");
+			next;
+		}
 		
 		if ($datastore_url =~ /^\/vmfs\/volumes/i) {
 			$datastore_view->summary->{normal_path} = "/vmfs/volumes/$datastore_name";



Mime
View raw message