Fix configuration file generator
1. What is the problem? When writing the manual installation guide, I find that configuration file generator fails to execute because there is an module import error in opts.py for local and central plugin configuration. Actually there's no need to generate configuration sample for plugin since the original Neutron configuration file will be used, this is left without clearing during the Tricircle splitting. 2. What is the solution to the problem? Remove the entry for generating plugin configuration sample in tox.ini. Also, tox.ini is modified to only install neutron dependency for py27 test, which will speed up pep8, docs and genconfig processes. 3. What the features need to be implemented to the Tricircle to realize the solution? No new features Change-Id: Ie1463a91e7f252943f74f54f80f85e6f10acefd0
This commit is contained in:
parent
d6e37673d5
commit
79623621c2
@ -1,4 +0,0 @@
|
||||
[DEFAULT]
|
||||
output_file = etc/tricircle_plugin.conf.sample
|
||||
wrap_width = 79
|
||||
namespace = tricircle.network
|
9
tox.ini
9
tox.ini
@ -14,10 +14,12 @@ setenv =
|
||||
deps =
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
-egit+https://git.openstack.org/openstack/neutron@master#egg=neutron
|
||||
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||
commands = python setup.py testr --slowest --testr-args='{posargs}'
|
||||
whitelist_externals = rm
|
||||
|
||||
[testenv:pep8]
|
||||
deps =
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = flake8
|
||||
|
||||
[testenv:venv]
|
||||
@ -27,11 +29,14 @@ commands = {posargs}
|
||||
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||
|
||||
[testenv:genconfig]
|
||||
deps =
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = oslo-config-generator --config-file=etc/api-cfg-gen.conf
|
||||
oslo-config-generator --config-file=etc/xjob-cfg-gen.conf
|
||||
oslo-config-generator --config-file=etc/tricircle_plugin-cfg-gen.conf
|
||||
|
||||
[testenv:docs]
|
||||
deps =
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[testenv:debug]
|
||||
|
@ -36,6 +36,7 @@ from neutron.extensions import availability_zone as az_ext
|
||||
from neutron.extensions import external_net
|
||||
from neutron.extensions import l3
|
||||
from neutron.extensions import providernet as provider
|
||||
from neutron_lib.api import validators
|
||||
from neutron_lib import constants
|
||||
import neutronclient.common.exceptions as q_cli_exceptions
|
||||
|
||||
@ -179,7 +180,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
@staticmethod
|
||||
def _ensure_az_set_for_external_network(context, req_data):
|
||||
external = req_data.get(external_net.EXTERNAL)
|
||||
external_set = attributes.is_attr_set(external)
|
||||
external_set = validators.is_attr_set(external)
|
||||
if not external_set or not external:
|
||||
return False
|
||||
if az_ext.AZ_HINTS in req_data and req_data[az_ext.AZ_HINTS]:
|
||||
@ -210,7 +211,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
provider_attrs = ('provider:network_type', 'provider:segmentation_id',
|
||||
'provider:physical_network')
|
||||
for provider_attr in provider_attrs:
|
||||
if attributes.is_attr_set(net.get(provider_attr)):
|
||||
if validators.is_attr_set(net.get(provider_attr)):
|
||||
body['network'][provider_attr] = net[provider_attr]
|
||||
|
||||
self._prepare_bottom_element(
|
||||
@ -233,7 +234,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
attrs = ('ip_version', 'cidr', 'gateway_ip', 'allocation_pools',
|
||||
'enable_dhcp')
|
||||
for attr in attrs:
|
||||
if attributes.is_attr_set(subnet.get(attr)):
|
||||
if validators.is_attr_set(subnet.get(attr)):
|
||||
body['subnet'][attr] = subnet[attr]
|
||||
self._prepare_bottom_element(
|
||||
t_ctx, subnet['tenant_id'], pod, {'id': top_id},
|
||||
@ -975,10 +976,10 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
'name': subnet_name,
|
||||
'prefixlen': 24,
|
||||
'ip_version': 4,
|
||||
'allocation_pools': attributes.ATTR_NOT_SPECIFIED,
|
||||
'dns_nameservers': attributes.ATTR_NOT_SPECIFIED,
|
||||
'host_routes': attributes.ATTR_NOT_SPECIFIED,
|
||||
'cidr': attributes.ATTR_NOT_SPECIFIED,
|
||||
'allocation_pools': constants.ATTR_NOT_SPECIFIED,
|
||||
'dns_nameservers': constants.ATTR_NOT_SPECIFIED,
|
||||
'host_routes': constants.ATTR_NOT_SPECIFIED,
|
||||
'cidr': constants.ATTR_NOT_SPECIFIED,
|
||||
'subnetpool_id': pool_id,
|
||||
'enable_dhcp': False,
|
||||
'tenant_id': project_id
|
||||
@ -1142,7 +1143,7 @@ class TricirclePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
router_data = copy.deepcopy(router['router'])
|
||||
need_update_bottom = False
|
||||
is_add = False
|
||||
if attributes.is_attr_set(router_data.get(l3.EXTERNAL_GW_INFO)):
|
||||
if validators.is_attr_set(router_data.get(l3.EXTERNAL_GW_INFO)):
|
||||
need_update_bottom = True
|
||||
ext_net_id = router_data[l3.EXTERNAL_GW_INFO].get('network_id')
|
||||
if ext_net_id:
|
||||
|
@ -16,9 +16,9 @@
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.extensions import external_net
|
||||
from neutron.plugins.ml2 import managers
|
||||
from neutron_lib.api import validators
|
||||
|
||||
from tricircle.common.i18n import _LE
|
||||
from tricircle.common.i18n import _LI
|
||||
@ -69,7 +69,7 @@ class TricircleTypeManager(managers.TypeManager):
|
||||
@staticmethod
|
||||
def _is_external_network(network):
|
||||
external = network.get(external_net.EXTERNAL)
|
||||
external_set = attributes.is_attr_set(external)
|
||||
external_set = validators.is_attr_set(external)
|
||||
if not external_set or not external:
|
||||
return False
|
||||
else:
|
||||
|
@ -1,22 +0,0 @@
|
||||
# Copyright 2015 Huawei Technologies Co., Ltd.
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import tricircle.network.plugin
|
||||
|
||||
|
||||
def list_opts():
|
||||
return [
|
||||
('DEFAULT', tricircle.network.plugin.tricircle_opts),
|
||||
]
|
Loading…
Reference in New Issue
Block a user