diff --git a/defaults/main.yml b/defaults/main.yml index fad8c811..a426d317 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -79,6 +79,10 @@ swift_middleware_list: - proxy-logging - proxy-server +# Setup tempauth users list (user__ = ) +swift_tempauth_users: + - "user_admin_admin = admin .admin .reseller_admin" + ## Swift default ports swift_proxy_port: "8080" # You can change the object, container, account ports. @@ -387,10 +391,15 @@ swift_pretend_min_part_hours_passed: False # Set this option to enable or disable the pypy interpreter for swift swift_pypy_enabled: false swift_pypy_archive: - url: "https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.3.1-linux64.tar.bz2" - sha256: "6d0e8b14875b76b1e77f06a2ee3f1fb5015a645a951ba7a7586289344d4d9c22" + url: "https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.6.0-linux64.tar.bz2" + sha256: "aad55328cb0673a60b2633dcc3c36cf452917ac906b577eb3aed5876a7666fca" swift_pypy_version: "{{ swift_pypy_archive['url'] | basename | replace('.tar.bz2', '') }}" swift_pypy_env: "/opt/pypy-runtime/{{ swift_pypy_version }}/bin/pypy" +# Set the Garbage Collection (GC) options for pypy if you would like to tune these +# More info on pypy garbage collection can be found here: +# http://doc.pypy.org/en/latest/gc_info.html +#swift_pypy_gc_min: "15M" +#swift_pypy_gc_max: "1GB" # This variable is used by the repo_build process to determine # which host group to check for members of before building the diff --git a/releasenotes/notes/swift-pypy-gc-options-663fecdf1e013a23.yaml b/releasenotes/notes/swift-pypy-gc-options-663fecdf1e013a23.yaml new file mode 100644 index 00000000..f9b77691 --- /dev/null +++ b/releasenotes/notes/swift-pypy-gc-options-663fecdf1e013a23.yaml @@ -0,0 +1,10 @@ +--- +features: + - When using the pypy python interpreter you can configure the garbage + collection (gc) settings for pypy. Set the minimum GC value using the + ``swift_pypy_gc_min`` variable. GC will only happen when the memory + size is above this value. Set the maximum GC value using the + ``swift_pypy_gc_max`` variable. This is the maximum memory heap size + for pypy. + Both variables are not defined by default, and will only be used if + the values are defined and ``swift_pypy_enabled`` is set to ``True``. diff --git a/releasenotes/notes/swift-tempauth-configuration-7f710a5e2a1af67f.yaml b/releasenotes/notes/swift-tempauth-configuration-7f710a5e2a1af67f.yaml new file mode 100644 index 00000000..1b303235 --- /dev/null +++ b/releasenotes/notes/swift-tempauth-configuration-7f710a5e2a1af67f.yaml @@ -0,0 +1,8 @@ +--- +features: + - Swift tempauth users now be specified. The + ``swift_tempauth_users`` variable can be defined as a list + of tempauth users, and their permissions. You will still + need to specify the appropriate Swift middleware using the + ``swift_middleware_list`` variable, in order to utilise + tempauth. diff --git a/tasks/main.yml b/tasks/main.yml index 3978915e..57ad8a12 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -112,6 +112,8 @@ - include: swift_sync_post_install.yml static: no - when: swift_do_sync | bool + when: + - swift_do_sync | bool + - not swift_do_setup | bool tags: - always diff --git a/templates/proxy-server.conf.j2 b/templates/proxy-server.conf.j2 index 9834730b..bf51b505 100644 --- a/templates/proxy-server.conf.j2 +++ b/templates/proxy-server.conf.j2 @@ -71,10 +71,9 @@ sorting_method = {{ swift_sorting_method }} {% if 'tempauth' in swift_middleware_list %} [filter:tempauth] use = egg:swift#tempauth -user_admin_admin = admin .admin .reseller_admin -user_test_tester = testing .admin -user_test2_tester2 = testing2 .admin -user_test_tester3 = testing3 +{% for user in swift_tempauth_users %} +{{ user }} +{% endfor %} {% endif %} {% if 'authtoken' in swift_middleware_list %} diff --git a/templates/swift-systemd-init.j2 b/templates/swift-systemd-init.j2 index 9da036ac..56a79475 100644 --- a/templates/swift-systemd-init.j2 +++ b/templates/swift-systemd-init.j2 @@ -9,6 +9,14 @@ Type=simple User={{ swift_system_user_name }} Group={{ swift_system_group_name }} +{% if swift_pypy_enabled %} +{% if swift_pypy_gc_min is defined %} +Environment=PYPY_GC_MIN={{ swift_pypy_gc_min }} +{% endif %} +{% if swift_pypy_gc_max is defined %} +Environment=PYPY_GC_MAX={{ swift_pypy_gc_max }} +{% endif %} +{% endif %} {% if item.value.program_override is defined %} ExecStart={{ item.value.program_override }} {{ item.value.program_config_options|default('') }} {% else %} diff --git a/templates/swift-upstart-init.j2 b/templates/swift-upstart-init.j2 index 5c8a10f4..8880d5aa 100644 --- a/templates/swift-upstart-init.j2 +++ b/templates/swift-upstart-init.j2 @@ -10,6 +10,14 @@ respawn limit 10 5 # Set the RUNBIN environment variable env RUNBIN="{{ swift_bin }}/{{ item.value.program_binary | default(item.value.program_name) }}" +{% if swift_pypy_enabled %} +{% if swift_pypy_gc_min is defined %} +env PYPY_GC_MIN={{ swift_pypy_gc_min }} +{% endif %} +{% if swift_pypy_gc_max is defined %} +env PYPY_GC_MAX={{ swift_pypy_gc_max }} +{% endif %} +{% endif %} # Change directory to service users home chdir "{{ swift_system_home_folder }}" diff --git a/tests/inventory_pypy b/tests/inventory_pypy new file mode 100644 index 00000000..6a33cf39 --- /dev/null +++ b/tests/inventory_pypy @@ -0,0 +1,43 @@ +[all] +localhost +swift-proxy +swift-storage1 +swift-storage2 + +[all_containers] +swift-proxy +swift-storage1 +swift-storage2 + +[memcached_all] +swift-proxy + +[service_all:children] +memcached_all + +[swift_hosts] +swift-storage1 +swift-storage2 + +[swift_proxy] +swift-proxy + +[swift_acc] +swift-storage1 +swift-storage2 + +[swift_cont] +swift-storage1 +swift-storage2 + +[swift_obj] +swift-storage1 +swift-storage2 + +[swift_all:children] +swift_acc +swift_proxy +swift_cont +swift_obj + +[swift_remote_all] diff --git a/tests/os_swift-overrides-pypy.yml b/tests/os_swift-overrides-pypy.yml new file mode 100644 index 00000000..924c29de --- /dev/null +++ b/tests/os_swift-overrides-pypy.yml @@ -0,0 +1,61 @@ +--- +# 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. + +bridges: + - name: "br-mgmt" + ip_addr: "10.1.1.1" + - name: "br-storage" + ip_addr: "10.1.2.1" + - name: "br-repl" + ip_addr: "10.1.3.1" + +# These values are quite low due to memory constraints in an AIO +swift_pypy_gc_min: "5M" +swift_pypy_gc_max: "200M" +swift_pypy_enabled: True + +swift_middleware_list: + - catch_errors + - gatekeeper + - healthcheck + - proxy-logging + - "{% if swift_ceilometer_enabled | bool %}ceilometer{% endif %}" + - cache + - container_sync + - bulk + - tempurl + - ratelimit + - tempauth + - staticweb + - container-quotas + - account-quotas + - slo + - dlo + - proxy-logging + - proxy-server + +swift_tempauth_users: + - "user_admin_admin = admin .admin .reseller_admin" + - "user_test1_test1 = test1 .admin" + - "user_test2_test2 = test2 .admin" + - "user_test1_test3 = test3" + - "user_test5_test5 = test5 service" + - "user_test6_test6 = test6 .reseller_admin" + +swift_hard_open_file_limits: 30720 +swift_soft_open_file_limits: 12288 + +swift_rsync_module_per_drive: True +test_swift_repl_number: 2 diff --git a/tests/swift_test.conf.j2 b/tests/swift_test.conf.j2 index deb2507c..d7f281bc 100644 --- a/tests/swift_test.conf.j2 +++ b/tests/swift_test.conf.j2 @@ -1,17 +1,20 @@ [func_test] +{% if groups['keystone_all'] is not defined %} # sample config for Swift with tempauth -#auth_host = 10.100.100.2 -#auth_port = 5000 -#auth_ssl = no -#auth_prefix = /auth/ +auth_host = {{ test_swift_proxy_host }} +auth_port = 8080 +auth_ssl = no +auth_prefix = /auth/ +{% else %} ## sample config for Swift with Keystone v2 API # For keystone v2 change auth_version to 2 and auth_prefix to /v2.0/ # And "allow_account_management" should not be set "true" auth_version = 3 -auth_host = {{ hostvars[groups['keystone_all'][0]]['ansible_host'] }} +auth_host = {{ test_keystone_host }} auth_port = 5000 auth_ssl = no auth_prefix = /v3/ +{% endif %} # Primary functional test account (needs admin access to the account) account = test1 diff --git a/tests/test-swift-functional.yml b/tests/test-swift-functional.yml index fc7e54bf..5b0c92b6 100644 --- a/tests/test-swift-functional.yml +++ b/tests/test-swift-functional.yml @@ -20,6 +20,7 @@ - { project_name: "test2", domain_name: "Default" } - { project_name: "test5", domain_name: "Default" } - { project_name: "test6", domain_name: "Default" } + when: groups['keystone_all'] is defined register: add_service run_once: true until: add_service|success @@ -37,6 +38,7 @@ with_items: - "test-role" - "test5" + when: groups['keystone_all'] is defined run_once: true register: add_service until: add_service|success @@ -60,6 +62,7 @@ - { user_name: "test3", project_name: "test1", password: "test3", domain_name: "Default" } - { user_name: "test5", project_name: "test5", password: "test5", domain_name: "Default" } - { user_name: "test6", project_name: "test6", password: "test6", domain_name: "Default" } + when: groups['keystone_all'] is defined run_once: true register: add_service until: add_service|success @@ -83,6 +86,7 @@ - { user_name: "test3", project_name: "test1", role_name: "test-role", domain_name: "Default" } - { user_name: "test5", project_name: "test5", role_name: "test5", domain_name: "Default" } - { user_name: "test6", project_name: "test6", role_name: "ResellerAdmin", domain_name: "Default" } + when: groups['keystone_all'] is defined retries: 5 run_once: true register: add_service @@ -108,6 +112,26 @@ dest: "/etc/swift/test.conf" owner: "swift" group: "swift" + - name: Create swap file for swift-storage hosts + command: dd if=/dev/zero of=/swift_swap bs=1M count=1024 + when: + - inventory_hostname in groups['swift_hosts'] + - name: Make swap for swift-storage hosts + command: mkswap /swift_swap + when: + - inventory_hostname in groups['swift_hosts'] + - name: Add swap to fstab for swift-storage hosts + lineinfile: + dest: /etc/fstab + regexp: "swift_swap" + line: "/swift_swap none swap sw 0 0" + state: present + when: + - inventory_hostname in groups['swift_hosts'] + - name: Turn swap on for swift-storage hosts + command: swapon -a + when: + - inventory_hostname in groups['swift_hosts'] - name: Run functional tests for swift shell: "source /openstack/venvs/swift-untagged/bin/activate && ./.functests" args: diff --git a/tox.ini b/tox.ini index b91c5d16..beb85aa3 100644 --- a/tox.ini +++ b/tox.ini @@ -116,7 +116,8 @@ deps = {[testenv:ansible]deps} setenv = {[testenv]setenv} - ANSIBLE_PARAMETERS=-vvv -e swift_pypy_enabled=True + ANSIBLE_INVENTORY={toxinidir}/tests/inventory_pypy + ANSIBLE_OVERRIDES={toxinidir}/tests/os_swift-overrides-pypy.yml commands = {[testenv:tests_clone]commands} bash -c "{toxinidir}/tests/common/test-ansible-functional.sh"