MCPcopy Create free account
hub / github.com/ceph/ceph / get_remote

Function get_remote

qa/tasks/util/__init__.py:3–23  ·  view source on GitHub ↗

Get the Remote for the host where a particular role runs. :param cluster: name of the cluster the service is part of :param service_type: e.g. 'mds', 'osd', 'client' :param service_id: The third part of a role, e.g. '0' for the role 'ceph.client.0' :retur

(ctx, cluster, service_type, service_id)

Source from the content-addressed store, hash-verified

1from teuthology import misc
2
3def get_remote(ctx, cluster, service_type, service_id):
4 """
5 Get the Remote for the host where a particular role runs.
6
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
13 """
14 def _is_instance(role):
15 role_tuple = misc.split_role(role)
16 return role_tuple == (cluster, service_type, str(service_id))
17 try:
18 (remote,) = ctx.cluster.only(_is_instance).remotes.keys()
19 except ValueError:
20 raise KeyError("Service {0}.{1}.{2} not found".format(cluster,
21 service_type,
22 service_id))
23 return remote
24
25def get_remote_for_role(ctx, role):
26 return get_remote(ctx, *misc.split_role(role))

Callers 2

find_remoteMethod · 0.90
get_remote_for_roleFunction · 0.85

Calls 3

onlyMethod · 0.80
keysMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected