Remove Neutron init from post-deployment init

The post-deployment init always creates a default-net tenant network,
a router and an ext-net external network. While this is good for demo
purposes they are not needed in a production environment for naming
or functional reasons and first thing that an operator does is to delete them.

You might not need the default router. For instance if you want to test vlan
provider networks. But the init creates the ext-net network and default router
though they are not needed.

It generates confusion when using network isolation. You have to specify
floating ip cidr, floating ip start, floating ip end, bm network gateway,
that match the external network settings set up in the network isolation
yaml file in order to get working connectivity. And you may end up deleting
them right after init finishes so you get a bad user experience.

Closes-bug: https://bugzilla.redhat.com/show_bug.cgi?id=1243056
Change-Id: Iddfcc39498ce1ac991b103df0b32b49f074deb34
This commit is contained in:
Ana Krivokapic 2015-07-14 18:19:44 +02:00
parent f1363b41e7
commit 9815b73eb5
2 changed files with 1 additions and 80 deletions

View File

@ -20,9 +20,7 @@ from django.utils.translation import ugettext_lazy as _
import horizon.exceptions
import horizon.forms
import horizon.messages
from neutronclient.common import exceptions as neutron_exceptions
from os_cloud_config import keystone as keystone_config
from os_cloud_config import neutron as neutron_config
from os_cloud_config.utils import clients
from tuskar_ui import api
@ -360,22 +358,6 @@ class PostDeployInit(horizon.forms.SelfHandlingForm):
label=_("Public Host"), initial="", required=False)
region = horizon.forms.CharField(
label=_("Region"), initial="regionOne")
float_allocation_start = horizon.forms.CharField(
label=_("Float Allocation Start"), initial="10.0.0.2")
float_allocation_end = horizon.forms.CharField(
label=_("Float Allocation End"), initial="10.255.255.254")
float_cidr = horizon.forms.CharField(
label=_("Float CIDR"), initial="10.0.0.0/8")
overcloud_nameserver = horizon.forms.CharField(
label=_("Overcloud Nameserver"), initial="8.8.8.8")
external_allocation_start = horizon.forms.CharField(
label=_("External Allocation Start"), initial="172.17.0.45")
external_allocation_end = horizon.forms.CharField(
label=_("External Allocation End"), initial="172.17.0.64")
external_cidr = horizon.forms.CharField(
label=_("External CIDR"), initial="172.17.0.0/16")
bm_network_gateway = horizon.forms.CharField(
label=_("Network Gateway"), initial="192.0.2.1")
def build_endpoints(self, plan, controller_role):
return {
@ -413,25 +395,6 @@ class PostDeployInit(horizon.forms.SelfHandlingForm):
'path': WEBROOT,
'admin_path': '%sadmin' % WEBROOT}}
def build_neutron_setup(self, data):
# TODO(lsmola) this is default devtest params, this should probably
# go from Tuskar parameters in the future.
return {
"float": {
"cidr": data['float_cidr'],
"name": "default-net",
"nameserver": data['overcloud_nameserver'],
"allocation_start": data['float_allocation_start'],
"allocation_end": data['float_allocation_end']
},
"external": {
"name": "ext-net",
"allocation_start": data['external_allocation_start'],
"allocation_end": data['external_allocation_end'],
"cidr": data['external_cidr'],
"gateway": data['bm_network_gateway']
}}
def handle(self, request, data):
try:
plan = api.tuskar.Plan.get_the_plan(request)
@ -457,8 +420,6 @@ class PostDeployInit(horizon.forms.SelfHandlingForm):
# retrieve needed Overcloud clients
keystone_client = clients.get_keystone_client(
auth_user, admin_password, auth_tenant, auth_url)
neutron_client = clients.get_neutron_client(
auth_user, admin_password, auth_tenant, auth_url)
# do the setup endpoints
keystone_config.setup_endpoints(
@ -468,16 +429,6 @@ class PostDeployInit(horizon.forms.SelfHandlingForm):
os_auth_url=auth_url,
client=keystone_client)
# do the neutron init
try:
neutron_config.initialize_neutron(
self.build_neutron_setup(data),
neutron_client=neutron_client,
keystone_client=keystone_client)
except neutron_exceptions.BadRequest as e:
LOG.info('Neutron has been already initialized.')
LOG.info(e.message)
except Exception as e:
LOG.exception(e)
horizon.exceptions.handle(request,

View File

@ -243,14 +243,6 @@ class OverviewTests(test.BaseAdminViewTests):
'admin_email': "example@example.org",
'public_host': '',
'region': 'regionOne',
'float_allocation_start': '10.0.0.2',
'float_allocation_end': '10.255.255.254',
'float_cidr': '10.0.0.0/8',
'external_allocation_start': '192.0.2.45',
'external_allocation_end': '192.0.2.64',
'external_cidr': '192.0.2.0/24',
"overcloud_nameserver": '8.8.8.8',
"bm_network_gateway": '192.0.2.1'
}
with contextlib.nested(
@ -262,15 +254,10 @@ class OverviewTests(test.BaseAdminViewTests):
return_value=None),
patch('os_cloud_config.keystone.setup_endpoints',
return_value=None),
patch('os_cloud_config.neutron.initialize_neutron',
return_value=None),
patch('os_cloud_config.utils.clients.get_keystone_client',
return_value='keystone_client'),
patch('os_cloud_config.utils.clients.get_neutron_client',
return_value='neutron_client'),
) as (mock_plan, mock_get_by_plan, mock_initialize,
mock_setup_endpoints, mock_initialize_neutron,
mock_get_keystone_client, mock_get_neutron_client):
mock_setup_endpoints, mock_get_keystone_client):
res = self.client.post(POST_DEPLOY_INIT_URL, data)
self.assertNoFormErrors(res)
@ -301,25 +288,8 @@ class OverviewTests(test.BaseAdminViewTests):
client='keystone_client',
region='regionOne',
public_host='')
mock_initialize_neutron.assert_called_once_with(
{'float':
{'cidr': '10.0.0.0/8',
'allocation_start': '10.0.0.2',
'name': 'default-net',
'allocation_end': '10.255.255.254',
'nameserver': '8.8.8.8'},
'external':
{'cidr': '192.0.2.0/24',
'allocation_start': '192.0.2.45',
'name': 'ext-net',
'allocation_end': '192.0.2.64',
'gateway': '192.0.2.1'}},
keystone_client='keystone_client',
neutron_client='neutron_client')
mock_get_keystone_client.assert_called_once_with(
'admin', None, 'admin', stack.keystone_auth_url)
mock_get_neutron_client.assert_called_once_with(
'admin', None, 'admin', stack.keystone_auth_url)
def test_get_role_data(self):
plan = api.tuskar.Plan(self.tuskarclient_plans.first())