]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
common_fs_utils: use common method to extract id from role
authorJosh Durgin <jdurgin@redhat.com>
Wed, 16 Mar 2016 06:37:20 +0000 (23:37 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Mon, 11 Apr 2016 21:36:41 +0000 (14:36 -0700)
This works with multiple clusters too.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
teuthology/task/common_fs_utils.py

index b963e98d429a105476d8b5b9fec230eb9acea86a..584897968a0e61ca0a0bba3fbdda32da2be9386b 100644 (file)
@@ -74,15 +74,6 @@ def generic_mount(ctx, config, devname_rtn):
     else:
         role_images = [(role, None) for role in config]
 
-    def strip_client_prefix(role):
-        """
-        Extract the number from the name of a client role
-        """
-        prefix = 'client.'
-        assert role.startswith(prefix)
-        id_ = role[len(prefix):]
-        return id_
-
     testdir = teuthology.get_testdir(ctx)
 
     mnt_template = '{tdir}/mnt.{id}'
@@ -91,7 +82,7 @@ def generic_mount(ctx, config, devname_rtn):
         if image is None:
             image = default_image_name(role)
         (remote,) = ctx.cluster.only(role).remotes.keys()
-        id_ = strip_client_prefix(role)
+        _, _, id_ = teuthology.split_role(role)
         mnt = mnt_template.format(tdir=testdir, id=id_)
         mounted.append((remote, mnt))
         remote.run(