From 0b260171fd58e035efd0614ae390e91f985d69bc Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Tue, 21 Aug 2018 09:19:57 -0400 Subject: [PATCH] Enable OVN scenarios As of Queens only HA OVN deployments are supported. Change-Id: I184c5a096fec9cbc3cf2ec06218700138ea3ed57 Signed-off-by: Tim Rozet (cherry picked from commit ee58a24647df8eec2418735b038e5035bdffe10d) --- apex/build_utils.py | 13 +++++++++++++ apex/builders/common_builder.py | 14 ++++++++++++-- apex/common/constants.py | 2 +- apex/tests/test_apex_build_utils.py | 6 ++++++ build/rpm_specs/opnfv-apex.spec | 5 ++++- config/deploy/os-ovn-nofeature-ha.yaml | 15 +++++++++++++++ config/deploy/os-ovn-nofeature-noha.yaml | 10 ---------- config/deploy/os-ovn-queens-ha.yaml | 17 +++++++++++++++++ lib/ansible/playbooks/post_deploy_overcloud.yml | 5 ++++- 9 files changed, 72 insertions(+), 15 deletions(-) create mode 100644 config/deploy/os-ovn-nofeature-ha.yaml delete mode 100644 config/deploy/os-ovn-nofeature-noha.yaml create mode 100644 config/deploy/os-ovn-queens-ha.yaml diff --git a/apex/build_utils.py b/apex/build_utils.py index 78467875..7457e561 100644 --- a/apex/build_utils.py +++ b/apex/build_utils.py @@ -111,6 +111,19 @@ def strip_patch_sections(patch, sections=['releasenotes', 'tests']): return '\n'.join(tmp_patch) +def is_path_in_patch(patch, path): + """ + Checks if a particular path is modified in a patch diff + :param patch: patch diff + :param path: path to check for in diff + :return: Boolean + """ + for line in patch.split("\n"): + if re.match('^diff.*{}'.format(path), line): + return True + return False + + def get_patch(change_id, repo, branch, url=con.OPENSTACK_GERRIT): logging.info("Fetching patch for change id {}".format(change_id)) change = get_change(url, repo, branch, change_id) diff --git a/apex/builders/common_builder.py b/apex/builders/common_builder.py index a5f301b8..b8894ec1 100644 --- a/apex/builders/common_builder.py +++ b/apex/builders/common_builder.py @@ -25,10 +25,11 @@ from apex.common import utils from apex.virtual import utils as virt_utils -def project_to_path(project): +def project_to_path(project, patch=None): """ Translates project to absolute file path to use in patching :param project: name of project + :param patch: the patch to applied to the project :return: File path """ if project.startswith('openstack/'): @@ -37,6 +38,15 @@ def project_to_path(project): return "/etc/puppet/modules/{}".format(project.replace('puppet-', '')) elif 'tripleo-heat-templates' in project: return "/usr/share/openstack-tripleo-heat-templates" + elif ('tripleo-common' in project and + build_utils.is_path_in_patch(patch, 'container-images/')): + # tripleo-common has python and another component to it + # here we detect if there is a change to the yaml component and if so + # treat it like it is not python. This has the caveat of if there + # is a patch to both python and yaml this will not work + # FIXME(trozet): add ability to split tripleo-common patches that + # modify both python and yaml + return "/usr/share/openstack-tripleo-common-containers/" else: # assume python. python patches will apply to a project name subdir. # For example, python-tripleoclient patch will apply to the @@ -157,7 +167,7 @@ def add_upstream_patches(patches, image, tmp_dir, branch = default_branch patch_diff = build_utils.get_patch(patch['change-id'], patch['project'], branch) - project_path = project_to_path(patch['project']) + project_path = project_to_path(patch['project'], patch_diff) # If docker tag and python we know this patch belongs on docker # container for a docker service. Therefore we build the dockerfile # and move the patch into the containers directory. We also assume diff --git a/apex/common/constants.py b/apex/common/constants.py index 0475615a..c3e3f5a0 100644 --- a/apex/common/constants.py +++ b/apex/common/constants.py @@ -65,7 +65,7 @@ VALID_DOCKER_SERVICES = { 'neutron-opendaylight-sriov.yaml': None, 'neutron-bgpvpn-opendaylight.yaml': None, 'neutron-sfc-opendaylight.yaml': None, - 'neutron-ml2-ovn.yaml': 'neutron-ovn.yaml' + 'neutron-ml2-ovn.yaml': 'neutron-ovn-ha.yaml' } DOCKERHUB_OOO = 'https://registry.hub.docker.com/v2/repositories' \ '/tripleomaster/' diff --git a/apex/tests/test_apex_build_utils.py b/apex/tests/test_apex_build_utils.py index f18103c8..36caaf1f 100644 --- a/apex/tests/test_apex_build_utils.py +++ b/apex/tests/test_apex_build_utils.py @@ -178,6 +178,12 @@ class TestBuildUtils(unittest.TestCase): self.assertNotRegex(tmp_patch, 'Steps of upgrade are as follows') self.assertNotRegex(tmp_patch, 'Steps invlolved in level 2 update') + def test_is_path_in_patch(self): + with open(os.path.join(con.TEST_DUMMY_CONFIG, '98faaca.diff')) as fh: + dummy_patch = fh.read() + self.assertTrue(build_utils.is_path_in_patch(dummy_patch, + 'releasenotes/')) + def test_strip_no_patch_sections(self): with open(os.path.join(con.TEST_DUMMY_CONFIG, '98faaca.diff')) as fh: dummy_patch = fh.read() diff --git a/build/rpm_specs/opnfv-apex.spec b/build/rpm_specs/opnfv-apex.spec index 510ce866..09da36a4 100644 --- a/build/rpm_specs/opnfv-apex.spec +++ b/build/rpm_specs/opnfv-apex.spec @@ -109,7 +109,8 @@ install config/inventory/pod_example_settings.yaml %{buildroot}%{_docdir}/opnfv/ %{_sysconfdir}/opnfv-apex/os-odl-sriov-ha.yaml %{_sysconfdir}/opnfv-apex/os-odl-sriov-noha.yaml %{_sysconfdir}/opnfv-apex/os-odl-gluon-noha.yaml -%{_sysconfdir}/opnfv-apex/os-ovn-nofeature-noha.yaml +%{_sysconfdir}/opnfv-apex/os-ovn-nofeature-ha.yaml +%{_sysconfdir}/opnfv-apex/os-ovn-queens-ha.yaml %{_sysconfdir}/opnfv-apex/os-onos-nofeature-ha.yaml %{_sysconfdir}/opnfv-apex/os-onos-sfc-ha.yaml %{_sysconfdir}/opnfv-apex/os-ocl-nofeature-ha.yaml @@ -129,6 +130,8 @@ install config/inventory/pod_example_settings.yaml %{buildroot}%{_docdir}/opnfv/ %doc %{_docdir}/opnfv/inventory.yaml.example %changelog +* Thu Sep 27 2018 Tim Rozet - 7.0-8 + Adds OVN HA and Queens scenario * Fri Aug 24 2018 Tim Rozet - 7.0-7 Add Calipso for Queens * Tue Aug 21 2018 Ricardo Noriega - 7.0-6 diff --git a/config/deploy/os-ovn-nofeature-ha.yaml b/config/deploy/os-ovn-nofeature-ha.yaml new file mode 100644 index 00000000..6c42cad9 --- /dev/null +++ b/config/deploy/os-ovn-nofeature-ha.yaml @@ -0,0 +1,15 @@ +--- +global_params: + ha_enabled: true + patches: + undercloud: + - change-id: Ic08ff58b10d4fa7116163be1f7fce57879cee8c5 + project: openstack/tripleo-common + +deploy_options: + containers: true + sdn_controller: ovn + tacker: false + congress: false + sfc: false + vpn: false diff --git a/config/deploy/os-ovn-nofeature-noha.yaml b/config/deploy/os-ovn-nofeature-noha.yaml deleted file mode 100644 index 8c8c5f97..00000000 --- a/config/deploy/os-ovn-nofeature-noha.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -global_params: - ha_enabled: false - -deploy_options: - sdn_controller: ovn - tacker: false - congress: true - sfc: false - vpn: false diff --git a/config/deploy/os-ovn-queens-ha.yaml b/config/deploy/os-ovn-queens-ha.yaml new file mode 100644 index 00000000..fe79068d --- /dev/null +++ b/config/deploy/os-ovn-queens-ha.yaml @@ -0,0 +1,17 @@ +--- +global_params: + ha_enabled: true + patches: + undercloud: + - change-id: Ic08ff58b10d4fa7116163be1f7fce57879cee8c5 + project: openstack/tripleo-common + branch: master + +deploy_options: + containers: true + os_version: queens + sdn_controller: ovn + tacker: false + congress: false + sfc: false + vpn: false diff --git a/lib/ansible/playbooks/post_deploy_overcloud.yml b/lib/ansible/playbooks/post_deploy_overcloud.yml index ff9895b0..882b0126 100644 --- a/lib/ansible/playbooks/post_deploy_overcloud.yml +++ b/lib/ansible/playbooks/post_deploy_overcloud.yml @@ -86,9 +86,12 @@ crudini --set /var/lib/config-data/puppet-generated/neutron/etc/neutron/metadata_agent.ini DEFAULT nova_metadata_host $(hiera -c /etc/puppet/hiera.yaml nova_metadata_vip) become: yes - when: "'controller' in ansible_hostname" + when: + - "'controller' in ansible_hostname" + - sdn != 'ovn' - name: Restart metadata service shell: "docker restart neutron_metadata_agent" become: yes when: - "'controller' in ansible_hostname" + - sdn != 'ovn' -- 2.16.6