From 1ae0a4b632425b2f229fd86b9e7730cb4015e60b Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Wed, 18 Feb 2015 12:11:07 +0100 Subject: [PATCH] Moved several services into neutron.cmd.eventlet - dhcp-agent - l3-agent - metadata-agent - metadata-proxy - metering-agent - server This allows us to remove explicit monkey_patch() call. Also removed ability to execute neutron-server avoiding a corresponding entry point. Depends-On: I2d7081dbd4cb532332e3b66667bb8c71aa5a6658 Related-Bug: #1418541 Change-Id: I89e3e8e23374ab1a9a1844b3caaa88e162418546 --- neutron/agent/dhcp_agent.py | 3 --- neutron/agent/l3_agent.py | 3 --- neutron/agent/metadata/namespace_proxy.py | 3 --- neutron/agent/metadata_agent.py | 3 --- neutron/cmd/eventlet/agents/__init__.py | 0 neutron/cmd/eventlet/agents/dhcp.py | 17 +++++++++++++++++ neutron/cmd/eventlet/agents/l3.py | 17 +++++++++++++++++ neutron/cmd/eventlet/agents/metadata.py | 17 +++++++++++++++++ neutron/cmd/eventlet/agents/metadata_proxy.py | 17 +++++++++++++++++ neutron/cmd/eventlet/server/__init__.py | 17 +++++++++++++++++ neutron/cmd/eventlet/services/__init__.py | 0 neutron/cmd/eventlet/services/metering_agent.py | 17 +++++++++++++++++ neutron/server/__init__.py | 6 ------ .../services/metering/agents/metering_agent.py | 3 --- setup.cfg | 12 ++++++------ 15 files changed, 108 insertions(+), 27 deletions(-) create mode 100644 neutron/cmd/eventlet/agents/__init__.py create mode 100644 neutron/cmd/eventlet/agents/dhcp.py create mode 100644 neutron/cmd/eventlet/agents/l3.py create mode 100644 neutron/cmd/eventlet/agents/metadata.py create mode 100644 neutron/cmd/eventlet/agents/metadata_proxy.py create mode 100644 neutron/cmd/eventlet/server/__init__.py create mode 100644 neutron/cmd/eventlet/services/__init__.py create mode 100644 neutron/cmd/eventlet/services/metering_agent.py diff --git a/neutron/agent/dhcp_agent.py b/neutron/agent/dhcp_agent.py index 0e7564511..c6cc7ad60 100644 --- a/neutron/agent/dhcp_agent.py +++ b/neutron/agent/dhcp_agent.py @@ -16,9 +16,6 @@ import sys -import eventlet -eventlet.monkey_patch() - from oslo_config import cfg from neutron.agent.common import config diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index 8a8f31904..665f6b455 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -16,9 +16,6 @@ import sys -import eventlet -eventlet.monkey_patch() - from oslo_config import cfg from neutron.agent.common import config diff --git a/neutron/agent/metadata/namespace_proxy.py b/neutron/agent/metadata/namespace_proxy.py index 05b34ba65..3bf465acb 100644 --- a/neutron/agent/metadata/namespace_proxy.py +++ b/neutron/agent/metadata/namespace_proxy.py @@ -15,9 +15,6 @@ import httplib import socket -import eventlet -eventlet.monkey_patch() - import httplib2 from oslo_config import cfg import six.moves.urllib.parse as urlparse diff --git a/neutron/agent/metadata_agent.py b/neutron/agent/metadata_agent.py index 407b157b3..a6cec3a28 100644 --- a/neutron/agent/metadata_agent.py +++ b/neutron/agent/metadata_agent.py @@ -14,9 +14,6 @@ import sys -import eventlet -eventlet.monkey_patch() - from oslo_config import cfg from neutron.agent.common import config as agent_conf diff --git a/neutron/cmd/eventlet/agents/__init__.py b/neutron/cmd/eventlet/agents/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron/cmd/eventlet/agents/dhcp.py b/neutron/cmd/eventlet/agents/dhcp.py new file mode 100644 index 000000000..f1c04cf33 --- /dev/null +++ b/neutron/cmd/eventlet/agents/dhcp.py @@ -0,0 +1,17 @@ +# 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. + +from neutron.agent import dhcp_agent + + +def main(): + dhcp_agent.main() diff --git a/neutron/cmd/eventlet/agents/l3.py b/neutron/cmd/eventlet/agents/l3.py new file mode 100644 index 000000000..e44acd509 --- /dev/null +++ b/neutron/cmd/eventlet/agents/l3.py @@ -0,0 +1,17 @@ +# 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. + +from neutron.agent import l3_agent + + +def main(): + l3_agent.main() diff --git a/neutron/cmd/eventlet/agents/metadata.py b/neutron/cmd/eventlet/agents/metadata.py new file mode 100644 index 000000000..17ad50a01 --- /dev/null +++ b/neutron/cmd/eventlet/agents/metadata.py @@ -0,0 +1,17 @@ +# 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. + +from neutron.agent import metadata_agent + + +def main(): + metadata_agent.main() diff --git a/neutron/cmd/eventlet/agents/metadata_proxy.py b/neutron/cmd/eventlet/agents/metadata_proxy.py new file mode 100644 index 000000000..dc61c1445 --- /dev/null +++ b/neutron/cmd/eventlet/agents/metadata_proxy.py @@ -0,0 +1,17 @@ +# 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. + +from neutron.agent.metadata import namespace_proxy + + +def main(): + namespace_proxy.main() diff --git a/neutron/cmd/eventlet/server/__init__.py b/neutron/cmd/eventlet/server/__init__.py new file mode 100644 index 000000000..bfa256862 --- /dev/null +++ b/neutron/cmd/eventlet/server/__init__.py @@ -0,0 +1,17 @@ +# 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. + +from neutron import server + + +def main(): + server.main() diff --git a/neutron/cmd/eventlet/services/__init__.py b/neutron/cmd/eventlet/services/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/neutron/cmd/eventlet/services/metering_agent.py b/neutron/cmd/eventlet/services/metering_agent.py new file mode 100644 index 000000000..b5f9b3fa7 --- /dev/null +++ b/neutron/cmd/eventlet/services/metering_agent.py @@ -0,0 +1,17 @@ +# 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. + +from neutron.services.metering.agents import metering_agent + + +def main(): + metering_agent.main() diff --git a/neutron/server/__init__.py b/neutron/server/__init__.py index 81f430310..8f286fbdb 100755 --- a/neutron/server/__init__.py +++ b/neutron/server/__init__.py @@ -21,8 +21,6 @@ import sys import eventlet -eventlet.monkey_patch() - from oslo_config import cfg from neutron.common import config @@ -63,7 +61,3 @@ def main(): pass except RuntimeError as e: sys.exit(_("ERROR: %s") % e) - - -if __name__ == "__main__": - main() diff --git a/neutron/services/metering/agents/metering_agent.py b/neutron/services/metering/agents/metering_agent.py index c24606211..5dcc56493 100644 --- a/neutron/services/metering/agents/metering_agent.py +++ b/neutron/services/metering/agents/metering_agent.py @@ -15,9 +15,6 @@ import sys import time -import eventlet -eventlet.monkey_patch() - from oslo_config import cfg import oslo_messaging from oslo_utils import importutils diff --git a/setup.cfg b/setup.cfg index 0a60ec4ee..6cb1a5d46 100644 --- a/setup.cfg +++ b/setup.cfg @@ -94,25 +94,25 @@ console_scripts = neutron-check-nsx-config = neutron.plugins.vmware.check_nsx_config:main neutron-db-manage = neutron.db.migration.cli:main neutron-debug = neutron.debug.shell:main - neutron-dhcp-agent = neutron.agent.dhcp_agent:main + neutron-dhcp-agent = neutron.cmd.eventlet.agents.dhcp:main neutron-hyperv-agent = neutron.plugins.hyperv.agent.hyperv_neutron_agent:main neutron-ibm-agent = neutron.plugins.ibm.agent.sdnve_neutron_agent:main - neutron-l3-agent = neutron.agent.l3_agent:main + neutron-l3-agent = neutron.cmd.eventlet.agents.l3:main neutron-linuxbridge-agent = neutron.plugins.linuxbridge.agent.linuxbridge_neutron_agent:main - neutron-metadata-agent = neutron.agent.metadata_agent:main + neutron-metadata-agent = neutron.cmd.eventlet.agents.metadata:main neutron-mlnx-agent = neutron.plugins.mlnx.agent.eswitch_neutron_agent:main neutron-nec-agent = neutron.plugins.nec.agent.nec_neutron_agent:main neutron-netns-cleanup = neutron.cmd.netns_cleanup:main - neutron-ns-metadata-proxy = neutron.agent.metadata.namespace_proxy:main + neutron-ns-metadata-proxy = neutron.cmd.eventlet.agents.metadata_proxy:main neutron-nsx-manage = neutron.plugins.vmware.shell:main neutron-nvsd-agent = neutron.plugins.oneconvergence.agent.nvsd_neutron_agent:main neutron-openvswitch-agent = neutron.plugins.openvswitch.agent.ovs_neutron_agent:main neutron-ovs-cleanup = neutron.cmd.ovs_cleanup:main neutron-restproxy-agent = neutron.plugins.bigswitch.agent.restproxy_agent:main - neutron-server = neutron.server:main + neutron-server = neutron.cmd.eventlet.server:main neutron-rootwrap = oslo_rootwrap.cmd:main neutron-usage-audit = neutron.cmd.usage_audit:main - neutron-metering-agent = neutron.services.metering.agents.metering_agent:main + neutron-metering-agent = neutron.cmd.eventlet.services.metering_agent:main neutron-ofagent-agent = neutron.plugins.ofagent.agent.main:main neutron-sriov-nic-agent = neutron.plugins.sriovnicagent.sriov_nic_agent:main neutron-sanity-check = neutron.cmd.sanity_check:main -- 2.45.2