Set lxc.autodev=0 for cinder_volumes in containers

With cinder_volumes we were creating a specific udev device, this will
fail to mount if lxc.autodev=1. This should only be required when lvm is
a backend for the cinder_volumes container.

We can specify lxc.autodev=0 for cinder_volumes containers. To do this
properly we first check if lvm is in use. We can also use this to ensure
that redundant "lvm" configuration isn't setup on volumes hosts with no
lvm backend.

Additionally this will fix the formatting on the "udev" lxc.mount.entry
as it was adding additional spaces.

Change-Id: Iabe72003ebcfefe11d360131fdde64ca4b21a192
Closes-Bug: #1483650
This commit is contained in:
Andy McCrae 2015-08-11 11:58:49 +01:00
parent 27831a026f
commit e85592d54c
3 changed files with 9 additions and 2 deletions

View File

@ -189,6 +189,8 @@ cinder_backends_rbd_inuse: >
endfor %}{{
_var.rbd_inuse }}
cinder_ceph_client: cinder
# cinder_backend_lvm_inuse: True if current host has an lvm backend
cinder_backend_lvm_inuse: '{{ (cinder_backends|default("")|to_json).find("cinder.volume.drivers.lvm.LVMVolumeDriver") != -1 }}'
## OpenStack Openrc

View File

@ -50,11 +50,15 @@
lxc_container:
name: "{{ container_name }}"
container_config:
- "lxc.autodev=0"
- "lxc.aa_profile=unconfined"
- "lxc.cgroup.devices.allow=a *:* rmw"
- "lxc.mount.entry = udev dev devtmpfs defaults 0 0"
- "lxc.mount.entry=udev dev devtmpfs defaults 0 0"
delegate_to: "{{ physical_host }}"
when: (is_metal == false or is_metal == "False") and inventory_hostname in groups['cinder_volume']
when: >
(is_metal == false or is_metal == "False") and
inventory_hostname in groups['cinder_volume'] and
cinder_backend_lvm_inuse
tags:
- cinder-container-setup
register: lxc_config

View File

@ -37,3 +37,4 @@
- include: cinder_lvm_config.yml
when: >
inventory_hostname in groups['cinder_volume']
and cinder_backend_lvm_inuse