admin> portcfgshow 0 ...... NPIV capability ON ...... Usage portCfgNPIVPort <PortNumber> <Mode> Mode Meaning 0 Disable the NPIV capability on the port 1 Enable the NPIV capability on the port
admin> portCfgNPIVPort 0 1
# ls /proc/scsi QLogic HBAs are listed as qla2xxx. Emulex HBAs are listed as lpfc.
# ls /proc/scsi/qla2xxx
# ls /proc/scsi/lpfc
# cat /proc/scsi/qla2xxx/7 FC Port Information for Virtual Ports: Virtual Port index = 1 Virtual Port 1:VP State = <ACTIVE>, Vp Flags = 0x0 scsiqla2port3=500601609020fd54:500601601020fd54:a00000:1000: 1; scsiqla2port4=500601609020fd54:500601681020fd54:a10000:1000: 1; Virtual Port 1 SCSI LUN Information: ( 0:10): Total reqs 10, Pending reqs 0, flags 0x0, 2:0:1000,
# cat /proc/scsi/lpfc/3 SLI Rev: 3 NPIV Supported: VPIs max 127 VPIs used 1 RPIs max 512 RPIs used 13 Vports list on this physical port: Vport DID 0x2f0901, vpi 1, state 0x20 Portname: 48:19:00:0c:29:00:00:0d Nodename: 48:19:00:0c:29:00:00:0b
libvirt
, you require a NPIV capable HBA and switch.
/sys/class
/fc_host
/hostN
directory where class
is the type of adaptor and fc_host
is the host number.
1111222233334444:5555666677778888
' is WWPN:WWNN
and host5
is the physical HBA which the virtual HBA is a client of.
# echo '1111222233334444:5555666677778888
' > /sys/class/fc_host/host5/vport_create
# echo '1111222233334444:5555666677778888
' > /sys/class/fc_host/host5/vport_delete
virsh
. This procedure requires a compatible HBA device.
List available HBAs
# virsh nodedev-list -TODO-cap=scsi_host pci_10df_fe00_0_scsi_host pci_10df_fe00_0_scsi_host_0 pci_10df_fe00_scsi_host pci_10df_fe00_scsi_host_0 pci_10df_fe00_scsi_host_0_scsi_host pci_10df_fe00_scsi_host_0_scsi_host_0
Gather parent HBA device data
pci_10df_fe00_scsi_host
.
# virsh nodedev-dumpxml pci_10df_fe00_scsi_host <device> <name>pci_10df_fe00_scsi_host</name> <parent>pci_10df_fe00</parent> <capability type='scsi_host'> <host>5</host> <capability type='fc_host'> <wwnn>20000000c9848140</wwnn> <wwpn>10000000c9848140</wwpn> </capability> <capability type='vport_ops' /> </capability> </device>
type='vport_ops'
in the XML definition.
Create the XML definition for the virtual HBA
newHBA.xml
.
<device> <parent>pci_10df_fe00_0_scsi_host</parent> <capability type='scsi_host'> <capability type='fc_host'> <wwpn>1111222233334444</wwpn> <wwnn>5555666677778888</wwnn> </capability> </capability> </device>
<parent>
element is the name of the parent HBA listed by the virsh nodedev-list
command. The <wwpn>
and <wwnn>
elements are the WWNN and WWPN for the virtual HBA.
# virsh nodedev-create badwwn.xml error: Failed to create node device from badwwn.xml error: Write of '1111222233334444:5555666677778888' to '/sys/class/fc_host/host6/vport_create' during vport create/delete failed: No such file or directory
Create the virtual HBA
virsh nodedev-create
command using the file from the previous step.
# virsh nodedev-create newHBA.xml Node device pci_10df_fe00_0_scsi_host_0_scsi_host created from newHBA.xml
virsh nodedev-destroy
:
# virsh nodedev-destroy pci_10df_fe00_0_scsi_host_0_scsi_host Destroyed node device 'pci_10df_fe00_0_scsi_host_0_scsi_host'