コード例 #1
0
ファイル: cross_delete.py プロジェクト: goldwynr/ocfs2-test
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,
				'')
コード例 #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()
コード例 #3
0
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()
コード例 #4
0
ファイル: run_multi_mmap.py プロジェクト: josephhz/ocfs2-test
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)
コード例 #5
0
ファイル: recovery_load.py プロジェクト: josephhz/ocfs2-test
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')
コード例 #6
0
ファイル: splice_test.py プロジェクト: josephhz/ocfs2-test
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, '')
コード例 #7
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()
コード例 #8
0
ファイル: buildkernel.py プロジェクト: goldwynr/ocfs2-test
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])
コード例 #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
コード例 #10
0
ファイル: splice_test.py プロジェクト: josephhz/ocfs2-test
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, '')
コード例 #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, '')
コード例 #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,
                      '')
コード例 #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,
         '')
コード例 #14
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,
			'')
コード例 #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, '')
コード例 #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, '')
コード例 #17
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,
            "",
        )
コード例 #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)
コード例 #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:
コード例 #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
コード例 #21
0
    #
    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:
コード例 #22
0
    #
    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
コード例 #23
0
ファイル: buildkernel.py プロジェクト: pibroch/ocfs2-test
	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:
コード例 #24
0
ファイル: buildkernel.py プロジェクト: pibroch/ocfs2-test
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)
コード例 #25
0
ファイル: splice_test.py プロジェクト: josephhz/ocfs2-test
		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, '=')
コード例 #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):
コード例 #27
0
    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()
コード例 #28
0
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',
コード例 #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
#
コード例 #30
0
ファイル: crfiles.py プロジェクト: xinghaichuangqi/ocfs2-test
    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,
コード例 #31
0
#
# 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",
コード例 #32
0
ファイル: open_delete.py プロジェクト: goldwynr/ocfs2-test
#
	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, '')
コード例 #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)
コード例 #34
0
ファイル: crfiles.py プロジェクト: goldwynr/ocfs2-test
    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, 
コード例 #35
0
        "-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
コード例 #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, '')
コード例 #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 \
コード例 #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, '=')
コード例 #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
コード例 #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,
コード例 #41
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('Blocksize must be between %s and %s\n\n' % 
		(MINBLOCKSIZE, MAXBLOCKSIZE), 
コード例 #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,
コード例 #43
0
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, '')
コード例 #44
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(
コード例 #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
コード例 #46
0
    # 			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()
コード例 #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:
コード例 #48
0
    #
    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)
コード例 #49
0
ファイル: command.py プロジェクト: xinghaichuangqi/ocfs2-test
    #
    (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)
#
コード例 #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',
コード例 #51
0
ファイル: crfiles.py プロジェクト: renzhengeek/ocfs2-test
    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:
コード例 #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:
コード例 #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' % \
コード例 #54
0
ファイル: ocfs2_nicdown.py プロジェクト: goldwynr/ocfs2-test
# 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",
コード例 #55
0
#
    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: