From 19424403f4a2be4957a86ef269081935f88abc79 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 2 Oct 2019 11:45:23 +0100 Subject: [PATCH] nova-net: Remove 'nova-dhcpbridge' binary There are actually a few things here that rely on a running nova-dhcpbridge instances, but since it's not possible to start nova-network now, that shouldn't matter. Change-Id: I63447baeaac0be3fb7f919bfe588da50133c74d7 Signed-off-by: Stephen Finucane --- doc/source/cli/index.rst | 1 - doc/source/cli/nova-dhcpbridge.rst | 56 ------- doc/source/conf.py | 1 - nova/cmd/dhcpbridge.py | 137 ------------------ .../remove-nova-network-c02953ba72a1795d.yaml | 3 + setup.cfg | 1 - 6 files changed, 3 insertions(+), 196 deletions(-) delete mode 100644 doc/source/cli/nova-dhcpbridge.rst delete mode 100644 nova/cmd/dhcpbridge.py diff --git a/doc/source/cli/index.rst b/doc/source/cli/index.rst index 1ce869fb223e..32699653fdad 100644 --- a/doc/source/cli/index.rst +++ b/doc/source/cli/index.rst @@ -85,6 +85,5 @@ deployments, but are documented for existing ones. .. toctree:: :maxdepth: 1 - nova-dhcpbridge nova-network nova-xvpvncproxy diff --git a/doc/source/cli/nova-dhcpbridge.rst b/doc/source/cli/nova-dhcpbridge.rst deleted file mode 100644 index 9fe5b143b8b8..000000000000 --- a/doc/source/cli/nova-dhcpbridge.rst +++ /dev/null @@ -1,56 +0,0 @@ -=============== -nova-dhcpbridge -=============== - ------------------------------------------------- -Handles Lease Database updates from DHCP servers ------------------------------------------------- - -:Author: openstack@lists.openstack.org -:Copyright: OpenStack Foundation -:Manual section: 1 -:Manual group: cloud computing - -Synopsis -======== - -:: - - nova-dhcpbridge [options] - -Description -=========== - -:program:`nova-dhcpbridge` is an application that handles lease database -updates from DHCP servers. :program:`nova-dhcpbridge` is used whenever nova is -managing DHCP (vlan and flatDHCP). :program:`nova-dhcpbridge` should not be run -as a daemon. - -.. warning:: - - This application is only for use with ``nova-network``, which is not - recommended for new deployments. - -Options -======= - -**General options** - -Files -===== - -* ``/etc/nova/nova.conf`` -* ``/etc/nova/api-paste.ini`` -* ``/etc/nova/policy.json`` -* ``/etc/nova/rootwrap.conf`` -* ``/etc/nova/rootwrap.d/`` - -See Also -======== - -* :nova-doc:`OpenStack Nova <>` - -Bugs -==== - -* Nova bugs are managed at `Launchpad `__ diff --git a/doc/source/conf.py b/doc/source/conf.py index 775509aa6bb1..0206b7763c67 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -86,7 +86,6 @@ _man_pages = [ ('nova-api-os-compute', u'Cloud controller fabric'), ('nova-compute', u'Cloud controller fabric'), ('nova-conductor', u'Cloud controller fabric'), - ('nova-dhcpbridge', u'Cloud controller fabric'), ('nova-manage', u'Cloud controller fabric'), ('nova-network', u'Cloud controller fabric'), ('nova-novncproxy', u'Cloud controller fabric'), diff --git a/nova/cmd/dhcpbridge.py b/nova/cmd/dhcpbridge.py deleted file mode 100644 index 3d3ab9dbad54..000000000000 --- a/nova/cmd/dhcpbridge.py +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# 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. - -""" -Handle lease database updates from DHCP servers. -""" - -from __future__ import print_function - -import os -import sys - -from oslo_config import cfg -from oslo_log import log as logging -from oslo_serialization import jsonutils -from oslo_utils import importutils - -from nova.cmd import common as cmd_common -from nova.conductor import rpcapi as conductor_rpcapi -import nova.conf -from nova import config -from nova import context -from nova.network import rpcapi as network_rpcapi -from nova import objects -from nova.objects import base as objects_base -from nova import rpc - -CONF = nova.conf.CONF -LOG = logging.getLogger(__name__) - - -def add_lease(mac, ip_address): - """Set the IP that was assigned by the DHCP server.""" - api = network_rpcapi.NetworkAPI() - api.lease_fixed_ip(context.get_admin_context(), ip_address, CONF.host) - - -def old_lease(mac, ip_address): - """Called when an old lease is recognized.""" - # NOTE(vish): We assume we heard about this lease the first time. - # If not, we will get it the next time the lease is - # renewed. - pass - - -def del_lease(mac, ip_address): - """Called when a lease expires.""" - api = network_rpcapi.NetworkAPI() - api.release_fixed_ip(context.get_admin_context(), ip_address, - CONF.host, mac) - - -def init_leases(network_id): - """Get the list of hosts for a network.""" - ctxt = context.get_admin_context() - network = objects.Network.get_by_id(ctxt, network_id) - network_manager = importutils.import_object(CONF.network_manager) - return network_manager.get_dhcp_leases(ctxt, network) - - -def add_action_parsers(subparsers): - subparsers.add_parser('init') - - # NOTE(cfb): dnsmasq always passes mac, and ip. hostname - # is passed if known. We don't care about - # hostname, but argparse will complain if we - # do not accept it. - actions = { - 'add': add_lease, - 'del': del_lease, - 'old': old_lease, - } - for action, func in actions.items(): - parser = subparsers.add_parser(action) - parser.add_argument('mac') - parser.add_argument('ip') - parser.add_argument('hostname', nargs='?', default='') - parser.set_defaults(func=func) - - -CONF.register_cli_opt( - cfg.SubCommandOpt('action', - title='Action options', - help='Available dhcpbridge options', - handler=add_action_parsers)) - - -def main(): - """Parse environment and arguments and call the appropriate action.""" - config.parse_args(sys.argv, - default_config_files=jsonutils.loads(os.environ['CONFIG_FILE'])) - - logging.setup(CONF, "nova") - global LOG - LOG = logging.getLogger('nova.dhcpbridge') - - if CONF.action.name == 'old': - # NOTE(sdague): old is the most frequent message sent, and - # it's a noop. We should just exit immediately otherwise we - # can stack up a bunch of requests in dnsmasq. A SIGHUP seems - # to dump this list, so actions queued up get lost. - return - - objects.register_all() - - cmd_common.block_db_access('nova-dhcpbridge') - objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI() - - if CONF.action.name in ['add', 'del']: - LOG.debug("Called '%(action)s' for mac '%(mac)s' with IP '%(ip)s'", - {"action": CONF.action.name, - "mac": CONF.action.mac, - "ip": CONF.action.ip}) - CONF.action.func(CONF.action.mac, CONF.action.ip) - else: - try: - network_id = int(os.environ.get('NETWORK_ID')) - except TypeError: - LOG.error("Environment variable 'NETWORK_ID' must be set.") - return 1 - - print(init_leases(network_id)) - - rpc.cleanup() diff --git a/releasenotes/notes/remove-nova-network-c02953ba72a1795d.yaml b/releasenotes/notes/remove-nova-network-c02953ba72a1795d.yaml index c56ce87b79c7..459465538977 100644 --- a/releasenotes/notes/remove-nova-network-c02953ba72a1795d.yaml +++ b/releasenotes/notes/remove-nova-network-c02953ba72a1795d.yaml @@ -51,3 +51,6 @@ upgrade: These were only useful for the now-removed *nova-network* service and have been deprecated since the 15.0.0 (Ocata) release. + - | + The ``nova-dhcpbridge`` service has been removed. This was only used with + the now-removed *nova-network* service. diff --git a/setup.cfg b/setup.cfg index db858c746f80..ddab9deaf349 100644 --- a/setup.cfg +++ b/setup.cfg @@ -66,7 +66,6 @@ console_scripts = nova-api-os-compute = nova.cmd.api_os_compute:main nova-compute = nova.cmd.compute:main nova-conductor = nova.cmd.conductor:main - nova-dhcpbridge = nova.cmd.dhcpbridge:main nova-manage = nova.cmd.manage:main nova-network = nova.cmd.network:main nova-novncproxy = nova.cmd.novncproxy:main