示例#1
0
def test_mdserver():

    dprint("running SLASH2 Metadata server tests")

    vhn = 'illusion-mds'

    #Only run the test on the active node--as signified by /local being mounted

    test_cmd = 'slmctl -sconn'
    bc = boundcmd(cmd=test_cmd, maxtries=2, timeout=10, verbose=options.pdebug)
    (rc, tout, terr) = bc.run()

    # Rewrite hostnames of multi-homed hosts
    mod_tout = scrubNames(tout)

    slashEval(vhn, 'slmctl', test_cmd, rc, mod_tout, terr)

    # Record the SLASH2 version number
    test_cmd = 'slmctl -p version'
    tname = 'slashd'
    bc = boundcmd(cmd=test_cmd, maxtries=1, timeout=5, verbose=options.pdebug)
    (rc, tout, terr) = bc.run()
    versionEval(vhn, tname, test_cmd, rc, tout, terr)

    test_cmd = 'zpool status -v arc_s2ssd_prod'
    bc = boundcmd(cmd=test_cmd, maxtries=1, timeout=10, verbose=options.pdebug)
    (rc, tout, terr) = bc.run()
    zpoolEval(vhn, 'arc_s2ssd_prod', test_cmd, rc, tout, terr)
示例#2
0
def test_mdserver():

	dprint("running SLASH2 Metadata server tests")

	vhn = 'illusion-mds'

	#Only run the test on the active node--as signified by /local being mounted

	test_cmd='slmctl -sconn'
	bc =  boundcmd(cmd=test_cmd,maxtries=2,timeout=10,verbose=options.pdebug)
	(rc,tout,terr) = bc.run()

	# Rewrite hostnames of multi-homed hosts
	mod_tout = scrubNames(tout)

	slashEval(vhn,'slmctl',test_cmd,rc,mod_tout,terr)

	# Record the SLASH2 version number
	test_cmd = 'slmctl -p version'
	tname = 'slashd'
	bc = boundcmd(cmd=test_cmd,maxtries=1,timeout=5,verbose=options.pdebug)
	(rc,tout,terr)=bc.run()
	versionEval(vhn,tname,test_cmd,rc,tout,terr)

	test_cmd='zpool status -v arc_s2ssd_prod'
	bc = boundcmd(cmd=test_cmd,maxtries=1,timeout=10,verbose=options.pdebug)
	(rc,tout,terr)=bc.run()
	zpoolEval(vhn,'arc_s2ssd_prod',test_cmd,rc,tout,terr)
def test_ioserver():
	global options

	dprint("running SLASH2 I/O server tests")

	#Abort if lock file is present as host is still mounting pools
	if os.path.exists(lockfile):
		dprint("DEBUG: lockfile exists; skipping zpool/sliod tests")
		return

	# Test the expected number of sliods on each node
	if not ion_cfg.has_key(hn):
		print "ERROR: # of sliods not defined for host " + hn + "; aborting now"
	else :
		i = 0
		cfg = ion_cfg[hn]

		while ( i < cfg["npools"] ):

			# Check zpool i
			test_cmd='zpool status -v %s_pool%i' % (hn,i)
			bc = boundcmd(cmd=test_cmd,maxtries=2,timeout=5,verbose=options.pdebug)
			(rc,tout,terr)=bc.run()
			zpoolEval(hn,'zpool%i' % i,test_cmd,rc,tout,terr)

			tname = 'sliod%i' % i
			rc = 0

			backfspath = cfg["path"] % i

			if not options.quick:
				# Perform functional test of sliod
				bc = boundcmd(sliodPoke,args=backfspath,maxtries=2,timeout=10,verbose=options.pdebug)
				(rc,tout,terr) = bc.run()

			# If the functional test succeeded, then gather list of connections via slictl
			if rc == 0 :
				test_cmd="slictl%i -sconn" % i
				bc = boundcmd(cmd=test_cmd,maxtries=2,timeout=5,verbose=options.pdebug)
				(rc,tout,terr)=bc.run()
				slashEval(hn,tname,test_cmd,rc,tout,terr)

				# Record the SLASH2 version number
				test_cmd = 'slictl%i -p version' % i
				bc = boundcmd(cmd=test_cmd,maxtries=2,timeout=5,verbose=options.pdebug)
				(rc,tout,terr)=bc.run()
				versionEval(hn,tname,test_cmd,rc,tout,terr)

			# If the functional test failed, tell Nagios
			else :
				dprint("DEBUG: /arc write failed (%s);; %i:%s" % (test_cmd,rc,terr))
				nsca_queue(hn,tname,nagios.critical,'sliod zpool/filesystem FAILED functional test : ' + terr)

			# increment the counter and loop again
			i = i+1
def test_client(prefix=''):
	global options

	dprint("running SLASH2 Client tests")

	# Test the SLASH2 client connections directly
	test_cmd='msctl -sconn'
	tname = prefix + 'msctl'
	bc = boundcmd(cmd=test_cmd,maxtries=2,timeout=10,verbose=options.pdebug)
	(rc,tout,terr)=bc.run()
	slashEval(hn,tname,test_cmd,rc,tout,terr)

	# Record the SLASH2 version number
	test_cmd = 'msctl -p version'
	bc = boundcmd(cmd=test_cmd,maxtries=2,timeout=10,verbose=options.pdebug)
	(rc,tout,terr)=bc.run()
	versionEval(hn,tname,test_cmd,rc,tout,terr)

	if not options.quick :
		# Test reading of a file from /arc
		if useExternalTest :
			test_cmd="dd if=%s/slash2_check.in of=/dev/null" % testdir
			dprint("trying read command '%s'" % test_cmd)
			bc = boundcmd(cmd=test_cmd,maxtries=2,timeout=5,verbose=options.pdebug)
		else :
			bc = boundcmd(func=readTest,maxtries=2,timeout=5,verbose=options.pdebug)
		(rc,tout,terr)=bc.run()
		tname = prefix + 'arc'
		if rc != 0 :
			bc = boundcmd(cmd='msctl -Hr %s/slash2_check.in' %
			    testdir,maxtries=1,timeout=3,verbose=options.pdebug)
			(rc,bmaptab,bmaperr)=bc.run()
			nsca_queue(hn,tname,nagios.critical,'/arc READ test failed; cmd: ' + \
			    test_cmd + '; map: ' + bmaptab + '; err: ' + terr)
			return

		# Test writing a file from /arc
		fn='%s/slash2_check.out-%s' % (testdir,hn)

		if useExternalTest :
			test_cmd="dd if=/dev/zero of=%s bs=1M count=1" % fn
			dprint("trying write command '%s'" % test_cmd)
			bc = boundcmd(cmd=test_cmd,maxtries=2,timeout=5,verbose=options.pdebug)
		else :
			bc = boundcmd(func=writeTest,maxtries=2,timeout=5,verbose=options.pdebug)
		(rc,tout,terr)=bc.run()
		if rc != 0 :
			dprint("DEBUG: /arc write failed (%s);; %i:%s" % (test_cmd,rc,terr))
			nsca_queue(hn,tname,nagios.critical,'/arc WRITE test failed; cmd: ' + \
			    test_cmd + '; err: ' + terr)
		else :
			nsca_queue(hn,tname,nagios.ok,'/arc READ & WRITE tests passed')