[Ocfs2-test-devel] [PATCH 1/1] Ocfs2-test: Let remote_mount support mounting options.

Marcos E. Matsunaga Marcos.Matsunaga at oracle.com
Tue Aug 11 06:13:05 PDT 2009


Looks good to me.

Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>

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.”



Tristan Ye wrote:
> Several tests such as quota_test should add mounting options
> when mounting volume among nodes, we therefore have to support
> this in remote_mount.
>
> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
> ---
>  programs/python_common/command.py      |   14 +++++++++++++-
>  programs/python_common/o2tf.py         |    4 ++--
>  programs/python_common/o2tf.sh         |   13 +++++++++++--
>  programs/python_common/remote_mount.py |   18 +++++++++++++++---
>  4 files changed, 41 insertions(+), 8 deletions(-)
>
> diff --git a/programs/python_common/command.py b/programs/python_common/command.py
> index 04c99e8..e6ca351 100755
> --- a/programs/python_common/command.py
> +++ b/programs/python_common/command.py
> @@ -34,6 +34,7 @@ logfile = config.LOGFILE
>  Usage = 'Usage: %prog [--Debug] \
>  [-l|--label label] \
>  [-m|--mountpoint mountpoint] \
> +[-o|--options mountoptions] \
>  [--mount] \
>  [--umount]'
>  #
> @@ -62,6 +63,12 @@ if __name__=='__main__':
>  		type='string',
>  		help='Directory where the partition will be mount.')
>  #
> +	parser.add_option('-o', 
> +		'--options', 
> +		dest='mountoptions',
> +		type='string',
> +		help='mounting options to be added')
> +#
>  	parser.add_option('--umount',
>  		action="store_true",
>  		dest='doumount',
> @@ -77,9 +84,14 @@ if __name__=='__main__':
>  			parser.error('Please specify mountpoint.')
>  		if not options.label:
>  			parser.error('Please specify Label.')
> +		if options.mountoptions:
> +			mt_options = '-o %s' %(options.mountoptions)
> +		else:
> +			mt_options = ''
>  		if not mounted:
>  			o2tf.SudoMount(options.DEBUGON, logfile, 
> -				options.mountpoint, options.label)
> +				       options.mountpoint, options.label,
> +				       mt_options)
>  		else:
>  			o2tf.printlog('Partition already mounted.',
>  				logfile, 0, '')
> diff --git a/programs/python_common/o2tf.py b/programs/python_common/o2tf.py
> index ab4374a..720fcf6 100644
> --- a/programs/python_common/o2tf.py
> +++ b/programs/python_common/o2tf.py
> @@ -405,10 +405,10 @@ def SudoUmount(DEBUGON, logfile, mountpoint):
>  #
>  # SudoMount is used by:
>  #
> -def SudoMount(DEBUGON, logfile, mountpoint, label):
> +def SudoMount(DEBUGON, logfile, mountpoint, label, options):
>  	'''Find and return device Label based on devicename'''
>  	from commands import getstatusoutput
> -	status = getstatusoutput('sudo mount LABEL=%s %s' % (label,
> +	status = getstatusoutput('sudo mount LABEL=%s %s %s' % (label, options,
>  		mountpoint))
>  	if status[0] == 0:
>  		return
> diff --git a/programs/python_common/o2tf.sh b/programs/python_common/o2tf.sh
> index c73f66c..d912a9b 100755
> --- a/programs/python_common/o2tf.sh
> +++ b/programs/python_common/o2tf.sh
> @@ -252,15 +252,24 @@ function f_remote_mount()
>  	#${2} specify label name
>  	#${3} specify mount point
>  	#${4} specify MPI hosts, it's comma-spearated-value
> +	#${5} specify mount options
>  
>  	local logfile=${1}
>  
>  	local L=${2}
>  	local M=${3}
>  	local MPIHOSTS=${4}
> +	local MT_OPTIONS=
> +
> +	shift 4
> +
> +	local O=${@}
> +	if [ ! -z "${O}" ];then
> +		MT_OPTIONS="-o ${O}"
> +	fi
>  
> -        f_LogMsg ${logfile} "${REMOTE_MOUNT_BIN} -l ${L} -m ${M} -n ${MPIHOSTS}"
> -        ${REMOTE_MOUNT_BIN} -l ${L} -m ${M} -n ${MPIHOSTS}>>${logfile} 2>&1
> +        f_LogMsg ${logfile} "${REMOTE_MOUNT_BIN} -l ${L} -m ${M} -n ${MPIHOSTS} ${MT_OPTIONS}"
> +        ${REMOTE_MOUNT_BIN} -l ${L} -m ${M} -n ${MPIHOSTS} ${MT_OPTIONS}>>${logfile} 2>&1
>          RET=$?
>  
>          if [ "${RET}" != "0" ];then
> diff --git a/programs/python_common/remote_mount.py b/programs/python_common/remote_mount.py
> index ae2a6c5..754f1ab 100755
> --- a/programs/python_common/remote_mount.py
> +++ b/programs/python_common/remote_mount.py
> @@ -37,7 +37,8 @@ logfile = config.LOGFILE
>  #
>  Usage = 'Usage: %prog [-l|-label label] \
>  [-m|--mountpoint mountpoint] \
> -[-n|--nodes nodelist]'
> +[-n|--nodes nodelist] \
> +[-o|--options mountoptions]'
>  #
>  if userid == 'root':
>  	o2tf.printlog('This program uses Openmpi. Should not run as root',
> @@ -63,6 +64,12 @@ if __name__=='__main__':
>  		dest='nodelist',
>  		type='string',
>  		help='List of nodes where the test will be executed.')
> +
> +	parser.add_option('-o', 
> +		'--options', 
> +		dest='mountoptions',
> +		type='string',
> +		help='Mounting options to be added.')
>  #
>  	(options, args) = parser.parse_args()
>  	if len(args) != 0:
> @@ -73,6 +80,10 @@ if __name__=='__main__':
>  		parser.error('Please specify mountpoint.')
>  	if not options.label:
>  		parser.error('Please specify Label.')
> +	if options.mountoptions:
> +		mt_options = '-o %s' %(options.mountoptions)
> +	else:
> +		mt_options = ''
>  #
>  	nodelist = options.nodelist.split(',')
>  	nodelen = len(nodelist)
> @@ -88,9 +99,10 @@ if DEBUGON:
>  else:
>  	buildcmd=config.BINDIR+'/command.py --mount'
>  #
> -command = str('%s -l %s -m %s' % (buildcmd,
> +command = str('%s -l %s -m %s %s' % (buildcmd,
>  	options.label,
> -	options.mountpoint))
> +	options.mountpoint,
> +	mt_options))
>  #
>  o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'ssh')
>  #
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.oracle.com/pipermail/ocfs2-test-devel/attachments/20090811/dc048c8d/attachment.html 


More information about the Ocfs2-test-devel mailing list