From 01ed75acefddb3247b697f3ab37c1a222e35e129 Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Mon, 21 Feb 2022 06:33:41 +0000 Subject: [PATCH] Add openEuler Distro support openEuler is the newest open source operating system, which is quite famous and widely used in China. This patch aims to add the OS support in kolla-ansible for the host OS. bp: support-openeuler-os Depends-On: https://review.opendev.org/c/openstack/ansible-collection-kolla/+/830320 Change-Id: I66dc84f02c324dbc0787ec25d4bd92ada9362e94 --- ansible/roles/prechecks/vars/main.yml | 2 ++ doc/source/user/quickstart.rst | 14 +++++++--- doc/source/user/support-matrix.rst | 1 + ...-support-for-host-os-9ccd799fa4a5b979.yaml | 5 ++++ tests/pre.yml | 26 +++++++++++++++++++ tests/templates/globals-default.j2 | 7 +++-- zuul.d/jobs.yaml | 10 +++++++ zuul.d/nodesets.yaml | 6 +++++ zuul.d/project.yaml | 1 + 9 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/add-openeuler-support-for-host-os-9ccd799fa4a5b979.yaml diff --git a/ansible/roles/prechecks/vars/main.yml b/ansible/roles/prechecks/vars/main.yml index 941ac268af..e42a60473d 100644 --- a/ansible/roles/prechecks/vars/main.yml +++ b/ansible/roles/prechecks/vars/main.yml @@ -13,6 +13,8 @@ host_os_distributions: - "8" Debian: - "bullseye" + openEuler: + - "20.03" RHEL: - "8" Rocky: diff --git a/doc/source/user/quickstart.rst b/doc/source/user/quickstart.rst index 3fc2a11c53..e8d9d76292 100644 --- a/doc/source/user/quickstart.rst +++ b/doc/source/user/quickstart.rst @@ -48,7 +48,7 @@ execution, which is described in #. Install Python build dependencies: - For CentOS or RHEL 8, run: + For CentOS, RHEL 8 or openEuler, run: .. code-block:: console @@ -67,7 +67,7 @@ If not installing Kolla Ansible in a virtual environment, skip this section. #. Install the virtual environment dependencies. - For CentOS or RHEL 8, you don't need to do anything. + For CentOS, RHEL 8 or openEuler, you don't need to do anything. For Debian or Ubuntu, run: @@ -105,7 +105,7 @@ If installing Kolla Ansible in a virtual environment, skip this section. #. Install ``pip``. - For CentOS or RHEL, run: + For CentOS, RHEL or openEuler, run: .. code-block:: console @@ -132,6 +132,12 @@ If installing Kolla Ansible in a virtual environment, skip this section. sudo dnf install ansible + For openEuler, run: + + .. code-block:: console + + sudo pip install ansible + For Debian or Ubuntu, run: .. code-block:: console @@ -334,7 +340,7 @@ than one node, edit ``multinode`` inventory: errors in the ``ping`` module. To quickly install Python with Ansible you can run: for Debian or Ubuntu: ``ansible -i multinode all -m raw -a "apt -y install python3"``, - and for CentOS or RHEL: + and for CentOS, RHEL or openEuler: ``ansible -i multinode all -m raw -a "dnf -y install python3"``. Kolla passwords diff --git a/doc/source/user/support-matrix.rst b/doc/source/user/support-matrix.rst index eeec537bac..a3d92451c8 100644 --- a/doc/source/user/support-matrix.rst +++ b/doc/source/user/support-matrix.rst @@ -23,6 +23,7 @@ Kolla Ansible supports the following host Operating Systems (OS): * CentOS Stream 8 * Debian Bullseye (11) +* openEuler 20.03 LTS SP2 * RHEL 8 (deprecated) * Rocky Linux 8 * Ubuntu Focal (20.04) diff --git a/releasenotes/notes/add-openeuler-support-for-host-os-9ccd799fa4a5b979.yaml b/releasenotes/notes/add-openeuler-support-for-host-os-9ccd799fa4a5b979.yaml new file mode 100644 index 0000000000..08e12c49ba --- /dev/null +++ b/releasenotes/notes/add-openeuler-support-for-host-os-9ccd799fa4a5b979.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + openEuler 20.03-LTS-SP2 distro is supported as host os for kolla-ansible + now. diff --git a/tests/pre.yml b/tests/pre.yml index 7bbd5ae550..def38158af 100644 --- a/tests/pre.yml +++ b/tests/pre.yml @@ -102,6 +102,32 @@ use: systemd become: true + # NOTE(wxy): There are some issues on openEuler, fix them by hand. + # 1. iptables-legacy is used by default. + # 2. NTP sync doesn't work by default. + - block: + # The CentOS Stream 8 in container uses iptables-nft while the host + # openEuler uses iptables-legacy by default. We should update openEuler + # to keep iptables the same. + # Ubuntu 20.04 container OS uses iptables-legacy by default. It works + # well on openEuler. + - name: Set iptables from legacy to nft for centos stream container + shell: + cmd: | + dnf install -y iptables-nft + iptables-save > iptables.txt + iptables-nft-restore < iptables.txt + update-alternatives --set iptables /usr/sbin/iptables-nft + become: true + when: base_distro == 'centos' + + # The command `timedatectl status` always times out if the command + # `timedatectl show-timesync` is not run first. + - name: Let ntp service work + shell: timedatectl show-timesync + become: true + when: ansible_facts.distribution == 'openEuler' + - name: Wait for ntp time sync command: timedatectl status register: timedatectl_status diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2 index 22dda70c7f..88632db725 100644 --- a/tests/templates/globals-default.j2 +++ b/tests/templates/globals-default.j2 @@ -1,6 +1,6 @@ --- -{% if ansible_os_family == 'Debian' %} -# Force the use of python3 on Debian and Ubuntu remote hosts. These distros +{% if ansible_os_family == 'Debian' or ansible_facts.distribution == "openEuler" %} +# Force the use of python3 on Debian, Ubuntu and openEuler remote hosts. These distros # typically have an unversioned Python interpreter which links to python2.7. ansible_python_interpreter: /usr/bin/python3 {% endif %} @@ -14,6 +14,9 @@ docker_custom_config: debug: true registry-mirrors: - {{ infra_dockerhub_mirror }} +{% if ansible_facts.distribution == "openEuler" %} + exec-opts: ["native.umask=normal"] +{% endif %} {% if kolla_python_version is defined and not is_previous_release %} distro_python_version: "{{ kolla_python_version }}" diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index ac0557ac89..9da16862d3 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -26,6 +26,16 @@ install_type: source tls_enabled: true +- job: + name: kolla-ansible-openeuler-source + parent: kolla-ansible-base + nodeset: kolla-ansible-openeuler-20.03-lts-sp2 + voting: false + vars: + base_distro: centos + install_type: source + tls_enabled: true + - job: name: kolla-ansible-rocky8-source parent: kolla-ansible-base diff --git a/zuul.d/nodesets.yaml b/zuul.d/nodesets.yaml index 7bcc6ebbd7..36d087474d 100644 --- a/zuul.d/nodesets.yaml +++ b/zuul.d/nodesets.yaml @@ -33,6 +33,12 @@ - name: secondary2 label: debian-bullseye +- nodeset: + name: kolla-ansible-openeuler-20.03-lts-sp2 + nodes: + - name: primary + label: openEuler-20-03-LTS-SP2 + - nodeset: name: kolla-ansible-rocky-8 nodes: diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index c4ceba3180..8bcbcefeca 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -12,6 +12,7 @@ jobs: - kolla-ansible-centos8s-source - kolla-ansible-debian-source + - kolla-ansible-openeuler-source - kolla-ansible-rocky8-source - kolla-ansible-ubuntu-source - kolla-ansible-centos8s-source-kvm