The SCSI host number is not stable on Linux platform, the number can be changed after a system rebooting or scsi kernel modules reloaded. To have a stable address for the scsi_host adapter of scsi pool, this introduces new XMLs like: <adapter type='scsi_host' parent='pci_0000_00_1f_2' unique_id='5'/> Where "parent" is the parent device of the scsi host, it should be consistent with the name style what node device driver uses (Either udev backend style or HAL backend style), or the PCI address in format "domain:bus:slot:function" format. "unique_id" is the number exposed by sysfs. E.g: % cat /sys/bus/pci/devices/0000:00:1f.2/ata5/host4/scsi_host/host4/unique_id 5 The attribute "parent" is required, attribute "unique_id" is optional, if it's omitted, the scsi host which has smallest unique_id under the "parent" device will be used. "parent" and the old "name" attribute are exclusive, since they are both to indicate scsi host number. Osier Yang (11): storage: Add a struct for scsi_host type adapter storage: Introduce new XMLs for stable SCSI host addressing util: Add a util to traverse directory tree util: Add util to find PCI device address by its vendor and product IDs util: Add util to parse the stable scsi host address storage_scsi: Don't ignore the return value of VIR_STRDUP storage_scsi: Translate the stable address into scsi host number util: Add util to pad string storage_scsi: Allow the direct PCI address for 'parent' util: Add a util to guess the scsi host name with specified "parent" storage_scsi: Allow the omitted 'unique_id' docs/schemas/basictypes.rng | 20 +- src/conf/storage_conf.c | 66 ++- src/conf/storage_conf.h | 7 +- src/libvirt_private.syms | 5 + src/phyp/phyp_driver.c | 8 +- src/storage/storage_backend_scsi.c | 152 +++++- src/util/virstring.c | 38 ++ src/util/virstring.h | 6 + src/util/virutil.c | 549 +++++++++++++++++++++ src/util/virutil.h | 67 +++ .../pool-scsi-type-scsi-host-stable.xml | 15 + .../pool-scsi-type-scsi-host-stable.xml | 18 + tests/storagepoolxml2xmltest.c | 1 + .../ata1/host0/scsi_host/host0/unique_id | 1 + .../ata2/host1/scsi_host/host1/unique_id | 1 + tests/sysfs/devices/pci0000:00/0000:00:1f.1/device | 1 + tests/sysfs/devices/pci0000:00/0000:00:1f.1/vendor | 1 + tests/sysfs/devices/pci0000:00/0000:00:1f.2/device | 1 + tests/sysfs/devices/pci0000:00/0000:00:1f.2/vendor | 1 + tests/sysfs/devices/pci0000:00/0000:00:1f.4/device | 1 + tests/sysfs/devices/pci0000:00/0000:00:1f.4/vendor | 1 + tests/utiltest.c | 137 +++++ 22 files changed, 1076 insertions(+), 21 deletions(-) create mode 100644 tests/storagepoolxml2xmlin/pool-scsi-type-scsi-host-stable.xml create mode 100644 tests/storagepoolxml2xmlout/pool-scsi-type-scsi-host-stable.xml create mode 100644 tests/sysfs/bus/pci/devices/0000:00:1f.2/ata1/host0/scsi_host/host0/unique_id create mode 100644 tests/sysfs/bus/pci/devices/0000:00:1f.2/ata2/host1/scsi_host/host1/unique_id create mode 100644 tests/sysfs/devices/pci0000:00/0000:00:1f.1/device create mode 100644 tests/sysfs/devices/pci0000:00/0000:00:1f.1/vendor create mode 100644 tests/sysfs/devices/pci0000:00/0000:00:1f.2/device create mode 100644 tests/sysfs/devices/pci0000:00/0000:00:1f.2/vendor create mode 100644 tests/sysfs/devices/pci0000:00/0000:00:1f.4/device create mode 100644 tests/sysfs/devices/pci0000:00/0000:00:1f.4/vendor -- 1.8.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list