[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] PATCH: Add SCSI HBA backend for storage driver



This patch adds a new backend to the storage driver supporting SCSI HBAs.
With this you can now enumerate physical disks provided by FibreChannel,
internal SCSI / PATA / SATA / USB adapters.

The implemention uses HAL to enumerate the volumes asssociated with an HBA.
It is common for most boxes to support multiple HBAs. eg on my Linux laptop

$ ls /sys/class/scsi_host/
host0  host1  host2  host3

These HBA names are used to identify the host when defining the XML:

  <pool type="scsi">
    <name>hba0</name>
    <source>
      <adapter name="host0"/>
    </source>
    <target>
      <path>/dev/disk/by-path</path>
    </target>
  </pool>


This does not provide any means of discovering HBA names - that's a later
piece of broader work on host device discovery. It also does not support
multipath devices (eg with FibreChannel the same storage volume can appear
on the host multiple  times)

Example using the first host adapter which is my internal SATA controller
with a single disk attached:

# ./src/virsh pool-create /root/hba0.xml 
Pool hba0 created from /root/hba0.xml

# ./src/virsh vol-list hba0
Name                 Path                                    
-----------------------------------------
0:0:0:0              /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0


# ./src/virsh vol-info /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
Name:           0:0:0:0
Type:           block
Capacity:       153.39 GB
Allocation:     153.39 GB

# ./src/virsh vol-dumpxml /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0
libvir: Storage error : no storage vol with matching key
<volume>
  <name>0:0:0:0</name>
  <key>SATA_HDT722516DLA380_VDK91GTE0WPLER</key>
  <source>
  </source>
  <capacity>164696555520</capacity>
  <allocation>164696555520</allocation>
  <target>
    <path>/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0</path>
    <permissions>
      <mode>060640</mode>
      <owner>0</owner>
      <group>6</group>
      <label>system_u:object_r:fixed_disk_device_t</label>
    </permissions>
  </target>
</volume>

This also does not deal with the problem of HBAs being created on the fly,
eg the NPIV case where you can add/remove adapters at will. I'm still working
on how to deal with this. If you have your virtual NPIV adapters already 
defined though, it can enumerate them fine.

Aside from the bit where I map from the short HBA name (eg 'host0') into the
HAL device name, this should be portable to Solaris as-is.

Dan.
-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]