On 06/11/2014 05:31 AM, Daniel P. Berrange wrote:
On Tue, Jun 10, 2014 at 03:03:55PM -0400, John Ferlan wrote:
> Add an optional unique_id parameter to nodedev. Allows for easier lookup
> and display of the unique_id value in order to document for use with
> scsi_host code.
>
> Signed-off-by: John Ferlan <jferlan(a)redhat.com>
> ---
> docs/formatnode.html.in | 11 +++++++++++
> docs/schemas/nodedev.rng | 6 ++++++
> src/conf/node_device_conf.c | 23 ++++++++++++++++------
> src/conf/node_device_conf.h | 1 +
> src/node_device/node_device_linux_sysfs.c | 6 ++++++
> src/test/test_driver.c | 5 +++--
> .../pci_8086_27c5_scsi_host_0_unique_id.xml | 8 ++++++++
> tests/nodedevxml2xmltest.c | 1 +
> 8 files changed, 53 insertions(+), 8 deletions(-)
> create mode 100644 tests/nodedevschemadata/pci_8086_27c5_scsi_host_0_unique_id.xml
>
> diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in
> index 76bf8af..cdf0277 100644
> --- a/docs/formatnode.html.in
> +++ b/docs/formatnode.html.in
> @@ -173,6 +173,17 @@
> <dl>
> <dt><code>host</code></dt>
> <dd>The SCSI host number.</dd>
> + <dt><code>unique_id</code></dt>
> + <dd>On input, this optionally provides the value from the
> + 'unique_id' file found in the scsi_host's directory. To
> + view the values of all 'unique_id' files, use
<code>find -H
> + /sys/class/scsi_host/host{0..9}/unique_id |
> + xargs grep '[0-9]'</code>. On output, if the
unique_id
> + file exists, the value from the file will be displayed.
> + This can be used in order to help uniquely identify the
> + scsi_host adapter in a <a
href="formatstorage.html">
> + Storage Pool</a>. <span class="since">Since
1.2.6</span>
> + </dd>
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(a)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;
Regards,
Daniel