Only build venvs for services which are deployed

The current repo build process builds venvs for all OpenStack services,
regardless of whether they're actually going to be used.

To reduce the repo build time, this patch will only build venvs for
OpenStack services where there is one or more members in the service
inventory group.

Change-Id: I01e6cdaa7a1a4aa07d2118c0badfea25b85b3249
This commit is contained in:
Jesse Pretorius 2016-07-20 12:02:54 +01:00 committed by Jesse Pretorius (odyssey4me)
parent ec7bffa13a
commit c391fd3eb0
6 changed files with 39 additions and 1 deletions

View File

@ -26,6 +26,9 @@ repo_build_pool_dir: "/var/www/repo/pools"
repo_build_release_tag: "untagged"
# Toggle whether venvs should be built selectively or not
repo_build_venv_selective: yes
# Optionally set this to change the default index from pypi to an alternative
#repo_build_pip_default_index: "https://pypi.python.org/simple"

View File

@ -0,0 +1,8 @@
---
features:
- The repo build process now selectively builds venvs based on
whether each OpenStack service group has any hosts in it. If
there are no hosts in the group, the venv will not be built.
This behaviour can be optionally changed to force all venvs
to be built by setting ``repo_build_venv_selective`` to
``yes``.

View File

@ -47,7 +47,12 @@ function venv_create {
# purposes the group data will be rendered as a comment.
{% set os_group = {} %}
{% for key, value in local_packages.results.0.item.role_packages.items() %}
{% if "os_" in key %}
{% if key == "os_tempest" %}
{% set _host_group = "utility_all" %}
{% else %}
{% set _host_group = key | replace('os_', '') + '_all' %}
{% endif %}
{% if ("os_" in key) and (not repo_build_venv_selective | bool) or ((groups[_host_group] is defined) and (groups[_host_group] | length > 0)) %}
# venv to build {{ key }}
# * packages within the {{ key }} venv: {{ value }}
{% set _ = os_group.update({key: value}) %}

View File

@ -7,3 +7,11 @@ container1
[all_containers:children]
repo_all
# This is here to validate the venv build inclusion
[keystone_all]
container1
# This is here to validate the venv build inclusion
[utility_all]
container1

View File

@ -39,5 +39,18 @@
roles:
- "repo_server"
- "{{ rolename | basename }}"
post_tasks:
- name: List the files in the venv folder
command: ls -1 /var/www/repo/venvs/{{ repo_build_release_tag }}/{{ ansible_distribution | lower }}/
register: venv_folder_content
- name: Ensure that the keystone venv is present
assert:
that: "'keystone-{{ repo_build_release_tag }}.tgz' in venv_folder_content.stdout"
- name: Ensure that the tempest venv is present
assert:
that: "'tempest-{{ repo_build_release_tag }}.tgz' in venv_folder_content.stdout"
- name: Ensure that the nova venv is NOT present
assert:
that: "'nova-{{ repo_build_release_tag }}.tgz' not in venv_folder_content.stdout"
vars_files:
- test-vars.yml

View File

@ -14,6 +14,7 @@
# limitations under the License.
openstack_release: testing
repo_build_release_tag: "{{ openstack_release }}"
galera_client_drop_config_file: false
local_packages:
results: