Re-activate vg and lvs on rebuild

Re-creates the loopback devices on rebuild/update.
Re-enables volume groups and also logical volumes

Change-Id: Ib319eebecfd29c71bc346c48ed47525552d54e94
This commit is contained in:
Cian O'Driscoll 2014-11-25 11:23:38 +00:00 committed by Julia Kreger
parent a60e01c0da
commit 82eb9d86ec
4 changed files with 50 additions and 3 deletions

View File

@ -0,0 +1,44 @@
# 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

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -eux
for CINDER_VOLUME in `dmsetup ls 2>/dev/null | cut -f 1 |grep 'cinder--volumes'|grep -v pool`; do
dmsetup remove $CINDER_VOLUME
for CINDER_VOLUME in `lvdisplay | grep cinder-volumes | grep 'LV Path' | awk '{print $3}'`; do
lvchange -a n $CINDER_VOLUME
done
vgchange -a n
vgchange -a n

View File

@ -270,6 +270,7 @@
max_fail_percentage: 0
sudo: yes
tasks:
- include: activate_cinder_volumes.yml
- include: mysql_init_fix.yml
- include: rabbitmq_occ_disable.yml
- include: refresh_config.yml
@ -349,6 +350,7 @@
max_fail_percentage: 0
sudo: yes
tasks:
- include: activate_cinder_volumes.yml
# This action of stopping prior to starting is to ensure that should
# MySQL started upon boot, then it would hopefully pickup new config
# that os-collect-config and os-apply-config would have put in place.

View File

@ -102,6 +102,7 @@ helion_overcloud_controller_services:
- nova-novncproxy
- nova-scheduler
- ceilometer-api
- ceilometer-collector
- snmpd
- rsync
- stunnel