search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Hyper-V vHBA: Virtual Port Creation failed with a NPIV error
Posted in Windows Powershell, Windows Server | No Comment | 7,883 views | 02/03/2014 23:34

You have a Hyper-V Cluster and you use vHBA on your virtual machines?
Then you may be familiar with this error after restart your virtual machine:

TestVM: Virtual port (C003FF4CC9C5003D) creation failed with a NPIV error (Virtual machine ID 12BE2D01-D693-4488-AA5F-3715CBDA4F10)

Technet gives 2 reasons for that error as a possible cause:

Virtual Port creation failure because the WWPN is still in use because of:
· HBA failing to remove virtual port
· Host unresponsiveness

You can check documentation from here:

Only solution in that case is restarting your Hyper-V server or changing WWNN and WWPN addresses of virtual machine.
But i don’t like both ways because it takes more operator time and requires more service downtime..

So I went a little bit deeper to see what may be the reason. Because I was not able to start my virtual machine.
I installed QLogic SanSurfer on my Hyper-V host to check Physical HBA and Virtual Ports.

Then I noticed something:

Step1

My Virtual Machine was off, but its virtual port was still active on server.
After discovering that, removed that virtual port via QLogic Tools.

Step2

It worked like a charm! I was able to start my virtual machine again.
So I wrote a PowerShell script to find other inactive vHBA ports and remove them.

First, download Hyper-V vHBA PowerShell Module and put it into PowerShell Modules Directory.

You can query your inactive vHBA ports with following command:

Get-InactiveFCVirtualPort

If you want to query a remote Hyper-V server, use following command:

Get-InactiveFCVirtualPort -ComputerName RemoteServerName

That will give you inactive ports as an output:

ComputerName : VMHOST36
vHBAWWNN     : C0:03:FF:00:00:FF:FF:00
vHBAWWPN     : C0:03:FF:F1:25:95:00:0B
pHBAWWNN     : 50:06:0B:00:00:C2:62:A1
pHBAWWPN     : 50:06:0B:00:00:C2:62:A0
 
ComputerName : VMHOST36
vHBAWWNN     : C0:03:FF:00:00:FF:FF:00
vHBAWWPN     : C0:03:FF:F1:25:95:00:09
pHBAWWNN     : 50:06:0B:00:00:C2:62:A3
pHBAWWPN     : 50:06:0B:00:00:C2:62:A2

You can use following command to remove all inactive virtual ports:

Remove-InactiveFCVirtualPort

Of course you can also remove inactive virtual ports on remote server:

Remove-InactiveFCVirtualPort -ComputerName RemoteServerName

After that you should be able to start your virtual machine.

RemovePortsSS

You can also list your all virtual ports and their virtual machine information:

PS C:\Users\yusufozt> Get-FCVirtualPort
 
ComputerName : localhost
VMName       : VMDB01
VMState      : Running
VMSanName    : Switch_A
VMSanSet     : Set A
vHBAWWNN     : C0:03:FF:00:00:FF:FF:00
vHBAWWPN     : C0:03:FF:F1:25:95:00:04
pHBAWWNN     : 50:06:0B:00:00:C2:62:1F
pHBAWWPN     : 50:06:0B:00:00:C2:62:1E
 
ComputerName : localhost
VMName       : VMDB01
VMState      : Running
VMSanName    : Switch_B
VMSanSet     : Set A
vHBAWWNN     : C0:03:FF:00:00:FF:FF:00
vHBAWWPN     : C0:03:FF:F1:25:95:00:06
pHBAWWNN     : 50:06:0B:00:00:C2:62:1D
pHBAWWPN     : 50:06:0B:00:00:C2:62:1C

If you have a Hyper-V cluster, then you can use something like that:

1
2
3
4
5
6
$ClusterNodes = Get-Cluster | Get-ClusterNode
 
foreach ($ClusterNode in $ClusterNodes)
{
     Remove-InactiveFCVirtualPort -ComputerName $ClusterNode
}

That will remove all inactive virtual ports on cluster.

You should run this script on one of your Hyper-V host.



Leave a Reply