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

Daniel P. Berrange berrange at redhat.com
Tue Aug 7 11:28:51 UTC 2012


On Mon, Aug 06, 2012 at 02:16:39PM -0600, Eric Blake wrote:
> On 08/02/2012 07:09 AM, Daniel P. Berrange 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.
> > ---
> >  src/util/storage_file.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  src/util/storage_file.h |  3 ++
> >  2 files changed, 96 insertions(+)
> > 
> > +#ifdef HAVE_UDEV
> > +const char *virStorageFileGetSCSIKey(const char *path)
> > +{
> > +    char *key = NULL;
> > +    virCommandPtr cmd = virCommandNewArgList(
> > +        "/lib/udev/scsi_id",
> 
> Are we okay hard-coding the name of this utility, or should it be
> learned during configure?  At any rate, changing that can be an
> incremental improvement later.

AFAIK, it is always in this location on all distros, so I think we're
safe for now. NB, this is the same as some code already present in
the storage driver source - I'll be sending a followup patch to
make the storage driver just call this method now.

> ACK.

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