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_ceph_rgw: "no"
enable_chrony: "no" enable_chrony: "no"
enable_cinder: "no" enable_cinder: "no"
enable_cinder_backup: "yes"
enable_cinder_backend_hnas_iscsi: "no" enable_cinder_backend_hnas_iscsi: "no"
enable_cinder_backend_hnas_nfs: "no" enable_cinder_backend_hnas_nfs: "no"
enable_cinder_backend_iscsi: "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_ceph: "{{ enable_ceph }}"
cinder_backend_vmwarevc_vmdk: "no" cinder_backend_vmwarevc_vmdk: "no"
cinder_volume_group: "cinder-volumes" cinder_volume_group: "cinder-volumes"
# Valid options are [ nfs, swift, ceph ]
cinder_backup_driver: "ceph" cinder_backup_driver: "ceph"
cinder_backup_share: "" cinder_backup_share: ""
cinder_backup_mount_options_nfs: "" cinder_backup_mount_options_nfs: ""

View File

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

View File

@ -1,26 +1,34 @@
--- ---
- name: Ensuring config directory exists - name: Ensuring config directory exists
vars:
services_need_directory:
- "cinder-volume"
- "cinder-backup"
file: file:
path: "{{ node_config_directory }}/{{ item }}" path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory" state: "directory"
with_items: when:
- "cinder-volume" - item.value.enabled | bool
- "cinder-backup" - inventory_hostname in groups[item.value.group]
when: inventory_hostname in groups['cinder-volume'] - item.key in services_need_directory
with_dict: "{{ cinder_services }}"
- name: Copying over ceph.conf(s) - name: Copying over ceph.conf(s)
vars: vars:
service_name: "{{ item }}" services_need_config:
- "cinder-volume"
- "cinder-backup"
merge_configs: merge_configs:
sources: sources:
- "{{ role_path }}/../ceph/templates/ceph.conf.j2" - "{{ role_path }}/../ceph/templates/ceph.conf.j2"
- "{{ node_custom_config }}/ceph.conf" - "{{ node_custom_config }}/ceph.conf"
- "{{ node_custom_config }}/ceph/{{ inventory_hostname }}/ceph.conf" - "{{ node_custom_config }}/ceph/{{ inventory_hostname }}/ceph.conf"
dest: "{{ node_config_directory }}/{{ item }}/ceph.conf" dest: "{{ node_config_directory }}/{{ item.key }}/ceph.conf"
with_items: when:
- "cinder-volume" - item.value.enabled | bool
- "cinder-backup" - inventory_hostname in groups[item.value.group]
when: inventory_hostname in groups['cinder-volume'] - item.key in services_need_config
with_dict: "{{ cinder_services }}"
- include: ../../ceph_pools.yml - include: ../../ceph_pools.yml
vars: vars:
@ -59,4 +67,6 @@
- { service_name: "cinder-volume", key_name: "cinder", content: "{{ cephx_key_cinder.stdout }}" } - { 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", content: "{{ cephx_key_cinder.stdout }}" }
- { service_name: "cinder-backup", key_name: "cinder-backup", content: "{{ cephx_key_cinder_backup.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 - name: Ensuring config directory exists
vars:
services_need_directory:
- "cinder-volume"
- "cinder-backup"
file: file:
path: "{{ node_config_directory }}/cinder-{{ item }}" path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory" state: "directory"
when: inventory_hostname in groups['cinder-volume'] or when:
inventory_hostname in groups['cinder-backup'] - item.value.enabled | bool
with_items: - inventory_hostname in groups[item.value.group]
- volume - item.key in services_need_directory
- backup with_dict: "{{ cinder_services }}"
- name: Copying over ceph.conf for Cinder - name: Copying over ceph.conf for Cinder
vars: vars:
service_name: "{{ item }}" services_need_config:
- "cinder-volume"
- "cinder-backup"
merge_configs: merge_configs:
sources: sources:
- "{{ node_custom_config }}/cinder/ceph.conf" - "{{ node_custom_config }}/cinder/ceph.conf"
- "{{ node_custom_config }}/cinder/{{ item }}/ceph.conf" - "{{ node_custom_config }}/cinder/{{ item.key }}/ceph.conf"
dest: "{{ node_config_directory }}/{{ item }}/ceph.conf" dest: "{{ node_config_directory }}/{{ item.key }}/ceph.conf"
with_items: when:
- "cinder-backup" - item.value.enabled | bool
- "cinder-volume" - 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 - name: Copy over Ceph keyring files for cinder-volume
copy: copy:
@ -27,7 +35,10 @@
dest: "{{ node_config_directory }}/cinder-volume/" dest: "{{ node_config_directory }}/cinder-volume/"
with_fileglob: with_fileglob:
- "{{ node_custom_config }}/cinder/cinder-volume/ceph.client*" - "{{ 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 - name: Copy over Ceph keyring files for cinder-backup
copy: copy:
@ -35,4 +46,7 @@
dest: "{{ node_config_directory }}/cinder-backup/" dest: "{{ node_config_directory }}/cinder-backup/"
with_fileglob: with_fileglob:
- "{{ node_custom_config }}/cinder/cinder-volume/ceph.client*" - "{{ 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(',') }} enabled_backends = {{ cinder_enabled_backends|map(attribute='name')|join(',') }}
{% endif %} {% 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" %} {% if enable_ceph | bool and cinder_backup_driver == "ceph" %}
backup_driver = cinder.backup.drivers.ceph backup_driver = cinder.backup.drivers.ceph
backup_ceph_conf = /etc/ceph/ceph.conf 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 # The OPENSTACK_CINDER_FEATURES settings can be used to enable optional
# services provided by cinder that is not exposed by its extension API. # services provided by cinder that is not exposed by its extension API.
OPENSTACK_CINDER_FEATURES = { 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 # 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_ceph_rgw: "no"
#enable_chrony: "no" #enable_chrony: "no"
#enable_cinder: "no" #enable_cinder: "no"
#enable_cinder_backup: "yes"
#enable_cinder_backend_hnas_iscsi: "no" #enable_cinder_backend_hnas_iscsi: "no"
#enable_cinder_backend_hnas_nfs: "no" #enable_cinder_backend_hnas_nfs: "no"
#enable_cinder_backend_iscsi: "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_ceph: "{{ enable_ceph }}"
#cinder_backend_vmwarevc_vmdk: "no" #cinder_backend_vmwarevc_vmdk: "no"
#cinder_volume_group: "cinder-volumes" #cinder_volume_group: "cinder-volumes"
# Valid options are [ nfs, swift, ceph ]
#cinder_backup_driver: "ceph" #cinder_backup_driver: "ceph"
#cinder_backup_share: "" #cinder_backup_share: ""
#cinder_backup_mount_options_nfs: "" #cinder_backup_mount_options_nfs: ""