From 216fcb90e86f18588e4e84f618940c4a4e11d1f7 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Tue, 13 Aug 2013 11:28:40 +0100 Subject: [PATCH] Remove use of fake_rabbit in Nova The fake_rabbit config option enables the memory transport for kombu. We use the fake RPC backend for all of our unit testing. As best I can tell, fake_rabbit harks back to a time when it was used for unit testing. The code in nova-dhcpbridge is the only place we explicitly do anything different for this case - i.e. we directly call out to the network manager to manage the IP address leases. When we move to oslo.messaging, we can't rely on this config option because it could be renamed in future. It's hard to imagine a more generic "is the transport going to actually send a message to a remote server" API in oslo.messaging. I don't think anyone uses fake_rabbit anymore. I just don't see how it can be useful to anyone. We should just remove it rather than putting in a bunch of work to retain it with oslo.messaging. blueprint: oslo-messaging Change-Id: I3a8f8a9d3cb6cc6f431d48b4222bde31da767559 --- nova/cmd/dhcpbridge.py | 22 +++++----------------- nova/tests/conf_fixture.py | 1 - 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/nova/cmd/dhcpbridge.py b/nova/cmd/dhcpbridge.py index bbd8df76e0a0..ace7f4632701 100644 --- a/nova/cmd/dhcpbridge.py +++ b/nova/cmd/dhcpbridge.py @@ -45,14 +45,8 @@ LOG = logging.getLogger(__name__) def add_lease(mac, ip_address): """Set the IP that was assigned by the DHCP server.""" - if CONF.fake_rabbit: - LOG.debug(_("leasing ip")) - network_manager = importutils.import_object(CONF.network_manager) - network_manager.lease_fixed_ip(context.get_admin_context(), - ip_address) - else: - api = network_rpcapi.NetworkAPI() - api.lease_fixed_ip(context.get_admin_context(), ip_address, CONF.host) + api = network_rpcapi.NetworkAPI() + api.lease_fixed_ip(context.get_admin_context(), ip_address, CONF.host) def old_lease(mac, ip_address): @@ -65,15 +59,9 @@ def old_lease(mac, ip_address): def del_lease(mac, ip_address): """Called when a lease expires.""" - if CONF.fake_rabbit: - LOG.debug(_("releasing ip")) - network_manager = importutils.import_object(CONF.network_manager) - network_manager.release_fixed_ip(context.get_admin_context(), - ip_address) - else: - api = network_rpcapi.NetworkAPI() - api.release_fixed_ip(context.get_admin_context(), ip_address, - CONF.host) + api = network_rpcapi.NetworkAPI() + api.release_fixed_ip(context.get_admin_context(), ip_address, + CONF.host) def init_leases(network_id): diff --git a/nova/tests/conf_fixture.py b/nova/tests/conf_fixture.py index cdce08931e99..f8e6dda5a70d 100644 --- a/nova/tests/conf_fixture.py +++ b/nova/tests/conf_fixture.py @@ -52,7 +52,6 @@ class ConfFixture(fixtures.Fixture): self.conf.set_default('host', 'fake-mini') self.conf.set_default('compute_driver', 'nova.virt.fake.FakeDriver') self.conf.set_default('fake_network', True) - self.conf.set_default('fake_rabbit', True) self.conf.set_default('flat_network_bridge', 'br100') self.conf.set_default('floating_ip_dns_manager', 'nova.tests.utils.dns_manager')