]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Logging indicates when service starts and terminates
authorGary Kotton <gkotton@redhat.com>
Mon, 8 Oct 2012 02:44:50 +0000 (02:44 +0000)
committerGary Kotton <gkotton@redhat.com>
Tue, 9 Oct 2012 01:33:24 +0000 (01:33 +0000)
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

quantum/common/config.py
quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py
quantum/plugins/linuxbridge/lb_quantum_plugin.py
quantum/plugins/openvswitch/agent/ovs_quantum_agent.py
quantum/plugins/openvswitch/ovs_quantum_plugin.py

index 3032c33225a4045b1ed9d41f400b74bd13aa4796..405a9023b5c72275f0e2ffec8e6f1596d3c7b83a 100644 (file)
@@ -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):
index 2cb25c32ddab17525a41e6a479990a4be076fe18..9cf021916e020e1a4675ec78c9e07c235eb3d55e 100755 (executable)
@@ -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)
 
index 5aeb687d6cbfcb74aca76a1be9ee8f713182a93c..edcb668419f42cdcedf5411b8b85246ba0d61b17 100644 (file)
@@ -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:
index da03ea673996eed5d6734bf3af612dd90a875c06..dc7fe0fc575552b327d9ba7e541db64f17167fb2 100755 (executable)
@@ -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)
index 01601717b218befb5b00759673644a4f8483b77a..5c3ca5a9999c67f20b599fb0e248cdea49a26b7a 100644 (file)
@@ -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)