From 6971824f19719299c8deb1fe9c2e56e09dccb3ec Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Thu, 7 Jan 2010 18:20:29 +0000 Subject: [PATCH] -Code to try to cope with vCenter renaming of datastores after xCAT requests a mount git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4909 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/esx.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index 9e783cf52..2225c6cdb 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -1727,6 +1727,7 @@ sub validate_datastore_prereqs { } #TODO: care about VMFS } } + my $refresh_names=0; foreach $node (@$nodes) { my @storage = split /,/,$tablecfg{vm}->{$node}->[0]->{storage}; if ($tablecfg{vm}->{$node}->[0]->{cfgstore}) { @@ -1741,6 +1742,7 @@ sub validate_datastore_prereqs { return 0; } unless ($hyphash{$hyp}->{datastoremap}->{$_}) { #If not already there, must mount it + $refresh_names=1; $hyphash{$hyp}->{datastoremap}->{$_}=mount_nfs_datastore($hostview,$location); } } else { @@ -1749,6 +1751,19 @@ sub validate_datastore_prereqs { } #TODO: raw device mapping, VMFS via iSCSI, VMFS via FC? } } + if ($refresh_names) { #if we are in a vcenter context, vmware can rename a datastore behind our backs immediately after adding + $hostview->update_view_data(); + if (defined $hostview->{datastore}) { # only iterate if it exists + foreach (@{$hostview->datastore}) { + my $dsv = $hypconn->get_view(mo_ref=>$_); + if (defined $dsv->info->{nas}) { + if ($dsv->info->nas->type eq 'NFS') { + $hyphash{$hyp}->{datastoremap}->{"nfs://".$dsv->info->nas->remoteHost.$dsv->info->nas->remotePath}=$dsv->info->name; + } #TODO: care about SMB + } #TODO: care about VMFS + } + } + } return 1; }