예제 #1
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, 
			'')
예제 #2
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, '')
예제 #3
0
   o2tf.printlog('test_netfail: tarfile = (%s)' % tarfile, logfile, 0, '')
   o2tf.printlog('test_netfail: buildcmd = (%s)' % buildcmd, logfile, 0, '')
   o2tf.printlog('test_netfail: command = (%s)' % command, logfile, 0, '')
#
os.chmod(logfile,0777)
pid = os.spawnv(os.P_NOWAIT, '/bin/bash', ['/bin/bash', '-c', '/bin/su -l '+options.username+' -c \"'+command+'\"'])
#
cluster = o2tf.GetOcfs2Cluster()
#
for i in range(nodelen):
	o2tf.printlog('test_netfail: Sleeping for %s seconds' % sleeptime,
		logfile,
		0,
		'')
	time.sleep(sleeptime)
	x = o2tf.lrand(DEBUGON, nodelen)
	if DEBUGON:
		o2tf.printlog('test_netfail: Woke up from sleep',
			logfile,
			0,
			'')
		o2tf.printlog('test_netfail: Will disable NIC on %s' % (nodelist[x-1]),
			logfile,
			0,
			'')
	if nodelist[x-1] != hostname:
		os.system('ssh %s %s/ocfs2_nicdown.py -l %s' % (nodelist[x-1], 
			config.BINDIR,
			logfile))
o2tf.printlog('test_netfail: Test completed successfully.',
	logfile,