From 90e01486cce2fa8912c4862279618413c8aa0936 Mon Sep 17 00:00:00 2001 From: vallard Date: Fri, 22 Jan 2010 22:39:57 +0000 Subject: [PATCH] added ability to add directories without mount points and consolidated mount points git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5021 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/litetree.pm | 42 ++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/litetree.pm b/xCAT-server/lib/xcat/plugins/litetree.pm index d75349744..15bfdf58e 100644 --- a/xCAT-server/lib/xcat/plugins/litetree.pm +++ b/xCAT-server/lib/xcat/plugins/litetree.pm @@ -147,26 +147,56 @@ sub showSync { my $callback = shift; my $node = shift; my $dirs = shift; - + my $mnts; + my $first; #print Dumper($dirs); # go through each directory in priority order #mkdir "/mnt/xcat"; if($syncType eq "dir"){ + foreach my $priority (sort {$a <=> $b} keys %$dirs){ # split the nfs server up from the directory: + my $mntpnt; my ($server, $dir) = split(/:/,$dirs->{$priority}); + + # if server is blank then its the directory: + unless($dir){ + $dir = $server; + $server = ''; + } + if(grep /\$|#CMD/, $dir){ $dir = subVar($dir,$node,'dir',$callback); $dir =~ s/\/\//\//g; } + $first = $dir; + $first =~ s!\/([^/]*)\/.*!$1!; - if(grep /\$/, $server){ - $server = subVar($server,$node,'server',$callback); - } - my $mntpnt = $server . ":" . $dir; + if($server){ + if(grep /\$/, $server){ + $server = subVar($server,$node,'server',$callback); + } + + $mntpnt = $server . ":"; + # we have a server and need to make sure we can mount them under unique names + if($mnts->{$first} eq '' ){ # if the first mount point doesn't have a server then leave it. + $mnts->{$first} = $server; + }else{ + # they may just have the name in twice: + unless($server eq $mnts->{$first}){ + my $msg = "# " . $mnts->{$first} . " and $server both mount /$first. This not supported."; + $callback->({info => $msg}); + return; + }else{ + $mntpnt = ""; # only mount it once, so get rid of the directory + } + } + } + $mntpnt .= $dir; # ok, now we have all the mount points. Let's go through them all? $callback->({info => "$node: $mntpnt"}); } + }elsif($syncType =~ /file|image/){ foreach my $file (sort keys %$dirs){ my $options = $dirs->{$file}; @@ -175,7 +205,7 @@ sub showSync { $callback->({info => $out}); } } - + } # some directories will have xCAT database values, like: