12.8. Using an NPIV Virtual Adapter (vHBA) with SCSI Devices
NPIV (N_Port ID Virtualization) is a software technology that allows sharing of a single physical Fibre Channel host bus adapter (HBA).
This allows multiple guests to see the same storage from multiple physical hosts, and thus allows for easier migration paths for the storage. As a result, there is no need for the migration to create or copy storage, as long as the correct storage path is specified.
In virtualization, the virtual host bus adapter, or vHBA, controls the LUNs for virtual machines. Each vHBA is identified by its own WWNN (World Wide Node Name) and WWPN (World Wide Port Name). The path to the storage is determined by the WWNN and WWPN values.
This section provides instructions for configuring a vHBA on a virtual machine. Note that Red Hat Enterprise Linux 6 does not support persistent vHBA configuration across host reboots; verify any vHBA-related settings following a host reboot.
12.8.1. Creating a vHBA
Procedure 12.6. Creating a vHBA
Locate HBAs on the host system
To locate the HBAs on your host system, examine the SCSI devices on the host system to locate ascsi_host
withvport
capability.Run the following command to retrieve ascsi_host
list:# virsh nodedev-list --cap scsi_host scsi_host0 scsi_host1 scsi_host2 scsi_host3 scsi_host4
For eachscsi_host
, run the following command to examine the device XML for the line<capability type='vport_ops'>
, which indicates ascsi_host
withvport
capability.# virsh nodedev-dumpxml scsi_hostN
Check the HBA's details
Use thevirsh nodedev-dumpxml HBA_device
command to see the HBA's details.The XML output from thevirsh nodedev-dumpxml
command will list the fields<name>
,<wwnn>
, and<wwpn>
, which are used to create a vHBA. The<max_vports>
value shows the maximum number of supported vHBAs.# virsh nodedev-dumpxml scsi_host3 <device> <name>scsi_host3</name> <path>/sys/devices/pci0000:00/0000:00:04.0/0000:10:00.0/host3</path> <parent>pci_0000_10_00_0</parent> <capability type='scsi_host'> <host>3</host> <capability type='fc_host'> <wwnn>20000000c9848140</wwnn> <wwpn>10000000c9848140</wwpn> <fabric_wwn>2002000573de9a81</fabric_wwn> </capability> <capability type='vport_ops'> <max_vports>127</max_vports> <vports>0</vports> </capability> </capability> </device>
In this example, the<max_vports>
value shows there are a total 127 virtual ports available for use in the HBA configuration. The<vports>
value shows the number of virtual ports currently being used. These values update after creating a vHBA.Create a vHBA host device
Create an XML file similar to the following (in this example, named vhba_host3.xml) for the vHBA host.# cat vhba_host3.xml <device> <parent>scsi_host3</parent> <capability type='scsi_host'> <capability type='fc_host'> </capability> </capability> </device>
The<parent>
field specifies the HBA device to associate with this vHBA device. The details in the<device>
tag are used in the next step to create a new vHBA device for the host. See http://libvirt.org/formatnode.html for more information on thenodedev
XML format.Create a new vHBA on the vHBA host device
To create a vHBA on vhba_host3, use thevirsh nodedev-create
command:# virsh nodedev-create vhba_host3.xml Node device scsi_host5 created from vhba_host3.xml
Verify the vHBA
Verify the new vHBA's details (scsi_host5
) with thevirsh nodedev-dumpxml
command:# virsh nodedev-dumpxml scsi_host5 <device> <name>scsi_host5</name> <path>/sys/devices/pci0000:00/0000:00:04.0/0000:10:00.0/host3/vport-3:0-0/host5</path> <parent>scsi_host3</parent> <capability type='scsi_host'> <host>5</host> <capability type='fc_host'> <wwnn>5001a4a93526d0a1</wwnn> <wwpn>5001a4ace3ee047d</wwpn> <fabric_wwn>2002000573de9a81</fabric_wwn> </capability> </capability> </device>