Update i18n translation for neutron.server/scheduler log msg's
Validate that hacking rules apply to directories: - neutron/scheduler - neutron/server Change-Id: I1353f5c8b01f85e4995ee1fb23a066506ed98e3f Partial-bug: #1320867
This commit is contained in:
parent
09566e272f
commit
25d3e0114a
|
@ -54,7 +54,9 @@ def _directory_to_check_translation(filename):
|
||||||
"neutron/hacking",
|
"neutron/hacking",
|
||||||
"neutron/locale",
|
"neutron/locale",
|
||||||
"neutron/notifiers",
|
"neutron/notifiers",
|
||||||
"neutron/openstack"]
|
"neutron/openstack",
|
||||||
|
"neutron/scheduler",
|
||||||
|
"neutron/server"]
|
||||||
return any([dir in filename for dir in dirs])
|
return any([dir in filename for dir in dirs])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ from sqlalchemy import sql
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.db import agents_db
|
from neutron.db import agents_db
|
||||||
from neutron.db import agentschedulers_db
|
from neutron.db import agentschedulers_db
|
||||||
|
from neutron.openstack.common.gettextutils import _LI, _LW
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,9 +49,9 @@ class ChanceScheduler(object):
|
||||||
except db_exc.DBDuplicateEntry:
|
except db_exc.DBDuplicateEntry:
|
||||||
# it's totally ok, someone just did our job!
|
# it's totally ok, someone just did our job!
|
||||||
context.session.rollback()
|
context.session.rollback()
|
||||||
LOG.info(_('Agent %s already present'), agent)
|
LOG.info(_LI('Agent %s already present'), agent)
|
||||||
LOG.debug(_('Network %(network_id)s is scheduled to be '
|
LOG.debug('Network %(network_id)s is scheduled to be '
|
||||||
'hosted by DHCP agent %(agent_id)s'),
|
'hosted by DHCP agent %(agent_id)s',
|
||||||
{'network_id': network_id,
|
{'network_id': network_id,
|
||||||
'agent_id': agent})
|
'agent_id': agent})
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ class ChanceScheduler(object):
|
||||||
dhcp_agents = plugin.get_dhcp_agents_hosting_networks(
|
dhcp_agents = plugin.get_dhcp_agents_hosting_networks(
|
||||||
context, [network['id']], active=True)
|
context, [network['id']], active=True)
|
||||||
if len(dhcp_agents) >= agents_per_network:
|
if len(dhcp_agents) >= agents_per_network:
|
||||||
LOG.debug(_('Network %s is hosted already'),
|
LOG.debug('Network %s is hosted already',
|
||||||
network['id'])
|
network['id'])
|
||||||
return
|
return
|
||||||
n_agents = agents_per_network - len(dhcp_agents)
|
n_agents = agents_per_network - len(dhcp_agents)
|
||||||
|
@ -76,7 +77,7 @@ class ChanceScheduler(object):
|
||||||
'agent_type': [constants.AGENT_TYPE_DHCP],
|
'agent_type': [constants.AGENT_TYPE_DHCP],
|
||||||
'admin_state_up': [True]})
|
'admin_state_up': [True]})
|
||||||
if not enabled_dhcp_agents:
|
if not enabled_dhcp_agents:
|
||||||
LOG.warn(_('No more DHCP agents'))
|
LOG.warn(_LW('No more DHCP agents'))
|
||||||
return
|
return
|
||||||
active_dhcp_agents = [
|
active_dhcp_agents = [
|
||||||
agent for agent in set(enabled_dhcp_agents)
|
agent for agent in set(enabled_dhcp_agents)
|
||||||
|
@ -85,7 +86,7 @@ class ChanceScheduler(object):
|
||||||
and agent not in dhcp_agents
|
and agent not in dhcp_agents
|
||||||
]
|
]
|
||||||
if not active_dhcp_agents:
|
if not active_dhcp_agents:
|
||||||
LOG.warn(_('No more DHCP agents'))
|
LOG.warn(_LW('No more DHCP agents'))
|
||||||
return
|
return
|
||||||
n_agents = min(len(active_dhcp_agents), n_agents)
|
n_agents = min(len(active_dhcp_agents), n_agents)
|
||||||
chosen_agents = random.sample(active_dhcp_agents, n_agents)
|
chosen_agents = random.sample(active_dhcp_agents, n_agents)
|
||||||
|
@ -105,7 +106,7 @@ class ChanceScheduler(object):
|
||||||
net_ids = set(s['network_id'] for s in subnets
|
net_ids = set(s['network_id'] for s in subnets
|
||||||
if s['enable_dhcp'])
|
if s['enable_dhcp'])
|
||||||
if not net_ids:
|
if not net_ids:
|
||||||
LOG.debug(_('No non-hosted networks'))
|
LOG.debug('No non-hosted networks')
|
||||||
return False
|
return False
|
||||||
query = context.session.query(agents_db.Agent)
|
query = context.session.query(agents_db.Agent)
|
||||||
query = query.filter(agents_db.Agent.agent_type ==
|
query = query.filter(agents_db.Agent.agent_type ==
|
||||||
|
@ -116,7 +117,7 @@ class ChanceScheduler(object):
|
||||||
for dhcp_agent in dhcp_agents:
|
for dhcp_agent in dhcp_agents:
|
||||||
if agents_db.AgentDbMixin.is_agent_down(
|
if agents_db.AgentDbMixin.is_agent_down(
|
||||||
dhcp_agent.heartbeat_timestamp):
|
dhcp_agent.heartbeat_timestamp):
|
||||||
LOG.warn(_('DHCP agent %s is not active'), dhcp_agent.id)
|
LOG.warn(_LW('DHCP agent %s is not active'), dhcp_agent.id)
|
||||||
continue
|
continue
|
||||||
for net_id in net_ids:
|
for net_id in net_ids:
|
||||||
agents = plugin.get_dhcp_agents_hosting_networks(
|
agents = plugin.get_dhcp_agents_hosting_networks(
|
||||||
|
|
|
@ -27,7 +27,7 @@ from neutron.common import utils
|
||||||
from neutron.db import l3_agentschedulers_db
|
from neutron.db import l3_agentschedulers_db
|
||||||
from neutron.db import l3_db
|
from neutron.db import l3_db
|
||||||
from neutron.db import l3_hamode_db
|
from neutron.db import l3_hamode_db
|
||||||
from neutron.openstack.common.gettextutils import _LE
|
from neutron.openstack.common.gettextutils import _LE, _LW
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ class L3Scheduler(object):
|
||||||
l3_agents = plugin.get_l3_agents_hosting_routers(
|
l3_agents = plugin.get_l3_agents_hosting_routers(
|
||||||
context, [router['id']], admin_state_up=True)
|
context, [router['id']], admin_state_up=True)
|
||||||
if l3_agents:
|
if l3_agents:
|
||||||
LOG.debug(('Router %(router_id)s has already been '
|
LOG.debug('Router %(router_id)s has already been '
|
||||||
'hosted by L3 agent %(agent_id)s'),
|
'hosted by L3 agent %(agent_id)s',
|
||||||
{'router_id': router['id'],
|
{'router_id': router['id'],
|
||||||
'agent_id': l3_agents[0]['id']})
|
'agent_id': l3_agents[0]['id']})
|
||||||
else:
|
else:
|
||||||
|
@ -153,8 +153,8 @@ class L3Scheduler(object):
|
||||||
target_routers = self.get_routers_can_schedule(
|
target_routers = self.get_routers_can_schedule(
|
||||||
context, plugin, unscheduled_routers, l3_agent)
|
context, plugin, unscheduled_routers, l3_agent)
|
||||||
if not target_routers:
|
if not target_routers:
|
||||||
LOG.warn(_('No routers compatible with L3 agent configuration'
|
LOG.warn(_LW('No routers compatible with L3 agent configuration'
|
||||||
' on host %s'), host)
|
' on host %s'), host)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.bind_routers(context, plugin, target_routers, l3_agent)
|
self.bind_routers(context, plugin, target_routers, l3_agent)
|
||||||
|
@ -170,15 +170,15 @@ class L3Scheduler(object):
|
||||||
l3_agents = plugin.get_l3_agents_hosting_routers(
|
l3_agents = plugin.get_l3_agents_hosting_routers(
|
||||||
context, [sync_router['id']], admin_state_up=True)
|
context, [sync_router['id']], admin_state_up=True)
|
||||||
if l3_agents and not sync_router.get('distributed', False):
|
if l3_agents and not sync_router.get('distributed', False):
|
||||||
LOG.debug(_('Router %(router_id)s has already been hosted'
|
LOG.debug('Router %(router_id)s has already been hosted'
|
||||||
' by L3 agent %(agent_id)s'),
|
' by L3 agent %(agent_id)s',
|
||||||
{'router_id': sync_router['id'],
|
{'router_id': sync_router['id'],
|
||||||
'agent_id': l3_agents[0]['id']})
|
'agent_id': l3_agents[0]['id']})
|
||||||
return
|
return
|
||||||
|
|
||||||
active_l3_agents = plugin.get_l3_agents(context, active=True)
|
active_l3_agents = plugin.get_l3_agents(context, active=True)
|
||||||
if not active_l3_agents:
|
if not active_l3_agents:
|
||||||
LOG.warn(_('No active L3 agents'))
|
LOG.warn(_LW('No active L3 agents'))
|
||||||
return
|
return
|
||||||
new_l3agents = plugin.get_l3_agent_candidates(context,
|
new_l3agents = plugin.get_l3_agent_candidates(context,
|
||||||
sync_router,
|
sync_router,
|
||||||
|
@ -190,7 +190,7 @@ class L3Scheduler(object):
|
||||||
else:
|
else:
|
||||||
candidates = new_l3agents
|
candidates = new_l3agents
|
||||||
if not candidates:
|
if not candidates:
|
||||||
LOG.warn(_('No L3 agents can host the router %s'),
|
LOG.warn(_LW('No L3 agents can host the router %s'),
|
||||||
sync_router['id'])
|
sync_router['id'])
|
||||||
|
|
||||||
return candidates
|
return candidates
|
||||||
|
|
|
@ -29,6 +29,7 @@ from neutron.common import config
|
||||||
from neutron import service
|
from neutron import service
|
||||||
|
|
||||||
from neutron.openstack.common import gettextutils
|
from neutron.openstack.common import gettextutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LI
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
gettextutils.install('neutron', lazy=True)
|
gettextutils.install('neutron', lazy=True)
|
||||||
|
|
||||||
|
@ -51,7 +52,8 @@ def main():
|
||||||
try:
|
try:
|
||||||
neutron_rpc = service.serve_rpc()
|
neutron_rpc = service.serve_rpc()
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
LOG.info(_("RPC was already started in parent process by plugin."))
|
LOG.info(_LI("RPC was already started in parent process by "
|
||||||
|
"plugin."))
|
||||||
else:
|
else:
|
||||||
rpc_thread = pool.spawn(neutron_rpc.wait)
|
rpc_thread = pool.spawn(neutron_rpc.wait)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue