1 from teuthology import misc
3 def get_remote(ctx, cluster, service_type, service_id):
5 Get the Remote for the host where a particular role runs.
7 :param cluster: name of the cluster the service is part of
8 :param service_type: e.g. 'mds', 'osd', 'client'
9 :param service_id: The third part of a role, e.g. '0' for
10 the role 'ceph.client.0'
11 :return: a Remote instance for the host where the
12 requested role is placed
14 def _is_instance(role):
15 role_tuple = misc.split_role(role)
16 return role_tuple == (cluster, service_type, str(service_id))
18 (remote,) = ctx.cluster.only(_is_instance).remotes.keys()
20 raise KeyError("Service {0}.{1}.{2} not found".format(cluster,
25 def get_remote_for_role(ctx, role):
26 return get_remote(ctx, *misc.split_role(role))