Beispiel #1
0
def BuildDelList(nodelist, dirlist):
#
# Now, invert the pair directories (A = Bdir and B = Adir).
#
	from os import access, remove, F_OK
	for n in range(nodelen):
		if divmod(n,2)[1] == 1:
			if access(os.path.join(stagedir,nodelist[n]+'_D.dat'), F_OK) == 1:
				remove(os.path.join(stagedir,nodelist[n]+'_D.dat'))
			fd = open(os.path.join(stagedir,nodelist[n]+'_D.dat'), 'w',0)
			fd.write(string.join(node_dirs[nodelist[n-1]+'_D'],','))
			fd.close
			if DEBUGON:
				o2tf.printlog('cross_delete:BuildDelList: (%s) was written to \
					the file %s' % (string.join(node_dirs[nodelist[n-1]+'_D'],','),
				os.path.join(stagedir, nodelist[n]+'_D.dat')), 
				logfile, 
				0, 
				'')
			fd = open(os.path.join(stagedir, nodelist[n-1]+'_D.dat'), 'w',0)
			fd.write(string.join(node_dirs[nodelist[n]+'_D'],','))
			fd.close
			if DEBUGON:
				o2tf.printlog('cross_delete:BuildDelList: (%s) was written to \
					the file %s' % (string.join(node_dirs[nodelist[n]+'_D'],','),
				os.path.join(stagedir, nodelist[n-1]+'_D.dat')),
				logfile,
				0,
				'')
Beispiel #2
0
def CheckDirs(nodes, dirs):
	'Check if the test directories at least exist'
	global tarfile, DEBUGON
	from commands import getoutput
	nodesl = nodes.split(',')
	dirl = dirs.split(',')
	MinSize = CompSize(tarfile)
	InitTrue = False
	for x in range(len(dirl)):
		if InitTrue:
			break
		for y in range(len(nodesl)):
			workdir=os.path.join(dirl[x], nodesl[y])
			from os import access,F_OK
			if os.access(workdir,F_OK) == 0:
				os.mkdir(workdir)
				InitTrue = True
				break
			size = getoutput('du -sb %s|cut -f1' % workdir)
			if DEBUGON:
				o2tf.printlog('workdir(%s) Minsize(%s) \
					 size (%s)' % \
					(workdir, MinSize, size), 
					logfile, 0, '')
			if int(MinSize) > int(size):
				InitTrue = True
				break
	if InitTrue:
		o2tf.printlog('At least one directory seems incomplete. \
			Will initialize them all',
			logfile, 0, '')
		Initialize()
def Cleanup():
    from os import access, F_OK

    filename = options.filename
    if access(filename, F_OK) == 1:
        if DEBUGON:
            o2tf.printlog("write_append_truncate: Removing filename (%s)" % filename, logfile, 0, "")
            os.system("rm -f %s" % filename)
    sys.exit()
Beispiel #4
0
def Cleanup(ret):
	from os import access, F_OK
	filename = options.filename
	if access(filename,F_OK) == 1:
		if DEBUGON:
			o2tf.printlog('multi_mmap: Removing filename (%s)' 
				      % filename, logfile, 0, '')
			os.system('rm -f %s' % filename)
	sys.exit(ret)
Beispiel #5
0
def Populate():
	from os import access, remove, F_OK
	localdir=os.path.join(options.directory,str('%s_recovery' % lhostname))
	if DEBUGON:
		o2tf.printlog('recovery_load: localdir [%s]' % localdir,
			logfile, 0, '')
	if access(localdir, F_OK) == 1:
		os.system('rm -fr '+localdir)
	o2tf.CreateDir(DEBUGON, localdir, logfile)
	o2tf.untar(DEBUGON, localdir, tarfile, logfile,'1')
Beispiel #6
0
def CreateBaseFile():
	from commands import getoutput
	global BASEMD5SUM 
	os.system('ps -efl > %s' % os.path.join('/tmp', filename))
	BASEMD5SUM=getoutput('%s %s|cut -f1 -d" "' % \
		(MD5SUM, os.path.join('/tmp', filename)))
	if DEBUGON:
		o2tf.printlog('splice_test: Running CreateBaseFile',
			logfile, 0, '')
		o2tf.printlog('splice_test: BASEMD5SUM %s' % BASEMD5SUM,
			logfile, 0, '')
def Cleanup():
	from os import access, F_OK
	for i in range(options.count):
		filename = options.path+'/create_racer:'+str(i).zfill(6)
		if access(filename,F_OK) == 1:
			if DEBUGON:
				o2tf.printlog('create_racer: Removing '+
				'filename (%s)' % filename,
				logfile, 0, '')
			os.system('rm -f %s' % filename)
	sys.exit()
Beispiel #8
0
def tbuild(thrid, command):
	'tbuild spawn process and build a process list'
	'tbuild takes 2 arguments:'
	'	 thrid - Thread number, which will index pidlist'
	'	 command - command to be executed'
	if DEBUGON:
		o2tf.printlog('buildkernel:tbuild - current directory %s' % os.getcwd(), 
			logfile, 0, '')
		o2tf.printlog('buildkernel:tbuild - command	%s ' % command, 
			logfile, 0, '')
	pidlist[thrid] = os.spawnv(os.P_NOWAIT, 
			'/bin/bash', 
			['bash', 
			'-c', 
			command])
Beispiel #9
0
def CompSize(tarfile):
	global logfile, DEBUGON
	from os import access,F_OK
	tmpfile='/tmp/src_%s.dat' % PID
	if os.access(tarfile,F_OK) == 1:
		os.system('tar tvfz %s > %s' % (tarfile, tmpfile))
	fd=open(tmpfile, 'r', 0)
	size=0
	while True:
		line = fd.readline()
		if not line: break
		linelist = line.split(" ")
		for i in range(linelist.count('')):
			linelist.remove('')
		if DEBUGON:
			o2tf.printlog('size = %s, filesize = %s' % \
				(size, linelist[2]), logfile, 0, '')
		size = size + int(linelist[2])
	return size
Beispiel #10
0
def SpliceWrite():
	global SCRIPT_STATUS
	from commands import getoutput
	print('Testing splice_write ........')
	from os import access, F_OK
	if access(os.path.join(directory, filename), F_OK) ==1:
		os.system('rm -fr ' + os.path.join(directory, filename))
	os.system('cat %s | %s %s %i' % (os.path.join('/tmp', filename), \
		SPLICEWRITE_BIN, os.path.join(directory, filename), \
		os.stat(os.path.join('/tmp', filename)).st_size))
	TEMPMD5SUM=getoutput('%s %s|cut -f1 -d" "' % \
		(MD5SUM, os.path.join(directory, filename)))
	if BASEMD5SUM == TEMPMD5SUM:
		print('PASSED')
	else:
		SCRIPT_STATUS=-1
		print('FAILED')
		o2tf.printlog('splice_test: BASEMD5SUM %s' % BASEMD5SUM,
			logfile, 0, '')
		o2tf.printlog('splice_test: TEMPMD5SUM %s' % TEMPMD5SUM,
			logfile, 0, '')
Beispiel #11
0
def SpliceRead():
	global SCRIPT_STATUS
	from commands import getoutput
	from os import access, F_OK
	print('Testing splice_read ........')
	if access(os.path.join(directory, filename), F_OK) ==1:
		os.system('rm -fr ' + os.path.join(directory, filename))
	os.system('%s %s | cat > %s' % (SPLICEREAD_BIN, \
		os.path.join('/tmp', filename), \
		os.path.join(directory, filename)))
	TEMPMD5SUM=getoutput('%s %s|cut -f1 -d" "' % \
		(MD5SUM, os.path.join(directory, filename)))
	if BASEMD5SUM == TEMPMD5SUM:
		print('PASSED')
	else:
		SCRIPT_STATUS=-1
		print('FAILED')
		o2tf.printlog('splice_test: BASEMD5SUM %s' % BASEMD5SUM,
			logfile, 0, '')
		o2tf.printlog('splice_test: TEMPMD5SUM %s' % TEMPMD5SUM,
			logfile, 0, '')
Beispiel #12
0
def SpliceWrite():
    global SCRIPT_STATUS
    from commands import getoutput
    print('Testing splice_write ........')
    from os import access, F_OK
    if access(os.path.join(directory, filename), F_OK) == 1:
        os.system('rm -fr ' + os.path.join(directory, filename))
    os.system('cat %s | %s %s %i' % (os.path.join('/tmp', filename), \
     SPLICEWRITE_BIN, os.path.join(directory, filename), \
     os.stat(os.path.join('/tmp', filename)).st_size))
    TEMPMD5SUM=getoutput('%s %s|cut -f1 -d" "' % \
     (MD5SUM, os.path.join(directory, filename)))
    if BASEMD5SUM == TEMPMD5SUM:
        print('PASSED')
    else:
        SCRIPT_STATUS = -1
        print('FAILED')
        o2tf.printlog('splice_test: BASEMD5SUM %s' % BASEMD5SUM, logfile, 0,
                      '')
        o2tf.printlog('splice_test: TEMPMD5SUM %s' % TEMPMD5SUM, logfile, 0,
                      '')
Beispiel #13
0
def CheckAtime(fname, logfile):
    from time import strftime, localtime
    from os.path import getatime
    from o2tf import printlog
    Atime1 = strftime("%m %d %Y %H %M", localtime(getatime(fname)))
    os.system('cat %s >> /dev/null' % fname)
    Atime2 = strftime("%m %d %Y %H %M", localtime(getatime(fname)))
    if Atime1 != Atime2:
        printlog('file %s - unexpected atime update - previous (%s),' \
         ' current(%s)' % (fname, Atime1, Atime2),
         logfile,
         0,
         '')
    time.sleep(atime + 1)
    Atime3 = strftime("%m %d %Y %H %M", localtime(getatime(fname)))
    if Atime3 == strftime("%m %d %Y %H %M", localtime()):
        if DEBUGON:
            printlog('file %s - atime update successful - ' \
             'previous (%s), current(%s)' % (fname, Atime1,
             Atime2),
             logfile,
             0,
             '')
    else:
        printlog('file %s - atime update failed - previous (%s),' \
         ' current(%s), expected (%s)' % \
         (fname, Atime1, Atime2, strftime("%m %d %Y %H %M", \
         localtime())),
         logfile,
         0,
         '')
def CheckAtime(fname, logfile):
	from time import strftime, localtime
	from os.path import getatime
	from o2tf import printlog
	Atime1 = strftime("%m %d %Y %H %M", localtime(getatime(fname)))
	os.system('cat %s >> /dev/null' % fname)
	Atime2 = strftime("%m %d %Y %H %M", localtime(getatime(fname)))
	if Atime1 != Atime2:
		printlog('file %s - unexpected atime update - previous (%s),' \
			' current(%s)' % (fname, Atime1, Atime2),
			logfile,
			0,
			'')
	time.sleep(atime+1)
	Atime3 = strftime("%m %d %Y %H %M", localtime(getatime(fname)))
	if Atime3 == strftime("%m %d %Y %H %M", localtime()):
		if DEBUGON:
			printlog('file %s - atime update successful - ' \
				'previous (%s), current(%s)' % (fname, Atime1, 
				Atime2),
				logfile,
				0,
				'')
	else:
		printlog('file %s - atime update failed - previous (%s),' \
			' current(%s), expected (%s)' % \
			(fname, Atime1, Atime2, strftime("%m %d %Y %H %M", \
			localtime())),
			logfile,
			0,
			'')
Beispiel #15
0
def Initialize():
    global DEBUGON, logfile
    'Initialize the directories (remove and extract)'
    #
    o2tf.printlog('Cleaning up directories.', logfile, 0, '')
    o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'ssh')
    o2tf.openmpi_run(DEBUGON, nproc, str('%s -c -d %s -l %s' % \
      (buildcmd,
      options.dirlist,
      options.logfile) ),
      options.nodelist,
      'ssh',
      options.interface,
      options.logfile,
      'WAIT')
    #
    o2tf.printlog('Extracting tar file into directories.', logfile, 0, '')
    o2tf.openmpi_run(DEBUGON, nproc, str('%s -e -d %s -l %s -t %s' % \
      (buildcmd,
      options.dirlist,
      options.logfile,
      tarfile) ),
      options.nodelist,
      'ssh',
      options.interface,
      options.logfile,
      'WAIT')
    o2tf.printlog('Directories initialization completed.', logfile, 0, '')
Beispiel #16
0
def Initialize():
	global DEBUGON, logfile
	'Initialize the directories (remove and extract)'
#
	o2tf.printlog('Cleaning up directories.', logfile, 0, '')
	o2tf.OpenMPIInit(DEBUGON, options.nodelist, logfile, 'ssh')
	o2tf.openmpi_run(DEBUGON, nproc, str('%s -c -d %s -l %s' % \
			(buildcmd, 
			options.dirlist, 
			options.logfile) ),
			options.nodelist, 
			'ssh',
			options.interface,
			options.logfile,
			'WAIT')
#
	o2tf.printlog('Extracting tar file into directories.', logfile, 0, '')
	o2tf.openmpi_run(DEBUGON, nproc, str('%s -e -d %s -l %s -t %s' % \
			(buildcmd, 
			options.dirlist, 
			options.logfile,
			tarfile) ),
			options.nodelist, 
			'ssh',
			options.interface,
			options.logfile,
			'WAIT')
	o2tf.printlog('Directories initialization completed.', logfile, 0, '')
def CheckAtime0(fname, logfile):
    from time import strftime, localtime
    from os.path import getatime
    from o2tf import printlog

    Atime1 = strftime("%m %d %Y %H %M", localtime(getatime(fname)))
    os.system("cat %s >> /dev/null" % fname)
    Atime2 = strftime("%m %d %Y %H %M", localtime(getatime(fname)))
    if Atime2 == strftime("%m %d %Y %H %M", localtime()):
        if DEBUGON:
            printlog(
                "file %s - atime update successful - " "previous (%s), current(%s)" % (fname, Atime1, Atime2),
                logfile,
                0,
                "",
            )
    else:
        printlog(
            "file %s - atime update failed - previous (%s),"
            " current(%s), expected (%s)" % (fname, Atime1, Atime2, strftime("%m %d %Y %H %M", localtime())),
            logfile,
            0,
            "",
        )
Beispiel #18
0
        nodelist = options.nodelist.split(',')
    logfile = options.logfile
    interface = options.interface
    tarfile = options.tarfile
    if nodelen > config.NPROC:
        nproc = nodelen
    else:
        nproc = config.NPROC
#
if DEBUGON:
    buildcmd = config.BINDIR + '/buildkernel.py -D'
else:
    buildcmd = config.BINDIR + '/buildkernel.py'
#
if DEBUGON:
    o2tf.printlog('run_buildkernel: dirlist = (%s)' % dirlist, logfile, 0, '')
    o2tf.printlog('run_buildkernel: dirlen = (%s)' % dirlen, logfile, 0, '')
    o2tf.printlog('run_buildkernel: nodelist = (%s)' % nodelist, logfile, 0,
                  '')
    o2tf.printlog('run_buildkernel: interface = (%s)' % interface, logfile, 0,
                  '')
    o2tf.printlog('run_buildkernel: nodelen = (%s)' % nodelen, logfile, 0, '')
    o2tf.printlog('run_buildkernel: logfile = (%s)' % logfile, logfile, 0, '')
    o2tf.printlog('run_buildkernel: tarfile = (%s)' % tarfile, logfile, 0, '')
    o2tf.printlog('run_buildkernel: buildcmd = (%s)' % buildcmd, logfile, 0,
                  '')
#
if options.initialize:
    Initialize()
elif not options.nocheckdirs:
    CheckDirs(options.nodelist, options.dirlist)
Beispiel #19
0
    #
    parser.add_option(
        "-f", "--filename", dest="filename", type="string", help="Filename that will be used during test."
    )
    #
    parser.add_option("-l", "--logfile", dest="logfile", type="string", help="Logfile used by the process.")
    #
    parser.add_option(
        "-s", "--seconds", dest="seconds", type="int", help="Number of seconds the test will run (def. 60)."
    )
    #
    parser.add_option("-u", "--uniquefile", action="store_true", dest="uniquefile", default=False)
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog("args left %s" % len(args), logfile, 0, "")
        parser.error("incorrect number of arguments")
    #
    if options.blocksize:
        blocksize = options.blocksize
        blockvalues = blocksize.split(",")
        if len(blockvalues) != 2:
            o2tf.printlog("Blocksize must be specified in format xxx,yyy\n\n", logfile, 0, "")
            parser.error("Invalid format.")
    else:
        parser.error("Blocksize parameter needs to be specified.")

    if int(blockvalues[0]) < MINBLOCKSIZE or int(blockvalues[1]) > MAXBLOCKSIZE:
        o2tf.printlog("Blocksize must be between %s and %s\n\n" % (MINBLOCKSIZE, MAXBLOCKSIZE), logfile, 0, "")
        parser.error("Invalid range.")
    if DEBUGON:
Beispiel #20
0
	parser.add_option('-l', 
		'--logfile', 
		dest='logfile',
		type='string', 
		help='Logfile used by the process.')
#
	parser.add_option('-n', 
		'--nodelist', 
		dest='nodelist',
		type='string', 
		help='List of nodes where test will run.')
#
	(options, args) = parser.parse_args()
	if len(args) != 2:
		o2tf.printlog('args left %s' % len(args), 
			  logfile, 
		0, 
		'')
		parser.error('incorrect number of arguments')
	else:
		sys.argv[:] = args
		domain = sys.argv[0]
		lockname = sys.argv[1]
#
	if options.dlmfs:
		dlmfs = options.dlmfs
#
	if options.count:
		count = options.count
#
	if options.hbdev:
		hbdev = ' -h '+options.hbdev
    #
    parser.add_option('-n',
                      '--numwrites',
                      dest='numwrites',
                      type='int',
                      help='Number of writes performed by the test.')
    #
    parser.add_option('-s',
                      '--size',
                      dest='size',
                      type='int',
                      help='Extend size')
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('incorrect number of arguments')
#
    if options.filename:
        param = 1
        filename = options.filename
#
    if options.size:
        param = 1
        size = options.size
#
    if options.numwrites:
        param = 1
        numwrites = options.numwrites
#
    if options.logfile:
    #
    parser.add_option('-n',
                      '--nodelist',
                      dest='nodelist',
                      type='string',
                      help='List of nodes where test will run.')
    #
    parser.add_option('-f',
                      '--filename',
                      dest='filename',
                      type='string',
                      help='filename used by the test.')
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('incorrect number of arguments')
#
#verify args
#
    if not options.filename:
        parser.error('filename is mandatory for test')

    if options.iterations:
        nloops = str(options.iterations)
    else:
        nloops = ''

    if options.filename:
        filename = options.filename
Beispiel #23
0
	dirlist = options.dirlist.split(',')
	dirlen = len(dirlist)
	if options.logfile:
		logfile = options.logfile
	if not options.cleardir and not options.extract_tar:
		if not options.nodelist:
			parser.error('Must provide a list of nodes where the test will run.')
		nodelen = len(options.nodelist)
		if nodelen == 1:
			nodelist = nodelist.add(options.nodelist)
		else:
			nodelist = options.nodelist.split(',')
			nodelen = len(nodelist)
#
if DEBUGON:
	o2tf.printlog('buildkernel: cleardir = (%s)' % cleardir, 
		logfile, 0, '')
	o2tf.printlog('buildkernel: dirlist = (%s)' % dirlist, 
		logfile, 0, '')
	o2tf.printlog('buildkernel: dirlen = (%s)' % dirlen, 
		logfile, 0, '')
	o2tf.printlog('buildkernel: logfile = (%s)' % logfile, 
		logfile, 0, '')
	o2tf.printlog('buildkernel: nodelist = (%s)' % nodelist, 
		logfile, 0, '')
	if options.extract_tar:
		o2tf.printlog('buildkernel: tarfile = (%s)' % tarfile, 
			logfile, 0, '')
	o2tf.printlog('buildkernel: extract_tar = (%s)' % extract_tar, 
		logfile, 0, '')
#
if cleardir:
Beispiel #24
0
def check_thread(logfile):
	'check_thread checks the pidlist for running tasks until the last one '
	'completes.'
	'check_thread takes 1 argument:'
	'	 logfile - logfile name'
	o2tf.printlog('buildkernel:check_thread: Waiting for processes to finish '
		'on thread ', logfile, 0, '')
	while len(pidlist) > 0:
		o2tf.printlog('buildkernel:check_thread: Checking thread processes',
			logfile, 0, '')
		o2tf.printlog('buildkernel:check_thread: pid list %s' % (pidlist), 
			logfile, 0, '')
		for z in range(len(pidlist)):
			out = os.waitpid(pidlist[z],os.WNOHANG)
			o2tf.printlog('buildkernel:check_thread: z=%s, out=%s' % (z, out[1]), 
				logfile, 0, '')
			if out[0] > 0:
				o2tf.printlog('buildkernel:check_thread: Removing pid '
					'%s from the list' %	pidlist[z], 
					logfile, 0, '')
				t2 = time.time()
				o2tf.printlog('buildkernel:check_thread: %s [%s]: Build '
					'time is %f seconds' % 
					(str(socket.gethostname()), pidlist[z], t2 - t1), 
					logfile, 0, '')
				pidlist.remove(out[0])
				break
		time.sleep(CHECKTHREAD_SLEEPTIME)
Beispiel #25
0
		parser.error('Please specify working directory.')
	else:
		if not os.path.isdir(options.directory):
			os.makedirs(options.directory, 0755)
	directory = options.directory
	if options.logfile:
		logfile = options.logfile+'_'+lhostname
	if options.count:
		count = options.count
#
# Make nproc at least the number of nodes
#
# End or arguments parsing
#
if DEBUGON:
	o2tf.printlog('splice_test: directory = (%s)' % directory,
		logfile, 0, '')
	o2tf.printlog('splice_test: filename = (%s)' % filename,
		logfile, 0, '')
	o2tf.printlog('splice_test: logfile = (%s)' % logfile,
		logfile, 0, '')
#
for i in range(count):
	CreateBaseFile()
	SpliceWrite()
	SpliceRead()
	if SCRIPT_STATUS:
		break
#
if SCRIPT_STATUS:
	o2tf.printlog('splice_test: Job Failed',
		logfile, 3, '=')
Beispiel #26
0
#			parser.error('incorrect number of arguments')
	if options.debug:
		DEBUGON=1
	logfile = options.logfile
	stagedir = options.stagedir
#
# First thing. Check if the dirlist is actually a directory or a file 
# containing the directory list.
#
fd = open(os.path.join(stagedir, socket.gethostname() + '_D.dat'), 'r', 0)
dirlist = string.split(fd.read(), ',')
fd.close()
dirlen = len(dirlist)
if DEBUGON:
	o2tf.printlog('crdel_del_files: dirlist = (%s)' % dirlist,
		logfile,
		0,
		'')
	o2tf.printlog('crdel_del_files: stagedir = (%s)' % stagedir,
		logfile,
		0,
		'')
	o2tf.printlog('crdel_del_files: dirlen = (%s)' % dirlen,
		logfile,
		0,
		'')
	o2tf.printlog('crdel_del_files: logfile = (%s)' % logfile,
		logfile,
		0,
		'')
#
for i in range(dirlen):
    else:
        dirlen = 0
#
    logfile = options.logfile
    stagedir = options.stagedir
#
# First thing. Check if the dirlist is actually a directory or a file
# containing the directory list.
#
if dirlen == 0:
    fd = open(os.path.join(stagedir, socket.gethostname() + '_C.dat'), 'r', 0)
    dirlist = string.split(fd.read(), ',')
    fd.close()
    dirlen = len(dirlist)
if DEBUGON:
    o2tf.printlog('crdel_gen_files: dirlist = (%s)' % dirlist, logfile, 0, '')
    o2tf.printlog('crdel_gen_files: stagedir = (%s)' % stagedir, logfile, 0,
                  '')
    o2tf.printlog('crdel_gen_files: dirlen = (%s)' % dirlen, logfile, 0, '')
    o2tf.printlog('crdel_gen_files: logfile = (%s)' % logfile, logfile, 0, '')
    o2tf.printlog('crdel_gen_files: tarfile = (%s)' % tarfile, logfile, 0, '')
#
o2tf.CreateDir(DEBUGON, string.join(dirlist, ','), logfile)
#
for i in range(dirlen):
    o2tf.untar(DEBUGON, dirlist[i], tarfile, logfile, '1')
#
# Remove the workfile after it is done.
#
sys.exit()
import os, pwd, sys, optparse, socket, time, o2tf, pdb, config
#
DEBUGON = os.getenv('DEBUG', 0)
#
userid = pwd.getpwuid(os.getuid())[0]
logfile = config.LOGFILE
#
Usage = 'Usage: %prog [-i|--if <Network Interface>] \
[-l|-label label] \
[-m|--mountpoint mountpoint] \
[-n|--nodes nodelist] \
[-o|--options mountoptions]'

#
if userid == 'root':
    o2tf.printlog('This program uses Openmpi. Should not run as root', logfile,
                  0, '')
    sys.exit(1)
if __name__ == '__main__':
    parser = optparse.OptionParser(Usage)
    #
    parser.add_option(
        '-i',
        '--if',
        dest='interface',
        type='string',
        help='Network Interface name to be used for MPI messaging.')
    #
    parser.add_option('-l',
                      '--label',
                      dest='label',
                      type='string',
Beispiel #29
0
    parser.add_option('-d',
     '--directory',
     dest='directory',
     type='string',
     help='directory where the files to be used in the test are' \
      'created.')
    #
    parser.add_option('-l',
                      '--logfile',
                      dest='logfile',
                      type='string',
                      help='Logfile used by the process.')
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('Incorrect number of arguments')
#
    if options.atime:
        atime = options.atime
#
    if options.directory:
        if not os.path.isdir(options.directory):
            parser.error('Invalid directory %s' % options.directory)
        directory = options.directory
    else:
        parser.error('Directory must be specified.')
#
    if options.logfile:
        logfile = options.logfile
#
Beispiel #30
0
    blocksize = options.blocksize
    logfile = options.logfile
    directory = options.directory
    if options.pgm:
        EXEC = config.BINDIR + '/extendo'
    else:
        EXEC = '/bin/dd'
    extint = options.extint
    extloop = options.extloop
    fileprefix = options.fileprefix
    interval = options.interval
    nfiles = options.nfiles
    size = options.size
#
if DEBUGON:
    o2tf.printlog('crfiles: blocksize = (%s)' % blocksize, logfile, 0, '')
    o2tf.printlog('crfiles: directory = (%s)' % directory, logfile, 0, '')
    o2tf.printlog('crfiles: EXEC = (%s)' % EXEC, logfile, 0, '')
    o2tf.printlog('crfiles: extint = (%s)' % extint, logfile, 0, '')
    o2tf.printlog('crfiles: extloop = (%s)' % extloop, logfile, 0, '')
    o2tf.printlog('crfiles: fileprefix = (%s)' % fileprefix, logfile, 0, '')
    o2tf.printlog('crfiles: interval = (%s)' % interval, logfile, 0, '')
    o2tf.printlog('crfiles: logfile = (%s)' % logfile, logfile, 0, '')
    o2tf.printlog('crfiles: nfiles = (%s)' % nfiles, logfile, 0, '')
#
# First, if directory does exist.
#
from os import access, F_OK
if not os.access(directory, os.F_OK | os.W_OK):
    if DEBUGON:
        o2tf.printlog('crfiles: Directory %s does not exist' % directory,
#
# Program      :  ocfs2_nicdown.py
# Description  :  This script will only disable the NIC used by OCFS2
#
# Author       :  Marcos E. Matsunaga
import o2tf, os, config, sys, pwd, optparse

DEBUGON = os.getenv('DEBUG', 0)
userid = pwd.getpwuid(os.getuid())[0]
Usage = 'Usage: %prog [-D|--Debug] \
[-l|--logfile logfile]'

#
if userid != 'root':
    o2tf.printlog(
        'ocfs2_nicdown: Not enough privileges to run. Need to be root.',
        logfile, 0, '')
    sys.exit(1)
if __name__ == '__main__':
    parser = optparse.OptionParser(Usage)
    #
    parser.add_option('-l',
                      '--logfile',
                      dest='logfile',
                      default='%s/log/ocfs2_nicdown.log' % config.O2TDIR,
                      type='string',
                      help='Logfile to be used by the script.')
    #
    parser.add_option('-D',
                      '--debug',
                      action="store_true",
Beispiel #32
0
#
	parser.add_option('-I', 
			'--interface', 
			dest='interface',
			type='string', 
			help='Nic used by MPI messaging.')
#
	parser.add_option('-n', 
			'--nodes', 
			dest='nodelist',
			type='string', 
			help='List of nodes to be used by the test.')
#
	(options, args) = parser.parse_args()
	if len(args) != 0:
		o2tf.printlog('args left %s' % len(args), logfile, 0, '')
		parser.error('incorrect number of arguments')
	if options.logfile:
		logfile = options.logfile
	if options.interface:
		interface = options.interface
	count = options.count
	filename = options.filename
	if options.nodelist:
		nodelist = options.nodelist.split(',')
		numnodes = len(nodelist)

#
if numnodes < 2:
	o2tf.printlog('open_delete: Must provide at least 2 nodes to \
		run the test.', logfile, 0, '')
Beispiel #33
0
#
	parser.add_option('-n', 
		'--nodelist', 
		dest='nodelist',
		type='string', 
		help='List of nodes where test will run.')
#
	parser.add_option('-p', 
		'--path', 
		dest='path',
		type='string',
		help='pathname used by the test.')
#
	(options, args) = parser.parse_args()
	if len(args) != 0:
		o2tf.printlog('args left %s' % len(args), 
			logfile, 0, '')
		parser.error('incorrect number of arguments')
#
	if options.cleanup and (not options.count or 
		not options.path):
		parser.error('Cleanup options requires path and count.')
#
	if options.count:
		count = options.count
#
	if options.logfile:
		logfile = options.logfile
#
	if options.nodelist:
		nodelist = options.nodelist.split(',')
		nodelen = len(nodelist)
Beispiel #34
0
    logfile = options.logfile
    directory = options.directory
    if options.pgm:
       EXEC = config.BINDIR + '/extendo'
    else:
       EXEC = '/bin/dd'
    extint = options.extint
    extloop = options.extloop
    fileprefix = options.fileprefix
    interval = options.interval
    nfiles = options.nfiles
    size = options.size
#
if DEBUGON:
   o2tf.printlog('crfiles: blocksize = (%s)' % blocksize, 
			logfile, 
			0, 
			'')
   o2tf.printlog('crfiles: directory = (%s)' % directory, 
			logfile, 
			0, 
			'')
   o2tf.printlog('crfiles: EXEC = (%s)' % EXEC, 
			logfile, 
			0, 
			'')
   o2tf.printlog('crfiles: extint = (%s)' % extint, 
			logfile, 
			0, 
			'')
   o2tf.printlog('crfiles: extloop = (%s)' % extloop, 
			logfile, 
        "-C", "--cleanup", action="store_true", dest="cleanup", default=False, help="Perform directory cleanup."
    )
    #
    parser.add_option("-i", "--iterations", dest="iterations", type="int", help="Number of iterations.")
    #
    parser.add_option("-l", "--logfile", dest="logfile", type="string", help="Logfile used by the process.")
    #
    parser.add_option("-I", "--interface", dest="interface", type="string", help="NIC used by MPI messaging.")
    #
    parser.add_option("-n", "--nodelist", dest="nodelist", type="string", help="List of nodes where test will run.")
    #
    parser.add_option("-f", "--filename", dest="filename", type="string", help="filename used by the test.")
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog("args left %s" % len(args), logfile, 0, "")
        parser.error("incorrect number of arguments")
    #
    # verify args
    #
    if not options.filename:
        parser.error("filename is mandatory for test")

    if options.iterations:
        nloops = str(options.iterations)
    else:
        nloops = ""

    if options.filename:
        filename = options.filename
Beispiel #36
0
def Find():
    o2tf.printlog('recovery_load: Find Started', logfile, 0, '')
    finddir = os.path.join(options.directory,
                           str('%s_recovery' % nodelist[NodeIndex]))
    if DEBUGON:
        o2tf.printlog('recovery_load: finddir [%s]' % finddir, logfile, 0, '')

    ret = os.system(str('find %s -type f -exec touch {} \;' % finddir))
    if not ret:
        o2tf.printlog('recovery_load: find on %s successful.' % finddir,
                      logfile, 0, '')
    else:
        o2tf.printlog('recovery_load: find on %s failed.' % finddir, logfile,
                      0, '')

    if DEBUGON:
        o2tf.printlog('recovery_load: directory [%s]' % \
         options.directory, logfile, 0, '')

    ret = os.system(
        str('find %s -type f -exec touch {} \;' % options.directory))
    if not ret:
        o2tf.printlog(
            'recovery_load: find on %s successful.' % options.directory,
            logfile, 0, '')
    else:
        o2tf.printlog('recovery_load: find on %s failed.' % options.directory,
                      logfile, 0, '')

    o2tf.printlog('recovery_load: Find Completed', logfile, 0, '')
Beispiel #37
0
    #
    parser.add_option('-I',
                      '--interface',
                      dest='interface',
                      type='string',
                      help='Nic used by MPI messaging.')
    #
    parser.add_option('-n',
                      '--nodes',
                      dest='nodelist',
                      type='string',
                      help='List of nodes to be used by the test.')
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('incorrect number of arguments')
    if options.logfile:
        logfile = options.logfile
    if options.interface:
        interface = options.interface
    count = options.count
    filename = options.filename
    if options.nodelist:
        nodelist = options.nodelist.split(',')
        numnodes = len(nodelist)

#
if numnodes < 2:
    o2tf.printlog(
        'open_delete: Must provide at least 2 nodes to \
Beispiel #38
0
        parser.error('Please specify working directory.')
    else:
        if not os.path.isdir(options.directory):
            os.makedirs(options.directory, 0755)
    directory = options.directory
    if options.logfile:
        logfile = options.logfile + '_' + lhostname
    if options.count:
        count = options.count
#
# Make nproc at least the number of nodes
#
# End or arguments parsing
#
if DEBUGON:
    o2tf.printlog('splice_test: directory = (%s)' % directory, logfile, 0, '')
    o2tf.printlog('splice_test: filename = (%s)' % filename, logfile, 0, '')
    o2tf.printlog('splice_test: logfile = (%s)' % logfile, logfile, 0, '')
#
for i in range(count):
    CreateBaseFile()
    SpliceWrite()
    SpliceRead()
    if SCRIPT_STATUS:
        break
#
if SCRIPT_STATUS:
    o2tf.printlog('splice_test: Job Failed', logfile, 3, '=')
    sys.exit(1)
else:
    o2tf.printlog('splice_test: Job completed successfully', logfile, 3, '=')
Beispiel #39
0
    #
    parser.add_option('-n',
                      '--nodelist',
                      dest='nodelist',
                      type='string',
                      help='List of nodes where test will run.')
    #
    parser.add_option('-p',
                      '--path',
                      dest='path',
                      type='string',
                      help='pathname used by the test.')
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('incorrect number of arguments')
#
    if options.cleanup and (not options.count or not options.path):
        parser.error('Cleanup options requires path and count.')
#
    if options.count:
        count = options.count
#
    if options.logfile:
        logfile = options.logfile
#
    if options.nodelist:
        nodelist = options.nodelist.split(',')
        nodelen = len(nodelist)
        procs = nodelen
Beispiel #40
0
		dirlen = 0
#
	logfile = options.logfile
	stagedir = options.stagedir
#
# First thing. Check if the dirlist is actually a directory or a file 
# containing the directory list.
#
if dirlen == 0:
	fd = open(os.path.join(stagedir, socket.gethostname()+'_C.dat'), 'r', 0)
	dirlist = string.split(fd.read(), ',')
	fd.close()
	dirlen = len(dirlist)
if DEBUGON:
	o2tf.printlog('crdel_gen_files: dirlist = (%s)' % dirlist,
		logfile,
		0,
		'')
	o2tf.printlog('crdel_gen_files: stagedir = (%s)' % stagedir,
		logfile,
		0,
		'')
	o2tf.printlog('crdel_gen_files: dirlen = (%s)' % dirlen,
		logfile,
		0,
		'')
	o2tf.printlog('crdel_gen_files: logfile = (%s)' % logfile,
		logfile,
		0,
		'')
	o2tf.printlog('crdel_gen_files: tarfile = (%s)' % tarfile,
		logfile,
#
	parser.add_option('-p', 
		'--procs', 
		dest='procs',
		type='int', 
		help='Number of copies of the test program to run.')
#
	parser.add_option('-s', 
		'--seconds', 
		dest='seconds',
		type='int', 
		help='Number of seconds the test will run (def. 60).')
#
	(options, args) = parser.parse_args()
	if len(args) != 0:
		o2tf.printlog('args left %s' % len(args), 
			  logfile, 0, '')
		parser.error('incorrect number of arguments')
#
	if options.blocksize:
		blocksize = options.blocksize
		blockvalues = blocksize.split(',')
		if len(blockvalues) != 2:
			o2tf.printlog('Blocksize must be specified in format xxx,yyy\n\n', 
			logfile, 0, '')
			parser.error('Invalid format.')
	else:
		parser.error('Blocksize parameter needs to be specified.')
		 
	if int(blockvalues[0]) < MINBLOCKSIZE or int(blockvalues[1]) > MAXBLOCKSIZE:
		o2tf.printlog('Blocksize must be between %s and %s\n\n' % 
		(MINBLOCKSIZE, MAXBLOCKSIZE), 
Beispiel #42
0
    if not options.tarfile and not options.find:
        parser.error('Must provide a gzipped kernel tarball to ' +
                     'run the test.')
#
    if options.extract and options.find:
        parser.error('Extract and find are exclusive options.')
    if options.extract or options.find:
        Client = True
    tarfile = options.tarfile
    nodelist = options.nodes.split(',')
    nodelen = len(nodelist)
    logfile = options.logfile
    interface = options.interface
    if nodelen < 2:
        o2tf.printlog(
            'recovery_load: nodelist must have at least 2 ' +
            'nodes' % options.directory, logfile, 0, '')
        sys.exit(1)
#
# Make nproc at least the number of nodes
#
    if nodelen > config.NPROC:
        nproc = nodelen
    else:
        nproc = config.NPROC
#
# End or arguments parsing
#
if DEBUGON:
    o2tf.printlog('recovery_load: Client = (%s)' % Client, logfile, 0, '')
    o2tf.printlog('recovery_load: directory = (%s)' % options.directory,
def BuildCrList(nodelist, nodelen, dirlist, dirlen):
    global node_dirs, stagedir
    from os import access, remove, F_OK
    for n in range(nodelen):
        dirl = []
        DelDir = []
        for i in range(dirlen):
            dirlvl = o2tf.lrand(1, MAXDIRLEVEL)
            directory = dirlist[i]
            DelDir.append(directory + '/' + nodelist[n] + '_0')
            for x in range(dirlvl):
                directory = directory + '/' + nodelist[n] + '_' + str(x)
            dirl.append(directory)
            if DEBUGON:
                o2tf.printlog(
                    'cross_delete:BuildList: Node = (%s)' % nodelist[n],
                    logfile, 0, '')
                o2tf.printlog('cross_delete:BuildList: dirlvl = (%s)' % dirlvl,
                              logfile, 0, '')
                o2tf.printlog(
                    'cross_delete:BuildList: directory = (%s)' % directory,
                    logfile, 0, '')
                o2tf.printlog('cross_delete:BuildList: DelDir = (%s)' % DelDir,
                              logfile, 0, '')
                o2tf.printlog('cross_delete: dirl (%s)' % dirl, logfile, 0, '')
#
        node_dirs[nodelist[n] + '_C'] = (dirl)
        node_dirs[nodelist[n] + '_D'] = (DelDir)
        if DEBUGON:
            o2tf.printlog('cross_delete: nodes_dirs = %s' % node_dirs, logfile,
                          0, '')
#
# Since the directory list is ready for the node, write it to the workfile
#
        if access(os.path.join(stagedir, nodelist[n] + '_C.dat'), F_OK) == 1:
            remove(os.path.join(stagedir, nodelist[n] + '_C.dat'))
        fd = open(os.path.join(stagedir, nodelist[n] + '_C.dat'), 'w', 0)
        fd.write(string.join(node_dirs[nodelist[n] + '_C'], ','))
        fd.close
        if DEBUGON:
            o2tf.printlog(
                'cross_delete:BuildDelList: (%s) was written to \
				the file %s' % (string.join(node_dirs[nodelist[n] + '_C'], ','),
                    os.path.join(stagedir, nodelist[n] + '_C.dat')), logfile,
                0, '')
    #
    parser.add_option('-p',
                      '--procs',
                      dest='procs',
                      type='int',
                      help='Number of copies of the test program to run.')
    #
    parser.add_option('-s',
                      '--seconds',
                      dest='seconds',
                      type='int',
                      help='Number of seconds the test will run (def. 60).')
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('incorrect number of arguments')
#
    if options.blocksize:
        blocksize = options.blocksize
        blockvalues = blocksize.split(',')
        if len(blockvalues) != 2:
            o2tf.printlog('Blocksize must be specified in format xxx,yyy\n\n',
                          logfile, 0, '')
            parser.error('Invalid format.')
    else:
        parser.error('Blocksize parameter needs to be specified.')

    if int(blockvalues[0]) < MINBLOCKSIZE or int(
            blockvalues[1]) > MAXBLOCKSIZE:
        o2tf.printlog(
Beispiel #45
0
		nodelist = options.nodelist.split(',')
	logfile = options.logfile
	interface = options.interface
	tarfile = options.tarfile
	if nodelen > config.NPROC:
	   nproc = nodelen
	else:
		nproc = config.NPROC
#
if DEBUGON:
	buildcmd= config.BINDIR+'/buildkernel.py -D'
else:
	buildcmd= config.BINDIR+'/buildkernel.py'
#
if DEBUGON:
   o2tf.printlog('run_buildkernel: dirlist = (%s)' % dirlist, logfile, 0, '')
   o2tf.printlog('run_buildkernel: dirlen = (%s)' % dirlen, logfile, 0, '')
   o2tf.printlog('run_buildkernel: nodelist = (%s)' % nodelist, logfile, 0, '')
   o2tf.printlog('run_buildkernel: interface = (%s)' % interface, logfile, 0, '')
   o2tf.printlog('run_buildkernel: nodelen = (%s)' % nodelen, logfile, 0, '')
   o2tf.printlog('run_buildkernel: logfile = (%s)' % logfile, logfile, 0, '')
   o2tf.printlog('run_buildkernel: tarfile = (%s)' % tarfile, logfile, 0, '')
   o2tf.printlog('run_buildkernel: buildcmd = (%s)' % buildcmd, logfile, 0, '')
#
if options.initialize:
	Initialize()
elif not options.nocheckdirs:
	CheckDirs(options.nodelist, options.dirlist)
#
for i in range(options.count):
	r = i+1
    # 			o2tf.printlog('args left %s' % len(args), logfile, 0, '')
    # 			parser.error('incorrect number of arguments')
    if options.debug:
        DEBUGON = 1
    logfile = options.logfile
    stagedir = options.stagedir
#
# First thing. Check if the dirlist is actually a directory or a file
# containing the directory list.
#
fd = open(os.path.join(stagedir, socket.gethostname() + "_D.dat"), "r", 0)
dirlist = string.split(fd.read(), ",")
fd.close()
dirlen = len(dirlist)
if DEBUGON:
    o2tf.printlog("crdel_del_files: dirlist = (%s)" % dirlist, logfile, 0, "")
    o2tf.printlog("crdel_del_files: stagedir = (%s)" % stagedir, logfile, 0, "")
    o2tf.printlog("crdel_del_files: dirlen = (%s)" % dirlen, logfile, 0, "")
    o2tf.printlog("crdel_del_files: logfile = (%s)" % logfile, logfile, 0, "")
#
for i in range(dirlen):
    o2tf.printlog("crdel_del_files: Removing directory %s." % dirlist[i], logfile, 0, "")
    o2tf.Del(DEBUGON, logfile, dirlist[i], ",".join(dirlist))
#
# Remove the workfile after it is done.
#
from os import access, F_OK

if os.access(os.path.join(stagedir, socket.gethostname()), F_OK) == 1:
    os.remove(os.path.join(stagedir, socket.gethostname() + "_D.dat"))
sys.exit()
Beispiel #47
0
    #
    parser.add_option('-p',
                      '--procs',
                      dest='procs',
                      type='int',
                      help='Number of copies of the test program to run.')
    #
    parser.add_option('-s',
                      '--sleep',
                      dest='sleep',
                      type='int',
                      help='ms in between each write (50000)')
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('incorrect number of arguments')
#
    if options.Debug:
        DEBUGON = 1
#
    if options.count:
        count = options.count
#
    if options.filename:
        filename = options.filename
#
    if options.logfile:
        logfile = options.logfile
#
    if options.nodelist:
    #
    parser.add_option('-d',
                      '--device',
                      dest='device',
                      type='string',
                      help='Target volume.')
    #
    parser.add_option('-m',
                      '--mountpoint',
                      dest='mountpoint',
                      type='string',
                      help='Mount point.')

    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('incorrect number of arguments')
#
#verify args
#
    if not options.device:
        parser.error('device mandatory for test')

    if not options.mountpoint:
        parser.error('mount point is mandatory for test')

    if not options.users and not options.groups:
        parser.error('either Users or groups should be specified at least')

    if options.iterations:
        iter_arg = '-i ' + str(options.iterations)
Beispiel #49
0
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        parser.error('incorrect number of arguments')
    mounted = o2tf.CheckMounted(options.DEBUGON, logfile, options.mountpoint)
    if options.domount:
        if not options.mountpoint:
            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, mt_options)
        else:
            o2tf.printlog('Partition already mounted.', logfile, 0, '')
            sys.exit(1)

    if options.doumount:
        if not options.mountpoint:
            parser.error('Please specify mountpoint.')
        if mounted:
            o2tf.SudoUmount(options.DEBUGON, logfile, options.mountpoint)
        else:
            o2tf.printlog('Partition not mounted.', logfile, 0, '')
            sys.exit(1)
#
Beispiel #50
0
userid = pwd.getpwuid(os.getuid())[0]
hostname = str(socket.gethostname())
#
Usage = 'Usage: %prog [-c|--count count] \
[-d|--directorylist dirlist] \
[-h|--help] \
[-i|--initialize] \
[-l|-logfile logfilename] \
[-n|--nodes nodelist] \
[-s|--sleeptime sleeptime] \
[-t|--tarfile fullpath tar filename] \
[-u|--user username]'
#
if userid != 'root':
	o2tf.printlog('Not enough privileges to run. Need to be root.',
		logfile,
		0,
		'')
	sys.exit(1)
if __name__=='__main__':
	parser = optparse.OptionParser(Usage)
#
	parser.add_option('-c', 
		'--count', 
		dest='count', 
		default='1',
		type='int', 
		help='Number of times it will build the kernel.  Default = 1.')
#
	parser.add_option('-d', 
		'--directorylist', 
		dest='dirlist',
Beispiel #51
0
    blocksize = options.blocksize
    logfile = options.logfile
    directory = options.directory
    if options.pgm:
        EXEC = config.BINDIR + "/extendo"
    else:
        EXEC = "/bin/dd"
    extint = options.extint
    extloop = options.extloop
    fileprefix = options.fileprefix
    interval = options.interval
    nfiles = options.nfiles
    size = options.size
#
if DEBUGON:
    o2tf.printlog("crfiles: blocksize = (%s)" % blocksize, logfile, 0, "")
    o2tf.printlog("crfiles: directory = (%s)" % directory, logfile, 0, "")
    o2tf.printlog("crfiles: EXEC = (%s)" % EXEC, logfile, 0, "")
    o2tf.printlog("crfiles: extint = (%s)" % extint, logfile, 0, "")
    o2tf.printlog("crfiles: extloop = (%s)" % extloop, logfile, 0, "")
    o2tf.printlog("crfiles: fileprefix = (%s)" % fileprefix, logfile, 0, "")
    o2tf.printlog("crfiles: interval = (%s)" % interval, logfile, 0, "")
    o2tf.printlog("crfiles: logfile = (%s)" % logfile, logfile, 0, "")
    o2tf.printlog("crfiles: nfiles = (%s)" % nfiles, logfile, 0, "")
#
# First, if directory does exist.
#
from os import access, F_OK

if not os.access(directory, os.F_OK | os.W_OK):
    if DEBUGON:
Beispiel #52
0
    #
    parser.add_option('-l',
                      '--logfile',
                      dest='logfile',
                      type='string',
                      help='Logfile used by the process.')
    #
    parser.add_option('-n',
                      '--nodelist',
                      dest='nodelist',
                      type='string',
                      help='List of nodes where test will run.')
    #
    (options, args) = parser.parse_args()
    if len(args) != 2:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('incorrect number of arguments')
    else:
        sys.argv[:] = args
        domain = sys.argv[0]
        lockname = sys.argv[1]
#
    if options.dlmfs:
        dlmfs = options.dlmfs
#
    if options.count:
        count = options.count
#
    if options.hbdev:
        hbdev = ' -h ' + options.hbdev
    else:
Beispiel #53
0
    #
    parser.add_option('-s',
                      '--seconds',
                      dest='seconds',
                      type='int',
                      help='Number of seconds the test will run (def. 60).')
    #
    parser.add_option('-u',
                      '--uniquefile',
                      action="store_true",
                      dest='uniquefile',
                      default=False)
    #
    (options, args) = parser.parse_args()
    if len(args) != 0:
        o2tf.printlog('args left %s' % len(args), logfile, 0, '')
        parser.error('incorrect number of arguments')
#
    if options.blocksize:
        blocksize = options.blocksize
        blockvalues = blocksize.split(',')
        if len(blockvalues) != 2:
            o2tf.printlog('Blocksize must be specified in format xxx,yyy\n\n',
                          logfile, 0, '')
            parser.error('Invalid format.')
    else:
        parser.error('Blocksize parameter needs to be specified.')

    if int(blockvalues[0]) < MINBLOCKSIZE or int(
            blockvalues[1]) > MAXBLOCKSIZE:
        o2tf.printlog('Blocksize must be between %s and %s\n\n' % \
Beispiel #54
0
# XXX: Future improvements:
#
# Program      :  ocfs2_nicdown.py
# Description  :  This script will only disable the NIC used by OCFS2
#
# Author       :  Marcos E. Matsunaga
import o2tf, os, config, sys, pwd, optparse

DEBUGON = os.getenv('DEBUG',0)
userid = pwd.getpwuid(os.getuid())[0]
Usage = 'Usage: %prog [-D|--Debug] \
[-l|--logfile logfile]'
#
if userid != 'root':
	o2tf.printlog('ocfs2_nicdown: Not enough privileges to run. Need to be root.',
	logfile,
	0,
	'')
	sys.exit(1)
if __name__=='__main__':
	parser = optparse.OptionParser(Usage)
#
	parser.add_option('-l',
		'--logfile',
		dest='logfile',
		default='%s/log/ocfs2_nicdown.log' % config.O2TDIR,
		type='string',
		help='Logfile to be used by the script.')
#
	parser.add_option('-D',
		'--debug',
		action="store_true",
#
    if not options.tarfile:
        parser.error('Must provide a gzipped kernel tarball to run the test.')
#
    tarfile = options.tarfile
    count = options.count
    dirlist = options.dirlist.split(',')
    dirlen = len(dirlist)
    interface = options.interface
    nodelist = options.nodes.split(',')
    nodelen = len(nodelist)
    if options.logfile:
        logfile = options.logfile
    if nodelen < 2:
        o2tf.printlog(
            'cross_delete: nodelist must have at least 2 nodes' % dirlist,
            logfile, 0, '')
        sys.exit(1)
#
# Find if the #of nodes is odd. If so, remove the last one to make even.
#
    if divmod(nodelen, 2)[1] == 1:
        if DEBUGON:
            o2tf.printlog('cross_delete: nodelist = (%s)' % nodelist, logfile,
                          0, '')
            o2tf.printlog(
                'cross_delete: Deleting node %s from the list' %
                nodelist[nodelen - 1], logfile, 0, '')
        nodelist.pop()
        nodelen = nodelen - 1
        if DEBUGON: