Make cinder-backup service optional

Introduced new option enable_cinder_backup, that controls
whether to deploy cinder-backup service.

Change-Id: Ibb0ca0a478748d4caba4df434456ead0df95ffca
Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
This commit is contained in:
Pavel Glushchak 2017-05-15 14:51:56 +03:00
parent 98ec9eb724
commit 0f70b3883d
7 changed files with 59 additions and 29 deletions

View File

@ -315,6 +315,7 @@ enable_ceph: "no"
enable_ceph_rgw: "no"
enable_chrony: "no"
enable_cinder: "no"
enable_cinder_backup: "yes"
enable_cinder_backend_hnas_iscsi: "no"
enable_cinder_backend_hnas_nfs: "no"
enable_cinder_backend_iscsi: "no"
@ -490,6 +491,8 @@ gnocchi_backend_storage: "{{ 'ceph' if enable_ceph|bool else 'file' }}"
cinder_backend_ceph: "{{ enable_ceph }}"
cinder_backend_vmwarevc_vmdk: "no"
cinder_volume_group: "cinder-volumes"
# Valid options are [ nfs, swift, ceph ]
cinder_backup_driver: "ceph"
cinder_backup_share: ""
cinder_backup_mount_options_nfs: ""

View File

@ -39,7 +39,7 @@ cinder_services:
cinder-backup:
container_name: cinder_backup
group: cinder-backup
enabled: true
enabled: "{{ enable_cinder_backup | bool }}"
image: "{{ cinder_backup_image_full }}"
privileged: True
volumes:

View File

@ -1,26 +1,34 @@
---
- name: Ensuring config directory exists
vars:
services_need_directory:
- "cinder-volume"
- "cinder-backup"
file:
path: "{{ node_config_directory }}/{{ item }}"
path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory"
with_items:
- "cinder-volume"
- "cinder-backup"
when: inventory_hostname in groups['cinder-volume']
when:
- item.value.enabled | bool
- inventory_hostname in groups[item.value.group]
- item.key in services_need_directory
with_dict: "{{ cinder_services }}"
- name: Copying over ceph.conf(s)
vars:
service_name: "{{ item }}"
services_need_config:
- "cinder-volume"
- "cinder-backup"
merge_configs:
sources:
- "{{ role_path }}/../ceph/templates/ceph.conf.j2"
- "{{ node_custom_config }}/ceph.conf"
- "{{ node_custom_config }}/ceph/{{ inventory_hostname }}/ceph.conf"
dest: "{{ node_config_directory }}/{{ item }}/ceph.conf"
with_items:
- "cinder-volume"
- "cinder-backup"
when: inventory_hostname in groups['cinder-volume']
dest: "{{ node_config_directory }}/{{ item.key }}/ceph.conf"
when:
- item.value.enabled | bool
- inventory_hostname in groups[item.value.group]
- item.key in services_need_config
with_dict: "{{ cinder_services }}"
- include: ../../ceph_pools.yml
vars:
@ -59,4 +67,6 @@
- { service_name: "cinder-volume", key_name: "cinder", content: "{{ cephx_key_cinder.stdout }}" }
- { service_name: "cinder-backup", key_name: "cinder", content: "{{ cephx_key_cinder.stdout }}" }
- { service_name: "cinder-backup", key_name: "cinder-backup", content: "{{ cephx_key_cinder_backup.stdout }}" }
when: inventory_hostname in groups['cinder-volume']
when:
- inventory_hostname in groups[item.service_name]
- cinder_services[item.service_name].enabled | bool

View File

@ -1,25 +1,33 @@
---
- name: Ensuring config directory exists
vars:
services_need_directory:
- "cinder-volume"
- "cinder-backup"
file:
path: "{{ node_config_directory }}/cinder-{{ item }}"
path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory"
when: inventory_hostname in groups['cinder-volume'] or
inventory_hostname in groups['cinder-backup']
with_items:
- volume
- backup
when:
- item.value.enabled | bool
- inventory_hostname in groups[item.value.group]
- item.key in services_need_directory
with_dict: "{{ cinder_services }}"
- name: Copying over ceph.conf for Cinder
vars:
service_name: "{{ item }}"
services_need_config:
- "cinder-volume"
- "cinder-backup"
merge_configs:
sources:
- "{{ node_custom_config }}/cinder/ceph.conf"
- "{{ node_custom_config }}/cinder/{{ item }}/ceph.conf"
dest: "{{ node_config_directory }}/{{ item }}/ceph.conf"
with_items:
- "cinder-backup"
- "cinder-volume"
- "{{ node_custom_config }}/cinder/{{ item.key }}/ceph.conf"
dest: "{{ node_config_directory }}/{{ item.key }}/ceph.conf"
when:
- item.value.enabled | bool
- inventory_hostname in groups[item.value.group]
- item.key in services_need_config
with_dict: "{{ cinder_services }}"
- name: Copy over Ceph keyring files for cinder-volume
copy:
@ -27,7 +35,10 @@
dest: "{{ node_config_directory }}/cinder-volume/"
with_fileglob:
- "{{ node_custom_config }}/cinder/cinder-volume/ceph.client*"
when: external_ceph_cephx_enabled | bool
when:
- external_ceph_cephx_enabled | bool
- inventory_hostname in groups['cinder-volume']
- cinder_services['cinder-volume'].enabled | bool
- name: Copy over Ceph keyring files for cinder-backup
copy:
@ -35,4 +46,7 @@
dest: "{{ node_config_directory }}/cinder-backup/"
with_fileglob:
- "{{ node_custom_config }}/cinder/cinder-volume/ceph.client*"
when: external_ceph_cephx_enabled | bool
when:
- external_ceph_cephx_enabled | bool
- inventory_hostname in groups['cinder-backup']
- cinder_services['cinder-backup'].enabled | bool

View File

@ -21,7 +21,7 @@ os_region_name = {{ openstack_region_name }}
enabled_backends = {{ cinder_enabled_backends|map(attribute='name')|join(',') }}
{% endif %}
{% if service_name == "cinder-backup" %}
{% if service_name == "cinder-backup" and enable_cinder_backup | bool %}
{% if enable_ceph | bool and cinder_backup_driver == "ceph" %}
backup_driver = cinder.backup.drivers.ceph
backup_ceph_conf = /etc/ceph/ceph.conf

View File

@ -287,7 +287,7 @@ OPENSTACK_HYPERVISOR_FEATURES = {
# The OPENSTACK_CINDER_FEATURES settings can be used to enable optional
# services provided by cinder that is not exposed by its extension API.
OPENSTACK_CINDER_FEATURES = {
'enable_backup': True,
'enable_backup': {{ 'True' if enable_cinder_backup | bool else 'False' }},
}
# The OPENSTACK_NEUTRON_NETWORK settings can be used to enable optional

View File

@ -126,6 +126,7 @@ kolla_internal_vip_address: "10.10.10.254"
#enable_ceph_rgw: "no"
#enable_chrony: "no"
#enable_cinder: "no"
#enable_cinder_backup: "yes"
#enable_cinder_backend_hnas_iscsi: "no"
#enable_cinder_backend_hnas_nfs: "no"
#enable_cinder_backend_iscsi: "no"
@ -278,6 +279,8 @@ kolla_internal_vip_address: "10.10.10.254"
#cinder_backend_ceph: "{{ enable_ceph }}"
#cinder_backend_vmwarevc_vmdk: "no"
#cinder_volume_group: "cinder-volumes"
# Valid options are [ nfs, swift, ceph ]
#cinder_backup_driver: "ceph"
#cinder_backup_share: ""
#cinder_backup_mount_options_nfs: ""