Add support of netapp configuration for glance in THT

This change adds all the required netapp environment configuartion
for glance in heat template.

Change-Id: Ib44796f77cbc50c3b3c37dcdd37a59f48a7baa1a
Closes-Bug: #1740456
This commit is contained in:
Pranali Deore 2018-01-02 10:29:03 +05:30
parent d0a03972a6
commit 5f7fdb1656
4 changed files with 66 additions and 0 deletions

View File

@ -61,6 +61,16 @@ parameters:
description: >
NFS mount options for image storage (when GlanceNfsEnabled is true)
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:
default: false
description: Remove package if the service is being disabled during upgrade
@ -82,6 +92,7 @@ conditions:
internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, 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]}
@ -184,6 +195,11 @@ outputs:
- nfs_backend_enabled
- /var/lib/glance:/var/lib/glance
- ''
-
if:
- netapp_nfs_backend_enabled
- /var/lib/glance:/var/lib/glance
- ''
-
if:
- cinder_backend_enabled
@ -229,6 +245,7 @@ outputs:
host_prep_tasks:
list_concat:
- {get_attr: [GlanceLogging, host_prep_tasks]}
- {get_attr: [GlanceApiPuppetBase, role_data, host_prep_tasks]}
- - name: Mount NFS on host
vars:
nfs_backend_enable: {get_param: GlanceNfsEnabled}

View File

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

View File

@ -109,6 +109,16 @@ parameters:
description: >
NFS share to mount for image storage (when GlanceNfsEnabled is true)
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:
default: '_netdev,bg,intr,context=system_u:object_r:glance_var_lib_t:s0'
description: >
@ -302,6 +312,35 @@ outputs:
- "%{hiera('mysql_bind_host')}"
step_config: |
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:
- name: Check if glance_api is deployed
command: systemctl is-enabled openstack-glance-api

View File

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