]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tgt and iscsi code need some minor fixes. Moved the settle call during
authorWarren Usui <warren.usui@inktank.com>
Fri, 15 Nov 2013 04:24:38 +0000 (20:24 -0800)
committerWarren Usui <warren.usui@inktank.com>
Tue, 26 Nov 2013 04:44:52 +0000 (20:44 -0800)
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
teuthology/task/tgt.py

index 3487d1d4b2c9f4adef0e1d288f31f9d19480231e..d83fbd2507f88053faa0b0303d053da5da745f3c 100644 (file)
@@ -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):
index 58a80e5c1511a802cba6434af19ce5f1f6c477da..c2b322e08297bc6ab2b979b78de5f9a19a1367f2 100644 (file)
@@ -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: