def start_iscsi_initiators(ctx, tgt_link): """ This is the sub-task that assigns an rbd to an iscsiadm control and performs a login (thereby creating a /dev/sd device). It performs a logout when finished. """ remotes = ctx.cluster.only(teuthology.is_type('client')).remotes tgtd_list = [] for role, host in tgt_link: rem = _get_remote(remotes, role) rem_name = _get_remote_name(remotes, host) rem.run(args=[ 'sudo', 'iscsiadm', '-m', 'discovery', '-t', 'st', '-p', rem_name, ]) proc = rem.run(args=[ 'sudo', 'iscsiadm', '-m', 'node', '--login', ]) if proc.exitstatus == 0: tgtd_list.append((rem, rem_name)) general_io_test(ctx, rem, host) try: with contextutil.nested( lambda: generic_mkfs(ctx=ctx, config={host: { 'fs_type': 'xfs' }}, devname_rtn=tgt_devname_rtn), lambda: generic_mount( ctx=ctx, config={host: None}, devname_rtn=tgt_devname_rtn), ): yield finally: for rem_info in tgtd_list: rem = rem_info[0] rem_name = rem_info[1] rem.run(args=[ 'sudo', 'iscsiadm', '-m', 'node', '--logout', ])
def start_iscsi_initiators(ctx, tgt_link): """ This is the sub-task that assigns an rbd to an iscsiadm control and performs a login (thereby creating a /dev/sd device). It performs a logout when finished. """ remotes = ctx.cluster.only(teuthology.is_type('client')).remotes tgtd_list = [] for role, host in tgt_link: rem = _get_remote(remotes, role) rem_name = _get_remote_name(remotes, host) rem.run( args=[ 'sudo', 'iscsiadm', '-m', 'discovery', '-t', 'st', '-p', rem_name, ]) proc = rem.run( args=[ 'sudo', 'iscsiadm', '-m', 'node', '--login', ]) if proc.exitstatus == 0: tgtd_list.append((rem, rem_name)) general_io_test(ctx, rem, host) try: with contextutil.nested( lambda: generic_mkfs(ctx=ctx, config={host: {'fs_type': 'xfs'}}, devname_rtn=tgt_devname_rtn), lambda: generic_mount(ctx=ctx, config={host: None}, devname_rtn=tgt_devname_rtn), ): yield finally: for rem_info in tgtd_list: rem = rem_info[0] rem_name = rem_info[1] rem.run( args=[ 'sudo', 'iscsiadm', '-m', 'node', '--logout', ])
def task(ctx, config): """ Create and mount an rbd image. For example, you can specify which clients to run on:: tasks: - ceph: - rbd: [client.0, client.1] There are a few image options:: tasks: - ceph: - rbd: client.0: # uses defaults client.1: image_name: foo image_size: 2048 image_format: 2 fs_type: xfs To use default options on all clients:: tasks: - ceph: - rbd: all: To create 20GiB images and format them with xfs on all clients:: tasks: - ceph: - rbd: all: image_size: 20480 fs_type: xfs """ if config is None: config = { 'all': None } norm_config = config if isinstance(config, dict): norm_config = teuthology.replace_all_with_clients(ctx.cluster, config) if isinstance(norm_config, dict): role_images = {} for role, properties in norm_config.items(): if properties is None: properties = {} role_images[role] = properties.get('image_name') else: role_images = norm_config log.debug('rbd config is: %s', norm_config) with contextutil.nested( lambda: create_image(ctx=ctx, config=norm_config), lambda: modprobe(ctx=ctx, config=norm_config), lambda: dev_create(ctx=ctx, config=role_images), lambda: generic_mkfs(ctx=ctx, config=norm_config, devname_rtn=rbd_devname_rtn), lambda: generic_mount(ctx=ctx, config=role_images, devname_rtn=rbd_devname_rtn), ): yield
def task(ctx, config): """ Create and mount an rbd image. For example, you can specify which clients to run on:: tasks: - ceph: - rbd: [client.0, client.1] There are a few image options:: tasks: - ceph: - rbd: client.0: # uses defaults client.1: image_name: foo image_size: 2048 image_format: 2 fs_type: xfs To use default options on all clients:: tasks: - ceph: - rbd: all: To create 20GiB images and format them with xfs on all clients:: tasks: - ceph: - rbd: all: image_size: 20480 fs_type: xfs """ if config is None: config = { 'all': None } norm_config = config if isinstance(config, dict): norm_config = teuthology.replace_all_with_clients(ctx.cluster, config) if isinstance(norm_config, dict): role_images = {} for role, properties in norm_config.iteritems(): if properties is None: properties = {} role_images[role] = properties.get('image_name') else: role_images = norm_config log.debug('rbd config is: %s', norm_config) with contextutil.nested( lambda: create_image(ctx=ctx, config=norm_config), lambda: modprobe(ctx=ctx, config=norm_config), lambda: dev_create(ctx=ctx, config=role_images), lambda: generic_mkfs(ctx=ctx, config=norm_config, devname_rtn=rbd_devname_rtn), lambda: generic_mount(ctx=ctx, config=role_images, devname_rtn=rbd_devname_rtn), ): yield