[libvirt-users] how to match the ID of a LUN in a storage pool with the GUID on the target server

Daniel P. Berrange berrange at redhat.com
Wed Jun 30 18:47:42 UTC 2010


On Wed, Jun 16, 2010 at 06:41:30PM +0100, Daniel P. Berrange wrote:
> On Wed, Jun 16, 2010 at 01:20:02PM -0400, Tom Georgoulias wrote:
> > I've configured a libvirt storage pool using an iscsi target from a Sun 
> > 7310 storage appliance and am using the LUNs in this target as volumes 
> > for my KVM guests.  The setup is very similar to what Daniel covered in 
> > a recent blog posting:
> > 
> > http://berrange.com/posts/2010/05/05/provisioning-kvm-virtual-machines-on-iscsi-the-hard-way-part-2-of-2/
> > 
> > It works great, but I can't figure out how to match the volume names & 
> > path IQNs within the storage pool to the GUIDs on the target.
> > 
> > For example, here's what I see when I use the vol-info command:
> > 
> > # virsh vol-list kvm-target
> > Name                 Path
> > -----------------------------------------
> > 6.0.0.0 
> > /dev/disk/by-path/ip-X.X.X.X:3260-iscsi-iqn.1986-03.com.sun:02:<snipped>-lun-0
> > 6.0.0.1 
> > /dev/disk/by-path/ip-X.X.X.X:3260-iscsi-iqn.1986-03.com.sun:02:<snipped>-lun-1
> > 
> > The IQN matches the targets IQN, but when I browse the LUNs from the 
> > storage system I do not see a way to determine which of them is *-lun-0 
> > and which is *-lun-1, I only see a GUID and an alias name that I created.
> > 
> > Is there any way to get that info (or something else that will do the 
> > job) from a virsh command?
> 
> Nothing at this time. If you weren't using libvirt, how would you discover
> the GUIDs on the Linux client ? If there is a way to get these from sysfs
> or elsewhere, we can wire it up in libvirt to the <key> element in the XML
> for the volume. I just don't know how yet...

I discovered you can get the info from UDEV, eg if libvirt reports a
volume '/dev/sde' you can query against the block device path

# scsi_id --export --whitelisted /dev/sde
ID_VENDOR=QNAP
ID_VENDOR_ENC=QNAP
ID_MODEL=iSCSI_Storage
ID_MODEL_ENC=iSCSI\x20Storage
ID_REVISION=3.1
ID_TYPE=disk
ID_SERIAL=36001405e61fd1a5d6f1dd4d66d9630d2
ID_SERIAL_SHORT=6001405e61fd1a5d6f1dd4d66d9630d2


The ID_SERIAL field should be what you what IIUC

We'll see about making libvirt report this value directly as the 'key' for
the volume

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvirt-users mailing list