Switch use_neutron=true by default

The old nova-network was deprecated in Newton and, according nova
release notes, no longer supported for regular deployment in Ocata.

Change the unit tests with the assumption that neutron is the default.

Change-Id: I67b23fe8797425bf47e4b2370fb82885b74318ae
This commit is contained in:
Luigi Toscano 2016-12-09 14:28:01 +01:00
parent 5de5e9b306
commit 176b480f53
8 changed files with 31 additions and 11 deletions

View File

@ -73,11 +73,9 @@ be set to DEBUG. By default the sahara's log level is set to WARNING.
Networking configuration
------------------------
By default sahara is configured to use the nova-network implementation
of OpenStack Networking. If an OpenStack cluster uses neutron,
then the ``use_neutron`` parameter should be set to ``True`` in the
sahara configuration file. Additionally, if the cluster supports network
namespaces the ``use_namespaces`` property can be used to enable their usage.
By default sahara is configured to use the neutron. Additionally, if the
cluster supports network namespaces the ``use_namespaces`` property can
be used to enable their usage.
.. sourcecode:: cfg
@ -90,6 +88,10 @@ namespaces the ``use_namespaces`` property can be used to enable their usage.
instance and namespaces are used, some additional configuration is
required, please see :ref:`non-root-users` for more information.
If an OpenStack cluster uses the deprecated nova-network,
then the ``use_neutron`` parameter should be set to ``False`` in the
sahara configuration file.
.. _floating_ip_management:
Floating IP management

View File

@ -16,7 +16,7 @@
#use_floating_ips=true
# Use Neutron or Nova Network (boolean value)
#use_neutron=false
#use_neutron=true
# Use network namespaces for communication (only valid to use in conjunction
# with use_neutron=True)

View File

@ -0,0 +1,5 @@
---
upgrade:
- Neutron is used by default now (use_neutron=True).
Nova-network is not functionaly for most use cases
starting from Ocata.

View File

@ -78,7 +78,7 @@ networking_opts = [
help="The suffix of the node's FQDN. In nova-network that is "
"the dhcp_domain config parameter."),
cfg.BoolOpt('use_neutron',
default=False,
default=True,
help="Use Neutron Networking (False indicates the use of Nova "
"networking)."),
cfg.BoolOpt('use_namespaces',

View File

@ -221,6 +221,7 @@ class TestQuotas(base.SaharaTestCase):
@mock.patch('sahara.utils.openstack.nova.client',
return_value=FakeNovaClient(nova_limits))
def test_get_nova_limits(self, nova):
self.override_config('use_neutron', False)
self.assertEqual(
{'cpu': 10, 'floatingips': 200,
'instances': 3, 'ram': 9, 'security_group_rules': 'unlimited',
@ -238,6 +239,7 @@ class TestQuotas(base.SaharaTestCase):
@mock.patch('sahara.utils.openstack.neutron.client',
return_value=FakeNeutronClient(neutron_limits))
def test_neutron_limits(self, neutron):
self.override_config('use_neutron', False)
self.assertEqual({}, quotas._get_neutron_limits())
self.override_config('use_neutron', True)
self.assertEqual({'floatingips': 2340,

View File

@ -158,6 +158,7 @@ class TestClusterCreateValidation(u.ValidationTestCase):
)
def test_cluster_create_mixed_nova_neutron(self):
self.override_config("use_neutron", False)
self._assert_create_object_validation(
data={
'name': "test-name",
@ -378,7 +379,6 @@ class TestClusterCreateValidation(u.ValidationTestCase):
)
def test_cluster_create_availability_zone(self):
self.override_config('use_neutron', True)
self._assert_create_object_validation(
data={
'name': 'testname',
@ -407,7 +407,6 @@ class TestClusterCreateValidation(u.ValidationTestCase):
)
def test_cluster_create_wrong_availability_zone(self):
self.override_config('use_neutron', True)
self._assert_create_object_validation(
data={
'name': 'testname',
@ -435,7 +434,6 @@ class TestClusterCreateValidation(u.ValidationTestCase):
)
def test_cluster_create_wrong_volumes_availability_zone(self):
self.override_config('use_neutron', True)
self._assert_create_object_validation(
data={
'name': 'testname',
@ -532,6 +530,8 @@ class TestClusterCreateFlavorValidation(base.SaharaWithDbTestCase):
"plugin_name": "fake",
"hadoop_version": "0.1",
"cluster_template_id": '%s' % ctmpl_id,
"neutron_management_network": "d9a3bebc-f788-4b81-"
"9a93-aa048022c1ca",
'default_image_id': '550e8400-e29b-41d4-a716-446655440000'
}
patchers = u.start_patch(False)
@ -542,6 +542,8 @@ class TestClusterCreateFlavorValidation(base.SaharaWithDbTestCase):
"name": "testwithnodegroups",
"plugin_name": "fake",
"hadoop_version": "0.1",
"neutron_management_network": "d9a3bebc-f788-4b81-"
"9a93-aa048022c1ca",
"node_groups": [
{
"name": "allinone",
@ -576,6 +578,8 @@ class TestClusterCreateFlavorValidation(base.SaharaWithDbTestCase):
"name": "testwithnodegroups",
"plugin_name": "fake",
"hadoop_version": "0.1",
"neutron_management_network": "d9a3bebc-f788-4b81-"
"9a93-aa048022c1ca",
"node_groups": [
{
"name": "allinone",
@ -614,6 +618,8 @@ class TestClusterCreateFlavorValidation(base.SaharaWithDbTestCase):
"plugin_name": "fake",
"hadoop_version": "0.1",
"cluster_template_id": '%s' % ctmpl_id,
"neutron_management_network": "d9a3bebc-f788-4b81-"
"9a93-aa048022c1ca",
'default_image_id': '550e8400-e29b-41d4-a716-446655440000',
"node_groups": [
{
@ -639,6 +645,8 @@ class TestClusterCreateFlavorValidation(base.SaharaWithDbTestCase):
"name": "testtmplnodegroups",
"plugin_name": "fake",
"hadoop_version": "0.1",
"neutron_management_network": "d9a3bebc-f788-4b81-"
"9a93-aa048022c1ca",
"node_groups": [
{
"node_group_template_id": '%s' % ng_id,

View File

@ -422,7 +422,9 @@ class ValidationTestCase(base.SaharaTestCase):
'plugin_name': 'fake',
'hadoop_version': '0.1',
'default_image_id': '550e8400-e29b-41d4-a716-446655440000',
'domain_name': 'domain.org.'
'domain_name': 'domain.org.',
'neutron_management_network': 'd9a3bebc-f788-4b81-'
'9a93-aa048022c1ca'
}
self._assert_create_object_validation(data=data)
data = {

View File

@ -159,6 +159,7 @@ class FakeNodeGroup(object):
def __init__(self, user, priv_key):
self.image_username = user
self.cluster = FakeCluster(priv_key)
self.floating_ip_pool = 'public'
class FakeInstance(object):