← Back to team overview

openstack team mailing list archive

Re: [nova] Disk attachment consistency

 

On Wed, Aug 15, 2012 at 03:49:45PM +0100, John Garbutt wrote:
> You can see what XenAPI exposes here:
>  http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/?c=VBD
> 
> I think the only thing you can influence when plugging in the disk is the “userdevice”
> which is the disk position: 0,1,2…  When you have attached the disk you can find out
> the “device” name, such as /dev/xvda
> 
> I don't know about Xen with libvirt. But from the previous discussion it seems using
> the disk position would also work with KVM?

No, this doesn't really work in general. Virtio disks get assigned SCSI device
numbers on a first-come first served basis. In the configuration you only have
control over the PCI device slot/function. You might assume that your disks
are probed in PCI device order, and thus get SCSI device numbers in that same
order. This is not really safe though. Further more if the guest has any
other kinds of devices, eg perhaps they logged into an iSCSI target, then all
bets are off for what SCSI device you get assigned.

All the host can safely say is

  - Virtio-blk disks get PCI address domain:bus:slot:function
  - Virtio-SCSI disks get SCSI address A.B.C.D
  - Disks have an unique serial string ZZZZZZZZZZZ

As a guest OS admin you can use this info get reliable disk names
in /dev/disk/by-{path,id}.

If your disk has a filesystem on it, you can also get a unique UUID
and /or filesystem label, which means you can refer to the device
from /dev/disk/by-{uuid,label} too.

Relying on /dev/sdXXX is doomed to failure in the long term, even on
bare metal, and should be avoided wherever possible.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


Follow ups

References