Enable udev for lvm in cinder-volume container

The current configuration of LVM for cinder-volume has udev_sync=0.
This means that udev is not creating the devices that appear in /dev.
The device files created reference specific device numbers, and these
persist between reboots. When the host is rebooted there is no
guarantee that device numbers allocated to the logical volumes will
match those defined in the device files. This can be observed by
comparing the output of 'dmsetup info' and 'ls -l /dev/mapper'.

LVM's use of udev was disabled in an attempt to protect the host from
the potential that uevents generated would be processed by all
containers on the host. In practise this should not be an issue because
there are not other containers running on a cinder host.

This commit adjusts the lvm.conf file created so that udev is used. It
also adds a mount entry to create a devtmpfs on /dev. Finally
'udevadm trigger' is run to add the devices under /dev/mapper.
Closes-Bug: #1436999
Change-Id: I9ab35cf4438a369563f8c08870c1acfd0cc394b0
This commit is contained in:
git-harry 2015-06-02 15:17:33 +01:00 committed by Kevin Carter
parent 973a28ef11
commit 6ba292a295
2 changed files with 22 additions and 10 deletions

View File

@ -43,9 +43,27 @@
- "lxc.aa_profile=unconfined"
- "lxc.cgroup.devices.allow=a *:* rmw"
delegate_to: "{{ physical_host }}"
when: is_metal == false or is_metal == "False"
when: (is_metal == false or is_metal == "False") and inventory_hostname not in groups['cinder_volume']
tags:
- cinder-container-setup
- name: Cinder volume extra lxc config
lxc_container:
name: "{{ container_name }}"
container_config:
- "lxc.aa_profile=unconfined"
- "lxc.cgroup.devices.allow=a *:* rmw"
- "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']
tags:
- cinder-container-setup
register: lxc_config
- name: udevadm trigger
command: udevadm trigger
tags:
- cinder-container-setup
delegate_to: "{{ physical_host }}"
when: lxc_config is defined and lxc_config.changed
- name: Flush net cache
command: /usr/local/bin/lxc-system-manage flush-net-cache
delegate_to: "{{ physical_host }}"

View File

@ -19,16 +19,10 @@
{% if used_lvm_devices.append('"r/.*/"') %}{% endif %}
{% endif %}
{% if is_metal == false or is_metal == "False" %}
{% set use_udev = 0 %}
{% else %}
{% set use_udev = 1 %}
{% endif %}
devices {
dir = "/dev"
scan = [ "/dev" ]
obtain_device_list_from_udev = {{ use_udev }}
obtain_device_list_from_udev = 1
preferred_names = [ ]
filter = [ {{ used_lvm_devices|join(', ') }} ]
cache_dir = "/run/lvm"
@ -96,8 +90,8 @@ global {
}
activation {
checks = 0
udev_sync = {{ use_udev }}
udev_rules = {{ use_udev }}
udev_sync = 1
udev_rules = 1
verify_udev_operations = 0
retry_deactivation = 1
missing_stripe_filler = "error"