[libvirt] [PATCH] Add APIs for obtaining the unique ID of LVM & SCSI volumes

Daniel P. Berrange berrange at redhat.com
Tue Aug 7 11:27:37 UTC 2012


On Fri, Aug 03, 2012 at 04:03:55PM +0100, Daniel P. Berrange wrote:
> On Thu, Aug 02, 2012 at 11:32:14PM -0500, Doug Goldstein wrote:
> > On Thu, Aug 2, 2012 at 8:09 AM, Daniel P. Berrange <berrange at redhat.com> wrote:
> > > From: "Daniel P. Berrange" <berrange at redhat.com>
> > >
> > > Both LVM volumes and SCSI LUNs have a globally unique
> > > identifier associated with them. It is useful to be able
> > > to query this identifier to then perform disk locking,
> > > rather than try to figure out a stable pathname.
> > > --
> > 
> > Would it not be better to call methods from within libdevmapper and
> > libblkid than relying on a callout? Its also worth noting that iSCSI
> > provides a GUID for the volume as well.
> 
> AFAICT, libblkid does not provide a way to get the SCSI WWN/Serial
> values. For iSCSI, I'm assuming that the devices just report the
> data using the regular kernel SCSI ioctls, so scsi_id should
> 'just work' already.

Issuing SCSI ioctls would indeed be possible, but the code is not
entirely trivial. I looked to see if sg3utils provided a nice API
for this, and while they do have APIs for dealing with SCSI commands,
all the code for actually interpreting the data is still in their
command line tools under GPL license, so that's not good.

Since we already invoke this scsi_id command from the storage
drivers, what I have here is no worse. So I'm shelfing the
idea of doing SCSI directly until I (or someone else) has more
time

> That said, I think I might implement the SCSI lookup directly because
> I know remember previous discussions about the fact that the scsi_id
> command changed its supported command line arguments over time.
> 
> I might try libdevmapper, if I can figure out its crazy API

Well, the API is even more crazy that I expected, so I'm not going
to change this patch now.

Regards,
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 :|




More information about the libvir-list mailing list