From e89a0a689aad0bf13b59c7718104525b376a5510 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Tue, 19 Feb 2019 15:20:41 -0500 Subject: [PATCH] Allow 'container image prepare' to support drivers This updates the 'overcloud container image prepare' command so that it sets the neutron_driver variable correctly. This allows tripleo-common to detect if OVN or ODL drivers are in used and prepares the resulting output files for container images and parameters accordingly. Previously you could only access this functionality if you used the new ContainerImagePrepare workflow (requires Mistral). Note: Bumps lower constraint for tripeo-common==9.5.0 to fix the lower constaints job. Change-Id: Icb5b20bfd98a704f3f33f739bc92f77550b52c26 Closes-bug: #1816663 (cherry picked from commit a2c4d07df6f043b17accd229aacfcb6c669340b1) --- lower-constraints.txt | 2 +- requirements.txt | 2 +- tripleoclient/tests/v1/test_container_image.py | 12 ++++++++---- tripleoclient/v1/container_image.py | 2 ++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index f2604576b..0b8ce0a50 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -146,7 +146,7 @@ testscenarios===0.4 testtools==2.2.0 tooz==1.58.0 traceback2==1.4.0 -tripleo-common==9.1.0 +tripleo-common==9.5.0 ujson==1.35 unittest2==1.1.0 vine==1.1.4 diff --git a/requirements.txt b/requirements.txt index 395cdf0e7..a863e53d8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,5 +16,5 @@ simplejson>=3.5.1 # MIT six>=1.10.0 # MIT osc-lib>=1.8.0 # Apache-2.0 websocket-client>=0.44.0 # LGPLv2+ -tripleo-common>=9.1.0 # Apache-2.0 +tripleo-common>=9.5.0 # Apache-2.0 cryptography>=2.1 # BSD/Apache-2.0 diff --git a/tripleoclient/tests/v1/test_container_image.py b/tripleoclient/tests/v1/test_container_image.py index 96341cff8..f08faaa33 100644 --- a/tripleoclient/tests/v1/test_container_image.py +++ b/tripleoclient/tests/v1/test_container_image.py @@ -186,10 +186,13 @@ class TestContainerImagePrepare(TestPluginV1): mock_get.side_effect = requests.exceptions.SSLError('ouch') mock_bsf.return_value = set(['OS::TripleO::Services::AodhEvaluator']) - resource_registry = {'resource_registry': { - 'OS::TripleO::Services::AodhEvaluator': aodh_file, - 'OS::TripleO::Services::AodhApi': aodh_file - }} + resource_registry = { + 'parameter_defaults': { + 'NeutronMechanismDrivers': 'ovn'}, + 'resource_registry': { + 'OS::TripleO::Services::AodhEvaluator': aodh_file, + 'OS::TripleO::Services::AodhApi': aodh_file + }} pmef.return_value = None, resource_registry arglist = [ @@ -255,6 +258,7 @@ class TestContainerImagePrepare(TestPluginV1): 'ceph_tag': 'mytag', 'ceph_image': 'mydaemon', 'tag': 'passed-ci', + 'neutron_driver': 'ovn', 'ceph_namespace': 'myceph', 'name_prefix': 'os-' }, diff --git a/tripleoclient/v1/container_image.py b/tripleoclient/v1/container_image.py index 25c2c5ea4..376f73ca0 100644 --- a/tripleoclient/v1/container_image.py +++ b/tripleoclient/v1/container_image.py @@ -415,6 +415,8 @@ class PrepareImageFiles(command.Command): 'name_suffix': parsed_args.suffix, } self.parse_set_values(mapping_args, parsed_args.set) + pd = env.get('parameter_defaults', {}) + kolla_builder.set_neutron_driver(pd, mapping_args) output_images_file = (parsed_args.output_images_file or 'container_images.yaml')