2

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/vda: 
/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?

larsks
  • 41,276
  • 13
  • 117
  • 170
  • 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 00:25
  • I see the same on CentOS 7.1.1503, although `udevadm trigger` doesn't work either. – Lqueryvg Feb 07 '16 at 13:53
  • @dyasny Do you have links to dig more into which /dev/disk/by-* to use for persistent naming for virtualized enviroment(kvm,esxi vmware) and non virtual ? im currently running a vmware esxi and /dev/disk/by-id is empty but /dev/disk/by-path have pci-0000:00:10.0-scsi-0:0:0:0 -> ../../sda pci-0000:00:10.0-scsi-0:0:0:0-part1 -> ../../sda1 – sherpaurgen Apr 04 '18 at 06:34
  • @satch_boogie if you're hopping environments and hypervisors, I think nothing is going to be reliable unless you put it there. So the only thing you should be able to rely on are actual tags you write to the disk images, like partition GUIDs or LVM names – dyasny Apr 04 '18 at 13:49

0 Answers0