Mount NFS volume to docker container.
[apex-tripleo-heat-templates.git] / docker / services / glance-api.yaml
index 17d9110..df226b1 100644 (file)
@@ -4,23 +4,21 @@ description: >
   OpenStack Glance service configured with Puppet
 
 parameters:
-  DockerNamespace:
-    description: namespace
-    default: 'tripleoupstream'
-    type: string
   DockerGlanceApiImage:
     description: image
-    default: 'centos-binary-glance-api:latest'
     type: string
   DockerGlanceApiConfigImage:
     description: The container image to use for the glance_api config_volume
-    default: 'centos-binary-glance-api:latest'
     type: string
   EndpointMap:
     default: {}
     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
@@ -41,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:
@@ -52,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}
@@ -71,17 +79,17 @@ 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:
         config_volume: glance_api
         puppet_tags: glance_api_config,glance_api_paste_ini,glance_swift_config,glance_cache_config
         step_config: *step_config
-        config_image:
-          list_join:
-            - '/'
-            - [ {get_param: DockerNamespace}, {get_param: DockerGlanceApiConfigImage} ]
+        config_image: {get_param: DockerGlanceApiConfigImage}
       kolla_config:
         /var/lib/kolla/config_files/glance_api.json:
           command: /usr/bin/glance-api --config-file /usr/share/glance/glance-api-dist.conf --config-file /etc/glance/glance-api.conf
@@ -90,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:
@@ -101,10 +113,7 @@ outputs:
         # Kolla_bootstrap/db_sync runs before permissions set by kolla_config
         step_2:
           glance_init_logs:
-            image: &glance_api_image
-              list_join:
-                - '/'
-                - [ {get_param: DockerNamespace}, {get_param: DockerGlanceApiImage} ]
+            image: &glance_api_image {get_param: DockerGlanceApiImage}
             privileged: false
             user: root
             volumes:
@@ -124,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
@@ -163,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