Add support of shared staging location for glance-direct

In the case of an HA setup (ie with 3 controller nodes) if image
import method is 'glance-direct', it would require a shared
consistent staging location on the controller nodes otherwise it
might happen that the image is uploaded to one node and triggering
the import is executed on a different node - where the image does not
exist.

Hence when import method 'glance-direct' is needed, operators need to
enable it explicitly with enabling NFS across the controller nodes
to share the staging.

Change-Id: I9a5bff5e5d0c3e109b73d691cc9088904a0401ac
Closes-Bug: #1765439
This commit is contained in:
Pranali Deore 2018-05-22 17:12:43 +05:30
parent 1eaa019a1f
commit a089310bf3
4 changed files with 45 additions and 10 deletions

View File

@ -202,16 +202,7 @@ outputs:
- /var/lib/kolla/config_files/glance_api.json:/var/lib/kolla/config_files/config.json
- /var/lib/config-data/puppet-generated/glance_api/:/var/lib/kolla/config_files/src:ro
- /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
-
if:
- nfs_backend_enabled
- /var/lib/glance:/var/lib/glance
- ''
-
if:
- netapp_nfs_backend_enabled
- /var/lib/glance:/var/lib/glance
- ''
- /var/lib/glance:/var/lib/glance:slave
-
if:
- cinder_backend_enabled

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:
# List of enabled Image Import Methods. Valid values in the list are 'glance-direct' and 'web-download'
# Type: comma_delimited_list
GlanceEnabledImportMethods: web-download
# When using GlanceBackend 'file', Netapp mount NFS share for image storage.
# Type: boolean
GlanceNetappNfsEnabled: False
@ -21,6 +25,18 @@ parameter_defaults:
# Type: string
GlanceNfsShare: ''
# URI that specifies the staging location to use when importing images
# Type: string
GlanceNodeStagingUri: file:///var/lib/glance/staging
# NFS mount options for NFS image import staging
# Type: string
GlanceStagingNfsOptions: _netdev,bg,intr,context=system_u:object_r:glance_var_lib_t:s0
# NFS share to mount for image import staging
# Type: string
GlanceStagingNfsShare: ''
# Netapp share to mount for image storage (when GlanceNetappNfsEnabled is true)
# Type: string
NetappShareLocation: ''

View File

@ -137,6 +137,21 @@ parameters:
List of enabled Image Import Methods. Valid values in the list are
'glance-direct' and 'web-download'
type: comma_delimited_list
GlanceStagingNfsShare:
default: ''
description: >
NFS share to mount for image import staging
type: string
GlanceNodeStagingUri:
default: 'file:///var/lib/glance/staging'
description: >
URI that specifies the staging location to use when importing images
type: string
GlanceStagingNfsOptions:
default: '_netdev,bg,intr,context=system_u:object_r:glance_var_lib_t:s0'
description: >
NFS mount options for NFS image import staging
type: string
KeystoneRegion:
type: string
default: 'regionOne'
@ -244,6 +259,7 @@ outputs:
glance::api::os_region_name: {get_param: KeystoneRegion}
glance::api::image_member_quota: {get_param: GlanceImageMemberQuota}
glance::api::enabled_import_methods: {get_param: GlanceEnabledImportMethods}
glance::api::node_staging_uri: {get_param: GlanceNodeStagingUri}
# NOTE: bind IP is found in hiera replacing the network name with the
# local node IP for the given network; replacement examples
# (eg. for internal_api):
@ -356,6 +372,14 @@ outputs:
- NETAPP_SHARE: {get_param: NetappShareLocation}
NFS_OPTIONS: {get_param: GlanceNfsOptions}
when: netapp_nfs_backend_enable
- name: Mount Node Staging Location
vars:
glance_node_staging_uri: {get_param: GlanceNodeStagingUri}
glance_staging_nfs_share: {get_param: GlanceStagingNfsShare}
glance_nfs_options: {get_param: GlanceStagingNfsOptions}
# Gleaning mount point by stripping "file://" prefix from staging uri
mount: name="{{glance_node_staging_uri[7:]}}" src="{{glance_staging_nfs_share}}" fstype=nfs opts="{{glance_nfs_options}}" state=mounted
when: glance_staging_nfs_share
upgrade_tasks:
- name: Check if glance_api is deployed

View File

@ -28,6 +28,10 @@ environments:
- GlanceNfsOptions
- GlanceNetappNfsEnabled
- NetappShareLocation
- GlanceEnabledImportMethods
- GlanceStagingNfsShare
- GlanceNodeStagingUri
- GlanceStagingNfsOptions
sample_values:
GlanceBackend: file
GlanceNfsEnabled: True