2 - name: remove golang tarball
4 path: "/opt/{{ golang_tarball }}"
9 - name: kill etcd daemon service
12 when: db_driver == "etcd" and container_enabled == false
14 - name: kill etcd containerized service
16 image: quay.io/coreos/etcd:latest
18 when: container_enabled == true
20 - name: remove etcd service data
22 path: "{{ etcd_dir }}"
26 when: db_driver == "etcd"
28 - name: remove etcd tarball
30 path: "/opt/{{ etcd_tarball }}"
34 when: db_driver == "etcd"
36 - name: kill osdslet daemon service
37 shell: killall osdslet
39 when: container_enabled == false
41 - name: kill osdslet containerized service
43 image: opensdsio/opensds-controller:latest
45 when: container_enabled == true
47 - name: kill osdsdock daemon service
48 shell: killall osdsdock
50 when: container_enabled == false
52 - name: kill osdsdock containerized service
54 image: opensdsio/opensds-dock:latest
56 when: container_enabled == true
58 - name: clean all opensds build files
59 shell: . /etc/profile; make clean
61 chdir: "{{ opensds_root_dir }}"
63 - name: clean all opensds configuration files
65 path: "{{ opensds_config_dir }}"
70 - name: clean all opensds log files
72 path: "{{ opensds_log_dir }}"
77 - name: check if it existed before cleaning a volume group
78 shell: vgdisplay {{ vg_name }}
81 when: enabled_backend == "lvm"
83 - name: remove a volume group if lvm backend specified
84 shell: vgremove {{ vg_name }}
85 when: enabled_backend == "lvm" and vg_existed.rc == 0
87 - name: check if it existed before cleaning a physical volume
88 shell: pvdisplay {{ pv_device }}
91 when: enabled_backend == "lvm"
93 - name: remove a physical volume if lvm backend specified
94 shell: pvremove {{ pv_device }}
95 when: enabled_backend == "lvm" and pv_existed.rc == 0
97 - name: stop cinder-standalone service
98 shell: docker-compose down
101 chdir: "{{ cinder_data_dir }}/cinder/contrib/block-box"
102 when: enabled_backend == "cinder"
104 - name: clean the volume group of cinder
108 # _clean_lvm_volume_group removes all default LVM volumes
110 # Usage: _clean_lvm_volume_group $vg
111 function _clean_lvm_volume_group {
114 # Clean out existing volumes
118 # _remove_lvm_volume_group removes the volume group
120 # Usage: _remove_lvm_volume_group $vg
121 function _remove_lvm_volume_group {
124 # Remove the volume group
128 # _clean_lvm_backing_file() removes the backing file of the
131 # Usage: _clean_lvm_backing_file() $backing_file
132 function _clean_lvm_backing_file {
133 local backing_file=$1
135 # If the backing physical device is a loop device, it was probably setup by DevStack
136 if [[ -n "$backing_file" ]] && [[ -e "$backing_file" ]]; then
138 vg_dev=$(sudo losetup -j $backing_file | awk -F':' '/'.img'/ { print $1}')
139 if [[ -n "$vg_dev" ]]; then
140 sudo losetup -d $vg_dev
146 # clean_lvm_volume_group() cleans up the volume group and removes the
149 # Usage: clean_lvm_volume_group $vg
150 function clean_lvm_volume_group {
153 _clean_lvm_volume_group $vg
154 _remove_lvm_volume_group $vg
155 # if there is no logical volume left, it's safe to attempt a cleanup
156 # of the backing file
157 if [[ -z "$(sudo lvs --noheadings -o lv_name $vg 2>/dev/null)" ]]; then
158 _clean_lvm_backing_file {{ cinder_data_dir }}/${vg}.img
162 clean_lvm_volume_group {{cinder_volume_group}}
165 executable: /bin/bash
167 when: enabled_backend == "cinder"