Merge "Add support of netapp configuration for glance in THT"

This commit is contained in:
Zuul 2018-03-08 14:35:00 +00:00 committed by Gerrit Code Review
commit 07857e3f87
4 changed files with 66 additions and 0 deletions

View File

@ -61,6 +61,16 @@ parameters:
description: > description: >
NFS mount options for image storage (when GlanceNfsEnabled is true) NFS mount options for image storage (when GlanceNfsEnabled is true)
type: string type: string
GlanceNetappNfsEnabled:
default: false
description: >
When using GlanceBackend 'file', Netapp mount NFS share for image storage.
type: boolean
NetappShareLocation:
default: ''
description: >
Netapp share to mount for image storage (when GlanceNetappNfsEnabled is true)
type: string
UpgradeRemoveUnusedPackages: UpgradeRemoveUnusedPackages:
default: false default: false
description: Remove package if the service is being disabled during upgrade description: Remove package if the service is being disabled during upgrade
@ -82,6 +92,7 @@ conditions:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]} internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
nfs_backend_enabled: {equals: [{get_param: GlanceNfsEnabled}, true]} nfs_backend_enabled: {equals: [{get_param: GlanceNfsEnabled}, true]}
netapp_nfs_backend_enabled: {equals: [{get_param: GlanceNetappNfsEnabled}, true]}
cinder_backend_enabled: {equals: [{get_param: GlanceBackend}, cinder]} cinder_backend_enabled: {equals: [{get_param: GlanceBackend}, cinder]}
@ -184,6 +195,11 @@ outputs:
- nfs_backend_enabled - nfs_backend_enabled
- /var/lib/glance:/var/lib/glance - /var/lib/glance:/var/lib/glance
- '' - ''
-
if:
- netapp_nfs_backend_enabled
- /var/lib/glance:/var/lib/glance
- ''
- -
if: if:
- cinder_backend_enabled - cinder_backend_enabled
@ -229,6 +245,7 @@ outputs:
host_prep_tasks: host_prep_tasks:
list_concat: list_concat:
- {get_attr: [GlanceLogging, host_prep_tasks]} - {get_attr: [GlanceLogging, host_prep_tasks]}
- {get_attr: [GlanceApiPuppetBase, role_data, host_prep_tasks]}
- - name: Mount NFS on host - - name: Mount NFS on host
vars: vars:
nfs_backend_enable: {get_param: GlanceNfsEnabled} nfs_backend_enable: {get_param: GlanceNfsEnabled}

View File

@ -9,6 +9,10 @@
# Configure and include this environment to enable the use of an NFS # Configure and include this environment to enable the use of an NFS
# share as the backend for Glance. # share as the backend for Glance.
parameter_defaults: parameter_defaults:
# When using GlanceBackend 'file', Netapp mount NFS share for image storage.
# Type: boolean
GlanceNetappNfsEnabled: False
# NFS mount options for image storage (when GlanceNfsEnabled is true) # NFS mount options for image storage (when GlanceNfsEnabled is true)
# Type: string # Type: string
GlanceNfsOptions: _netdev,bg,intr,context=system_u:object_r:glance_var_lib_t:s0 GlanceNfsOptions: _netdev,bg,intr,context=system_u:object_r:glance_var_lib_t:s0
@ -17,6 +21,10 @@ parameter_defaults:
# Type: string # Type: string
GlanceNfsShare: '' GlanceNfsShare: ''
# Netapp share to mount for image storage (when GlanceNetappNfsEnabled is true)
# Type: string
NetappShareLocation: ''
# ****************************************************** # ******************************************************
# Static parameters - these are values that must be # Static parameters - these are values that must be
# included in the environment but should not be changed. # included in the environment but should not be changed.

View File

@ -109,6 +109,16 @@ parameters:
description: > description: >
NFS share to mount for image storage (when GlanceNfsEnabled is true) NFS share to mount for image storage (when GlanceNfsEnabled is true)
type: string type: string
GlanceNetappNfsEnabled:
default: false
description: >
When using GlanceBackend 'file', Netapp mount NFS share for image storage.
type: boolean
NetappShareLocation:
default: ''
description: >
Netapp share to mount for image storage (when GlanceNetappNfsEnabled is true)
type: string
GlanceNfsOptions: GlanceNfsOptions:
default: '_netdev,bg,intr,context=system_u:object_r:glance_var_lib_t:s0' default: '_netdev,bg,intr,context=system_u:object_r:glance_var_lib_t:s0'
description: > description: >
@ -302,6 +312,35 @@ outputs:
- "%{hiera('mysql_bind_host')}" - "%{hiera('mysql_bind_host')}"
step_config: | step_config: |
include ::tripleo::profile::base::glance::api include ::tripleo::profile::base::glance::api
host_prep_tasks:
- name: Mount Netapp NFS
vars:
netapp_nfs_backend_enable: {get_param: GlanceNetappNfsEnabled}
block:
- name:
set_fact:
remote_file_path: /etc/glance/glance-metadata-file.conf
- name:
file:
path: "{{ remote_file_path }}"
state: touch
- stat: path="{{ remote_file_path }}"
register: file_path
- copy:
content: {"share_location" : "{{item.NETAPP_SHARE}}", "mount_point" : "/var/lib/glance/images", "type" : "nfs",}
dest: "{{ remote_file_path }}"
with_items:
- NETAPP_SHARE: {get_param: NetappShareLocation}
when:
- file_path.stat.exists == true
- name:
mount: name=/var/lib/glance/images src="{{item.NETAPP_SHARE}}" fstype=nfs4 opts="{{item.NFS_OPTIONS}}" state=mounted
with_items:
- NETAPP_SHARE: {get_param: NetappShareLocation}
NFS_OPTIONS: {get_param: GlanceNfsOptions}
when: netapp_nfs_backend_enable
upgrade_tasks: upgrade_tasks:
- name: Check if glance_api is deployed - name: Check if glance_api is deployed
command: systemctl is-enabled openstack-glance-api command: systemctl is-enabled openstack-glance-api

View File

@ -60,6 +60,8 @@ environments:
- GlanceNfsEnabled - GlanceNfsEnabled
- GlanceNfsShare - GlanceNfsShare
- GlanceNfsOptions - GlanceNfsOptions
- GlanceNetappNfsEnabled
- NetappShareLocation
sample_values: sample_values:
GlanceBackend: file GlanceBackend: file
GlanceNfsEnabled: True GlanceNfsEnabled: True