pseudo agent port binding: log owner and device_id

When port binding fails, log device_owner and device_id in addition
to the existing ones. They are helpful to determine what port is for.
e.g. vm, dhcp, router etc when diagnosing failure of port binding.
There is a race condition between dhcp port creation and network
deletion because notification to dhcp agent can be delayed.
If dhcp port is to be bound after network is deleted, the binding
fails. It's safe to ignore such a case.

Change-Id: I26e235fa3e0bdab5e3d568a9a0f60a380642c760
This commit is contained in:
Isaku Yamahata
2017-07-18 15:26:39 -07:00
committed by Isaku Yamahata
parent 5b9b3e02c5
commit b2fc9700ee

View File

@@ -254,9 +254,12 @@ class PseudoAgentDBBindingController(port_binding.PortBindingController):
break # Port binding suceeded!
else: # Port binding failed!
LOG.warning(
"Failed to bind Port %(pid)s for host %(host)s on network "
"%(network)s.", {
"Failed to bind Port %(pid)s devid %(device_id)s "
"owner %(owner)s for host %(host)s "
"on network %(network)s.", {
'pid': port_context.current['id'],
'devce_id': port_context.current['device_id'],
'owner': port_context.current['device_owner'],
'host': port_context.host,
'network': port_context.network.current['id']})
else: # No hostconfig found for host in agentdb.