Menu Close

Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

12.8.2. Creating a Storage Pool Using the vHBA

It is recommended to define a libvirt storage pool based on the vHBA in order to preserve the vHBA configuration.
Using a storage pool has two primary advantages:
  • the libvirt code can easily find the LUN's path using the virsh command output, and
  • virtual machine migration requires only defining and starting a storage pool with the same vHBA name on the target machine. To do this, the vHBA LUN, libvirt storage pool and volume name must be specified in the virtual machine's XML configuration. Refer to Section 12.8.3, “Configuring the Virtual Machine to Use a vHBA LUN” for an example.
  1. Create a SCSI storage pool

    To create a vHBA configuration, first create a libvirt 'scsi' storage pool XML file based on the vHBA using the format below.


    Ensure you use the vHBA created in Procedure 12.6, “Creating a vHBA” as the host name, modifying the vHBA name scsi_hostN to hostN for the storage pool configuration. In this example, the vHBA is named scsi_host5, which is specified as <adapter name='host5'/> in a Red Hat Enterprise Linux 6 libvirt storage pool.
    It is recommended to use a stable location for the <path> value, such as one of the /dev/disk/by-{path|id|uuid|label} locations on your system. More information on <path> and the elements within <target> can be found at
    In this example, the 'scsi' storage pool is named vhbapool_host3.xml:
      <pool type='scsi'>
         <capacity unit='bytes'>0</capacity>
         <allocation unit='bytes'>0</allocation>
         <available unit='bytes'>0</available>
           <adapter name='host5'/>
  2. Define the pool

    To define the storage pool (named vhbapool_host3 in this example), use the virsh pool-define command:
             # virsh pool-define vhbapool_host3.xml
             Pool vhbapool_host3 defined from vhbapool_host3.xml
  3. Start the pool

    Start the storage pool with the following command:
    # virsh pool-start vhbapool_host3
    Pool vhbapool_host3 started
  4. Enable autostart

    Finally, to ensure that subsequent host reboots will automatically define vHBAs for use in virtual machines, set the storage pool autostart feature (in this example, for a pool named vhbapool_host3):
    # virsh pool-autostart vhbapool_host3