I am provisioning a Nova server and Cinder volumes using a Heat template.

In order to identify the Cinder volumes attached to my OpenStack server I would like to use the /dev/disk/by-id/... symlinks provided by udev. Unfortunately, these seem to be unreliable. I have the following devices attached to the system:

# find -H /sys/class/block/* -name serial | while read x; do dev=${x%/*}; echo "$dev: $(cat $x)"; done
/sys/class/block/vdb: f78447c1-8da2-4a68-b
/sys/class/block/vdc: d85a0192-37cf-46f3-8

So there should be symlinks in /dev/disk/by-id for both vdb and vdc. However:

# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx. 1 root root  9 Oct 11 16:44 virtio-d85a0192-37cf-46f3-8 -> ../../vdc

If I run udevadm trigger, the device appears:

# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx. 1 root root  9 Oct 11 17:55 virtio-d85a0192-37cf-46f3-8 -> ../../vdc
lrwxrwxrwx. 1 root root  9 Oct 11 17:55 virtio-f78447c1-8da2-4a68-b -> ../../vdb

But I would like the device to appear reliably on boot. Has anyone seen this behavior before?

  • What OS/distribution is this? – ewwhite Oct 11 '14 at 18:17
  • if you're provisioning in a VM (is this TripleO?) the disk IDs may not be reliable, but under KVM the disks always show up in the sam eorder they are defined in the libvirt domxml. On real hardware, these IDs should be reliable afaik. – dyasny Oct 11 '14 at 18:34
  • 2
    Unless Ubuntu... – ewwhite Oct 11 '14 at 19:40
  • This is Fedora, running on OpenStack Nova instances (so yes, these are VMs). There's no way to determine what order the disks are defined in the libvirt xml (that isn't exposed via the api). It looks as if simply running udevadm trigger in my user-data script is sufficient to make things "work". – larsks Oct 12 '14 at 0:25
  • I see the same on CentOS 7.1.1503, although udevadm trigger doesn't work either. – Lqueryvg Feb 7 '16 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.