Skip to content

Assigning Fibre Channel HBA to Virtual Machine

First, identify the appropriate Fibre Channel HBA to use for PCI passthrough using CLI. Then, you can use the Virtual Machine Manager GUI or Linux Cockpit to assign the device to your virtual machine.

For the full list of supported Fibre Channel HBA devices, refer to the Supported Platforms page.

  1. Create a text file. For example:

    nano iommu_groups.sh
    
  2. Copy and paste the following script1 to list all PCI/PCIe cards that can be used for passthrough into your newly created file:

    #!/bin/bash
    shopt -s nullglob
    for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
        echo "IOMMU Group ${g##*/}:"
        for d in $g/devices/*; do
             echo -e "\t$(lspci -nns ${d##*/})"
        done;
    done;
    
  3. Save the changes and exit the editor.

  4. Add execute permissions to the file containing the script by running the following command:

    chmod +x iommu_groups.sh
    
  5. Run the script:

    ./iommu_groups.sh
    

    Your output will look similar to this:

    .
    .
    .
    IOMMU Group 8:
          11:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter [1077:2261] (rev 01)
          11:00.1 Fibre Channel [0c04]: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter [1077:2261] (rev 01)
    IOMMU Group 9:
          12:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter [1077:2261] (rev 01)
          12:00.1 Fibre Channel [0c04]: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter [1077:2261] (rev 01)
    .
    .
    .

  6. In your output, find a group that contains a Fibre Channel HBA that you want to pass through to the virtual machine. The two entries in a group represent PCI addresses and functions that you will need when assigning the Fibre Channel HBA to your VM.

  7. Use one of the methods below to assign a Fibre Channel HBA to your virtual machine.

    Warning

    Make sure to shut down your virtual machine before you assign an HBA device to it.

  1. Open Virtual Machine Manager either from the Application Launcher or by running the virt-manager command in your CLI. A new window will open.

  2. Select the VM that you want to edit and click the Open button. A new window will open.

  3. Click the light bulb icon (Show virtual hardware details). Then, click the Add Hardware button in the bottom-left corner. A new window will open.

  4. In the menu on the left, select PCI Host Device.

  5. From the list on the right, you must select and add both entries from the group that you found in this step. Select the first entry and click Finish. You will be redirected to the Virtual Hardware Details window.

  6. Click the Add Hardware button in the bottom-left corner once again. A new window will open.

  7. From the list on the right, find the second entry for the device you are assigning to your VM. Select the entry and click Finish.

    You should now be able to see both entries listed on the right pane of the Virtual Hardware Details window.

Using Linux Cockpit to assign PCI devices to a virtual machine is the easiest and quickest method. Linux Cockpit performs all of the host operating system interactions required for PCI passthrough.

  1. If Linux Cockpit is not installed on your system by default, refer to the steps described in the Introduction to Cockpit article on how to install and enable Linux Cockpit (for both RHEL and OL systems).

  2. Log in to Linux Cockpit by going to your-linux-system-ip-address:9090 from your browser.

  3. Enter your credentials and click Log in.

  4. In the menu on the left, select Virtual Machines.

  5. Click on the name of the VM to which you want to assign a Fibre Channel HBA. You will see your virtual machine configuration details.

  6. Scroll down to the Host devices section and click Add host device. A pop-up window will open.

  7. Select PCI as the device type to list all the PCI devices available for PCI passthrough.

  8. Select both PCI device entries that you found using this script. Click Add.

    Caution

    If you do not assign both functions of a multi-function PCI device to the VM, the host system may crash.

  9. Click Add to add both functions of the Fibre Channel HBA device.

  10. You should now see both functions of the device assigned to your virtual machine on the VM configuration page.

  1. Create two empty XML files on the host. For example:

    nano pt-dev-conf-1.xml
    nano pt-dev-conf-2.xml
    

  2. Copy and paste the following XML configuration into each of the newly created files:

    <hostdev mode='subsystem' type='pci' managed='yes'>
    <driver name='vfio'/>
     <source>
      <address domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
     </source>
    </hostdev>
    

  3. Edit the files so that the values in the line <address domain='0x0000' bus='0x00' slot='0x00' function='0x0'/> correspond to each of the entries in the group containing the HBA device you are adding.

    For example, if you are adding the following device:

    11:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter [1077:2261] (rev 01)
    11:00.1 Fibre Channel [0c04]: QLogic Corp. ISP2722-based 16/32Gb Fibre Channel to PCIe Adapter [1077:2261] (rev 01)

    For the first entry, the XML configuration will look like this:

    <hostdev mode='subsystem' type='pci' managed='yes'>
     <driver name='vfio'/>
      <source>
       <address domain='0x0000' bus='0x11' slot='0x00' function='0x0'/>
      </source>
    </hostdev>

    For the second entry, it will look like this:

    <hostdev mode='subsystem' type='pci' managed='yes'>
     <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x11' slot='0x00' function='0x1'/>
      </source>
    </hostdev>

    Important

    The two configurations of the Fibre Channel HBA device must be saved in separate files.

  4. Save the changes to the XML configuration files.

  5. Run the following command to add the first Fibre Channel HBA configuration to your virtual machine configuration file:

    virsh attach-device --file --persistent pt-dev-conf-1.xml
    

  6. Run the following command to add the second Fibre Channel HBA configuration to your virtual machine configuration file:

    virsh attach-device --file --persistent pt-dev-conf-2.xml
    

    Note

    After you have added both Fibre Channel HBA configurations, you may safely delete the XML files that you created.

Tip

You can assign a Fibre Channel HBA device to your virtual machine during installation if you use the --host-device argument on the virt-install command. Specify the PCI addresses of the appropriate devices that can be found using this script. For example:

--host-device 11:00.0 --host-device 11:00.1

The number of the arguments must be equal to the number of entries in the corresponding group.

Verification

You can verify that the Fibre Channel HBA device has been assigned to the virtual machine by opening the System Dump Analyzer (SDA) and executing CLUE CONFIG/ADAPTER in OpenVMS running on your VM:

$ ANALYZE/SYSTEM

OpenVMS system analyzer

SDA> CLUE CONFIG/ADAPTER
TR Adapter   ...  Hose Bus      ...   Node GSIN   iVec    SCB  Port Slot Device Name / HW-Id
-- ------------------- -------------- ---- ------------------- ---- ---- -------------------
.
.
.
10 PCIE      ...     0 07 PCIE  ...    700 0017    00D0   1500 FGA:    0 QLogic ISP2722 PCIe Fibre
11 PCIE      ...     0 08 PCIE  ...    800 0016    00CF   14F0 FGB:    0 QLogic ISP2722 PCIe Fibre

Alternatively, it is possible to determine whether the Fibre Channel HBA is assigned to the virtual machine by the presence of the Fibre Channel FG devices as follows:

$ SHOW DEVICES FG
Device                  Device           Error
Name                    Status           Count
FGA0:                   Online               0
FGB0:                   Online               0 

If not yet configured, you can now create storage devices on the storage controller and map them to the Fibre Channel HBA assigned to the virtual machine.

For more information on mapping tape devices, refer to Guidelines for OpenVMS Cluster Configurations.

For instructions on how to map Fibre Channel volumes to OpenVMS guests, refer to your storage array documentation and support.