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
This commit is contained in:
Matt Riedemann 2017-01-02 13:29:39 -05:00
parent 41b4e456ef
commit 6627de4aa5
12 changed files with 29 additions and 28 deletions

View File

@ -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="""

View File

@ -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()

View File

@ -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()

View File

@ -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))

View File

@ -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')

View File

@ -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'))

View File

@ -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')

View File

@ -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())

View File

@ -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}

View File

@ -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

View File

@ -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'))

View File

@ -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.