From 176b480f5326aae6466db9d46f11c94c449d24ff Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Fri, 9 Dec 2016 14:28:01 +0100 Subject: [PATCH] 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 --- doc/source/userdoc/configuration.guide.rst | 12 +++++++----- etc/sahara/sahara.conf.sample-basic | 2 +- .../notes/neutron-default-a6baf93d857d86b3.yaml | 5 +++++ sahara/config.py | 2 +- sahara/tests/unit/service/test_quotas.py | 2 ++ .../validation/test_cluster_create_validation.py | 14 +++++++++++--- sahara/tests/unit/service/validation/utils.py | 4 +++- sahara/tests/unit/utils/test_ssh_remote.py | 1 + 8 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 releasenotes/notes/neutron-default-a6baf93d857d86b3.yaml diff --git a/doc/source/userdoc/configuration.guide.rst b/doc/source/userdoc/configuration.guide.rst index 39f50b64..727ae524 100644 --- a/doc/source/userdoc/configuration.guide.rst +++ b/doc/source/userdoc/configuration.guide.rst @@ -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 diff --git a/etc/sahara/sahara.conf.sample-basic b/etc/sahara/sahara.conf.sample-basic index 96adf76c..863b8c5f 100644 --- a/etc/sahara/sahara.conf.sample-basic +++ b/etc/sahara/sahara.conf.sample-basic @@ -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) diff --git a/releasenotes/notes/neutron-default-a6baf93d857d86b3.yaml b/releasenotes/notes/neutron-default-a6baf93d857d86b3.yaml new file mode 100644 index 00000000..edc5d58e --- /dev/null +++ b/releasenotes/notes/neutron-default-a6baf93d857d86b3.yaml @@ -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. diff --git a/sahara/config.py b/sahara/config.py index db45da73..a8bd4141 100644 --- a/sahara/config.py +++ b/sahara/config.py @@ -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', diff --git a/sahara/tests/unit/service/test_quotas.py b/sahara/tests/unit/service/test_quotas.py index 9ca87f49..06a4251b 100644 --- a/sahara/tests/unit/service/test_quotas.py +++ b/sahara/tests/unit/service/test_quotas.py @@ -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, diff --git a/sahara/tests/unit/service/validation/test_cluster_create_validation.py b/sahara/tests/unit/service/validation/test_cluster_create_validation.py index cf77f77f..5193e095 100644 --- a/sahara/tests/unit/service/validation/test_cluster_create_validation.py +++ b/sahara/tests/unit/service/validation/test_cluster_create_validation.py @@ -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, diff --git a/sahara/tests/unit/service/validation/utils.py b/sahara/tests/unit/service/validation/utils.py index 471487e7..4193deba 100644 --- a/sahara/tests/unit/service/validation/utils.py +++ b/sahara/tests/unit/service/validation/utils.py @@ -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 = { diff --git a/sahara/tests/unit/utils/test_ssh_remote.py b/sahara/tests/unit/utils/test_ssh_remote.py index 73733acb..92412517 100644 --- a/sahara/tests/unit/utils/test_ssh_remote.py +++ b/sahara/tests/unit/utils/test_ssh_remote.py @@ -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):