[libvirt] [PATCH 6/8] Add unique_id to nodedev output

John Ferlan jferlan at redhat.com
Wed Jun 11 15:05:19 UTC 2014



On 06/11/2014 10:10 AM, Daniel P. Berrange wrote:
> On Wed, Jun 11, 2014 at 10:00:24AM -0400, John Ferlan wrote:
>>
>>
>> On 06/11/2014 05:31 AM, Daniel P. Berrange wrote:
>>> On Tue, Jun 10, 2014 at 03:03:55PM -0400, John Ferlan wrote:
>>>
>>> Where is the data from the 'unique_id' coming from ? Is this since that
>>> Linux makes up, or is it some standard attribute from the hardware ? It
>>> would be desirable to document what it is in a way that's not simply
>>> refering to Linux sysfs, since sysfs itself is mostly undocumented :-)
>>>
>>>
>>
>> Using 'unique_id' was from Osier's initial design - I 'assumed' that his
>> research into this had determined using this was unique enough.
>>
>> A small amount of searching turns this up:
>>
>> https://lkml.org/lkml/2011/8/17/274
>> ...
>> +What:		/sys/bus/scsi/devices/host*/scsi_host/host*/unique_id
>> +Date:		February, 2003
>> +KernelVersion:	Unknown
>> +Contact:	James Bottomley <James.Bottomley at HansenPartnership.com>
>> +Description:
>> +		Read only unsigned integer uniquely identifying the SCSI host
>> +		within the system.  This value is assigned by the low level
>> +		driver.
>> +
>> ...
>>
>>
>> Also from various sources, there's '/linux/include/scsi/scsi_host.h
>>
>> /*
>>  * This is a unique identifier that must be assigned so that we
>>  * have some way of identifying each detected host adapter properly
>>  * and uniquely.  For hosts that do not support more than one card
>>  * in the system at one time, this does not need to be set.  It is
>>  * initialized to 0 in scsi_register.
>>  */
>> unsigned int unique_id;
> 
> Hmm, that's all rather fuzzy.  I wonder how much "better" this is unique
> int ID is than the current hostNN numbers. eg is this unique id stable
> when you plug / unplug iSCSI targets in arbitrary order
> 

Not sure I can answer with authority on the plug/unplug topic; however,
as I understand it the hostNN numbers can "change" what they are
pointing at after perhaps a reboot or scsi kernel module reload.  I'm
not an expert in these matters, but as I do understand it hardware is
scanned and devices named in the order they are found.

Using the PCI address and unique_id in combination provides a bit more
of a chance that if the hostNN number changes, then libvirt will/could
find the same adapter that was previously used.

John




More information about the libvir-list mailing list