• Home
  • Raw
  • Download

Lines Matching full:role

39 def warn_missing_role(role, exclude_server):  argument
41 given role.
43 @param role: Name of the role.
44 @param exclude_server: Server to be excluded from search for role.
47 roles__role=role,
51 message = ('WARNING! There will be no server with role %s after it\'s '
53 'normally without any server in role %s.' %
54 (role, exclude_server.hostname, role))
58 def get_servers(hostname=None, role=None, status=None): argument
59 """Find servers with given role and status.
62 @param role: Role of server, default to None.
65 @return: A list of server objects with given role and status.
70 if role:
71 filters['roles__role'] = role
175 No Role :
186 for role, role_servers in servers_by_role.iteritems():
187 result_lines.append(_format_role_servers_summary(role, role_servers))
190 _format_role_servers_summary('No Role', servers_without_roles))
207 @returns: Mapping of role strings to lists of servers.
209 roles = [role for role, _ in server_models.ServerRole.ROLE.choices()]
212 for role in server.get_role_names():
213 servers_by_role[role].append(server)
217 def _format_role_servers_summary(role, servers): argument
218 """Format one line of servers for a role in a server list summary.
220 @param role: Role string.
227 return '%-15s: %s' % (role, servers_part)
230 def check_server(hostname, role): argument
231 """Confirm server with given hostname is ready to be primary of given role.
233 If the server is a backup and failed to be verified for the role, remove
234 the role from its roles list. If it has no other role, set its status to
238 @param role: Role to be checked.
239 @return: True if server can be verified for the given role, otherwise
242 # TODO(dshi): Add more logic to confirm server is ready for the role.
305 servers = get_servers(role=server_models.ServerRole.ROLE.DRONE,
359 servers = get_servers(role=server_models.ServerRole.ROLE.SHARD,
364 def confirm_server_has_role(hostname, role): argument
365 """Confirm a given server has the given role, and its status is primary.
368 @param role: Name of the role to be checked.
369 @raise ServerActionError: If localhost does not have given role or it's
376 servers = get_servers(role=role, status=server_models.Server.STATUS.PRIMARY)
380 raise ServerActionError('Server %s does not have role of %s running in '
381 'status primary.' % (hostname, role))