[Ocfs2-test-devel] [PATCH 03/11] ocfs2-test: changed to accept an alternate NIC to be used by the test.

Marcos E. Matsunaga Marcos.Matsunaga at oracle.com
Sat Jun 12 06:47:56 PDT 2010


Tristan,

Will add it.

Regards,

Marcos Eduardo Matsunaga

Oracle USA
Linux Engineering

“The statements and opinions expressed here are my own and do not
necessarily represent those of Oracle Corporation.”


On 06/03/2010 09:49 PM, tristan wrote:
> Marcos Matsunaga wrote:
>> - on untar fucntion, created an option to separate the extraction
>> logfile
>>   from the general logfile. This is to try to keep the general logfile
>>   clean.
>> - added the option to use an alternate network interface to
>> remote_umount.py
>>   and remote_mount.py
>
> Oh, Marcos,
>
> Could you please also add an option to specify the access method(I
> mean ssh or rsh) for remote_[u]mount.py?
>
> Of course, this patch looks good:)
>
>>
>> Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>
>> ---
>>  programs/python_common/o2tf.py          |   37
>> +++++++++++++++++++++----------
>>  programs/python_common/remote_mount.py  |   10 +++++++-
>>  programs/python_common/remote_umount.py |   13 +++++++++-
>>  3 files changed, 45 insertions(+), 15 deletions(-)
>>
>> diff --git a/programs/python_common/o2tf.py
>> b/programs/python_common/o2tf.py
>> index df060cb..69081bf 100644
>> --- a/programs/python_common/o2tf.py
>> +++ b/programs/python_common/o2tf.py
>> @@ -18,7 +18,7 @@
>>  #
>>  # o2tf - OCFS2 Tests Functions.
>>  #
>> -import os, sys, signal, string, popen2, socket, time, pdb, shutil,
>> platform
>> +import os, sys, signal, string, socket, time, pdb, shutil, platform
>>  import config, stat, os.path
>>  #from log import log
>>  # Set time executable to use.
>> @@ -130,7 +130,7 @@ def extract_tar(DEBUGON, logfile, dirl, tarfile):
>>                  % wdir, logfile, 0, '')
>>          os.mkdir(wdir)
>>          os.chdir(wdir)
>> -        untar(DEBUGON, wdir, tarfile, logfile)
>> +        untar(DEBUGON, wdir, tarfile, logfile, '1')
>>  #
>>  # CreateDir is used by :
>>  #   - o2tf.py
>> @@ -162,7 +162,7 @@ def CreateDir(DEBUGON, dirl, logfile):
>>  #
>>  # untar is used by :
>>  #   - o2tf.py
>> -def untar(DEBUGON, destdir, tarfile, logfile):
>> +def untar(DEBUGON, destdir, tarfile, logfile, quiet):
>>      'Untar into a destdir, the tarfile, logging the output into a
>> logfile'
>>      'For the moment, it only works with compressed tar files.'
>>      if DEBUGON:
>> @@ -174,19 +174,27 @@ def untar(DEBUGON, destdir, tarfile, logfile):
>>      options = 'xvf'
>>      compress = 'z'
>>      st = os.stat(destdir)
>> +    logdate = str(time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()))
>> +    arch = str(platform.machine())
>>      if stat.S_ISREG(st.st_mode):
>>          o2tf.printlog('o2tf.untar: (%s) is a regular file. Can\'t \
>>              extract tarfile into a regular file.' % \
>>              destdir, logfile, 0, '')
>>      else:
>> -        if DEBUGON:
>> -            printlog('o2tf.untar: Extracting tar file %s into %s \
>> -                directory.' %  (tarfile, destdir),
>> -                logfile, 0, '')
>> +        printlog('o2tf.untar: Extracting tar file %s into %s \
>> +            directory.' %  (tarfile, destdir),
>> +            logfile, 0, '')
>> +        if quiet == '1':
>> +            tlogfile =
>> os.path.join(dirlog,logdate+'_untar_'+arch+'_'+nodename)
>> +        else:
>> +            tlogfile = logfile
>> +        printlog('o2tf.untar: Extraction logfile at %s ' % logfile,
>> +            logfile, 0, '')
>> +
>>          t1 = time.time()
>>          os.system('cd %s; tar %s %s 2>&1 1>> %s; du -sh * 1>> %s' % \
>> -            (destdir, options + compress, tarfile, logfile,
>> -                logfile))
>> +            (destdir, options + compress, tarfile, tlogfile,
>> +                tlogfile))
>>          t2 = time.time()
>>          printlog('o2tf.untar: Extraction elapsed time = %s' % \
>>              (t2 - t1), logfile, 0, '')
>> @@ -236,7 +244,7 @@ so just do a sanity check here to test if all
>> nodes are available.
>>  #
>>  # Calls mpirun from openmpi
>>  #
>> -def openmpi_run(DEBUGON, nproc, cmd, nodes, remote_sh, logfile,
>> w_flag):
>> +def openmpi_run(DEBUGON, nproc, cmd, nodes, remote_sh, interface,
>> logfile, w_flag):
>>      """
>>      Execute commands in parallel using OpenMPI.'
>>      """
>> @@ -251,6 +259,11 @@ def openmpi_run(DEBUGON, nproc, cmd, nodes,
>> remote_sh, logfile, w_flag):
>>      else:
>>          nprocopt='-np ' + str(nproc)
>>  
>> +    if not interface:
>> +        iface = ''
>> +    else:
>> +        iface = '-mca btl_tcp_if_include '+interface
>> +
>>      if remote_sh == '' or remote_sh == 'ssh':
>>          shopt = '-mca plm_rsh_agent ssh:rsh'
>>      else:
>> @@ -269,8 +282,8 @@ def openmpi_run(DEBUGON, nproc, cmd, nodes,
>> remote_sh, logfile, w_flag):
>>                  logfile, 0, '')
>>          pid = os.spawnv(os.P_NOWAIT,
>>              '/bin/bash', ['bash', '-xc',
>> -            config.MPIRUN + ' -mca btl tcp,self %s %s --host %s %s' % \
>> -            (shopt, nprocopt, nodes, cmd)])
>> +            config.MPIRUN + ' -mca btl tcp,self %s %s %s --host %s
>> %s' % \
>> +            (shopt, iface, nprocopt, nodes, cmd)])
>>          if w_flag == 'NOWAIT':
>>              return pid
>>          else:
>> diff --git a/programs/python_common/remote_mount.py
>> b/programs/python_common/remote_mount.py
>> index c688cf0..b782ce8 100755
>> --- a/programs/python_common/remote_mount.py
>> +++ b/programs/python_common/remote_mount.py
>> @@ -35,7 +35,8 @@ DEBUGON = os.getenv('DEBUG',0)
>>  userid = pwd.getpwuid(os.getuid())[0]
>>  logfile = config.LOGFILE
>>  #
>> -Usage = 'Usage: %prog [-l|-label label] \
>> +Usage = 'Usage: %prog [-i|--if <Network Interface>] \
>> +[-l|-label label] \
>>  [-m|--mountpoint mountpoint] \
>>  [-n|--nodes nodelist] \
>>  [-o|--options mountoptions]'
>> @@ -47,6 +48,12 @@ if userid == 'root':
>>  if __name__=='__main__':
>>      parser = optparse.OptionParser(Usage)
>>  #
>> +        parser.add_option('-i',
>> +                '--if',
>> +                dest='interface',
>> +                type='string',
>> +                help='Network interface to be used by the test.')
>> +#
>>      parser.add_option('-l',          '--label',         
>> dest='label', @@ -112,6 +119,7 @@ ret = o2tf.openmpi_run(DEBUGON,
>>           str('%s' % command),
>>           options.nodelist,
>>           'ssh',
>> +         options.interface,
>>           logfile,
>>           'WAIT')
>>  
>> diff --git a/programs/python_common/remote_umount.py
>> b/programs/python_common/remote_umount.py
>> index 7b8f24d..3b6a08f 100755
>> --- a/programs/python_common/remote_umount.py
>> +++ b/programs/python_common/remote_umount.py
>> @@ -35,7 +35,8 @@ DEBUGON = os.getenv('DEBUG',0)
>>  userid = pwd.getpwuid(os.getuid())[0]
>>  logfile = config.LOGFILE
>>  #
>> -Usage = 'Usage: %prog [-m|--mountpoint mountpoint] \
>> +Usage = 'Usage: %prog [-i|--if <Network Interface>] \
>> +[-m|--mountpoint mountpoint] \
>>  [-n|--nodes nodelist]'
>>  #
>>  if userid == 'root':
>> @@ -45,6 +46,12 @@ if userid == 'root':
>>  if __name__=='__main__':
>>      parser = optparse.OptionParser(Usage)
>>  #
>> +        parser.add_option('-i',
>> +                '--if',
>> +                dest='interface',
>> +                type='string',
>> +                help='Network interface to be used by the test.')
>> +#
>>      parser.add_option('-m',          '--mountpoint',         
>> dest='mountpoint',
>> @@ -89,7 +96,9 @@ ret = o2tf.openmpi_run(DEBUGON,
>>           nproc,
>>           str('%s' % command),
>>           options.nodelist,
>> -         'ssh', logfile,
>> +         'ssh', +         options.interface,
>> +         logfile,
>>           'WAIT')
>>  
>>  if ret:
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-test-devel/attachments/20100612/f5db93e0/attachment-0001.html 


More information about the Ocfs2-test-devel mailing list