Add more log when dhcp agent sync_state.

DHCP agent output no log when synchronizing network state, it's hard to observe
agent work state through log.

Add log to indication status and progress of sync state process:
 * Agent has fetched all active networks
 * Agent configure a network start and finish

Closes-Bug: #1535285

Change-Id: I517073e4a9a7a870cbbfd8cb0e14a7571176f562
This commit is contained in:
yaowei 2016-01-18 20:15:25 +08:00
parent d6d43b32ca
commit 89ca42fef4
1 changed files with 4 additions and 0 deletions

View File

@ -153,6 +153,7 @@ class DhcpAgent(manager.Manager):
try:
active_networks = self.plugin_rpc.get_active_networks_info()
LOG.info(_LI('All active networks have been fetched through RPC.'))
active_network_ids = set(network.id for network in active_networks)
for deleted_id in known_network_ids - active_network_ids:
try:
@ -218,7 +219,10 @@ class DhcpAgent(manager.Manager):
@utils.exception_logger()
def safe_configure_dhcp_for_network(self, network):
try:
network_id = network.get('id')
LOG.info(_LI('Starting network %s dhcp configuration'), network_id)
self.configure_dhcp_for_network(network)
LOG.info(_LI('Finished network %s dhcp configuration'), network_id)
except (exceptions.NetworkNotFound, RuntimeError):
LOG.warn(_LW('Network %s may have been deleted and its resources '
'may have already been disposed.'), network.id)