git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@13571 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
		
			
				
	
	
		
			72 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Perl
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env perl
 | |
| # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
 | |
| #####################################################
 | |
| #
 | |
| #   xCAT post script for diskless nodes 
 | |
| #   to setup tunable parameters for NFSv4 replication failover
 | |
| #   It only works on AIX for now
 | |
| #
 | |
| #####################################################
 | |
| 
 | |
| # Change these two parameters according to your requirements
 | |
| $::NFSRETRIES = 3;
 | |
| $::NFSTIMEO = 10;
 | |
| 
 | |
| # Candidate commands: mount, df, lsfs, nfs4cl showfs
 | |
| # Only the mount command could list all file systems
 | |
| # Even the file system is not in /etc/filesystems
 | |
| my $cmd = "mount";
 | |
| &runcmd($cmd);
 | |
| my @nfs4fs;
 | |
| 
 | |
| foreach my $line (@::outref)
 | |
| {
 | |
|     chomp($line);
 | |
| 
 | |
|     #header line
 | |
|     if ($line =~ /node\s+mounted\s+mounted over/)
 | |
|     {
 | |
|         next;
 | |
|     }
 | |
| 
 | |
|     if ($line =~ /^-------/)
 | |
|     {
 | |
|         next;
 | |
|     }
 | |
|     my ($node, $mounted, $mountedover, $vfs, $dummy) = split(/\s+/, $line, 5);
 | |
|     if ($vfs eq "nfs4")
 | |
|     {
 | |
|         push @nfs4fs, $mountedover;
 | |
|     }
 | |
| }
 | |
|      
 | |
| foreach my $nfs4mnt (@nfs4fs)
 | |
| {
 | |
|     my $nfscmd = "nfs4cl setfsoptions $nfs4mnt timeo=$::NFSTIMEO; nfs4cl setfsoptions $nfs4mnt retrans=$::NFSRETRIES";
 | |
|     &runcmd($nfscmd);
 | |
| }
 | |
| 
 | |
| sub runcmd
 | |
| {
 | |
|     my ($cmd) = @_;
 | |
|     my $rc=0;
 | |
|     $cmd .= ' 2>&1' ;
 | |
|     @::outref = `$cmd`;
 | |
|     if ($?)
 | |
|     {
 | |
|         $rc = $? >> 8;
 | |
|         if ($rc > 0)
 | |
|         {
 | |
|             `logger -t xcat "runcmd $cmd failed, error message is:"`;
 | |
|             my $errmsg;
 | |
|             foreach my $err (@::outref)
 | |
|             {
 | |
|                 $errmsg .= $err;
 | |
|             }
 | |
|             `logger -t xcat "$errmsg"`;
 | |
|              exit;
 | |
|         }
 | |
|     }
 | |
|     return $rc;
 | |
| }
 |