1 heat_template_version: pike
4 OpenStack containerized Cinder Volume service
7 DockerCinderVolumeImage:
10 DockerCinderConfigImage:
11 description: The container image to use for the cinder config_volume
15 description: Mapping of service endpoint -> protocol. Typically set
16 via parameter_defaults in the resource registry.
20 description: Dictionary packing service data
24 description: Mapping of service_name -> network name. Typically set
25 via parameter_defaults in the resource registry. This
26 mapping overrides those in ServiceNetMapDefaults.
33 description: Role name on which the service is applied
37 description: Parameters specific to the role
39 # custom parameters for the Cinder volume role
40 CinderEnableIscsiBackend:
42 description: Whether to enable or not the Iscsi backend for Cinder
44 CinderLVMLoopDeviceSize:
46 description: The size of the loopback file used by the cinder LVM driver.
52 type: ../../../puppet/services/database/mysql-client.yaml
55 type: ../../../puppet/services/cinder-volume.yaml
57 EndpointMap: {get_param: EndpointMap}
58 ServiceData: {get_param: ServiceData}
59 ServiceNetMap: {get_param: ServiceNetMap}
60 DefaultPasswords: {get_param: DefaultPasswords}
61 RoleName: {get_param: RoleName}
62 RoleParameters: {get_param: RoleParameters}
66 description: Role data for the Cinder Volume role.
68 service_name: {get_attr: [CinderBase, role_data, service_name]}
71 - get_attr: [CinderBase, role_data, config_settings]
72 - tripleo::profile::base::lvm::enable_udev: false
73 tripleo::profile::pacemaker::cinder::volume_bundle::cinder_volume_docker_image: &cinder_volume_image_pcmklatest
77 data: {get_param: DockerCinderVolumeImage}
78 expression: $.data.rightSplit(separator => ":", maxSplits => 1)[0]
80 cinder::volume::manage_service: false
81 cinder::volume::enabled: false
82 cinder::host: hostgroup
83 logging_source: {get_attr: [CinderBase, role_data, logging_source]}
84 logging_groups: {get_attr: [CinderBase, role_data, logging_groups]}
85 step_config: &step_config
88 - - "include ::tripleo::profile::base::lvm"
89 - get_attr: [CinderBase, role_data, step_config]
90 - get_attr: [MySQLClient, role_data, step_config]
91 service_config_settings: {get_attr: [CinderBase, role_data, service_config_settings]}
92 # BEGIN DOCKER SETTINGS
95 puppet_tags: cinder_config,file,concat,file_line
96 step_config: *step_config
97 config_image: {get_param: DockerCinderConfigImage}
99 /var/lib/kolla/config_files/cinder_volume.json:
100 command: /usr/bin/cinder-volume --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf
102 - source: "/var/lib/kolla/config_files/src/*"
105 preserve_properties: true
106 - source: "/var/lib/kolla/config_files/src-ceph/"
109 preserve_properties: true
110 - source: "/var/lib/kolla/config_files/src-iscsid/*"
113 preserve_properties: true
115 - path: /var/log/cinder
120 cinder_volume_image_tag:
130 "/usr/bin/docker tag 'CINDERVOLUME_IMAGE' 'CINDERVOLUME_IMAGE_PCMKLATEST'"
132 CINDERVOLUME_IMAGE: {get_param: DockerCinderVolumeImage}
133 CINDERVOLUME_IMAGE_PCMKLATEST: *cinder_volume_image_pcmklatest
134 image: {get_param: DockerCinderVolumeImage}
136 - /etc/hosts:/etc/hosts:ro
137 - /etc/localtime:/etc/localtime:ro
138 - /dev/shm:/dev/shm:rw
139 - /etc/sysconfig/docker:/etc/sysconfig/docker:ro
140 - /usr/bin:/usr/bin:ro
141 - /var/run/docker.sock:/var/run/docker.sock:rw
143 cinder_volume_init_logs:
145 image: {get_param: DockerCinderVolumeImage}
149 - /var/log/containers/cinder:/var/log/cinder
150 command: ['/bin/bash', '-c', 'chown -R cinder:cinder /var/log/cinder']
152 cinder_volume_init_bundle:
164 - - "cp -a /tmp/puppet-etc/* /etc/puppet; echo '{\"step\": 5}' > /etc/puppet/hieradata/docker.json"
165 - "FACTER_uuid=docker puppet apply --tags file_line,concat,augeas,TAGS --debug -v -e 'CONFIG'"
167 TAGS: 'pacemaker::resource::bundle,pacemaker::property,pacemaker::constraint::location'
168 CONFIG: 'include ::tripleo::profile::base::pacemaker;include ::tripleo::profile::pacemaker::cinder::volume_bundle'
169 image: {get_param: DockerCinderVolumeImage}
171 - /etc/hosts:/etc/hosts:ro
172 - /etc/localtime:/etc/localtime:ro
173 - /etc/puppet:/tmp/puppet-etc:ro
174 - /usr/share/openstack-puppet/modules:/usr/share/openstack-puppet/modules:ro
175 - /etc/corosync/corosync.conf:/etc/corosync/corosync.conf:ro
176 - /dev/shm:/dev/shm:rw
178 - name: create persistent directories
183 - /var/log/containers/cinder
185 - name: ensure ceph configurations exist
189 - name: cinder_enable_iscsi_backend fact
191 cinder_enable_iscsi_backend: {get_param: CinderEnableIscsiBackend}
192 - name: cinder create LVM volume group dd
196 - - 'dd if=/dev/zero of=/var/lib/cinder/cinder-volumes bs=1 count=0 seek='
200 VALUE: {get_param: CinderLVMLoopDeviceSize}
203 creates: /var/lib/cinder/cinder-volumes
204 when: cinder_enable_iscsi_backend
205 - name: cinder create LVM volume group
207 if ! losetup /dev/loop2; then
208 losetup /dev/loop2 /var/lib/cinder/cinder-volumes
210 if ! pvdisplay | grep cinder-volumes; then
213 if ! vgdisplay | grep cinder-volumes; then
214 vgcreate cinder-volumes /dev/loop2
217 executable: /bin/bash
219 when: cinder_enable_iscsi_backend
221 - name: get bootstrap nodeid
223 command: hiera -c /etc/puppet/hiera.yaml bootstrap_nodeid
224 register: bootstrap_node
225 - name: set is_bootstrap_node fact
227 set_fact: is_bootstrap_node={{bootstrap_node.stdout|lower == ansible_hostname|lower}}
228 - name: Disable the openstack-cinder-volume cluster resource
231 resource: openstack-cinder-volume
233 wait_for_resource: true
236 until: output.rc == 0
237 when: is_bootstrap_node
238 - name: Delete the stopped openstack-cinder-volume cluster resource.
241 resource: openstack-cinder-volume
243 wait_for_resource: true
246 until: output.rc == 0
247 when: is_bootstrap_node
248 - name: Disable cinder_volume service from boot
250 service: name=openstack-cinder-volume enabled=no
252 - name: Get docker Cinder-Volume image
254 docker_image: {get_param: DockerCinderVolumeImage}
255 docker_image_latest: *cinder_volume_image_pcmklatest
257 - name: Get previous Cinder-Volume image id
258 shell: "docker images | awk '/cinder-volume.* pcmklatest/{print $3}'"
259 register: cinder_volume_image_id
261 - name: Get a list of container using Cinder-Volume image
262 shell: "docker ps -q -f 'ancestor={{cinder_volume_image_id.stdout}}'"
263 register: cinder_volume_containers_to_destroy
264 # It will be recreated with the delpoy step.
265 - name: Remove any container using the same Cinder-Volume image
266 shell: "docker rm -fv {{item}}"
267 with_items: "{{ cinder_volume_containers_to_destroy.stdout_lines }}"
268 - name: Remove previous Cinder-Volume images
269 shell: "docker rmi -f {{cinder_volume_image_id.stdout}}"
272 - cinder_volume_image_id.stdout != ''
273 - name: Pull latest Cinder-Volume images
274 command: "docker pull {{docker_image}}"
276 - name: Retag pcmklatest to latest Cinder-Volume image
277 shell: "docker tag {{docker_image}} {{docker_image_latest}}"
279 # Got to check that pacemaker_is_active is working fine with bundle.
280 # TODO: pacemaker_is_active resource doesn't support bundle.