<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.7</span>
+ </dd>
<dt><code>capability</code></dt>
<dd>Current capabilities include "vports_ops" (indicates
vport operations are supported) and "fc_host". "vport_ops"
<ref name='unsignedLong'/>
</element>
+ <optional>
+ <element name='unique_id'>
+ <ref name='positiveInteger'/>
+ </element>
+ </optional>
+
<optional>
<zeroOrMore>
<element name='capability'>
case VIR_NODE_DEV_CAP_SCSI_HOST:
virBufferAsprintf(&buf, "<host>%d</host>\n",
data->scsi_host.host);
+ if (data->scsi_host.unique_id != -1)
+ virBufferAsprintf(&buf, "<unique_id>%d</unique_id>\n",
+ data->scsi_host.unique_id);
if (data->scsi_host.flags & VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST) {
virBufferAddLit(&buf, "<capability type='fc_host'>\n");
virBufferAdjustIndent(&buf, 2);
orignode = ctxt->node;
ctxt->node = node;
- if (create == EXISTING_DEVICE &&
- virNodeDevCapsDefParseULong("number(./host[1])", ctxt,
- &data->scsi_host.host, def,
- _("no SCSI host ID supplied for '%s'"),
- _("invalid SCSI host ID supplied for '%s'")) < 0) {
- goto out;
+ if (create == EXISTING_DEVICE) {
+ if (virNodeDevCapsDefParseULong("number(./host[1])", ctxt,
+ &data->scsi_host.host, def,
+ _("no SCSI host ID supplied for '%s'"),
+ _("invalid SCSI host ID supplied for '%s'")) < 0) {
+ goto out;
+ }
+ /* Optional unique_id value */
+ data->scsi_host.unique_id = -1;
+ if (virNodeDevCapsDefParseIntOptional("number(./unique_id[1])", ctxt,
+ &data->scsi_host.unique_id, def,
+ _("invalid unique_id supplied for '%s'")) < 0) {
+ goto out;
+ }
}
if ((n = virXPathNodeSet("./capability", ctxt, &nodes)) < 0) {
} net;
struct {
unsigned int host;
+ int unique_id;
char *wwnn;
char *wwpn;
char *fabric_wwn;
char *vports = NULL;
int ret = -1;
+ if (virReadSCSIUniqueId(NULL, d->scsi_host.host,
+ &d->scsi_host.unique_id) < 0) {
+ VIR_DEBUG("Failed to read unique_id for host%d", d->scsi_host.host);
+ d->scsi_host.unique_id = -1;
+ }
+
VIR_DEBUG("Checking if host%d is an FC HBA", d->scsi_host.host);
if (virIsCapableFCHost(NULL, d->scsi_host.host)) {
if (VIR_STRDUP(def->name, wwpn) < 0)
goto cleanup;
- /* Fill in a random 'host' value, since this would also come from
- * the backend */
+ /* Fill in a random 'host' and 'unique_id' value,
+ * since this would also come from the backend */
caps = def->caps;
while (caps) {
if (caps->type != VIR_NODE_DEV_CAP_SCSI_HOST)
continue;
caps->data.scsi_host.host = virRandomBits(10);
+ caps->data.scsi_host.unique_id = 2;
caps = caps->next;
}
--- /dev/null
+<device>
+ <name>pci_8086_27c5_scsi_host_0</name>
+ <parent>pci_8086_27c5</parent>
+ <capability type='scsi_host'>
+ <host>1</host>
+ <unique_id>2</unique_id>
+ </capability>
+</device>
DO_TEST("pci_1002_71c4");
DO_TEST("pci_8086_10c9_sriov_pf");
DO_TEST("pci_8086_27c5_scsi_host_0");
+ DO_TEST("pci_8086_27c5_scsi_host_0_unique_id");
DO_TEST("pci_8086_27c5_scsi_host_scsi_device_lun0");
DO_TEST("pci_8086_27c5_scsi_host_scsi_host");
DO_TEST("pci_8086_27c5_scsi_host");