-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
This commit is contained in:
jbjohnso 2010-01-07 18:20:29 +00:00
parent 70bf53deae
commit 6971824f19

View File

@ -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;
}