Mount NFS volume to docker container.
[apex-tripleo-heat-templates.git] / docker / services / glance-api.yaml
index 97b2260..df226b1 100644 (file)
@@ -15,6 +15,10 @@ parameters:
     description: Mapping of service endpoint -> protocol. Typically set
                  via parameter_defaults in the resource registry.
     type: json
+  ServiceData:
+    default: {}
+    description: Dictionary packing service data
+    type: json
   ServiceNetMap:
     default: {}
     description: Mapping of service_name -> network name. Typically set
@@ -35,10 +39,16 @@ parameters:
   EnableInternalTLS:
     type: boolean
     default: false
+  GlanceNfsEnabled:
+    default: false
+    description: >
+      When using GlanceBackend 'file', mount NFS share for image storage.
+    type: boolean
 
 conditions:
 
   internal_tls_enabled: {equals: [{get_param: EnableInternalTLS}, true]}
+  nfs_backend_enabled: {equals: [{get_param: GlanceNfsEnabled}, true]}
 
 
 resources:
@@ -46,10 +56,14 @@ resources:
   ContainersCommon:
     type: ./containers-common.yaml
 
+  MySQLClient:
+    type: ../../puppet/services/database/mysql-client.yaml
+
   GlanceApiPuppetBase:
     type: ../../puppet/services/glance-api.yaml
     properties:
       EndpointMap: {get_param: EndpointMap}
+      ServiceData: {get_param: ServiceData}
       ServiceNetMap: {get_param: ServiceNetMap}
       DefaultPasswords: {get_param: DefaultPasswords}
       RoleName: {get_param: RoleName}
@@ -65,7 +79,10 @@ outputs:
           - get_attr: [GlanceApiPuppetBase, role_data, config_settings]
           - glance::api::sync_db: false
       step_config: &step_config
-        get_attr: [GlanceApiPuppetBase, role_data, step_config]
+        list_join:
+          - "\n"
+          - - {get_attr: [GlanceApiPuppetBase, role_data, step_config]}
+            - {get_attr: [MySQLClient, role_data, step_config]}
       service_config_settings: {get_attr: [GlanceApiPuppetBase, role_data, service_config_settings]}
       # BEGIN DOCKER SETTINGS #
       puppet_config:
@@ -81,6 +98,10 @@ outputs:
               dest: "/"
               merge: true
               preserve_properties: true
+            - source: "/var/lib/kolla/config_files/src-ceph/"
+              dest: "/etc/ceph/"
+              merge: true
+              preserve_properties: true
         /var/lib/kolla/config_files/glance_api_tls_proxy.json:
           command: /usr/sbin/httpd -DFOREGROUND
           config_files:
@@ -112,6 +133,12 @@ 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
                   - /var/log/containers/glance:/var/log/glance
+                  - /etc/ceph:/var/lib/kolla/config_files/src-ceph:ro
+                  -
+                    if:
+                      - nfs_backend_enabled
+                      - /var/lib/glance:/var/lib/glance
+                      - ''
             environment:
               - KOLLA_BOOTSTRAP=True
               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
@@ -151,6 +178,10 @@ outputs:
           file:
             path: /var/log/containers/glance
             state: directory
+        - name: ensure ceph configurations exist
+          file:
+            path: /etc/ceph
+            state: directory
       upgrade_tasks:
         - name: Stop and disable glance_api service
           tags: step2