tripleo-ansible/playbooks/activate_cinder_volumes.yml

45 lines
1.6 KiB
YAML

# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Check if using lvm based storage
stat: path=/mnt/state/var/lib/cinder/cinder-volumes-backing-file
register: lvm_backing_file
- name: Re-create cinder loopdevice
command: losetup -f /mnt/state/var/lib/cinder/cinder-volumes-backing-file
when: lvm_backing_file.stat.exists
sudo: yes
- pause: seconds=5
when: lvm_backing_file.stat.exists
- name: Re-scan for volume groups
command: pvscan
when: lvm_backing_file.stat.exists
sudo: yes
- pause: seconds=5
- name: Re-enable volume groups
command: vgchange -a y
when: lvm_backing_file.stat.exists
sudo: yes
- pause: seconds=5
when: lvm_backing_file.stat.exists
- name: Get all cinder lvm volumes
shell: "lvdisplay | grep cinder-volumes | grep 'LV Path' | awk '{print $3}'"
when: lvm_backing_file.stat.exists
register: cinder_volumes
sudo: yes
- name: Activate cinder lvm volumes
shell: lvchange -a y {{ item }}
with_items: cinder_volumes.stdout_lines
when: lvm_backing_file.stat.exists
sudo: yes