def run(**kw): ceph_nodes = kw.get('ceph_nodes') clients = kw.get('clients') win_client = clients[0] config = kw.get('config') test_data = kw.get('test_data') no_of_luns = config.get('no_of_luns', 10) image_name = 'test_image' + str(random.randint(10, 999)) login = test_data['initiator_name'].split(":")[1] iscsi_util = IscsiUtils(ceph_nodes) iscsi_util.create_luns(no_of_luns, test_data['gwcli_node'], test_data['initiator_name'], image_name, iosize="2g", map_to_client=True) win_client.connect_to_target(test_data['gwcli_node'].private_ip, login, "redhat@123456") win_client.create_disk(no_of_luns) job_options = iscsi_util.get_fio_jobs(no_of_luns) win_client.create_fio_job_options(job_options) output = win_client.run_fio_test() return output
def run(**kw): ceph_nodes = kw.get('ceph_nodes') clients = kw.get('clients') test_data = kw.get('test_data') win_client = clients[0] log.info('Preparing windows cient') win_client.start_iscsi_initiator() win_client.create_new_target(test_data['gwcli_node'].private_ip) test_data['initiator_name'] = win_client.get_iscsi_initiator_name() log.info('Creating iscsi host') iscsi_util = IscsiUtils(ceph_nodes) iscsi_util.create_host(test_data['gwcli_node'], test_data['initiator_name']) return 0
def run(**kw): ceph_nodes = kw.get("ceph_nodes") clients = kw.get("clients") test_data = kw.get("test_data") win_client = clients[0] log.info("Preparing windows cient") win_client.start_iscsi_initiator() win_client.create_new_target(test_data["gwcli_node"].private_ip) test_data["initiator_name"] = win_client.get_iscsi_initiator_name() log.info("Creating iscsi host") iscsi_util = IscsiUtils(ceph_nodes) iscsi_util.create_host(test_data["gwcli_node"], test_data["initiator_name"]) return 0
def run(**kw): config = kw.get('config') test_data = kw.get('test_data') test_data['no_of_luns'] = config.get('no_of_luns', 10) ceph_nodes = kw.get('ceph_nodes') image_name = 'test_image' + str(random.randint(10, 999)) log.info('Creating iscsi host') iscsi_util = IscsiUtils(ceph_nodes) iscsi_util.install_prereq_rhel_client() initiator_name = iscsi_util.get_initiatorname(full=True) iscsi_util.create_host(test_data['gwcli_node'], initiator_name) iscsi_util.create_luns( test_data['no_of_luns'], test_data['gwcli_node'], initiator_name, image_name, iosize="2g", map_to_client=True) return 0
def run(**kw): config = kw.get("config") test_data = kw.get("test_data") test_data["no_of_luns"] = config.get("no_of_luns", 10) ceph_nodes = kw.get("ceph_nodes") image_name = "test_image" + str(random.randint(10, 999)) log.info("Creating iscsi host") iscsi_util = IscsiUtils(ceph_nodes) iscsi_util.install_prereq_rhel_client() initiator_name = iscsi_util.get_initiatorname(full=True) iscsi_util.create_host(test_data["gwcli_node"], initiator_name) iscsi_util.create_luns( test_data["no_of_luns"], test_data["gwcli_node"], initiator_name, image_name, iosize="2g", map_to_client=True, ) return 0
def run(**kw): log.info("Running test") ceph_nodes = kw.get("ceph_nodes") test_data = kw.get("test_data") iscsi_util = IscsiUtils(ceph_nodes) iscsi_initiator = iscsi_util.get_iscsi_initiator_linux() initiatorname = iscsi_util.get_initiatorname() iscsi_util.write_multipath(iscsi_initiator) # to be chnage later iscsi_util.write_chap(initiatorname, iscsi_initiator) no_of_luns = test_data["no_of_luns"] device_list = iscsi_util.get_devicelist_luns(no_of_luns) if device_list == 1: return 1 iscsi_util.create_directory_with_io(device_list, iscsi_initiator, io_size="2G") rc = iscsi_util.do_ios(iscsi_initiator, device_list) if iscsi_util.check_mnted_disks(iscsi_initiator, device_list) == 1: return 1 iscsi_util.umount_directory(device_list, iscsi_initiator) iscsi_util.dissconect_linux_initiator(iscsi_initiator) if rc != 0: log.error("fio test failed") return 1 else: return 0
def run(**kw): log.info("Running test") ceph_nodes = kw.get("ceph_nodes") test_data = kw.get("test_data") iscsi_util = IscsiUtils(ceph_nodes) iscsi_initiators = iscsi_util.get_iscsi_initiator_linux() initiatorname = iscsi_util.get_initiatorname() iscsi_util.write_multipath(iscsi_initiators) iscsi_util.write_chap(initiatorname, iscsi_initiators) no_of_luns = test_data["no_of_luns"] rc = [] device_list = iscsi_util.get_devicelist_luns(no_of_luns) iscsi_util.create_directory_with_io(device_list, iscsi_initiators, io_size="1G") with parallel() as p: p.spawn(iscsi_util.do_ios, iscsi_initiators, device_list) p.spawn(do_failover, iscsi_initiators, device_list, ceph_nodes) for op in p: rc.append(op) uuid = [] iscsi_initiators.exec_command(sudo=True, cmd="cp /etc/fstab /etc/fstab.backup") out, err = iscsi_initiators.exec_command(sudo=True, cmd="cat /etc/fstab") output = out.read().decode() fstab = output.rstrip("\n") for device in device_list: out, err = iscsi_initiators.exec_command( sudo=True, cmd="blkid /dev/mapper/mpa" + device + "" " -s UUID -o value", long_running=True, ) output = out.rstrip("\n") uuid.append(output) for i in range(no_of_luns): temp = ("\nUUID=" + uuid[i] + "\t/mnt/" + device_list[i] + "/\text4\t_netdev\t0 0") fstab += temp fstab_file = iscsi_initiators.remote_file(sudo=True, file_name="/etc/fstab", file_mode="w") fstab_file.write(fstab) fstab_file.flush() mnted_disks = list_mnted_disks(iscsi_initiators) iscsi_initiators.exec_command(sudo=True, cmd="reboot", check_ec=False) sleep(200) iscsi_initiators.reconnect() iscsi_util.do_iptables_flush() mnted_disks_after_reboot = list_mnted_disks(iscsi_initiators) log.info("i/o exit code: {}, failover exit code{}".format(rc[0], rc[1])) log.info("disks before reboot:\n" + str(mnted_disks)) log.info("disks after reboot:\n" + str(mnted_disks_after_reboot)) log.info("number number of disks before reboot:" + str(len(mnted_disks))) log.info("number number of disks after reboot:" + str(len(mnted_disks_after_reboot))) if sum(rc) == 0 and mnted_disks_after_reboot == mnted_disks: iscsi_util.umount_directory(device_list, iscsi_initiators) iscsi_util.dissconect_linux_initiator(iscsi_initiators) iscsi_initiators.exec_command(sudo=True, cmd="mv /etc/fstab.backup /etc/fstab") return 0 else: return 1
def run(**kw): log.info("Running setup") log.info('Running iscsi configuration') ceph_nodes = kw.get('ceph_nodes') config = kw.get('config') test_data = kw.get('test_data') test_data['no_of_luns'] = config.get('no_of_luns') no_of_gw = config.get('no_of_gateways') iscsi_util = IscsiUtils(ceph_nodes) iscsi_util.install_prereq_rhel_client() initiator_name = iscsi_util.get_initiatorname(full=True) host_name = iscsi_util.get_initiatorname() luns_setting, luns_list = iscsi_util.generate_luns(test_data['no_of_luns']) client_setting = iscsi_util.generate_clients(initiator_name, luns_list, host_name) test_data["gw_ip_list"] = iscsi_util.generate_gw_ips(no_of_gw) test_data["luns_setting"] = luns_setting test_data["initiator_setting"] = client_setting iscsi_util.install_config_pkg() return 0
def run(**kw): log.info("Running test") ceph_nodes = kw.get("ceph_nodes") test_data = kw.get("test_data") iscsi_util = IscsiUtils(ceph_nodes) iscsi_initiators = iscsi_util.get_iscsi_initiator_linux() initiatorname = iscsi_util.get_initiatorname() iscsi_util.write_multipath(iscsi_initiators) iscsi_util.write_chap(initiatorname, iscsi_initiators) no_of_luns = test_data["no_of_luns"] rc = [] device_list = iscsi_util.get_devicelist_luns(no_of_luns) iscsi_util.create_directory_with_io(device_list, iscsi_initiators, io_size="1G") with parallel() as p: p.spawn(iscsi_util.do_ios, iscsi_initiators, device_list) p.spawn(do_failover, iscsi_initiators, device_list, ceph_nodes) for op in p: rc.append(op) print("return " + str(rc)) rc = set(rc) if len(rc) == 1: print(rc) iscsi_util.umount_directory(device_list, iscsi_initiators) iscsi_initiators.exec_command( sudo=True, cmd="iscsiadm -m node -T iqn.2003-01.com.redhat.iscsi-" "gw:ceph-igw -u", long_running=True, ) iscsi_initiators.exec_command(sudo=True, cmd="systemctl stop multipathd", long_running=True) return 0 else: print(rc) return 1
def run(**kw): log.info('Running iscsi configuration') ceph_nodes = kw.get('ceph_nodes') config = kw.get('config') test_data = kw.get('test_data') no_of_gateways = config.get('no_of_gateways', 2) log.info('Preparing ceph cluster') iscsi_util = IscsiUtils(ceph_nodes) iscsi_util.restart_ceph_mon() iscsi_util.install_prereq_gw() iscsi_util.open_ports() test_data['gw_list'] = iscsi_util.get_gw_list(no_of_gateways) iscsi_util.check_installed_rpm(test_data['gw_list']) test_data['gwcli_node'] = iscsi_util.setup_gw(test_data['gw_list']) iscsi_util.create_and_check_target(test_data['gwcli_node']) iscsi_util.create_and_check_gateways(test_data['gwcli_node'], test_data['gw_list']) return 0
def run(**kw): log.info("Running iscsi configuration") ceph_nodes = kw.get("ceph_nodes") config = kw.get("config") test_data = kw.get("test_data") no_of_gateways = config.get("no_of_gateways", 2) log.info("Preparing ceph cluster") iscsi_util = IscsiUtils(ceph_nodes) iscsi_util.restart_ceph_mon() iscsi_util.install_prereq_gw() iscsi_util.open_ports() test_data["gw_list"] = iscsi_util.get_gw_list(no_of_gateways) iscsi_util.check_installed_rpm(test_data["gw_list"]) test_data["gwcli_node"] = iscsi_util.setup_gw(test_data["gw_list"]) iscsi_util.create_and_check_target(test_data["gwcli_node"]) iscsi_util.create_and_check_gateways(test_data["gwcli_node"], test_data["gw_list"]) return 0