Fixes cinder backend support for backends without a volume_group key

Currently we allow multiple cinder backends to be configured. Some
do not need a volume_group defined. This patch fixes the logic around
when we add a volume group device to cinder (only when defined)

Change-Id: I118546e8bc6c3fa7fac62b96ea2295a76711e0f3
Closes-Bug: 1439843
This commit is contained in:
Jacob Wagner 2015-04-02 15:40:02 -05:00
parent c717a61889
commit d493f8a3fc

View File

@ -20,11 +20,15 @@
pre_tasks:
- name: Add volume group block device to cinder
shell: |
{% if item.1.volume_group is defined %}
if [ "$(pvdisplay | grep -B1 {{ item.1.volume_group }} | awk '/PV/ {print $3}')" ];then
for device in `pvdisplay | grep -B1 {{ item.1.volume_group }} | awk '/PV/ {print $3}'`
do lxc-device -n {{ container_name }} add $device
done
fi
{% else %}
echo "{{ item.1 }} volume_group not defined"
{% endif %}
with_items: cinder_backends|dictsort
when: >
cinder_backends is defined and