From 4c7dd504ca6fcf0c85264465578dbf063253a37f Mon Sep 17 00:00:00 2001 From: Warren Usui Date: Thu, 14 Nov 2013 20:24:38 -0800 Subject: [PATCH] tgt and iscsi code need some minor fixes. Moved the settle call during simple read testing. In iscsi.py, generic_mkfs and generic_mount need to be called from the main body of the task. An extraneous iscsiadm command was removed. The tgt size is now not hard-coded. It is extracted from the property and defaults to 10240. Fixes: #6782 --- teuthology/task/iscsi.py | 27 +++++++-------------------- teuthology/task/tgt.py | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/teuthology/task/iscsi.py b/teuthology/task/iscsi.py index 3487d1d4b2..d83fbd2507 100644 --- a/teuthology/task/iscsi.py +++ b/teuthology/task/iscsi.py @@ -105,6 +105,11 @@ def general_io_test(ctx, rem, image_name): Do simple I/O tests to the iscsi interface before putting a filesystem on it. """ + rem.run( + args=[ + 'udevadm', + 'settle', + ]) test_phrase = 'The time has come the walrus said to speak of many things.' lnkpath = tgt_devname_get(ctx, image_name) proc = rem.run(args=['mktemp'], stdout=StringIO(),) @@ -154,21 +159,15 @@ def start_iscsi_initiators(ctx, tgt_link): ]) if proc.exitstatus == 0: tgtd_list.append((rem, rem_name)) - rem.run( - args=[ - 'udevadm', - 'settle', - ]) 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), ): - pass - try: - yield + yield finally: for rem_info in tgtd_list: rem = rem_info[0] @@ -181,18 +180,6 @@ def start_iscsi_initiators(ctx, tgt_link): 'node', '--logout', ]) - rem.run( - args=[ - 'sudo', - 'iscsiadm', - '-m', - 'discovery', - '-p', - rem_name, - '-o', - 'delete', - ]) - @contextlib.contextmanager def task(ctx, config): diff --git a/teuthology/task/tgt.py b/teuthology/task/tgt.py index 58a80e5c15..c2b322e082 100644 --- a/teuthology/task/tgt.py +++ b/teuthology/task/tgt.py @@ -26,13 +26,14 @@ def start_tgt_remotes(ctx, start_tgtd): if _id in start_tgtd: if not rem in tgtd_list: tgtd_list.append(rem) + size = ctx.config.get('image_size', 10240) rem.run( args=[ 'rbd', 'create', 'iscsi-image', '--size', - '500', + str(size), ]) rem.run( args=[ @@ -143,6 +144,13 @@ def task(ctx, config): client.0: client.3: + An image blocksize size can also be specified:: + + tasks: + - ceph: + - tgt: + image_size = 20480 + The general flow of things here is: 1. Find clients on which tgt is supposed to run (start_tgtd) 2. Remotely start up tgt daemon @@ -151,10 +159,14 @@ def task(ctx, config): The iscsi administration is handled by the iscsi task. """ + if config: + config = {key : val for key, val in config.items() + if key.startswith('client')} + # config at this point should only contain keys starting with 'client' start_tgtd = [] remotes = ctx.cluster.only(teuthology.is_type('client')).remotes log.info(remotes) - if config == None: + if not config: start_tgtd = ['client.{id}'.format(id=id_) for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')] else: -- 2.39.5