From 6627de4aa55110989b4b976ae794f3d8a3deb797 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Mon, 2 Jan 2017 13:29:39 -0500 Subject: [PATCH] Enable Neutron by default This changes the use_neutron configuration option default value to True. nova-network has been deprecated since Newton and only runs in a cells v1 configuration now, so it's time to make Neutron the default configuration for new Nova deployments. As far as testing, the unit tests have already been taken care of for use_neutron=True by default. There are several functional tests which are converted over to using Neutron via the fixture in this change. However, the legacy API samples functional tests were written with nova-network stubs so it will take some time to convert over to using Neutron stubs. This patch does not attempt to clean all of those up and just configures nova-network by default. The remaining tests will need to be converted to using Neutron in a later series of changes. Depends-On: I82721b5d10711401b9b0ebc2b0ed07cc8287bbf7 Implements blueprint use-neutron-by-default Change-Id: I8388c29ad310cd8800084b4d5c026013158bfbed --- nova/conf/network.py | 2 +- .../functional/api_sample_tests/test_security_groups.py | 2 +- nova/tests/functional/integrated_helpers.py | 7 +++++++ nova/tests/functional/regressions/test_bug_1522536.py | 7 +------ nova/tests/functional/regressions/test_bug_1548980.py | 7 +------ nova/tests/functional/regressions/test_bug_1558866.py | 1 + nova/tests/functional/regressions/test_bug_1595962.py | 8 ++------ nova/tests/functional/regressions/test_bug_1620248.py | 5 +---- nova/tests/functional/test_metadata.py | 3 +++ nova/tests/functional/test_server_group.py | 5 +---- nova/tests/functional/wsgi/test_servers.py | 1 + .../ocata-use-neutron-by-default-7a836e65e1c3ccaf.yaml | 9 +++++++++ 12 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 releasenotes/notes/ocata-use-neutron-by-default-7a836e65e1c3ccaf.yaml diff --git a/nova/conf/network.py b/nova/conf/network.py index 3995327417fe..7b22afe60bb2 100644 --- a/nova/conf/network.py +++ b/nova/conf/network.py @@ -486,7 +486,7 @@ with the name 'share_address'. # NOTE(stephenfin): This should move to True for a cycle before being # removed. cfg.BoolOpt('use_neutron', - default=False, + default=True, deprecated_for_removal=True, deprecated_since='15.0.0', deprecated_reason=""" diff --git a/nova/tests/functional/api_sample_tests/test_security_groups.py b/nova/tests/functional/api_sample_tests/test_security_groups.py index 8988bc426505..0f9d96f3144b 100644 --- a/nova/tests/functional/api_sample_tests/test_security_groups.py +++ b/nova/tests/functional/api_sample_tests/test_security_groups.py @@ -60,9 +60,9 @@ def fake_create_security_group(self, context, name, description): class SecurityGroupsJsonTest(test_servers.ServersSampleBase): sample_dir = 'os-security-groups' + USE_NEUTRON = True def setUp(self): - self.flags(use_neutron=True) self.neutron = fixtures.NeutronFixture(self) self.useFixture(self.neutron) super(SecurityGroupsJsonTest, self).setUp() diff --git a/nova/tests/functional/integrated_helpers.py b/nova/tests/functional/integrated_helpers.py index be40118da408..c12d7a8a6e5b 100644 --- a/nova/tests/functional/integrated_helpers.py +++ b/nova/tests/functional/integrated_helpers.py @@ -63,11 +63,18 @@ def generate_new_element(items, prefix, numeric=False): class _IntegratedTestBase(test.TestCase): REQUIRES_LOCKING = True ADMIN_API = False + # Override this in subclasses which use the NeutronFixture. New tests + # should rely on Neutron since nova-network is deprecated. The default + # value of False here is only temporary while we update the existing + # functional tests to use Neutron. + USE_NEUTRON = False def setUp(self): super(_IntegratedTestBase, self).setUp() self.flags(verbose=True) + # TODO(mriedem): Fix the functional tests to work with Neutron. + self.flags(use_neutron=self.USE_NEUTRON) nova.tests.unit.image.fake.stub_out_image_service(self) self._setup_services() diff --git a/nova/tests/functional/regressions/test_bug_1522536.py b/nova/tests/functional/regressions/test_bug_1522536.py index 237b7e0ca8f6..3a2c864d882d 100644 --- a/nova/tests/functional/regressions/test_bug_1522536.py +++ b/nova/tests/functional/regressions/test_bug_1522536.py @@ -12,8 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - import nova.scheduler.utils import nova.servicegroup from nova import test @@ -23,8 +21,6 @@ from nova.tests.unit import cast_as_call import nova.tests.unit.image.fake from nova.tests.unit import policy_fixture -CONF = cfg.CONF - class TestServerGet(test.TestCase): REQUIRES_LOCKING = True @@ -32,6 +28,7 @@ class TestServerGet(test.TestCase): def setUp(self): super(TestServerGet, self).setUp() self.useFixture(policy_fixture.RealPolicyFixture()) + self.useFixture(nova_fixtures.NeutronFixture(self)) api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( api_version='v2.1')) @@ -43,8 +40,6 @@ class TestServerGet(test.TestCase): self.start_service('conductor') self.flags(driver='chance_scheduler', group='scheduler') self.start_service('scheduler') - self.network = self.start_service('network', - manager=CONF.network_manager) self.compute = self.start_service('compute') self.useFixture(cast_as_call.CastAsCall(self.stubs)) diff --git a/nova/tests/functional/regressions/test_bug_1548980.py b/nova/tests/functional/regressions/test_bug_1548980.py index 2d7d79c9cde5..5dfbe0098313 100644 --- a/nova/tests/functional/regressions/test_bug_1548980.py +++ b/nova/tests/functional/regressions/test_bug_1548980.py @@ -14,8 +14,6 @@ import time -from oslo_config import cfg - import nova.scheduler.utils import nova.servicegroup from nova import test @@ -25,8 +23,6 @@ from nova.tests.unit import cast_as_call import nova.tests.unit.image.fake from nova.tests.unit import policy_fixture -CONF = cfg.CONF - class TestServerGet(test.TestCase): REQUIRES_LOCKING = True @@ -34,6 +30,7 @@ class TestServerGet(test.TestCase): def setUp(self): super(TestServerGet, self).setUp() self.useFixture(policy_fixture.RealPolicyFixture()) + self.useFixture(nova_fixtures.NeutronFixture(self)) api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( api_version='v2.1')) @@ -51,8 +48,6 @@ class TestServerGet(test.TestCase): self.start_service('conductor') self.flags(driver='chance_scheduler', group='scheduler') self.start_service('scheduler') - self.network = self.start_service('network', - manager=CONF.network_manager) self.compute = self.start_service('compute') self.consoleauth = self.start_service('consoleauth') diff --git a/nova/tests/functional/regressions/test_bug_1558866.py b/nova/tests/functional/regressions/test_bug_1558866.py index 495e9063f43f..9f2ab46e4129 100644 --- a/nova/tests/functional/regressions/test_bug_1558866.py +++ b/nova/tests/functional/regressions/test_bug_1558866.py @@ -29,6 +29,7 @@ class TestServerGet(test.TestCase): def setUp(self): super(TestServerGet, self).setUp() self.useFixture(policy_fixture.RealPolicyFixture()) + self.useFixture(nova_fixtures.NeutronFixture(self)) api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( api_version='v2.1')) diff --git a/nova/tests/functional/regressions/test_bug_1595962.py b/nova/tests/functional/regressions/test_bug_1595962.py index fb32a18b35ee..71368bcb9e85 100644 --- a/nova/tests/functional/regressions/test_bug_1595962.py +++ b/nova/tests/functional/regressions/test_bug_1595962.py @@ -17,7 +17,7 @@ import time import fixtures import mock -import nova.conf +import nova from nova import test from nova.tests import fixtures as nova_fixtures from nova.tests.unit import cast_as_call @@ -27,15 +27,13 @@ from nova.tests.unit.virt.libvirt import fakelibvirt from nova.virt.libvirt import guest as libvirt_guest -CONF = nova.conf.CONF - - class TestSerialConsoleLiveMigrate(test.TestCase): REQUIRES_LOCKING = True def setUp(self): super(TestSerialConsoleLiveMigrate, self).setUp() self.useFixture(policy_fixture.RealPolicyFixture()) + self.useFixture(nova_fixtures.NeutronFixture(self)) api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( api_version='v2.1')) # Replace libvirt with fakelibvirt @@ -70,8 +68,6 @@ class TestSerialConsoleLiveMigrate(test.TestCase): self.start_service('conductor') self.flags(driver='chance_scheduler', group='scheduler') self.start_service('scheduler') - self.network = self.start_service('network', - manager=CONF.network_manager) self.compute = self.start_service('compute', host='test_compute1') self.consoleauth = self.start_service('consoleauth') diff --git a/nova/tests/functional/regressions/test_bug_1620248.py b/nova/tests/functional/regressions/test_bug_1620248.py index f787b7be6f4d..8bcc606ef6d2 100644 --- a/nova/tests/functional/regressions/test_bug_1620248.py +++ b/nova/tests/functional/regressions/test_bug_1620248.py @@ -10,16 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg - from nova import test from nova.tests import fixtures as nova_fixtures from nova.tests.unit import cast_as_call import nova.tests.unit.image.fake from nova.tests.unit import policy_fixture -CONF = cfg.CONF - class TestServerUpdate(test.TestCase): REQUIRES_LOCKING = True @@ -27,6 +23,7 @@ class TestServerUpdate(test.TestCase): def setUp(self): super(TestServerUpdate, self).setUp() self.useFixture(policy_fixture.RealPolicyFixture()) + self.useFixture(nova_fixtures.NeutronFixture(self)) # Simulate requests coming in before the instance is scheduled by # using a no-op for conductor build_instances self.useFixture(nova_fixtures.NoopConductorFixture()) diff --git a/nova/tests/functional/test_metadata.py b/nova/tests/functional/test_metadata.py index 0ebf369e3f5b..1e7ff1e92988 100644 --- a/nova/tests/functional/test_metadata.py +++ b/nova/tests/functional/test_metadata.py @@ -68,6 +68,9 @@ class MetadataTest(test.TestCase): # NOTE(mikal): We could create a network and a fixed IP here, but it # turns out to be heaps of fiddly boiler plate code, so let's just # fake it and hope mriedem doesn't notice. + # TODO(mriedem): Make this all work with the Neutron fixture. + self.flags(use_neutron=False) + def fake_get_fixed_ip_by_address(self, ctxt, address): return {'instance_uuid': instance.uuid} diff --git a/nova/tests/functional/test_server_group.py b/nova/tests/functional/test_server_group.py index 7c9335f9b5b8..0e75973de942 100644 --- a/nova/tests/functional/test_server_group.py +++ b/nova/tests/functional/test_server_group.py @@ -16,7 +16,6 @@ import time import mock -from oslo_config import cfg from nova import context from nova import db @@ -32,8 +31,6 @@ import nova.scheduler.utils import nova.servicegroup import nova.tests.unit.image.fake -CONF = cfg.CONF - # An alternate project id PROJECT_ID_ALT = "616c6c796f7572626173656172656f73" @@ -70,6 +67,7 @@ class ServerGroupTestBase(test.TestCase, self.flags(report_interval=self._report_interval) self.useFixture(policy_fixture.RealPolicyFixture()) + self.useFixture(nova_fixtures.NeutronFixture(self)) api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( api_version='v2.1')) @@ -111,7 +109,6 @@ class ServerGroupTestV21(ServerGroupTestBase): def setUp(self): super(ServerGroupTestV21, self).setUp() - self.start_service('network', manager=CONF.network_manager) self.compute = self.start_service('compute') # NOTE(gibi): start a second compute host to be able to test affinity diff --git a/nova/tests/functional/wsgi/test_servers.py b/nova/tests/functional/wsgi/test_servers.py index 63a6f026ddcc..964e09e8592f 100644 --- a/nova/tests/functional/wsgi/test_servers.py +++ b/nova/tests/functional/wsgi/test_servers.py @@ -38,6 +38,7 @@ class ServersPreSchedulingTestCase(test.TestCase): fake_image.stub_out_image_service(self) self.useFixture(policy_fixture.RealPolicyFixture()) self.useFixture(nova_fixtures.NoopConductorFixture()) + self.useFixture(nova_fixtures.NeutronFixture(self)) api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( api_version='v2.1')) diff --git a/releasenotes/notes/ocata-use-neutron-by-default-7a836e65e1c3ccaf.yaml b/releasenotes/notes/ocata-use-neutron-by-default-7a836e65e1c3ccaf.yaml new file mode 100644 index 000000000000..0d437c28b2c6 --- /dev/null +++ b/releasenotes/notes/ocata-use-neutron-by-default-7a836e65e1c3ccaf.yaml @@ -0,0 +1,9 @@ +--- +prelude: > + Neutron is now the default configuration for new deployments. +upgrade: + - | + The nova-network service was deprecated in the 14.0.0 Newton release. In + the 15.0.0 Ocata release, nova-network will only work in a Cells v1 + deployment. The Neutron networking service is now the default configuration + for new deployments based on the ``use_neutron`` configuration option.