Logging indicates when service starts and terminates
Fixes bug 1064070 The patch adds a log entry indication that the service has started. In addition to this if there is an "exit" statement in the code, then the log message will indicate that the service has been terminated. Change-Id: Idb6cff4b85d26331df2c6e14aa0680e82b4e2cd7
This commit is contained in:
@@ -118,6 +118,7 @@ def setup_logging(conf):
|
||||
|
||||
handler.setFormatter(formatter)
|
||||
root_logger.addHandler(handler)
|
||||
LOG.info("Logging enabled!")
|
||||
|
||||
|
||||
def load_paste_app(app_name):
|
||||
|
||||
@@ -636,7 +636,8 @@ class LinuxBridgeQuantumAgentRPC:
|
||||
if devices:
|
||||
mac = utils.get_interface_mac(devices[0].name)
|
||||
else:
|
||||
LOG.error("Unable to obtain MAC of any device for agent_id")
|
||||
LOG.error("Unable to obtain MAC address for unique ID. "
|
||||
"Agent terminated!")
|
||||
exit(1)
|
||||
self.agent_id = '%s%s' % ('lb', (mac.replace(":", "")))
|
||||
LOG.info("RPC agent_id: %s" % self.agent_id)
|
||||
@@ -800,7 +801,8 @@ def main():
|
||||
LOG.debug("physical network %s mapped to physical interface %s" %
|
||||
(physical_network, physical_interface))
|
||||
except ValueError as ex:
|
||||
LOG.error("Invalid physical interface mapping: \'%s\' - %s" %
|
||||
LOG.error("Invalid physical interface mapping: %s - %s. "
|
||||
"Agent terminated!" %
|
||||
(mapping, ex))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@@ -163,7 +163,8 @@ class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
if self.tenant_network_type not in [constants.TYPE_LOCAL,
|
||||
constants.TYPE_VLAN,
|
||||
constants.TYPE_NONE]:
|
||||
LOG.error("Invalid tenant_network_type: %s" %
|
||||
LOG.error("Invalid tenant_network_type: %s. "
|
||||
"Service terminated!" %
|
||||
self.tenant_network_type)
|
||||
sys.exit(1)
|
||||
self.agent_rpc = cfg.CONF.AGENT.rpc
|
||||
@@ -194,7 +195,8 @@ class LinuxBridgePluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
int(vlan_min),
|
||||
int(vlan_max))
|
||||
except ValueError as ex:
|
||||
LOG.error("Invalid network VLAN range: \'%s\' - %s" %
|
||||
LOG.error("Invalid network VLAN range: '%s' - %s. "
|
||||
"Service terminated!" %
|
||||
(entry, ex))
|
||||
sys.exit(1)
|
||||
else:
|
||||
|
||||
@@ -452,7 +452,8 @@ class OVSQuantumAgent(object):
|
||||
if int(self.patch_tun_ofport) < 0 or int(self.patch_int_ofport) < 0:
|
||||
LOG.error("Failed to create OVS patch port. Cannot have tunneling "
|
||||
"enabled on this agent, since this version of OVS does "
|
||||
"not support tunnels or patch ports.")
|
||||
"not support tunnels or patch ports. "
|
||||
"Agent terminated!")
|
||||
exit(1)
|
||||
self.tun_br.remove_all_flows()
|
||||
self.tun_br.add_flow(priority=1, actions="drop")
|
||||
@@ -471,7 +472,8 @@ class OVSQuantumAgent(object):
|
||||
for physical_network, bridge in bridge_mappings.iteritems():
|
||||
# setup physical bridge
|
||||
if not ip_lib.device_exists(bridge, self.root_helper):
|
||||
LOG.error("Bridge %s for physical network %s does not exist",
|
||||
LOG.error("Bridge %s for physical network %s does not exist. "
|
||||
"Agent terminated!",
|
||||
bridge, physical_network)
|
||||
sys.exit(1)
|
||||
br = ovs_lib.OVSBridge(bridge, self.root_helper)
|
||||
@@ -803,7 +805,8 @@ def main():
|
||||
enable_tunneling = cfg.CONF.OVS.enable_tunneling
|
||||
|
||||
if enable_tunneling and not local_ip:
|
||||
LOG.error("Invalid local_ip. (%s)" % repr(local_ip))
|
||||
LOG.error("Invalid local_ip. (%s). "
|
||||
"Agent terminated!" % repr(local_ip))
|
||||
sys.exit(1)
|
||||
|
||||
bridge_mappings = {}
|
||||
@@ -816,7 +819,8 @@ def main():
|
||||
LOG.info("Physical network %s mapped to bridge %s",
|
||||
physical_network, bridge)
|
||||
except ValueError as ex:
|
||||
LOG.error("Invalid bridge mapping: \'%s\' - %s", mapping, ex)
|
||||
LOG.error("Invalid bridge mapping: %s - %s. "
|
||||
"Agent terminated!", mapping, ex)
|
||||
sys.exit(1)
|
||||
|
||||
plugin = OVSQuantumAgent(integ_br, tun_br, local_ip, bridge_mappings,
|
||||
@@ -824,6 +828,7 @@ def main():
|
||||
reconnect_interval, rpc, enable_tunneling)
|
||||
|
||||
# Start everything.
|
||||
LOG.info("Agent initialized successfully, now running... ")
|
||||
plugin.daemon_loop(db_connection_url)
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
@@ -200,7 +200,8 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
constants.TYPE_VLAN,
|
||||
constants.TYPE_GRE,
|
||||
constants.TYPE_NONE]:
|
||||
LOG.error("Invalid tenant_network_type: %s",
|
||||
LOG.error("Invalid tenant_network_type: %s. "
|
||||
"Agent terminated!",
|
||||
self.tenant_network_type)
|
||||
sys.exit(1)
|
||||
self.enable_tunneling = cfg.CONF.OVS.enable_tunneling
|
||||
@@ -209,7 +210,8 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
self._parse_tunnel_id_ranges()
|
||||
ovs_db_v2.sync_tunnel_allocations(self.tunnel_id_ranges)
|
||||
elif self.tenant_network_type == constants.TYPE_GRE:
|
||||
LOG.error("Tunneling disabled but tenant_network_type is 'gre'")
|
||||
LOG.error("Tunneling disabled but tenant_network_type is 'gre'. "
|
||||
"Agent terminated!")
|
||||
sys.exit(1)
|
||||
self.agent_rpc = cfg.CONF.AGENT.rpc
|
||||
self.setup_rpc()
|
||||
@@ -239,7 +241,8 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
int(vlan_min),
|
||||
int(vlan_max))
|
||||
except ValueError as ex:
|
||||
LOG.error("Invalid network VLAN range: \'%s\' - %s",
|
||||
LOG.error("Invalid network VLAN range: '%s' - %s. "
|
||||
"Agent terminated!",
|
||||
entry, ex)
|
||||
sys.exit(1)
|
||||
else:
|
||||
@@ -261,7 +264,8 @@ class OVSQuantumPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
tun_min, tun_max = entry.split(':')
|
||||
self.tunnel_id_ranges.append((int(tun_min), int(tun_max)))
|
||||
except ValueError as ex:
|
||||
LOG.error("Invalid tunnel ID range: \'%s\' - %s", entry, ex)
|
||||
LOG.error("Invalid tunnel ID range: '%s' - %s. "
|
||||
"Agent terminated!", entry, ex)
|
||||
sys.exit(1)
|
||||
LOG.info("Tunnel ID ranges: %s", self.tunnel_id_ranges)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user