def create_pool(): ssh = shell_operator.create_ssh_connect(config.mds_list[0], 1046, config.abnormal_user) mds = [] mds_addrs = "" for mds_host in config.mds_list: mds.append(mds_host + ":6666") mds_addrs = ",".join(mds) physical_pool = "curve-tool -cluster_map=topo.json -mds_addr=%s\ -op=create_physicalpool" % (mds_addrs) rs = shell_operator.ssh_exec(ssh, physical_pool) if rs[3] == 0: logger.info("create physical pool sucess") else: assert False, "create physical fail ,msg is %s" % rs[2] for host in config.chunkserver_list: ssh2 = shell_operator.create_ssh_connect(host, 1046, config.abnormal_user) ori_cmd = "sudo nohup ./chunkserver_ctl.sh start all &" shell_operator.ssh_background_exec2(ssh2, ori_cmd) time.sleep(60) logical_pool = "curve-tool -cluster_map=topo.json -mds_addr=%s\ -op=create_logicalpool" % (mds_addrs) rs = shell_operator.ssh_exec(ssh, logical_pool) time.sleep(180)
def random_kill_snapshot(): snap_server = random.choice(config.snap_server_list) logger2.info("begin to kill snapshotserver %s"%(snap_server)) kill_snapshotclone_server(snap_server) time.sleep(10) ssh = shell_operator.create_ssh_connect(snap_server, 1046, config.abnormal_user) ori_cmd = "cd snapshot/temp && sudo nohup curve-snapshotcloneserver -conf=/etc/curve/snapshot_clone_server.conf &" shell_operator.ssh_background_exec2(ssh, ori_cmd)
def start_fs_vdbench(): test_client = config.fs_test_client[0] cmd = "scp -i %s -o StrictHostKeyChecking=no -P 1046 robot/Resources/config/profile \ %s:~/tools/vdbench/"%(config.pravie_key_path,test_client) shell_operator.run_exec2(cmd) ssh = shell_operator.create_ssh_connect(test_client, 1046, config.abnormal_user) ori_cmd = "cd /home/nbs/tools/vdbench && sudo nohup ./vdbench -jn -f profile &" rs = shell_operator.ssh_background_exec2(ssh, ori_cmd) time.sleep(5) ssh.close()
def start_abnormal_test_services(): try: for host in config.etcd_list: ssh = shell_operator.create_ssh_connect(host, 1046, config.abnormal_user) ori_cmd = "sudo rm -rf /etcd/default.etcd" shell_operator.ssh_exec(ssh, ori_cmd) etcd_cmd = "cd etcdrun && sudo nohup ./run.sh new &" shell_operator.ssh_background_exec2(ssh, etcd_cmd) ori_cmd = "ps -ef|grep -v grep | grep -w etcd | awk '{print $2}'" time.sleep(2) rs = shell_operator.ssh_exec(ssh, ori_cmd) logger.debug("etcd pid is %s"%rs[1]) assert rs[1] != [], "up etcd fail" for host in config.mds_list: ssh = shell_operator.create_ssh_connect(host, 1046, config.abnormal_user) mds_cmd = "sudo nohup /usr/bin/curve-mds --confPath=/etc/curve/mds.conf &" shell_operator.ssh_background_exec2(ssh, mds_cmd) time.sleep(1) ori_cmd = "ps -ef|grep -v grep | grep -v curve-mds.log | grep -v sudo | grep -w curve-mds | awk '{print $2}'" rs = shell_operator.ssh_exec(ssh, ori_cmd) assert rs[1] != [], "up mds fail" logger.debug("mds pid is %s"%rs[1]) for host in config.snap_server_list: ssh = shell_operator.create_ssh_connect(host, 1046, config.abnormal_user) ori_cmd = "cd snapshot/temp && sudo nohup curve-snapshotcloneserver -conf=/etc/curve/snapshot_clone_server.conf &" shell_operator.ssh_background_exec2(ssh, ori_cmd) except Exception: logger.error("up servers fail.") raise