From 80d2d96a5f01cc455add5e9c8699c7138d06af47 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Wed, 17 Aug 2016 20:00:48 +0100 Subject: [PATCH] Add Multi Region Swift gate scenario * Fix networking so that we can extend it for MR swift gate. * Add a vars file for region A and region B. * Add host_vars and inventory files for region A and region B * Split out the function-test to allow all scenarios to use the same test.yml file. * Use -e @vars-file.yml format in tox.ini since we can't include vars files based on a variable. * Remove any references to include_vars: test-vars.yml as a result of moving to use -e @vars-file.yml * Add static routes into host_vars for swift-proxy and swift-storage hosts so that they can route to the other region. * Make addresses in test-vars more generic based on inventory. Change-Id: I52b4068acbc80dcb7710d388ccbed2edcb8bfd61 --- tests/host_vars/infra1.yml | 4 +- tests/host_vars/infraA1.yml | 23 +++++ tests/host_vars/infraB1.yml | 23 +++++ tests/host_vars/swift-proxy.yml | 6 +- tests/host_vars/swift-proxyA.yml | 33 +++++++ tests/host_vars/swift-proxyB.yml | 33 +++++++ tests/host_vars/swift-storage1.yml | 8 +- tests/host_vars/swift-storage2.yml | 8 +- tests/host_vars/swift-storage3.yml | 8 +- tests/host_vars/swift-storage4.yml | 8 +- tests/host_vars/swift-storageA1.yml | 43 +++++++++ tests/host_vars/swift-storageA2.yml | 43 +++++++++ tests/host_vars/swift-storageB1.yml | 43 +++++++++ tests/host_vars/swift-storageB2.yml | 44 +++++++++ tests/inventory_MR_A | 55 ++++++++++++ tests/inventory_MR_B | 55 ++++++++++++ tests/test-install-infra.yml | 2 - tests/test-install-keystone.yml | 2 - tests/test-install-swift.yml | 6 +- tests/test-prepare-containers.yml | 1 - tests/test-prepare-host.yml | 37 +++++--- tests/test-swift-MR-interfaces.cfg.j2 | 67 ++++++++++++++ tests/test-swift-functional.yml | 2 - tests/test-swift-interfaces.cfg.j2 | 36 ++++++++ tests/test-vars-MR-A.yml | 124 ++++++++++++++++++++++++++ tests/test-vars-MR-B.yml | 124 ++++++++++++++++++++++++++ tests/test-vars.yml | 25 +++--- tests/test.yml | 3 - tox.ini | 88 ++++++++++++++++-- 29 files changed, 894 insertions(+), 60 deletions(-) create mode 100644 tests/host_vars/infraA1.yml create mode 100644 tests/host_vars/infraB1.yml create mode 100644 tests/host_vars/swift-proxyA.yml create mode 100644 tests/host_vars/swift-proxyB.yml create mode 100644 tests/host_vars/swift-storageA1.yml create mode 100644 tests/host_vars/swift-storageA2.yml create mode 100644 tests/host_vars/swift-storageB1.yml create mode 100644 tests/host_vars/swift-storageB2.yml create mode 100644 tests/inventory_MR_A create mode 100644 tests/inventory_MR_B create mode 100644 tests/test-swift-MR-interfaces.cfg.j2 create mode 100644 tests/test-swift-interfaces.cfg.j2 create mode 100644 tests/test-vars-MR-A.yml create mode 100644 tests/test-vars-MR-B.yml diff --git a/tests/host_vars/infra1.yml b/tests/host_vars/infra1.yml index af44c3df..0fcdabb9 100644 --- a/tests/host_vars/infra1.yml +++ b/tests/host_vars/infra1.yml @@ -13,11 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.100.100.101 +ansible_ssh_host: 10.1.1.101 container_networks: management_address: address: "{{ ansible_ssh_host }}" - bridge: "lxcbr0" + bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" type: "veth" diff --git a/tests/host_vars/infraA1.yml b/tests/host_vars/infraA1.yml new file mode 100644 index 00000000..aefd6155 --- /dev/null +++ b/tests/host_vars/infraA1.yml @@ -0,0 +1,23 @@ +--- +# 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_ssh_host: 10.1.1.101 +container_networks: + management_address: + address: "{{ ansible_ssh_host }}" + bridge: "br-mgmtA" + interface: "eth1" + netmask: "255.255.255.0" + type: "veth" diff --git a/tests/host_vars/infraB1.yml b/tests/host_vars/infraB1.yml new file mode 100644 index 00000000..a785b42a --- /dev/null +++ b/tests/host_vars/infraB1.yml @@ -0,0 +1,23 @@ +--- +# 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_ssh_host: 10.1.11.101 +container_networks: + management_address: + address: "{{ ansible_ssh_host }}" + bridge: "br-mgmtB" + interface: "eth1" + netmask: "255.255.255.0" + type: "veth" diff --git a/tests/host_vars/swift-proxy.yml b/tests/host_vars/swift-proxy.yml index 570a9d5b..0cd1e6e8 100644 --- a/tests/host_vars/swift-proxy.yml +++ b/tests/host_vars/swift-proxy.yml @@ -13,12 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.100.100.102 -storage_address: 10.100.101.102 +ansible_ssh_host: 10.1.1.102 +storage_address: 10.1.2.102 container_networks: management_address: address: "{{ ansible_ssh_host }}" - bridge: "lxcbr0" + bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" type: "veth" diff --git a/tests/host_vars/swift-proxyA.yml b/tests/host_vars/swift-proxyA.yml new file mode 100644 index 00000000..b9311cbb --- /dev/null +++ b/tests/host_vars/swift-proxyA.yml @@ -0,0 +1,33 @@ +--- +# 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_ssh_host: 10.1.1.102 +storage_address: 10.1.2.102 +container_networks: + management_address: + address: "{{ ansible_ssh_host }}" + bridge: "br-mgmtA" + interface: "eth1" + netmask: "255.255.255.0" + type: "veth" + storage_address: + address: "{{ storage_address }}" + bridge: "br-storageA" + interface: "eth2" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.12.0/24" + gateway: "10.1.2.1" diff --git a/tests/host_vars/swift-proxyB.yml b/tests/host_vars/swift-proxyB.yml new file mode 100644 index 00000000..77ee23f8 --- /dev/null +++ b/tests/host_vars/swift-proxyB.yml @@ -0,0 +1,33 @@ +--- +# 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_ssh_host: 10.1.11.102 +storage_address: 10.1.12.102 +container_networks: + management_address: + address: "{{ ansible_ssh_host }}" + bridge: "br-mgmtB" + interface: "eth1" + netmask: "255.255.255.0" + type: "veth" + storage_address: + address: "{{ storage_address }}" + bridge: "br-storageB" + interface: "eth2" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.2.0/24" + gateway: "10.1.12.1" diff --git a/tests/host_vars/swift-storage1.yml b/tests/host_vars/swift-storage1.yml index e3cbb99d..168eef5c 100644 --- a/tests/host_vars/swift-storage1.yml +++ b/tests/host_vars/swift-storage1.yml @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.100.100.103 -storage_address: 10.100.101.103 -replication_address: 10.100.102.103 +ansible_ssh_host: 10.1.1.103 +storage_address: 10.1.2.103 +replication_address: 10.1.3.103 container_networks: management_address: address: "{{ ansible_ssh_host }}" - bridge: "lxcbr0" + bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" type: "veth" diff --git a/tests/host_vars/swift-storage2.yml b/tests/host_vars/swift-storage2.yml index 77cb2ef0..5d4528ae 100644 --- a/tests/host_vars/swift-storage2.yml +++ b/tests/host_vars/swift-storage2.yml @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.100.100.104 -storage_address: 10.100.101.104 -replication_address: 10.100.102.104 +ansible_ssh_host: 10.1.1.104 +storage_address: 10.1.2.104 +replication_address: 10.1.3.104 container_networks: management_address: address: "{{ ansible_ssh_host }}" - bridge: "lxcbr0" + bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" type: "veth" diff --git a/tests/host_vars/swift-storage3.yml b/tests/host_vars/swift-storage3.yml index 1a1df354..9c292022 100644 --- a/tests/host_vars/swift-storage3.yml +++ b/tests/host_vars/swift-storage3.yml @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.100.100.105 -storage_address: 10.100.101.105 -replication_address: 10.100.102.105 +ansible_ssh_host: 10.1.1.105 +storage_address: 10.1.2.105 +replication_address: 10.1.3.105 container_networks: management_address: address: "{{ ansible_ssh_host }}" - bridge: "lxcbr0" + bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" type: "veth" diff --git a/tests/host_vars/swift-storage4.yml b/tests/host_vars/swift-storage4.yml index c0c25ab7..b794fef7 100644 --- a/tests/host_vars/swift-storage4.yml +++ b/tests/host_vars/swift-storage4.yml @@ -13,13 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: 10.100.100.106 -storage_address: 10.100.101.106 -replication_address: 10.100.102.106 +ansible_ssh_host: 10.1.1.106 +storage_address: 10.1.2.106 +replication_address: 10.1.3.106 container_networks: management_address: address: "{{ ansible_ssh_host }}" - bridge: "lxcbr0" + bridge: "br-mgmt" interface: "eth1" netmask: "255.255.255.0" type: "veth" diff --git a/tests/host_vars/swift-storageA1.yml b/tests/host_vars/swift-storageA1.yml new file mode 100644 index 00000000..7cd911eb --- /dev/null +++ b/tests/host_vars/swift-storageA1.yml @@ -0,0 +1,43 @@ +--- +# 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_ssh_host: 10.1.1.103 +storage_address: 10.1.2.103 +replication_address: 10.1.3.103 +container_networks: + management_address: + address: "{{ ansible_ssh_host }}" + bridge: "br-mgmtA" + interface: "eth1" + netmask: "255.255.255.0" + type: "veth" + storage_address: + address: "{{ storage_address }}" + bridge: "br-storageA" + interface: "eth2" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.12.0/24" + gateway: "10.1.2.1" + replication_address: + address: "{{ replication_address }}" + bridge: "br-replA" + interface: "eth3" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.13.0/24" + gateway: "10.1.3.1" diff --git a/tests/host_vars/swift-storageA2.yml b/tests/host_vars/swift-storageA2.yml new file mode 100644 index 00000000..bbd76fba --- /dev/null +++ b/tests/host_vars/swift-storageA2.yml @@ -0,0 +1,43 @@ +--- +# 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_ssh_host: 10.1.1.104 +storage_address: 10.1.2.104 +replication_address: 10.1.3.104 +container_networks: + management_address: + address: "{{ ansible_ssh_host }}" + bridge: "br-mgmtA" + interface: "eth1" + netmask: "255.255.255.0" + type: "veth" + storage_address: + address: "{{ storage_address }}" + bridge: "br-storageA" + interface: "eth2" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.12.0/24" + gateway: "10.1.2.1" + replication_address: + address: "{{ replication_address }}" + bridge: "br-replA" + interface: "eth3" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.13.0/24" + gateway: "10.1.3.1" diff --git a/tests/host_vars/swift-storageB1.yml b/tests/host_vars/swift-storageB1.yml new file mode 100644 index 00000000..5953ae7f --- /dev/null +++ b/tests/host_vars/swift-storageB1.yml @@ -0,0 +1,43 @@ +--- +# 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_ssh_host: 10.1.11.103 +storage_address: 10.1.12.103 +replication_address: 10.1.13.103 +container_networks: + management_address: + address: "{{ ansible_ssh_host }}" + bridge: "br-mgmtB" + interface: "eth1" + netmask: "255.255.255.0" + type: "veth" + storage_address: + address: "{{ storage_address }}" + bridge: "br-storageB" + interface: "eth2" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.2.0/24" + gateway: "10.1.12.1" + replication_address: + address: "{{ replication_address }}" + bridge: "br-replB" + interface: "eth3" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.3.0/24" + gateway: "10.1.13.1" diff --git a/tests/host_vars/swift-storageB2.yml b/tests/host_vars/swift-storageB2.yml new file mode 100644 index 00000000..4cd642ca --- /dev/null +++ b/tests/host_vars/swift-storageB2.yml @@ -0,0 +1,44 @@ +--- +# 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_ssh_host: 10.1.11.104 +storage_address: 10.1.12.104 +replication_address: 10.1.13.104 +container_networks: + management_address: + address: "{{ ansible_ssh_host }}" + bridge: "br-mgmtB" + interface: "eth1" + netmask: "255.255.255.0" + type: "veth" + storage_address: + address: "{{ storage_address }}" + bridge: "br-storageB" + interface: "eth2" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.2.0/24" + gateway: "10.1.12.1" + replication_address: + address: "{{ replication_address }}" + bridge: "br-replB" + interface: "eth3" + netmask: "255.255.255.0" + type: "veth" + static_routes: + - cidr: "10.1.3.0/24" + gateway: "10.1.13.1" + diff --git a/tests/inventory_MR_A b/tests/inventory_MR_A new file mode 100644 index 00000000..810517ad --- /dev/null +++ b/tests/inventory_MR_A @@ -0,0 +1,55 @@ +[all] +localhost ansible_connection=local ansible_become=True +infraA1 +swift-proxyA +swift-storageA1 +swift-storageA2 + +[all_containers] +infraA1 +swift-proxyA +swift-storageA1 +swift-storageA2 + +[galera_all] +infraA1 + +[memcached_all] +infraA1 + +[service_all:children] +galera_all +memcached_all + +[keystone_all] +infraA1 + +[swift_hosts] +swift-storageA1 +swift-storageA2 + +[swift_proxy] +swift-proxyA + +[swift_acc] +swift-storageA1 +swift-storageA2 + +[swift_cont] +swift-storageA1 +swift-storageA2 + +[swift_obj] +swift-storageA1 +swift-storageA2 + +[swift_all:children] +swift_acc +swift_proxy +swift_cont +swift_obj + +[swift_remote_all] +swift-proxyB +swift-storageB1 +swift-storageB2 diff --git a/tests/inventory_MR_B b/tests/inventory_MR_B new file mode 100644 index 00000000..d4d656ed --- /dev/null +++ b/tests/inventory_MR_B @@ -0,0 +1,55 @@ +[all] +localhost ansible_connection=local ansible_become=True +infraB1 +swift-proxyB +swift-storageB1 +swift-storageB2 + +[all_containers] +infraB1 +swift-proxyB +swift-storageB1 +swift-storageB2 + +[galera_all] +infraB1 + +[memcached_all] +infraB1 + +[service_all:children] +galera_all +memcached_all + +[keystone_all] +infraB1 + +[swift_hosts] +swift-storageB1 +swift-storageB2 + +[swift_proxy] +swift-proxyB + +[swift_acc] +swift-storageB1 +swift-storageB2 + +[swift_cont] +swift-storageB1 +swift-storageB2 + +[swift_obj] +swift-storageB1 +swift-storageB2 + +[swift_all:children] +swift_acc +swift_proxy +swift_cont +swift_obj + +[swift_remote_all] +swift-proxyA +swift-storageA1 +swift-storageA2 diff --git a/tests/test-install-infra.yml b/tests/test-install-infra.yml index 79ef1bd0..6e3e2136 100644 --- a/tests/test-install-infra.yml +++ b/tests/test-install-infra.yml @@ -20,5 +20,3 @@ roles: - role: "memcached_server" - role: "galera_server" - vars_files: - - test-vars.yml diff --git a/tests/test-install-keystone.yml b/tests/test-install-keystone.yml index 4c5c8c4f..613d68e8 100644 --- a/tests/test-install-keystone.yml +++ b/tests/test-install-keystone.yml @@ -48,5 +48,3 @@ - mysql-db-setup roles: - role: os_keystone - vars_files: - - test-vars.yml diff --git a/tests/test-install-swift.yml b/tests/test-install-swift.yml index 8cdb6551..ebd2a2cf 100644 --- a/tests/test-install-swift.yml +++ b/tests/test-install-swift.yml @@ -13,8 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# We can set the swift_groups so that the multi-region test will run against only the local hosts +# when the remote hosts haven't been created yet. - name: Playbook for deploying swift - hosts: swift_all + hosts: "{{ swift_groups | default('swift_all:swift_remote_all') }}" user: root gather_facts: true pre_tasks: @@ -26,5 +28,3 @@ - hostvars[inventory_hostname]['container_networks']['replication_address']['address'] is defined roles: - role: "{{ rolename | basename }}" - vars_files: - - test-vars.yml diff --git a/tests/test-prepare-containers.yml b/tests/test-prepare-containers.yml index c0d539ea..f85472e4 100644 --- a/tests/test-prepare-containers.yml +++ b/tests/test-prepare-containers.yml @@ -18,7 +18,6 @@ gather_facts: false roles: - role: "lxc_container_create" - lxc_container_release: trusty lxc_container_backing_store: dir global_environment_variables: PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" diff --git a/tests/test-prepare-host.yml b/tests/test-prepare-host.yml index 84867167..c8641e75 100644 --- a/tests/test-prepare-host.yml +++ b/tests/test-prepare-host.yml @@ -37,17 +37,34 @@ - { src: '/etc/pip.conf', dest: '/etc/pip.conf' } when: nodepool.stat.exists | bool post_tasks: - - name: Create br-storage bridge - shell: /sbin/brctl addbr br-storage || true - - name: IP br-storage - command: /sbin/ifconfig br-storage 10.100.101.1 netmask 255.255.255.0 - - name: Create br-repl bridge - shell: /sbin/brctl addbr br-repl || true - - name: IP br-repl - command: /sbin/ifconfig br-repl 10.100.102.1 netmask 255.255.255.0 + - name: Ensure that /etc/network/interfaces.d/ exists + file: + path: /etc/network/interfaces.d/ + state: directory + - name: Copy network configuration + template: + src: "{{ interfaces_file }}" + dest: /etc/network/interfaces.d/swift_interfaces.cfg + register: swift_interfaces + + - name: Ensure our interfaces.d configuration files are loaded automatically + lineinfile: + dest: /etc/network/interfaces + line: "source /etc/network/interfaces.d/*.cfg" + + - name: Shut down the network interfaces + command: "ifdown {{ item }}" + when: swift_interfaces | changed + with_items: + - "{{ bridges }}" + + - name: Start the network interfaces + command: "ifup {{ item }}" + when: swift_interfaces | changed + with_items: + - "{{ bridges }}" + - name: Add iptables rule to ensure ssh checksum is correct command: /sbin/iptables -A POSTROUTING -t mangle -p tcp --dport 22 -j CHECKSUM --checksum-fill roles: - role: "lxc_hosts" - vars_files: - - test-vars.yml diff --git a/tests/test-swift-MR-interfaces.cfg.j2 b/tests/test-swift-MR-interfaces.cfg.j2 new file mode 100644 index 00000000..271aed70 --- /dev/null +++ b/tests/test-swift-MR-interfaces.cfg.j2 @@ -0,0 +1,67 @@ +## The default networking requires several bridges. These bridges were named to be informative +## however they can be named what ever you like and is adaptable to any network infrastructure +## environment. This file serves as an example of how to setup basic networking and was ONLY +## built for the purpose of being an example and used expressly in the building of an ALL IN +## ONE development environment. + +auto br-mgmtA +iface br-mgmtA inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + # Notice the bridge port is the vlan tagged interface + bridge_ports none + address 10.1.1.1 + netmask 255.255.255.0 + offload-sg off + +auto br-storageA +iface br-storageA inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + bridge_ports none + address 10.1.2.1 + netmask 255.255.255.0 + offload-sg off + +auto br-replA +iface br-replA inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + bridge_ports none + address 10.1.3.1 + netmask 255.255.255.0 + offload-sg off + +auto br-mgmtB +iface br-mgmtB inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + # Notice the bridge port is the vlan tagged interface + bridge_ports none + address 10.1.11.1 + netmask 255.255.255.0 + offload-sg off + +auto br-storageB +iface br-storageB inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + bridge_ports none + address 10.1.12.1 + netmask 255.255.255.0 + offload-sg off + +auto br-replB +iface br-replB inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + bridge_ports none + address 10.1.13.1 + netmask 255.255.255.0 + offload-sg off diff --git a/tests/test-swift-functional.yml b/tests/test-swift-functional.yml index 4f784380..17e85358 100644 --- a/tests/test-swift-functional.yml +++ b/tests/test-swift-functional.yml @@ -115,5 +115,3 @@ args: chdir: "/opt/swift/" executable: "/bin/bash" - vars_files: - - test-vars.yml diff --git a/tests/test-swift-interfaces.cfg.j2 b/tests/test-swift-interfaces.cfg.j2 new file mode 100644 index 00000000..4c15fef9 --- /dev/null +++ b/tests/test-swift-interfaces.cfg.j2 @@ -0,0 +1,36 @@ +## The default networking requires several bridges. These bridges were named to be informative +## however they can be named what ever you like and is adaptable to any network infrastructure +## environment. This file serves as an example of how to setup basic networking and was ONLY +## built for the purpose of being an example and used expressly in the building of an ALL IN +## ONE development environment. + +auto br-mgmt +iface br-mgmt inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + # Notice the bridge port is the vlan tagged interface + bridge_ports none + address 10.1.1.1 + netmask 255.255.255.0 + offload-sg off + +auto br-storage +iface br-storage inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + bridge_ports none + address 10.1.2.1 + netmask 255.255.255.0 + offload-sg off + +auto br-repl +iface br-repl inet static + bridge_stp off + bridge_waitport 0 + bridge_fd 0 + bridge_ports none + address 10.1.3.1 + netmask 255.255.255.0 + offload-sg off diff --git a/tests/test-vars-MR-A.yml b/tests/test-vars-MR-A.yml new file mode 100644 index 00000000..80ea2d45 --- /dev/null +++ b/tests/test-vars-MR-A.yml @@ -0,0 +1,124 @@ +--- +# 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. + +# General Environment Settings +external_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" +internal_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" +debug: true + +# LXC Settings +lxc_net_address: 10.100.100.1 +lxc_net_netmask: 255.255.255.0 +lxc_net_dhcp_range: 10.100.100.2,10.100.100.99 +lxc_net_bridge: lxcbr0 +lxc_kernel_options: + - { key: 'fs.inotify.max_user_instances', value: 1024 } + +# Galera Settings +galera_root_password: secrete +galera_root_user: root +galera_server_id: "{{ inventory_hostname | string_2_int }}" +galera_wsrep_node_name: "{{ inventory_hostname }}" +galera_innodb_buffer_pool_size: 512M +galera_innodb_log_buffer_size: 32M +galera_wsrep_provider_options: + - { option: "gcache.size", value: "32M" } +galera_server_id: "{{ inventory_hostname | string_2_int }}" + +# Memcache Settings +memcached_listen: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" +memcached_servers: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" +memcached_encryption_key: "secrete" + +# Network interface settings +interfaces_file: "test-swift-MR-interfaces.cfg.j2" +bridges: + - br-mgmtA + - br-storageA + - br-replA + - br-mgmtB + - br-storageB + - br-replB + +# Keystone Settings +keystone_messaging_enabled: false +keystone_admin_user_name: admin +keystone_admin_tenant_name: admin +keystone_auth_admin_password: "SuperSecretePassword" +keystone_service_adminuri_insecure: false +keystone_service_internaluri_insecure: false +keystone_service_internaluri: "http://{{ internal_lb_vip_address }}:5000" +keystone_service_internalurl: "{{ keystone_service_internaluri }}/v3" +keystone_service_adminuri: "http://{{ internal_lb_vip_address }}:35357" +keystone_service_adminurl: "{{ keystone_service_adminuri }}/v3" +keystone_service_password: "secrete" +keystone_galera_database: keystone +keystone_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_ssh_host'] }}" +keystone_container_mysql_password: "SuperSecrete" +keystone_venv_tag: "testing" +keystone_developer_mode: true +keystone_git_install_branch: master +keystone_requirements_git_install_branch: master +keystone_service_region: RegionOne +keystone_httpd_mpm_thread_limit: 20 +keystone_httpd_mpm_min_spare_threads: 2 +keystone_httpd_mpm_max_spare_threads: 10 + +# Optimization for MR Swift memory usage +keystone_wsgi_processes: 2 +swift_account_server_workers: 2 +swift_container_server_workers: 2 +swift_object_server_workers: 2 +swift_proxy_server_workers: 2 + +# Swift specific settings +swift_storage_address: "{{ ansible_ssh_host }}" +swift_container_mysql_password: "SuperSecrete" +swift_dispersion_password: "secrete" +swift_hash_path_prefix: "secrete_prefx" +swift_hash_path_suffix: "secrete_suffix" +swift_service_password: "secrete" +swift_developer_mode: true +swift_git_install_branch: master +swift_venv_tag: untagged +swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin" +swift_service_publicuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" +swift_service_adminuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" +swift_service_internaluri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" +swift_replication_address: "{{ replication_address }}" +swift: + storage_network: eth1 + replication_network: eth3 + part_power: 8 + region: 1 + drives: + - name: swift1 + - name: swift2 + mount_point: /openstack + storage_policies: + - policy: + name: gold + index: 0 + repl_number: 3 + default: True +swift_proxy_server_conf_overrides: + "filter:keystoneauth": + reseller_prefix: "AUTH, SERVICE" + "SERVICE_service_roles": "test5" + +# openrc settings +openrc_os_password: "{{ keystone_auth_admin_password }}" +openrc_os_domain_name: "Default" +openrc_os_auth_url: "http://{{ internal_lb_vip_address }}:5000/v3" diff --git a/tests/test-vars-MR-B.yml b/tests/test-vars-MR-B.yml new file mode 100644 index 00000000..3e42120e --- /dev/null +++ b/tests/test-vars-MR-B.yml @@ -0,0 +1,124 @@ +--- +# 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. + +# General Environment Settings +external_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" +internal_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" +debug: true + +# LXC Settings +lxc_net_address: 10.100.100.1 +lxc_net_netmask: 255.255.255.0 +lxc_net_dhcp_range: 10.100.100.2,10.100.100.99 +lxc_net_bridge: lxcbr0 +lxc_kernel_options: + - { key: 'fs.inotify.max_user_instances', value: 1024 } + +# Galera Settings +galera_root_password: secrete +galera_root_user: root +galera_server_id: "{{ inventory_hostname | string_2_int }}" +galera_wsrep_node_name: "{{ inventory_hostname }}" +galera_innodb_buffer_pool_size: 512M +galera_innodb_log_buffer_size: 32M +galera_wsrep_provider_options: + - { option: "gcache.size", value: "32M" } +galera_server_id: "{{ inventory_hostname | string_2_int }}" + +# Memcache Settings +memcached_listen: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" +memcached_servers: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" +memcached_encryption_key: "secrete" + +# Network interface settings +interfaces_file: "test-swift-MR-interfaces.cfg.j2" +bridges: + - br-mgmtA + - br-storageA + - br-replA + - br-mgmtB + - br-storageB + - br-replB + +# Keystone Settings +keystone_messaging_enabled: false +keystone_admin_user_name: admin +keystone_admin_tenant_name: admin +keystone_auth_admin_password: "SuperSecretePassword" +keystone_service_adminuri_insecure: false +keystone_service_internaluri_insecure: false +keystone_service_internaluri: "http://{{ internal_lb_vip_address }}:5000" +keystone_service_internalurl: "{{ keystone_service_internaluri }}/v3" +keystone_service_adminuri: "http://{{ internal_lb_vip_address }}:35357" +keystone_service_adminurl: "{{ keystone_service_adminuri }}/v3" +keystone_service_password: "secrete" +keystone_galera_database: keystone +keystone_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_ssh_host'] }}" +keystone_container_mysql_password: "SuperSecrete" +keystone_venv_tag: "testing" +keystone_developer_mode: true +keystone_git_install_branch: master +keystone_requirements_git_install_branch: master +keystone_service_region: RegionOne +keystone_httpd_mpm_thread_limit: 20 +keystone_httpd_mpm_min_spare_threads: 2 +keystone_httpd_mpm_max_spare_threads: 10 + +# Optimization for MR Swift memory usage +keystone_wsgi_processes: 2 +swift_account_server_workers: 2 +swift_container_server_workers: 2 +swift_object_server_workers: 2 +swift_proxy_server_workers: 2 + +# Swift specific settings +swift_storage_address: "{{ ansible_ssh_host }}" +swift_container_mysql_password: "SuperSecrete" +swift_dispersion_password: "secrete" +swift_hash_path_prefix: "secrete_prefx" +swift_hash_path_suffix: "secrete_suffix" +swift_service_password: "secrete" +swift_developer_mode: true +swift_git_install_branch: master +swift_venv_tag: untagged +swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin" +swift_service_publicuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" +swift_service_adminuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" +swift_service_internaluri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" +swift_replication_address: "{{ replication_address }}" +swift: + storage_network: eth1 + replication_network: eth3 + part_power: 8 + region: 2 + drives: + - name: swift1 + - name: swift2 + mount_point: /openstack + storage_policies: + - policy: + name: gold + index: 0 + repl_number: 3 + default: True +swift_proxy_server_conf_overrides: + "filter:keystoneauth": + reseller_prefix: "AUTH, SERVICE" + "SERVICE_service_roles": "test5" + +# openrc settings +openrc_os_password: "{{ keystone_auth_admin_password }}" +openrc_os_domain_name: "Default" +openrc_os_auth_url: "http://{{ internal_lb_vip_address }}:5000/v3" diff --git a/tests/test-vars.yml b/tests/test-vars.yml index 21b81c32..b6cd11dd 100644 --- a/tests/test-vars.yml +++ b/tests/test-vars.yml @@ -14,8 +14,8 @@ # limitations under the License. # General Environment Settings -external_lb_vip_address: 10.100.100.101 -internal_lb_vip_address: 10.100.100.101 +external_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" +internal_lb_vip_address: "{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}" debug: true # LXC Settings @@ -29,8 +29,6 @@ lxc_kernel_options: # Galera Settings galera_root_password: secrete galera_root_user: root -galera_innodb_buffer_pool_size: 512M -galera_innodb_log_buffer_size: 32M galera_server_id: "{{ inventory_hostname | string_2_int }}" galera_wsrep_node_name: "{{ inventory_hostname }}" galera_wsrep_provider_options: @@ -38,10 +36,17 @@ galera_wsrep_provider_options: galera_server_id: "{{ inventory_hostname | string_2_int }}" # Memcache Settings -memcached_listen: 10.100.100.101 -memcached_servers: 10.100.100.101 +memcached_listen: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" +memcached_servers: "{{ hostvars[groups['memcached_all'][0]]['ansible_ssh_host'] }}" memcached_encryption_key: "secrete" +# Network interface settings +interfaces_file: "test-swift-interfaces.cfg.j2" +bridges: + - br-mgmt + - br-storage + - br-repl + # Keystone Settings keystone_messaging_enabled: false keystone_admin_user_name: admin @@ -55,7 +60,7 @@ keystone_service_adminuri: "http://{{ internal_lb_vip_address }}:35357" keystone_service_adminurl: "{{ keystone_service_adminuri }}/v3" keystone_service_password: "secrete" keystone_galera_database: keystone -keystone_galera_address: 10.100.100.101 +keystone_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_ssh_host'] }}" keystone_container_mysql_password: "SuperSecrete" keystone_venv_tag: "testing" keystone_developer_mode: true @@ -74,9 +79,9 @@ swift_developer_mode: true swift_git_install_branch: master swift_venv_tag: untagged swift_bin: "/openstack/venvs/swift-{{ swift_venv_tag }}/bin" -swift_service_publicuri: "http://10.100.100.102:8080" -swift_service_adminuri: "http://10.100.100.102:8080" -swift_service_internaluri: "http://10.100.100.102:8080" +swift_service_publicuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" +swift_service_adminuri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" +swift_service_internaluri: "http://{{ hostvars[groups['swift_proxy'][0]]['ansible_ssh_host'] }}:8080" swift_replication_address: "{{ replication_address }}" swift: storage_network: eth1 diff --git a/tests/test.yml b/tests/test.yml index 1773a69a..7134007e 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -33,6 +33,3 @@ # Install Swift - include: test-install-swift.yml - -# Test Swift -- include: test-swift-functional.yml diff --git a/tox.ini b/tox.ini index 53ffe749..24327386 100644 --- a/tox.ini +++ b/tox.ini @@ -147,18 +147,23 @@ commands = ansible-lint {toxinidir} +[testenv:func_base] +# NOTE(odyssey4me): this target does not use constraints because +# it doesn't work in OpenStack-CI yet. Once that's fixed, we can +# drop the install_command. +install_command = + pip install -U --force-reinstall {opts} {packages} + + [testenv:functional] # Ignore_errors is set to true so that the logs are collected at the # end of the run. This will not produce a failse positive. Any # exception will be mark the run as failed and exit 1 after all of # the commands have been iterated through. ignore_errors = True -# NOTE(odyssey4me): this target does not use constraints because -# it doesn't work in OpenStack-CI yet. Once that's fixed, we can -# drop the install_command. # NOTE(andymccr): this will test standard Swift install. install_command = - pip install -U --force-reinstall {opts} {packages} + {[testenv:func_base]install_command} deps = {[testenv:ansible]deps} setenv = @@ -168,16 +173,21 @@ commands = ansible-playbook -i {toxinidir}/tests/inventory \ -e "rolename={toxinidir}" \ -e "install_test_packages=True" \ + -e @{toxinidir}/tests/test-vars.yml \ {toxinidir}/tests/test.yml -vvvv + ansible-playbook -i {toxinidir}/tests/inventory \ + -e "rolename={toxinidir}" \ + -e "install_test_packages=True" \ + -e @{toxinidir}/tests/test-vars.yml \ + {toxinidir}/tests/test-swift-functional.yml -vvvv bash -c 'mkdir -p {toxinidir}/logs' bash -c 'rsync -av --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true' - # NOTE(andymccr): this will test Swift running in pypy. [testenv:func_pypy] install_command = - pip install -U --force-reinstall {opts} {packages} + {[testenv:func_base]install_command} deps = {[testenv:ansible]deps} setenv = @@ -187,12 +197,78 @@ commands = ansible-playbook -i {toxinidir}/tests/inventory \ -e "rolename={toxinidir}" \ -e "install_test_packages=True" \ + -e @{toxinidir}/tests/test-vars.yml \ -e "swift_pypy_enabled=True" \ {toxinidir}/tests/test.yml -vvvv + ansible-playbook -i {toxinidir}/tests/inventory \ + -e "rolename={toxinidir}" \ + -e "install_test_packages=True" \ + -e @{toxinidir}/tests/test-vars.yml \ + -e "swift_pypy_enabled=True" \ + {toxinidir}/tests/test-swift-functional.yml -vvvv bash -c 'mkdir -p {toxinidir}/logs' bash -c 'rsync -av --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true' +# NOTE(andmccr): this will test a MR Swift deploy. +[testenv:multi_reg] +install_command = + {[testenv:func_base]install_command} +deps = + {[testenv:ansible]deps} +setenv = + {[testenv:ansible]setenv} +commands = + {[testenv:ansible]commands} + # Setup the host and Region A + # NB we run against swift_all only since region B hosts don't exist yet. + ansible-playbook -i {toxinidir}/tests/inventory_MR_A \ + -e "rolename={toxinidir}" \ + -e "install_test_packages=True" \ + -e "swift_do_setup=True" \ + -e "swift_do_sync=False" \ + -e "swift_groups='swift_all'" \ + -e @{toxinidir}/tests/test-vars-MR-A.yml \ + {toxinidir}/tests/test.yml -vvvv + # Setup region B + ansible-playbook -i {toxinidir}/tests/inventory_MR_B \ + -e "rolename={toxinidir}" \ + -e "install_test_packages=True" \ + -e "swift_do_setup=True" \ + -e "swift_do_sync=False" \ + -e @{toxinidir}/tests/test-vars-MR-B.yml \ + {toxinidir}/tests/test.yml -vvvv + # Sync rings from region A + ansible-playbook -i {toxinidir}/tests/inventory_MR_A \ + -e "rolename={toxinidir}" \ + -e "install_test_packages=True" \ + -e "swift_do_setup=False" \ + -e "swift_do_sync=True" \ + -e @{toxinidir}/tests/test-vars-MR-A.yml \ + {toxinidir}/tests/test-install-swift.yml -vvvv + # Sync rings from region B + ansible-playbook -i {toxinidir}/tests/inventory_MR_B \ + -e "rolename={toxinidir}" \ + -e "install_test_packages=True" \ + -e "swift_do_setup=False" \ + -e "swift_do_sync=True" \ + -e @{toxinidir}/tests/test-vars-MR-B.yml \ + {toxinidir}/tests/test-install-swift.yml -vvvv + # Run functional tests against region A + ansible-playbook -i {toxinidir}/tests/inventory_MR_A \ + -e "rolename={toxinidir}" \ + -e "install_test_packages=True" \ + -e @{toxinidir}/tests/test-vars-MR-A.yml \ + {toxinidir}/tests/test-swift-functional.yml -vvvv + # Run functional tests against region B + ansible-playbook -i {toxinidir}/tests/inventory_MR_B \ + -e "rolename={toxinidir}" \ + -e "install_test_packages=True" \ + -e @{toxinidir}/tests/test-vars-MR-B.yml \ + {toxinidir}/tests/test-swift-functional.yml -vvvv + bash -c 'mkdir -p {toxinidir}/logs' + bash -c 'rsync -av --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true' + [testenv:linters] deps =