-Ensure datastore name stays at no more than 42 characters, while preserving as much detail as possible
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3757 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
2a7049b1fa
commit
d086433fba
@ -1508,6 +1508,22 @@ sub mount_nfs_datastore {
|
||||
($server,$path) = split /\//,$location,2;
|
||||
$location =~ s/\//_/g;
|
||||
$location= 'nfs_'.$location;
|
||||
#VMware has a 42 character limit, we will start mangling to get under 42.
|
||||
#Will try to preserve as much informative detail as possible, hence several conditionals instead of taking the easy way out
|
||||
if (length($location) > 42) {
|
||||
$location =~ s/nfs_//; #Ditch unique names for different protocols to the same path, seems unbelievably unlikely
|
||||
}
|
||||
if (length($location) > 42) {
|
||||
$location =~ s/\.//g; #Next, ditch host delimiter, it is unlikely that hosts will have unique names if their dots are removed
|
||||
}
|
||||
if (length($location) > 42) {
|
||||
$location =~ s/_//g; #Next, ditch path delimiter, it is unlikely that two paths will happen to look the same without delimiters
|
||||
}
|
||||
if (length($location) > 42) { #finally, replace the middle with ellipsis
|
||||
substr($location,20,-20,'..');
|
||||
}
|
||||
|
||||
|
||||
my $nds = HostNasVolumeSpec->new(accessMode=>'readWrite',
|
||||
remoteHost=>$server,
|
||||
localPath=>$location,
|
||||
|
Loading…
x
Reference in New Issue
Block a user