Lines Matching full:role
43 def warn_missing_role(role, exclude_server): argument
45 given role.
47 @param role: Name of the role.
48 @param exclude_server: Server to be excluded from search for role.
51 roles__role=role,
55 message = ('WARNING! There will be no server with role %s after it\'s '
57 'normally without any server in role %s.' %
58 (role, exclude_server.hostname, role))
62 def get_servers(hostname=None, role=None, status=None): argument
63 """Find servers with given role and status.
66 @param role: Role of server, default to None.
69 @return: A list of server objects with given role and status.
74 if role:
75 filters['roles__role'] = role
133 def check_server(hostname, role): argument
134 """Confirm server with given hostname is ready to be primary of given role.
136 If the server is a backup and failed to be verified for the role, remove
137 the role from its roles list. If it has no other role, set its status to
141 @param role: Role to be checked.
142 @return: True if server can be verified for the given role, otherwise
145 # TODO(dshi): Add more logic to confirm server is ready for the role.
208 servers = get_servers(role=server_models.ServerRole.ROLE.DRONE,
262 servers = get_servers(role=server_models.ServerRole.ROLE.SHARD,
267 def confirm_server_has_role(hostname, role): argument
268 """Confirm a given server has the given role, and its status is primary.
271 @param role: Name of the role to be checked.
272 @raise ServerActionError: If localhost does not have given role or it's
279 servers = get_servers(role=role, status=server_models.Server.STATUS.PRIMARY)
283 raise ServerActionError('Server %s does not have role of %s running in '
284 'status primary.' % (hostname, role))