Merge "Optimise the distro package installation"

This commit is contained in:
Jenkins 2017-06-07 21:17:58 +00:00 committed by Gerrit Code Review
commit 86ff6d05db
5 changed files with 30 additions and 47 deletions

View File

@ -23,8 +23,6 @@ cinder_git_install_branch: master
cinder_developer_mode: false
cinder_developer_constraints:
- "git+{{ cinder_git_repo }}@{{ cinder_git_install_branch }}#egg=cinder"
cinder_developer_mode_packages:
- git
# Name of the virtual env to deploy into
cinder_venv_tag: untagged

View File

@ -15,57 +15,14 @@
- name: Install distro packages
package:
name: "{{ item }}"
name: "{{ cinder_package_list }}"
state: "{{ cinder_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages|success
until: install_packages | success
retries: 5
delay: 2
with_items: "{{ cinder_distro_packages }}"
- name: Install distro packages common between different backends
package:
name: "{{ item }}"
state: "{{ cinder_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ cinder_volume_distro_packages }}"
when:
- inventory_hostname in groups['cinder_volume']
- name: Install distro packages for LVM backend
package:
name: "{{ item }}"
state: "{{ cinder_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ cinder_lvm_volume_distro_packages }}"
when:
- inventory_hostname in groups['cinder_volume']
- cinder_backend_lvm_inuse | bool
- name: Install distro packages for developer_mode installs
package:
name: "{{ item }}"
state: "{{ cinder_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: "{{ cinder_developer_mode_packages }}"
when: cinder_developer_mode | bool
- name: Create developer mode constraint file
copy:

View File

@ -13,6 +13,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Compile a list of the distro packages to install based on
# whether the host is in the host group and the service is
# enabled.
#
cinder_package_list: |-
{% set packages = cinder_distro_packages %}
{% if cinder_services['cinder-volume']['group'] in group_names %}
{% set _ = packages.extend(cinder_volume_distro_packages) %}
{% if cinder_backend_lvm_inuse | bool %}
{% set _ = packages.extend(cinder_lvm_volume_distro_packages) %}
{% endif %}
{% endif %}
{% if cinder_developer_mode | bool %}
{% set _ = packages.extend(cinder_developer_mode_distro_packages) %}
{% endif %}
{{ packages }}
#
# Compile a list of the services on a host based on whether
# the host is in the host group and the service is enabled.
#
filtered_cinder_services: >
{%- set services = cinder_services.copy() %}
{%- for key,value in cinder_services.items() %}

View File

@ -28,6 +28,9 @@ cinder_distro_packages:
- which
- iscsi-initiator-utils
cinder_developer_mode_distro_packages:
- git
cinder_volume_distro_packages:
- qemu-img-ev

View File

@ -35,6 +35,9 @@ cinder_distro_packages:
- libssl-dev
- open-iscsi
cinder_developer_mode_distro_packages:
- git-core
cinder_volume_distro_packages:
- qemu-utils