diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 43e1174e5..dea9f25b1 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -23,16 +23,18 @@ function configure_tobiko { iniset "${tobiko_conf}" keystone username "${ADMIN_USERNAME:-admin}" iniset "${tobiko_conf}" keystone password "${ADMIN_PASSWORD:-secret}" iniset "${tobiko_conf}" keystone project_name "${ADMIN_TENANT_NAME:-admin}" - iniset "${tobiko_conf}" keystone user_domain_name "${ADMIN_DOMAIN_NAME:-Default}" - iniset "${tobiko_conf}" keystone project_domain_name "${ADMIN_DOMAIN_NAME:-Default}" + iniset "${tobiko_conf}" keystone user_domain_name \ + "${ADMIN_DOMAIN_NAME:-Default}" + iniset "${tobiko_conf}" keystone project_domain_name \ + "${ADMIN_DOMAIN_NAME:-Default}" echo_summary "Write compute service options to ${TOBIKO_CONF}" - iniset "${tobiko_conf}" compute image_ref "$(get_image_ref)" - iniset "${tobiko_conf}" compute flavor_ref "$(get_flavor_ref)" + iniset "${tobiko_conf}" nova image "$(get_image)" + iniset "${tobiko_conf}" nova flavor "$(get_flavor)" echo_summary "Write networking options to ${TOBIKO_CONF}" - iniset "${tobiko_conf}" network floating_network_name \ - "$(get_floating_network_name)" + iniset "${tobiko_conf}" neutron floating_network \ + "$(get_floating_network)" echo_summary "Apply changes to ${TOBIKO_CONF} file." sudo mkdir -p $(dirname "${TOBIKO_CONF}") @@ -46,7 +48,7 @@ function get_keystone_auth_url { } -function get_image_ref { +function get_image { local name=${DEFAULT_IMAGE_NAME:-} if [ "${name}" != "" ]; then openstack image show -f value -c id "${name}" @@ -56,7 +58,7 @@ function get_image_ref { } -function get_flavor_ref { +function get_flavor { local name=${DEFAULT_INSTANCE_TYPE:-} if [ "${name}" != "" ]; then openstack flavor show -f value -c id "${name}" @@ -66,7 +68,7 @@ function get_flavor_ref { } -function get_floating_network_name { +function get_floating_network { # the public network (for floating ip access) is only available # if the extension is enabled. # If NEUTRON_CREATE_INITIAL_NETWORKS is not true, there is no network created diff --git a/tobiko/common/constants.py b/tobiko/common/constants.py index 7accfc82a..11c0ddcbc 100644 --- a/tobiko/common/constants.py +++ b/tobiko/common/constants.py @@ -15,16 +15,16 @@ from __future__ import absolute_import from tobiko import config +CONF = config.CONF + TEMPLATE_SUFFIX = ".yaml" DEFAULT_PARAMS = { - 'public_net': config.get_any_option( - 'tobiko.network.floating_network_name', - 'tempest.network.floating_network_name'), - 'image': config.get_any_option( - 'tobiko.compute.image_ref', - 'tempest.compute.image_ref'), - 'flavor': config.get_any_option( - 'tobiko.compute.flavor_ref', - 'tempest.compute.flavor_ref'), + + # Nova + 'image': CONF.tobiko.nova.image, + 'flavor': CONF.tobiko.nova.flavor, + + # Neutron + 'public_net': CONF.tobiko.neutron.floating_network, } diff --git a/tobiko/config.py b/tobiko/config.py index f9ef2936d..f53e3801c 100644 --- a/tobiko/config.py +++ b/tobiko/config.py @@ -24,8 +24,9 @@ import tobiko LOG = log.getLogger(__name__) -CONFIG_MODULES = ['tobiko.openstack.config', - 'tobiko.openstack.keystone.config'] +CONFIG_MODULES = ['tobiko.openstack.keystone.config', + 'tobiko.openstack.neutron.config', + 'tobiko.openstack.nova.config'] CONFIG_DIRS = [os.getcwd(), os.path.expanduser("~/.tobiko"), @@ -87,6 +88,12 @@ def init_tobiko_config(default_config_dirs=None, product_name='tobiko', def register_tobiko_options(conf): + conf.register_opts( + group=cfg.OptGroup('shell'), + opts=[cfg.StrOpt('command', + help="Default shell command used for executing " + "local commands")]) + conf.register_opts( group=cfg.OptGroup('http'), opts=[cfg.StrOpt('http_proxy', @@ -97,12 +104,6 @@ def register_tobiko_options(conf): help="Don't use proxy server to connect to listed " "hosts")]) - conf.register_opts( - group=cfg.OptGroup('tempest'), - opts=[cfg.BoolOpt('enabled', - default=True, - help="Enables tempest integration if available")]) - for module_name in CONFIG_MODULES: module = importlib.import_module(module_name) if hasattr(module, 'register_tobiko_options'): diff --git a/tobiko/openstack/config.py b/tobiko/openstack/config.py deleted file mode 100644 index 009add030..000000000 --- a/tobiko/openstack/config.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2018 Red Hat -# -# 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. -from __future__ import absolute_import - -from oslo_config import cfg - - -def register_tobiko_options(conf): - - conf.register_opts( - group=cfg.OptGroup('compute'), - opts=[cfg.StrOpt('image_ref', - help="Default image reference"), - cfg.StrOpt('flavor_ref', - help="Default flavor reference")]) - - conf.register_opts( - group=cfg.OptGroup('network'), - opts=[cfg.StrOpt('floating_network_name', - help="Network name for creating floating IPs")]) - - conf.register_opts( - group=cfg.OptGroup('shell'), - opts=[cfg.StrOpt('command', - help="Default shell command used for executing " - "local commands")]) - - -def setup_tobiko_config(): - pass diff --git a/tobiko/openstack/neutron/config.py b/tobiko/openstack/neutron/config.py new file mode 100644 index 000000000..539e0cba9 --- /dev/null +++ b/tobiko/openstack/neutron/config.py @@ -0,0 +1,23 @@ +# Copyright 2019 Red Hat +# +# 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. +from __future__ import absolute_import + +from oslo_config import cfg + + +def register_tobiko_options(conf): + conf.register_opts( + group=cfg.OptGroup('neutron'), + opts=[cfg.StrOpt('floating_network', + help="Network for creating floating IPs")]) diff --git a/tobiko/openstack/nova/config.py b/tobiko/openstack/nova/config.py new file mode 100644 index 000000000..095b49c0a --- /dev/null +++ b/tobiko/openstack/nova/config.py @@ -0,0 +1,25 @@ +# Copyright 2019 Red Hat +# +# 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. +from __future__ import absolute_import + +from oslo_config import cfg + + +def register_tobiko_options(conf): + conf.register_opts( + group=cfg.OptGroup('nova'), + opts=[cfg.StrOpt('image', + help="Default image for new server instances"), + cfg.StrOpt('flavor', + help="Default flavor for new server instances")])