From 1075fe411aa7b37e6c536e1c1ea5d4bfd509d2b0 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 22 Feb 2018 18:30:40 +0000 Subject: [PATCH] Restore support for percona packages when using ppc64le In https://review.openstack.org/535252 the installation process for the role was simplified, but an unintentional side-effect was to removed the previously included support for installing the extra percona packages when installing on the ppc64le platform. This patch re-introduces that ability, but scopes it to only execute on that hardware platform, and only for Ubuntu. The download is, by default, facilitated through the deploy node (rather than the target nodes) so that the download is done once, then pushed to the targets. This can be adjusted with the right parameters to download from the targets instead. Also, in https://review.openstack.org/543888 adjustments were made to disable compression/qpress on architectures other than x86_64, and to fail the role execution if it was enabled on any other architecture. This has been corrected to ensure that compression is enabled by default for ppc64le on Ubuntu, and enabled by default for x86_64, but disabled by default for all other combinations. The fail task is adjusted appropriately and moved to the main task file so that it executes and fails out before any changes are made. Change-Id: I850a37b465a427a827e357111942973457fafa0d --- defaults/main.yml | 14 +++++- .../ppc64le-var-changes-84aa4f3f9bb0ef52.yaml | 31 ++++++++++++ tasks/galera_install.yml | 27 +++++++---- tasks/galera_install_apt.yml | 2 +- ...galera_install_download_extra_packages.yml | 47 +++++++++++++++++++ tasks/main.yml | 9 ++++ vars/redhat-7.yml | 2 +- vars/ubuntu-16.04.yml | 9 +++- 8 files changed, 127 insertions(+), 14 deletions(-) create mode 100644 releasenotes/notes/ppc64le-var-changes-84aa4f3f9bb0ef52.yaml create mode 100644 tasks/galera_install_download_extra_packages.yml diff --git a/defaults/main.yml b/defaults/main.yml index 4bcc0c4b..5310d60e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -113,8 +113,8 @@ galera_wsrep_provider_options: galera_wsrep_sst_auth_user: "root" galera_wsrep_sst_auth_password: "{{ galera_root_password }}" -# Enable compression of backups. Qpress is only availabe for x86_64 -galera_xtrabackup_compression: "{{ (ansible_architecture == 'x86_64') | ternary(true, false) }}" +# Enable compression of backups. +galera_xtrabackup_compression: "{{ (ansible_architecture == 'x86_64') or (ansible_architecture == 'ppc64le' and ansible_distribution == 'Ubuntu') }}" # xtrabackup parallel/compression/sync threads galera_xtrabackup_threads: 4 @@ -193,3 +193,13 @@ galera_disable_privatedevices: "{{ _galera_disable_privatedevices }}" ## Set default mirror for openSUSE repositories # NOTE(hwoarang): Ensure that the full path to the 'opensuse' directory is used. #galera_server_opensuse_mirror_obs_url: "http://widehat.opensuse.org" + +# Where the extra package download is executed from. +# Options are ['deployment-host', 'target-host'] +galera_server_extra_package_downloader: "deployment-host" + +# The location where the extra packages are downloaded to +galera_server_extra_package_path: "/opt/cache/files" + +# Toggle whether certificate validation should be enabled/disabled +galera_server_extra_package_validate_certs: yes diff --git a/releasenotes/notes/ppc64le-var-changes-84aa4f3f9bb0ef52.yaml b/releasenotes/notes/ppc64le-var-changes-84aa4f3f9bb0ef52.yaml new file mode 100644 index 00000000..6075e8dd --- /dev/null +++ b/releasenotes/notes/ppc64le-var-changes-84aa4f3f9bb0ef52.yaml @@ -0,0 +1,31 @@ +--- +features: + - | + The extra packages percona packages used by the ppc64le + are now downloaded by the Ansible deployment host by + default, as opposed to the target hosts. Once downloaded + the packages are pushed up to the target hosts. + This behaviour may be adjusted by setting + ``galera_server_extra_package_downloader`` to + ``target-host``. + The packages are downloaded to the path set in + ``galera_server_extra_package_path``. +deprecations: + - | + The following variables have been removed as they no + longer serve any purpose. + + * ``galera_package_arch`` + * ``percona_package_download_validate_certs`` + * ``percona_package_url`` + * ``percona_package_fallback_url`` + * ``percona_package_sha256`` + * ``percona_package_path`` + * ``qpress_package_download_validate_certs`` + * ``qpress_package_url`` + * ``qpress_package_fallback_url`` + * ``qpress_package_sha256`` + * ``qpress_package_path`` + + The functionality previously using these variables has + been transitioned to using a simpler data structure. diff --git a/tasks/galera_install.yml b/tasks/galera_install.yml index a2cd0b66..6f901894 100644 --- a/tasks/galera_install.yml +++ b/tasks/galera_install.yml @@ -13,22 +13,31 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Add percona packages to the galera packages list +- name: Prepare the package list set_fact: - galera_packages_list: "{{ galera_server_required_distro_packages + galera_server_mariadb_distro_packages + galera_server_percona_distro_packages }}" + galera_packages_list: |- + {% set packages = galera_server_required_distro_packages + galera_server_mariadb_distro_packages %} + {% if ansible_architecture == 'x86_64' %} + {% set _ = packages.extend(galera_server_percona_distro_packages) %} + {% endif %} + {% if ansible_architecture == 'ppc64le' and ansible_distribution == 'Ubuntu' %} + {% for extra_package in galera_server_percona_distro_packages_alt_arch['ansible_architecture'] %} + {% set _package_path = galera_server_extra_package_path ~ '/' ~ ansible_architecture %} + {% set _ = packages.append(_package_path ~ '/' ~ extra_package['url'] | basename) %} + {% endfor %} + {% endif %} + {{ packages }} + +- name: Download the extra packages + include_tasks: galera_install_download_extra_packages.yml + when: + - ansible_architecture == 'ppc64le' - name: Remove conflicting distro packages package: name: "{{ galera_server_mariadb_distro_packages_remove | default([]) }}" state: absent -- name: Fail if compression is enabled on unsupported architecture - fail: - msg: "qpress compression is only available on x86_64 architectures" - when: - - galera_xtrabackup_compression | bool - - ansible_architecture != 'x86_64' - - include_tasks: "galera_install_{{ ansible_pkg_mgr }}.yml" - name: Install pip packages diff --git a/tasks/galera_install_apt.yml b/tasks/galera_install_apt.yml index 42b77bbb..743fe522 100644 --- a/tasks/galera_install_apt.yml +++ b/tasks/galera_install_apt.yml @@ -94,7 +94,7 @@ retries: 5 delay: 2 -- name: Remove policy-rc +- name: Remove policy-rc now that the package install is complete file: path: "/usr/sbin/policy-rc.d" state: absent diff --git a/tasks/galera_install_download_extra_packages.yml b/tasks/galera_install_download_extra_packages.yml new file mode 100644 index 00000000..a6692337 --- /dev/null +++ b/tasks/galera_install_download_extra_packages.yml @@ -0,0 +1,47 @@ +--- +# Copyright 2016, Rackspace US, Inc. +# +# 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. + +- name: Ensure that galera_server_extra_package_paths exist + file: + path: "{{ galera_server_extra_package_path }}/{{ item.key }}" + state: directory + with_dict: "{{ galera_server_percona_distro_packages_alt_arch }}" + delegate_to: "{{ (galera_server_extra_package_downloader == 'deployment-host') | ternary('localhost', omit) }}" + +- name: Download extra packages + get_url: + url: "{{ item.value.url }}" + dest: "{{ galera_server_extra_package_path }}/{{ item.key }}/" + checksum: "{{ item.value.checksum | default(omit) }}" + force: "{{ item.value.checksum is not defined }}" + validate_certs: "{{ galera_server_extra_package_validate_certs }}" + with_dict: "{{ galera_server_percona_distro_packages_alt_arch }}" + register: fetch_url + until: fetch_url | success + retries: 3 + delay: 10 + delegate_to: "{{ (galera_server_extra_package_downloader == 'deployment-host') | ternary('localhost', omit) }}" + +- name: Copy downloaded packages from deployment-host to target-host + copy: + src: "{{ galera_server_extra_package_path }}/{{ item.key }}/{{ item.value.url | basename }}" + dest: "{{ galera_server_extra_package_path }}/{{ item.key }}/" + with_dict: "{{ galera_server_percona_distro_packages_alt_arch }}" + when: + - galera_server_extra_package_downloader == "deployment-host" + register: file_copy + until: file_copy | success + retries: 5 + delay: 10 diff --git a/tasks/main.yml b/tasks/main.yml index f4ec05ac..1bf309c3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -29,6 +29,15 @@ tags: - always +- name: Fail if compression is enabled on unsupported architecture/distro + fail: + msg: | + qpress compression is only supported for x86_64 and for Ubuntu/ppc64le + when: + - galera_xtrabackup_compression | bool + - (ansible_architecture != 'x86_64') and + not (ansible_architecture == 'ppc64le' and ansible_distribution == 'Ubuntu') + - name: Gather variables for each operating system include_vars: "{{ item }}" with_first_found: diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index 411a205e..7af24254 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -82,4 +82,4 @@ galera_server_percona_distro_packages: galera_wsrep_provider: "/usr/lib/galera/libgalera_smm.so" -_use_percona_upstream: yes +_use_percona_upstream: "{{ ansible_architecture == 'x86_64' }}" diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml index 0682fd27..9100168f 100644 --- a/vars/ubuntu-16.04.yml +++ b/vars/ubuntu-16.04.yml @@ -101,4 +101,11 @@ _galera_repo: galera_wsrep_provider: "/usr/lib/galera/libgalera_smm.so" -_use_percona_upstream: yes +_use_percona_upstream: "{{ ansible_architecture == 'x86_64' }}" + +galera_server_percona_distro_packages_alt_arch: + ppc64le: + - url: "http://public.dhe.ibm.com/systems/virtualization/Novalink/misc/percona-xtrabackup/percona-xtrabackup-24_2.4.5-1_ppc64el.deb" + checksum: "sha256:3d4e4112f4c8020c9190a91d962dabed1dfaad307160a939e121208887eaee2a" + - url: "http://public.dhe.ibm.com/systems/virtualization/Novalink/misc/qpress/qpress_11-1_ppc64el.deb" + checksum: "sha256:a31d3e00dbcec9b3f98eae82b261d054d0b80a57f4a38967d0e953811cb082f3"