From 99e97c4cc7ca4c7b8a4b8d6a0bfa20b738c4205a Mon Sep 17 00:00:00 2001 From: Olivier Bourdon Date: Tue, 4 Sep 2018 11:48:49 +0200 Subject: [PATCH] Add voting and gating test with Keystone enabled Without this test, the Ironic services might end up misconfigured and machines can not be provisioned properly. The Ironic configuration templates that Bifrost uses should be validated for both Keystone enabled and disabled. Change-Id: Iab4457a6dcea232b5c19e681dc87b08570c2a120 Depends-On: I4c733dba8e65fe624c9de5b9c5722cef2df59109 --- .../bifrost-integration-tinyipa/run.yaml | 12 ++++++- .../templates/ironic.conf.j2 | 6 +++- .../tasks/pip_install.yml | 35 +++++++++++++++++-- scripts/test-bifrost.sh | 1 + zuul.d/legacy-bifrost-jobs.yaml | 7 ++++ zuul.d/project.yaml | 2 ++ 6 files changed, 58 insertions(+), 5 deletions(-) diff --git a/playbooks/legacy/bifrost-integration-tinyipa/run.yaml b/playbooks/legacy/bifrost-integration-tinyipa/run.yaml index 81c560b5d..c33439d30 100644 --- a/playbooks/legacy/bifrost-integration-tinyipa/run.yaml +++ b/playbooks/legacy/bifrost-integration-tinyipa/run.yaml @@ -6,6 +6,16 @@ tasks: + - name: Set script name for testing without Keystone + set_fact: + script_name: scripts/test-bifrost.sh + when: not (use_keystone | default(false) | bool) + + - name: Set script name for testing with Keystone + set_fact: + script_name: scripts/test-bifrost-keystone-auth.sh + when: use_keystone | default(false) | bool + - name: Ensure legacy workspace directory file: path: '{{ ansible_user_dir }}/workspace' @@ -66,7 +76,7 @@ export GIT_BASE=$(pwd) export UPPER_CONSTRAINTS_FILE=$WORKSPACE/upper-constraints.txt cd openstack/bifrost - scripts/test-bifrost.sh + "{{ script_name }}" executable: /bin/bash chdir: '{{ ansible_user_dir }}/workspace' environment: '{{ zuul | zuul_legacy_vars }}' diff --git a/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 index 029e3a026..20c2b4c8e 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 @@ -35,7 +35,11 @@ log_dir = {{ ironic_log_dir }} {% endif %} [pxe] +{% if testing | bool %} +pxe_append_params = console=/dev/ttyS0 +{% else %} pxe_append_params = systemd.journald.forward_to_console=yes {{ extra_kernel_options | default('') }} +{% endif %} pxe_config_template = $pybasedir/drivers/modules/ipxe_config.template tftp_server = {{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }} tftp_root = /tftpboot @@ -108,5 +112,5 @@ project_domain_id = default region_name = {{ keystone.bootstrap.region_name | default('RegionOne')}} {% else %} auth_type = none -endpoint_override = http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:6385 {% endif %} +endpoint_override = http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:6385 diff --git a/playbooks/roles/bifrost-keystone-install/tasks/pip_install.yml b/playbooks/roles/bifrost-keystone-install/tasks/pip_install.yml index 43dfa2e2c..7ffeda49a 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/pip_install.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/pip_install.yml @@ -11,18 +11,47 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -- name: "Install {{ package }} package from pip" + +- name: set virtualenv_command + set_fact: + venv_command: "{{ hostvars[inventory_hostname].ansible_python.executable }} -m virtualenv" + when: enable_venv|bool + +- name: "Install {{ package }} package from pip using virtualenv" pip: name: "{{ package }}" state: "{{ state | default(omit) }}" version: "{{ version | default(omit) }}" - virtualenv: "{{ bifrost_venv_dir if enable_venv else omit }}" + virtualenv: "{{ bifrost_venv_dir }}" + virtualenv_command: "{{ venv_command | default(omit) }}" extra_args: "{{ extra_args | default(omit) }}" - when: source_install is not defined or source_install == false + register: pip_package_install_done + until: pip_package_install_done|succeeded + retries: 5 + delay: 10 + when: (source_install is not defined or source_install == false) and enable_venv|bool + +- name: "Install {{ package }} package from pip without virtualenv" + pip: + name: "{{ package }}" + state: "{{ state | default(omit) }}" + version: "{{ version | default(omit) }}" + extra_args: "{{ extra_args | default(omit) }}" + requirements: "{{ requirements_file | default(omit) }}" + register: pip_package_install_done + until: pip_package_install_done|succeeded + retries: 5 + delay: 10 + when: (source_install is not defined or source_install == false) and not enable_venv|bool + # NOTE (cinerama): We should be able to use the pip module here and # possibly merge these two tasks when # https://github.com/ansible/ansible-modules-core/pull/2600 lands. - name: "Install from {{ sourcedir }} using pip" command: pip install --upgrade {{ sourcedir }} {{ extra_args | default('') }} + register: pip_package_install_done + until: pip_package_install_done|succeeded + retries: 5 + delay: 10 when: source_install is defined and (source_install | bool == true) environment: "{{ bifrost_venv_env if enable_venv else {} }}" diff --git a/scripts/test-bifrost.sh b/scripts/test-bifrost.sh index 086ed0e3b..0063e5807 100755 --- a/scripts/test-bifrost.sh +++ b/scripts/test-bifrost.sh @@ -200,6 +200,7 @@ ${ANSIBLE} -vvvv \ -e wait_timeout=${PROVISION_WAIT_TIMEOUT} \ -e noauth_mode=${NOAUTH_MODE} \ -e enable_keystone=${ENABLE_KEYSTONE} \ + -e use_public_urls=${ENABLE_KEYSTONE} \ -e wait_for_node_deploy=${WAIT_FOR_DEPLOY} \ -e not_enrolled_data_file=${BAREMETAL_DATA_FILE}.rest \ ${CLOUD_CONFIG} diff --git a/zuul.d/legacy-bifrost-jobs.yaml b/zuul.d/legacy-bifrost-jobs.yaml index df5c922b3..8c3d5b513 100644 --- a/zuul.d/legacy-bifrost-jobs.yaml +++ b/zuul.d/legacy-bifrost-jobs.yaml @@ -83,6 +83,13 @@ parent: bifrost-integration-tinyipa nodeset: ubuntu-xenial +- job: + name: bifrost-integration-tinyipa-keystone-ubuntu-xenial + parent: bifrost-integration-tinyipa + nodeset: ubuntu-xenial + vars: + use_keystone: true + - job: name: bifrost-integration-tinyipa-centos-7 parent: bifrost-integration-tinyipa diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 9d0f4830d..2b991d78d 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -7,6 +7,7 @@ check: jobs: - bifrost-integration-tinyipa-ubuntu-xenial + - bifrost-integration-tinyipa-keystone-ubuntu-xenial - bifrost-integration-tinyipa-opensuse-423 # Non-voting jobs - bifrost-integration-dhcp-ubuntu-xenial: @@ -27,5 +28,6 @@ gate: jobs: - bifrost-integration-tinyipa-ubuntu-xenial + - bifrost-integration-tinyipa-keystone-ubuntu-xenial - bifrost-integration-tinyipa-opensuse-423 - openstack-tox-lower-constraints