Share via


SCVMM 2012 Quick Tip: Finding which storage arrays a Hyper-V host can see

SNIA SMI Lab kicked off the 4th and final plugfest for 2011 this week. Microsoft is here along with several storage partners. Earlier today, we started testing VMM 2012 with a SMI-S based storage provider and we tried to allocate a LUN to a host group that contained a Hyper-V host. This operation succeeded with the following warning 26130:

 

 

The recommended action tells me that zoning might not be correct. So I check host properties and notice that the host cannot see any arrays. This means either the iSCSI initiator is not logged into any targets and there is no zone created on the FC switch that includes the host and array WWNs.

 

I can also access this information using VMM PowerShell. In the SNIA SMI lab, the Hyper-V host is connected to multiple arrays using both FC and iSCSI. Using VMM cmdlets, I can figure out if the host is properly zoned to array and/or logged into target of array and get detailed information about the target names and port WWNs using PowerShell:

#establish connection to VMM server

Get-SCVMMServer localhost | Out-Null

 

$arrays = Get-SCStorageArray

 

#collect FC endpoints from array object

$FCarrayendpointaddress = @()

foreach($array in $arrays){

      foreach($FCstorageendpoint in $array.StorageEndpoints){

            if($FCarrayendpointaddress -notcontains $FCstorageendpoint.Address){

                  $FCarrayendpointaddress += $FCstorageendpoint.Address

            }

      }

}

 

#collect target endpoint address from array object

$iSCSIarrayendpointaddress = @()

foreach($array in $arrays){

      foreach($portal in $array.StorageiSCSIPortals){

            foreach($iSCSIendpoint in $portal.StorageEndpoints){

                  if($iSCSIarrayendpointaddress -notcontains $iSCSIendpoint.Address){

                        $iSCSIarrayendpointaddress += $iSCSIendpoint.Address

                  }

            }

      }

}

 

$vmhost = Get-SCVMHost | where {$_.Name -eq "MSSCVMMHost1.msscvmm.com"}

 

#collect discovered FC portwwns from vmhost object

$vmhostportwwn = @()

foreach($hba in $vmhost.FibreChannelHbas) {

      foreach($fibreport in $hba.DiscoveredFibrePorts)  {

            $vmhostportwwn += $fibreport.PortWWN

      }

}

 

#collect target names vmhost iSCSI initiator is logged into

$vmhosttargetnames = @()

foreach($hba in $vmhost.InternetSCSIHbas){

      foreach($target in $hba.Targets){

            $vmhosttargetnames += $target.targetname

      }

}

 

#compare endpoints exposed to vmhost using portwwn information

$FCexposedendpoints = @()

foreach($portwwn in $vmhostportwwn){

      if($FCarrayendpointaddress -contains $portwwn){

            if($FCexposedendpoints -notcontains $portwwn){

                  $FCexposedendpoints += $portwwn

            }

      }

}

 

 #compare targets exposed to vmhost using hba target name information

$iSCSIexposedendpoints = @()

foreach($targetname in $vmhosttargetnames){

      if($iSCSIarrayendpointaddress -contains $targetname){

            if($iSCSIexposedendpoints -notcontains $targetname){

                  $iSCSIexposedendpoints += $targetname

            }

      }

}

 

#output results

"FC arrays zoned to: " + $vmhost.Name

if($FCexposedendpoints.Count -eq 0){

      "`tHost cannot see any FC arrays"

} else{

      "`tExposed endpoints:"

      foreach($array in $arrays){

            foreach($FCstorageendpoint in $array.StorageEndpoints){

                  if($FCexposedendpoints -contains $FCstorageendpoint.Address){

                        "`t`t" + $array.Name + ": " + $FCstorageendpoint.Address

                  }

            }

      }

}

 

"iSCSI arrays logged into from: " + $vmhost.Name

if($iSCSIexposedendpoints.Count -eq 0){

      "`tHost cannot see any iSCSI arrays"

} else{

      "`tExposed endpoints:"

      foreach($array in $arrays){

            foreach($portal in $array.StorageiSCSIPortals){

                  foreach($iSCSIendpoint in $portal.StorageEndpoints){

                        if($iSCSIexposedendpoints -contains $iSCSIendpoint.Address){

                              "`t`t" + $array.Name + ": " + $iSCSIendpoint.Address

                        }

                  }

            }

      }

}

 

Sample output will look like this

FC arrays zoned to: MSSCVMMHost1.msscvmm.com

      Exposed endpoints:

            EMC VMAX-1SE: 50000972C006251C

            EMC VMAX-1SE: 50000972C0062518

iSCSI arrays logged into from: MSSCVMMHost1.msscvmm.com

      Host cannot see any iSCSI arrays

 

 

If you only need to know which array (by name) the Hyper-V host is exposed to (iSCSI and/or FC), you can also do this:

#establish connection to VMM server

Get-SCVMMServer localhost | Out-Null

 

$vmhost = Get-SCVMHost | where {$_.Name -eq "MSSCVMMHost1.msscvmm.com"}

 

$arrays = Get-SCStorageArray -VMHost $vmhost

 

foreach($array in $arrays){

      $vmhost.Name + " is can  see array: " + $array.Name

}

 

Sample output will look like this

MSSCVMMHost1.msscvmm.com is can see array: EMC VMAX-1SE

In the VMM console, you will see this:

 

 

ConnectedArrays.ps1