]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Enable Guru Meditation Reports for other refarch agents
authorIhar Hrachyshka <ihrachys@redhat.com>
Thu, 17 Dec 2015 13:38:08 +0000 (14:38 +0100)
committerIhar Hrachyshka <ihrachys@redhat.com>
Fri, 18 Dec 2015 22:04:56 +0000 (22:04 +0000)
OVS agent already supports GMR, but LinuxBridge and SR-IOV agents don't.
To enable them for those agents, we should move their main() entry
points under neutron/cmd/, so that __init__.py code that initializes
them is triggered on their invocation.

Since we put their entrypoints under neutron/cmd/eventlet/, there is now
also no need to explicitly monkey patch stdlib for eventlet in the
agents code (neutron/cmd/eventlet/__init__.py already does it for us).
With that, there is no more code in the tree that directly patches
stdlib except neutron/cmd/eventlet/__init__.py.

Also removed a way to execute agent modules as scripts since it's not a
supported way to invoke them (instead, stevedore generated console
scripts should always be used).

Change-Id: I9b823d07a41b575334e52065eed7e6be2741e79d
Implements: blueprint guru-meditation-report

neutron/cmd/eventlet/plugins/linuxbridge_neutron_agent.py [new file with mode: 0644]
neutron/cmd/eventlet/plugins/sriov_nic_neutron_agent.py [new file with mode: 0644]
neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py
neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py
setup.cfg

diff --git a/neutron/cmd/eventlet/plugins/linuxbridge_neutron_agent.py b/neutron/cmd/eventlet/plugins/linuxbridge_neutron_agent.py
new file mode 100644 (file)
index 0000000..2ffc230
--- /dev/null
@@ -0,0 +1,21 @@
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import \
+    neutron.plugins.ml2.drivers.linuxbridge.agent.linuxbridge_neutron_agent \
+    as agent_main
+
+
+def main():
+    agent_main.main()
diff --git a/neutron/cmd/eventlet/plugins/sriov_nic_neutron_agent.py b/neutron/cmd/eventlet/plugins/sriov_nic_neutron_agent.py
new file mode 100644 (file)
index 0000000..7695fc4
--- /dev/null
@@ -0,0 +1,20 @@
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import neutron.plugins.ml2.drivers.mech_sriov.agent.sriov_nic_agent \
+        as agent_main
+
+
+def main():
+    agent_main.main()
index 00fc6ac3f4fae921cd89e163efd5ea230870b56c..a826136adcb256ddc3a4a94ac01c912a1b2ee79b 100644 (file)
@@ -22,9 +22,6 @@
 import sys
 import time
 
-import eventlet
-eventlet.monkey_patch()
-
 import netaddr
 from oslo_config import cfg
 from oslo_log import log as logging
@@ -1145,7 +1142,3 @@ def main():
     LOG.info(_LI("Agent initialized successfully, now running... "))
     launcher = service.launch(cfg.CONF, agent)
     launcher.wait()
-
-
-if __name__ == "__main__":
-    main()
index 6268009b8442672894d39c3bf9037bfba208450c..fd48c5e71078f288365489490b07950925f5a1a0 100644 (file)
@@ -18,9 +18,6 @@ import socket
 import sys
 import time
 
-import eventlet
-eventlet.monkey_patch()
-
 from oslo_config import cfg
 from oslo_log import log as logging
 import oslo_messaging
@@ -411,7 +408,3 @@ def main():
     # Start everything.
     LOG.info(_LI("Agent initialized successfully, now running... "))
     agent.daemon_loop()
-
-
-if __name__ == '__main__':
-    main()
index 66ad544c5f6e7b752f9d52851fa7e963188025cd..9dc75d6d149b13d3df83874d23a1a1cc24356620 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -48,7 +48,7 @@ console_scripts =
     neutron-keepalived-state-change = neutron.cmd.keepalived_state_change:main
     neutron-ipset-cleanup = neutron.cmd.ipset_cleanup:main
     neutron-l3-agent = neutron.cmd.eventlet.agents.l3:main
-    neutron-linuxbridge-agent = neutron.plugins.ml2.drivers.linuxbridge.agent.linuxbridge_neutron_agent:main
+    neutron-linuxbridge-agent = neutron.cmd.eventlet.plugins.linuxbridge_neutron_agent:main
     neutron-linuxbridge-cleanup = neutron.cmd.linuxbridge_cleanup:main
     neutron-metadata-agent = neutron.cmd.eventlet.agents.metadata:main
     neutron-netns-cleanup = neutron.cmd.netns_cleanup:main
@@ -63,7 +63,7 @@ console_scripts =
     neutron-rootwrap-daemon = oslo_rootwrap.cmd:daemon
     neutron-usage-audit = neutron.cmd.eventlet.usage_audit:main
     neutron-metering-agent = neutron.cmd.eventlet.services.metering_agent:main
-    neutron-sriov-nic-agent = neutron.plugins.ml2.drivers.mech_sriov.agent.sriov_nic_agent:main
+    neutron-sriov-nic-agent = neutron.cmd.eventlet.plugins.sriov_nic_neutron_agent:main
     neutron-sanity-check = neutron.cmd.sanity_check:main
 neutron.core_plugins =
     ml2 = neutron.plugins.ml2.plugin:Ml2Plugin