def fail_simulate_loop(): try: _fail_simulate_loop() except Exp, e: derror(e) kill9_self() exit(e.errno)
def test_exec(args): dmsg("test begin, log is in %s" % (LOG_PATH)) if not args.noclean: dmsg("clean begin") test_clean() else: dmsg("no clean") test_init() begin = time.time() global RUNNING RUNNING = 1 if not args.nofail: fail_simulate() time.sleep(3) try: test() except Exception, e: umount_nfsv4() print 'test fail' print e RUNNING = 0 end = time.time() print "used %s!" % (end - begin) kill9_self() exit(e.errno)
def new_test(args): dmsg("test begin, log is in %s" % (LOG_PATH)) pool = "default" os.system("rm -rf %s" % (LOG_PATH)) os.system("mkdir -p %s" % (LOG_PATH)) cmd = "python2 " + os.path.abspath(os.path.split(os.path.realpath(__file__))[0]) + "/docker.py create --pool %s >> %s/docker.log 2>&1" % (pool, LOG_PATH) print cmd os.system(cmd) begin = time.time() global RUNNING RUNNING = 1 """ if not args.nofail: fail_simulate() time.sleep(3) """ try: test(pool) except Exception, e: print 'test fail' print e RUNNING = 0 end = time.time() print "used %s!" % (end - begin) kill9_self() exit(e.errno)
def test_uss_objmv(filename): global OBJMVING from_nid = "" to_nid = "" chkid = "" succ_count = 0 total_move_count = 10 chkid = _get_chkid(filename) if len(chkid) == 0: OBJMVING = 0 return while succ_count < total_move_count: try: dmsg( "\n--------------------before objmv, stat info-------------------------" ) cmd = "sdfs.stat %s -v" % (filename) out, err = exec_shell(cmd, need_return=True) dmsg(out) dmsg( "--------------------------------------------------------------------\n" ) from_nid = _get_src_nid(filename) to_nid = _get_dest_nid(filename) cmd = "sdfs.objmv --chkid %s[0] -f %s -t %s" % (chkid, from_nid, to_nid) exec_shell(cmd) succ_count = succ_count + 1 dmsg("=====object moved count %d, left %d====n" % (succ_count, total_move_count - succ_count)) dmsg( "\n--------------------after objmv, stat info-------------------------" ) cmd = "sdfs.stat %s -v" % (filename) out, err = exec_shell(cmd, need_return=True) dmsg(out) dmsg( "--------------------------------------------------------------------\n" ) except Exp, e: if e.errno == errno.ENOENT or e.errno == errno.ENONET or e.errno == errno.ETIMEDOUT or e.errno == errno.EPERM: pass else: derror("objmv from %s to %s fail. errno:%d" % (from_nid, to_nid, e.errno)) out, err = exec_shell("sdfs.cluster list", need_return=True) dmsg(out) cmd = "sdfs.stat %s -v" % (filename) out, err = exec_shell(cmd, need_return=True) dmsg(out) OBJMVING = 0 kill9_self()
def test_uss_write(filename): global OBJMVING global RUNNING while OBJMVING: try: _test_uss_write(filename) except Exp, e: if e.errno == errno.ETIMEDOUT or e.errno == errno.ENONET: pass else: derror(e) RUNNING = 0 kill9_self()