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 8ccc47e315
commit 1e2e15ee87

View File

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