From 660c5b8baed420992ecce9d27b9ff121682f5dfb Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Tue, 4 Oct 2016 16:56:42 +0100 Subject: [PATCH] Standardize the testing for Cinder This PR standardizes the testing around the central tests repository: * Removes the install-cinder and prepare-vg playbooks * Moves the inventory settings into host_vars * Adjusts the "bridges" settings * Standardize IP addresses on the 10.1.1.0/24 range Change-Id: I91c8079b033bb83e0175a3ab4b1c020a8df4a0db Depends-On: Ibe2bcd91af9eac099e86e92f9294ed04fffe7b95 --- tests/cinder-overrides.yml | 18 ++++++++ tests/host_vars/cinder.yml | 18 ++++++++ tests/host_vars/infra1.yml | 18 ++++++++ tests/host_vars/keystone.yml | 18 ++++++++ tests/host_vars/localhost.yml | 5 ++- tests/inventory | 8 ++-- tests/test-cinder-functional.yml | 1 - tests/test-install-cinder.yml | 70 -------------------------------- tests/test-prepare-vg.yml | 52 ------------------------ tests/test-vars.yml | 42 ------------------- tests/test.yml | 4 +- tox.ini | 2 - 12 files changed, 81 insertions(+), 175 deletions(-) create mode 100644 tests/cinder-overrides.yml create mode 100644 tests/host_vars/cinder.yml create mode 100644 tests/host_vars/infra1.yml create mode 100644 tests/host_vars/keystone.yml delete mode 100644 tests/test-install-cinder.yml delete mode 100644 tests/test-prepare-vg.yml delete mode 100644 tests/test-vars.yml diff --git a/tests/cinder-overrides.yml b/tests/cinder-overrides.yml new file mode 100644 index 00000000..3ac818be --- /dev/null +++ b/tests/cinder-overrides.yml @@ -0,0 +1,18 @@ +--- +# 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. + +# There are currently no overrides required for the cinder role. +# If you need cinder specific variable overries set them below and add +# "-e @{toxinidir}/tests/cinder-overrides.yml \" to the ansible test run. diff --git a/tests/host_vars/cinder.yml b/tests/host_vars/cinder.yml new file mode 100644 index 00000000..1f172ba5 --- /dev/null +++ b/tests/host_vars/cinder.yml @@ -0,0 +1,18 @@ +--- +# 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. + +ansible_host: 10.1.1.103 +ansible_become: True +ansible_user: root diff --git a/tests/host_vars/infra1.yml b/tests/host_vars/infra1.yml new file mode 100644 index 00000000..bfdc1359 --- /dev/null +++ b/tests/host_vars/infra1.yml @@ -0,0 +1,18 @@ +--- +# 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. + +ansible_host: 10.1.1.101 +ansible_become: True +ansible_user: root diff --git a/tests/host_vars/keystone.yml b/tests/host_vars/keystone.yml new file mode 100644 index 00000000..e50c2381 --- /dev/null +++ b/tests/host_vars/keystone.yml @@ -0,0 +1,18 @@ +--- +# 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. + +ansible_host: 10.1.1.102 +ansible_become: True +ansible_user: root diff --git a/tests/host_vars/localhost.yml b/tests/host_vars/localhost.yml index 65ddeaa0..c8c09b3e 100644 --- a/tests/host_vars/localhost.yml +++ b/tests/host_vars/localhost.yml @@ -14,6 +14,7 @@ # limitations under the License. bridges: - - "br-mgmt" - + - name: "br-mgmt" + ip_addr: "10.1.1.1" +ansible_become: True ansible_python_interpreter: "/usr/bin/python2" diff --git a/tests/inventory b/tests/inventory index 1d6647ad..93ed5a0e 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,8 +1,8 @@ [all] -localhost ansible_become=True -infra1 ansible_host=10.100.100.2 ansible_become=True ansible_user=root -keystone ansible_host=10.100.100.3 ansible_become=True ansible_user=root -cinder ansible_host=10.100.100.4 ansible_become=True ansible_user=root +localhost +infra1 +keystone +cinder [all_containers] infra1 diff --git a/tests/test-cinder-functional.yml b/tests/test-cinder-functional.yml index 74a48905..be2c7417 100644 --- a/tests/test-cinder-functional.yml +++ b/tests/test-cinder-functional.yml @@ -34,4 +34,3 @@ {{ tempest_venv_bin | dirname }}/run_tempest.sh --no-virtual-env --serial tempest.api.volume.test_volumes_get vars_files: - common/test-vars.yml - - test-vars.yml diff --git a/tests/test-install-cinder.yml b/tests/test-install-cinder.yml deleted file mode 100644 index 11363136..00000000 --- a/tests/test-install-cinder.yml +++ /dev/null @@ -1,70 +0,0 @@ ---- -# Copyright 2015, 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: Deploy cinder - hosts: cinder_all - user: root - gather_facts: true - pre_tasks: - - name: Ensure Rabbitmq vhost - rabbitmq_vhost: - name: "{{ cinder_rabbitmq_vhost }}" - state: "present" - delegate_to: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_host'] }}" - when: inventory_hostname == groups['cinder_all'][0] - - name: Ensure rabbitmq user - rabbitmq_user: - user: "{{ cinder_rabbitmq_userid }}" - password: "{{ cinder_rabbitmq_password }}" - vhost: "{{ cinder_rabbitmq_vhost }}" - configure_priv: ".*" - read_priv: ".*" - write_priv: ".*" - state: "present" - delegate_to: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_host'] }}" - when: inventory_hostname == groups['cinder_all'][0] - - name: Create DB for service - mysql_db: - login_user: "{{ galera_root_user }}" - login_password: "{{ galera_root_password }}" - login_host: "{{ cinder_galera_address }}" - name: "{{ cinder_galera_database }}" - state: "present" - when: inventory_hostname == groups['cinder_all'][0] - delegate_to: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}" - tags: - - mysql-db-setup - - name: Grant access to the DB for the service - mysql_user: - login_user: "{{ galera_root_user }}" - login_password: "{{ galera_root_password }}" - login_host: "{{ cinder_galera_address }}" - name: "{{ cinder_galera_user }}" - password: "{{ cinder_container_mysql_password }}" - host: "{{ item }}" - state: "present" - priv: "{{ cinder_galera_database }}.*:ALL" - when: inventory_hostname == groups['cinder_all'][0] - delegate_to: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}" - with_items: - - "localhost" - - "%" - tags: - - mysql-db-setup - roles: - - role: "os_cinder" - vars_files: - - common/test-vars.yml - - test-vars.yml diff --git a/tests/test-prepare-vg.yml b/tests/test-prepare-vg.yml deleted file mode 100644 index e5049adb..00000000 --- a/tests/test-prepare-vg.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -# Copyright 2015, 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: Prepare cinder-volumes volume group - hosts: localhost - tasks: - - name: Install lvm2 apt package - apt: - name: lvm2 - when: - - ansible_pkg_mgr == 'apt' - - name: Install lvm2 yum package - yum: - name: lvm2 - when: - - ansible_pkg_mgr == 'yum' - - name: Create sparse Cinder file - shell: "truncate -s 10G /openstack/cinder.img" - args: - creates: /openstack/cinder.img - register: cinder_create - - name: Get a loopback device for cinder file - shell: losetup -f - when: cinder_create | changed - register: cinder_losetup - - name: Create the loopback device - shell: "losetup {{ cinder_losetup.stdout }} /openstack/cinder.img" - when: cinder_create | changed - - name: Make LVM physical volume on the cinder device - shell: "{{ item }}" - when: cinder_create | changed - with_items: - - "pvcreate {{ cinder_losetup.stdout }}" - - "pvscan" - - name: Add cinder-volumes volume group - lvg: - vg: cinder-volumes - pvs: "{{ cinder_losetup.stdout }}" - when: cinder_create | changed - diff --git a/tests/test-vars.yml b/tests/test-vars.yml deleted file mode 100644 index 37dcac33..00000000 --- a/tests/test-vars.yml +++ /dev/null @@ -1,42 +0,0 @@ -cinder_backends: - lvm: - volume_group: cinder-volumes - volume_driver: cinder.volume.drivers.lvm.LVMVolumeDriver - volume_backend_name: LVM_iSCSI -cinder_default_volume_type: lvm - -cinder_container_mysql_password: "SuperSecrete" -cinder_developer_mode: true -cinder_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}" -cinder_git_install_branch: master -cinder_glance_api_servers: "http://glance_server:9292" -cinder_profiler_hmac_key: "secrete" -cinder_rabbitmq_port: "{{ rabbitmq_port }}" -cinder_rabbitmq_servers: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_host'] }}" -cinder_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}" -cinder_rabbitmq_password: "{{ rabbitmq_password }}" -cinder_rabbitmq_userid: cinder -cinder_rabbitmq_vhost: /cinder -cinder_galera_user: cinder -cinder_galera_database: cinder -cinder_requirements_git_install_branch: master -cinder_service_password: "secrete" -cinder_venv_tag: "testing" - -cinder_service_port: 8776 -cinder_service_proto: http -cinder_service_publicuri: "{{ cinder_service_proto }}://{{ hostvars[groups['cinder_api'][0]]['ansible_host'] }}:{{ cinder_service_port }}" -cinder_service_publicurl: "{{ cinder_service_publicuri }}/v1/%(tenant_id)s" -cinder_service_adminuri: "{{ cinder_service_proto }}://{{ hostvars[groups['cinder_api'][0]]['ansible_host'] }}:{{ cinder_service_port }}" -cinder_service_adminurl: "{{ cinder_service_adminuri }}/v1/%(tenant_id)s" -cinder_service_internaluri: "{{ cinder_service_proto }}://{{ hostvars[groups['cinder_api'][0]]['ansible_host'] }}:{{ cinder_service_port }}" -cinder_service_internalurl: "{{ cinder_service_internaluri }}/v1/%(tenant_id)s" - -cinder_service_v2_port: 8776 -cinder_service_v2_proto: http -cinder_service_v2_publicuri: "{{ cinder_service_v2_proto }}://{{ hostvars[groups['cinder_api'][0]]['ansible_host'] }}:{{ cinder_service_v2_port }}" -cinder_service_v2_publicurl: "{{ cinder_service_publicuri }}/v2/%(tenant_id)s" -cinder_service_v2_adminuri: "{{ cinder_service_v2_proto }}://{{ hostvars[groups['cinder_api'][0]]['ansible_host'] }}:{{ cinder_service_v2_port }}" -cinder_service_v2_adminurl: "{{ cinder_service_adminuri }}/v2/%(tenant_id)s" -cinder_service_v2_internaluri: "{{ cinder_service_v2_proto }}://{{ hostvars[groups['cinder_api'][0]]['ansible_host'] }}:{{ cinder_service_v2_port }}" -cinder_service_v2_internalurl: "{{ cinder_service_internaluri }}/v2/%(tenant_id)s" \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml index 977fcb68..171570fa 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -17,7 +17,7 @@ - include: common/test-setup-host.yml # Prepare the cinder-volumes VG -- include: test-prepare-vg.yml +- include: common/test-setup-cinder-localhost.yml # Install RabbitMQ/MariaDB - include: common/test-install-infra.yml @@ -26,7 +26,7 @@ - include: common/test-install-keystone.yml # Install Cinder -- include: test-install-cinder.yml +- include: common/test-install-cinder.yml # Install Tempest - include: common/test-install-tempest.yml diff --git a/tox.ini b/tox.ini index 6c4310b0..56e510e5 100644 --- a/tox.ini +++ b/tox.ini @@ -136,8 +136,6 @@ deps = commands = {[testenv:ansible]commands} ansible-playbook -i {toxinidir}/tests/inventory \ - -e "install_test_packages=True" \ - -e @{toxinidir}/tests/test-vars.yml \ {toxinidir}/tests/test.yml -vvvv {[testenv:func_logs]commands}