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