libvirt/tests/storagepoolxml2xmlout
Osier Yang a4bd62adc1 storage: Introduce parentaddr into virStoragePoolSourceAdapter
Between reboots and kernel reloads, the SCSI host number used for SCSI
storage pools may change requiring modification to the storage pool XML
in order to use a specific SCSI host adapter.

This patch introduces the "parentaddr" element and "unique_id" attribute
for the SCSI host adapter in order to uniquely identify the adapter
between reboots and kernel reloads. For now the goal is to only parse
and format the XML. Both will be required to be provided in order to
uniquely identify the desired SCSI host.

The new XML is expected to be as follows:

  <adapter type='scsi_host'>
    <parentaddr unique_id='3'>
      <address domain='0x0000' bus='0x00' slot='0x1f' func='0x2'/>
    </parentaddr>
  </adapter>

where "parentaddr" is the parent device of the SCSI host using the PCI
address on which the device resides and the value from the unique_id file
for the device. Both the PCI address and unique_id values will be used
to traverse the /sys/class/scsi_host/ directories looking at each link
to match the PCI address reformatted to the directory link format where
"domain🚌slot:function" is found.  Then for each matching directory
the unique_id file for the scsi_host will be used to match the unique_id
value in the xml.

For a PCI address listed above, this will be formatted to "0000:00:1f.2"
and the links in /sys/class/scsi_host will be used to find the host#
to be used for the 'scsi_host' device. Each entry is a link to the
/sys/bus/pci/devices directories, e.g.:

%  ls -al /sys/class/scsi_host/host2
lrwxrwxrwx. 1 root root 0 Jun  1 00:22 /sys/class/scsi_host/host2 -> ../../devices/pci0000:00/0000:00:1f.2/ata3/host2/scsi_host/host2

% cat /sys/class/scsi_host/host2/unique_id
3

The "parentaddr" and "name" attributes are mutually exclusive to identify
the SCSI host number. Use of the "parentaddr" element will be the preferred
mechanism.

This patch only supports to parse and format the XMLs. Later patches will
add code to find out the scsi host number.
2014-07-21 12:55:10 -04:00
..
pool-dir-naming.xml storage: use valid XML for awkward volume names 2013-11-21 17:29:47 -07:00
pool-dir.xml
pool-disk.xml
pool-fs.xml
pool-gluster-sub.xml storage: document gluster pool 2013-11-25 11:03:19 -07:00
pool-gluster.xml storage: document gluster pool 2013-11-25 11:03:19 -07:00
pool-iscsi-auth.xml
pool-iscsi-multiiqn.xml
pool-iscsi-vendor-product.xml
pool-iscsi.xml
pool-logical-create.xml
pool-logical-nopath.xml Make logical pools independent on target path 2013-07-16 12:16:37 +02:00
pool-logical.xml
pool-mpath.xml
pool-netfs-gluster.xml storage: fix RNG validation of gluster via netfs 2013-11-13 12:10:00 -07:00
pool-netfs.xml
pool-rbd.xml
pool-scsi-type-fc-host.xml
pool-scsi-type-scsi-host-stable.xml storage: Introduce parentaddr into virStoragePoolSourceAdapter 2014-07-21 12:55:10 -04:00
pool-scsi-type-scsi-host.xml
pool-scsi.xml
pool-sheepdog.xml