Automation

 View Only
  • 1.  Wierd errors with get-VMHostHBA

    Posted Sep 21, 2010 03:36 PM

    I am having some issues with get-vmhosthba. When I run the command aggainst a 4.0 host, the commed works as desired:

    get-vmhost pbnvm15 | Get-VMHostHba

    Device Type Model Status

    vmhba33 IScsi iSCSI Software Adapter Unknown

    When I run it against a fresh 4.1 host I get this:

    get-vmhost pbnvm16 | Get-VMHostHba

    Get-VMHostHba : 9/21/2010 9:29:44 AM Get-VMHostHba Requested value 'unbound' was not found.

    At line:1 char:51

    + get-vmhost pbnvm16.petrobakken.pvt | Get-VMHostHba <<<<

    + CategoryInfo : NotSpecified: (:smileyhappy: , ViError

    + FullyQualifiedErrorId : Client20_StorageSerivceImpl_GetVMHostHba_VIError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.Storage.GetVMHostHba

    I have a PowerCli script that I use to setup new hosts. The iSCSI section fails when deploying 4.1 hosts.

    I am using PowerCLI Version VMware vSphere PowerCLI 4.1 build 264274

    Any help would be appreciated.

    Thx,

    Dan



  • 2.  RE: Wierd errors with get-VMHostHBA

    Posted Sep 23, 2010 01:09 PM

    Hi Dan,

    Did you find a solution? I am having the same problems with my PowerCLI commands on a 4.1 host (PowerCLI 4.1 client installed too).

    -Dillon



  • 3.  RE: Wierd errors with get-VMHostHBA

    Posted Sep 24, 2010 08:44 AM

    Hi there,

    The call Get-VmHost | Get-VmHostHba seems simple enough, so it does not look like you are doing something wrong. We have been trying to reproduce the problem in our test lab with different versions of hosts with no success so there must be something with a specific of the environment. Therefore I would like to ask you to provide us with the following data:

    1. Execute Get-VmHost pbnvm15 | Get-VmHostHba and then get: Error[0].Exception.InnerException and $Error[0].Exception.StackTrace

    2. What does the following line of code return: (Get-VmHost pbnvm15).StorageInfo.ExtensionData.StorageDeviceInfo.HostBusAdapter

    \Yavor

    PowerCLI team



  • 4.  RE: Wierd errors with get-VMHostHBA

    Posted Sep 24, 2010 12:56 PM

    I am also exerpencing the same issue with vSphere PowerCLI 4.1 Build # 264274 against vSphere 4.1 ESX/ESXi hosts. Here is the output of the command:

    C:\Program Files\VMware\Infrastructure\vSphere PowerCLI&gt; Get-VMHost 10.112.96.17 | Get-VMHostHba

    Get-VMHostHba : 9/24/2010 6:19:14 PM Get-VMHostHba Requested value 'u

    nbound' was not found.

    At line:1 char:40

    + Get-VMHost 10.112.96.17 | Get-VMHostHba &lt;&lt;&lt;&lt;

    + CategoryInfo : NotSpecified: (:smileyhappy: , ViError

    + FullyQualifiedErrorId : Client20_StorageSerivceImpl_GetVMHostHba_VIError

    ,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.Storage.GetVMHostHba

    Thanks in advance !!!

    f10

    VCP3, VCP4, HPCP, HP UX CSA



  • 5.  RE: Wierd errors with get-VMHostHBA

    Posted Sep 24, 2010 01:00 PM

    Hello,

    Thanks for your help! I'm trying to modify our Post-Install script from vSphere 4.0 to 4.1, and one of the things we do is call the HBA's so that we can bind the correct VMK's to the iSCSI interfaces. It works fine on a 4.0 host with the 4.1 version of PowerCLI installed, but this command breaks in the script when run against a 4.1 host. The exact commands we're running in this part of our script are as follows (with the Get-VMHostHba commands in blue):

    # Enable software iSCSI on the host
    Write-Host "Enabling the software iSCSI initiator" -ForegroundColor yellow -BackgroundColor Black
    Get-VMHostStorage $ESXiHostIP | Set-VMHostStorage -SoftwareIScsiEnabled $true
    # Retrieve the iSCSI HBA(s) on the host
    Write-Host "Retrieving the iSCSI HBA(s) on the host" -ForegroundColor yellow -BackgroundColor Black
    $iscsiHba = Get-VMHostHba -Type IScsi
    # Add a new iSCSI target for dynamic discovery (the default port number is 3260)
    Write-Host "Adding an iSCSI target for dynamic discovery" -ForegroundColor yellow -BackgroundColor Black
    $iscsiHba | New-IScsiHbaTarget -Address $ESXiiSCSIgroupIP -Type Send
    #$iscsiHbaType = $iscsiHba.Description
    # Binding VMkernel ports to iSCSI software adapter
    Write-Host
    Write-Host "Launching esxcli in order to finish configuration of the iSCSI software adapter" -ForegroundColor yellow -BackgroundColor Black
    New-Item -Path c:\temp\esxcli\connection.config -Type "File" -Value "VI_SERVER = "
    Add-Content $DirEsxCli\connection.config -Value $ESXiHostIP
    Add-Content $DirEsxCli\connection.config "VI_USERNAME = root"
    Add-Content $DirEsxCli\connection.config "VI_PASSWORD = $ESXiPassword"
    Start-Sleep -Seconds 1
    & $ProgramFilesESXCLI --config $DirEsxCli\connection.config swiscsi nic add -n vmk1 -d $iscsihba
    Start-Sleep -Seconds 10
    & $ProgramFilesESXCLI --config $DirEsxCli\connection.config swiscsi nic add -n vmk2 -d $iscsihba
    Start-Sleep -Seconds 10
    Write-Host
    Write-Host "Listing the VMkernel ports and their associated bindings"
    & $ProgramFilesESXCLI --config $DirEsxCli\connection.config swiscsi nic list -d $iscsihba

    Configuration

    Client that I'm running commands from: Windows Server 2008R2 with PowerCLI 4.1 (build 264274) installed (on the same sub-net) OR Windows 7 with PowerCLI 4.1 installed (on a seperate sub-net)- same error on both clients
    Host server that I'm connecting to: vSphere ESXi 4.1 (build 260247) in evaluation mode (I have not joined it to vCenter yet since this command is part of my post-install script). Hardware: HP BL460G1 blade server with nc373i NICs.

    Commands, in order:

    1. Connect-VIServer 100.1.1.11 -user root -password password

    WARNING: There were one or more problems with the server certificate:
    * The X509 chain could not be built up to the root certificate.
    * The certificate's CN name does not match the passed value.

    Name Port User
    -


    -


    -



    100.1.1.11 443 root

    2. Get-VMHost | Get-VMHostHba

    Get-VMHostHba : 9/24/2010 8:30:41 AM Get-VMHostHba Requested value 'unbound' was not found.
    At line:1 char:40
    + Get-VmHost 100.1.1.11 | Get-VmHostHba &lt;&lt;&lt;&lt;
    + CategoryInfo : NotSpecified: (:smileyhappy: , ViError
    + FullyQualifiedErrorId : Client20_StorageSerivceImpl_GetVMHostHba_VIError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.Storage.GetVMHostHba

    3. (Get-VmHost 100.1.1.11).StorageInfo.ExtensionData.StorageDeviceInfo.HostBusAdapter

    Key : key-vim.host.BlockHba-vmhba0
    Device : vmhba0
    Bus : 11
    Status : unknown
    Model : Smart Array E200i
    Driver : cciss
    Pci : 0b:08.0
    DynamicType :
    DynamicProperty :
    IsSoftwareBased : True
    DiscoveryCapabilities : VMware.Vim.HostInternetScsiHbaDiscoveryCapabilities
    DiscoveryProperties : VMware.Vim.HostInternetScsiHbaDiscoveryProperties
    AuthenticationCapabilities : VMware.Vim.HostInternetScsiHbaAuthenticationCapabilities
    AuthenticationProperties : VMware.Vim.HostInternetScsiHbaAuthenticationProperties
    DigestCapabilities : VMware.Vim.HostInternetScsiHbaDigestCapabilities
    DigestProperties : VMware.Vim.HostInternetScsiHbaDigestProperties
    IpCapabilities : VMware.Vim.HostInternetScsiHbaIPCapabilities
    IpProperties : VMware.Vim.HostInternetScsiHbaIPProperties
    SupportedAdvancedOptions : {ErrorRecoveryLevel, LoginRetryMax, MaxOutstandingR2T, FirstBurstLength...}
    AdvancedOptions : {ErrorRecoveryLevel, LoginRetryMax, MaxOutstandingR2T, FirstBurstLength...}
    IScsiName : iqn.1998-01.com.vmware:localhost.usa.wtbts.net:1277364922:32
    IScsiAlias : bnx2i-001f29ce5f5c
    ConfiguredSendTarget :
    ConfiguredStaticTarget :
    MaxSpeedMb :
    CurrentSpeedMb :
    Key : key-vim.host.InternetScsiHba-vmhba32
    Device : vmhba32
    Bus : -1
    Status : unbound
    Model : Broadcom iSCSI Adapter
    Driver : bnx2i
    Pci : UNKNOWN - NULL PCI DEV IN VMKCTL
    DynamicType :
    DynamicProperty :
    IsSoftwareBased : True
    DiscoveryCapabilities : VMware.Vim.HostInternetScsiHbaDiscoveryCapabilities
    DiscoveryProperties : VMware.Vim.HostInternetScsiHbaDiscoveryProperties
    AuthenticationCapabilities : VMware.Vim.HostInternetScsiHbaAuthenticationCapabilities
    AuthenticationProperties : VMware.Vim.HostInternetScsiHbaAuthenticationProperties
    DigestCapabilities : VMware.Vim.HostInternetScsiHbaDigestCapabilities
    DigestProperties : VMware.Vim.HostInternetScsiHbaDigestProperties
    IpCapabilities : VMware.Vim.HostInternetScsiHbaIPCapabilities
    IpProperties : VMware.Vim.HostInternetScsiHbaIPProperties
    SupportedAdvancedOptions : {ErrorRecoveryLevel, LoginRetryMax, MaxOutstandingR2T, FirstBurstLength...}
    AdvancedOptions : {ErrorRecoveryLevel, LoginRetryMax, MaxOutstandingR2T, FirstBurstLength...}
    IScsiName : iqn.1998-01.com.vmware:localhost.usa.wtbts.net:1277364922:33
    IScsiAlias : bnx2i-001f29ce5f5e
    ConfiguredSendTarget :
    ConfiguredStaticTarget :
    MaxSpeedMb :
    CurrentSpeedMb :
    Key : key-vim.host.InternetScsiHba-vmhba33
    Device : vmhba33
    Bus : -1
    Status : unbound
    Model : Broadcom iSCSI Adapter
    Driver : bnx2i
    Pci : UNKNOWN - NULL PCI DEV IN VMKCTL
    DynamicType :
    DynamicProperty :
    IsSoftwareBased : True
    DiscoveryCapabilities : VMware.Vim.HostInternetScsiHbaDiscoveryCapabilities
    DiscoveryProperties : VMware.Vim.HostInternetScsiHbaDiscoveryProperties
    AuthenticationCapabilities : VMware.Vim.HostInternetScsiHbaAuthenticationCapabilities
    AuthenticationProperties : VMware.Vim.HostInternetScsiHbaAuthenticationProperties
    DigestCapabilities : VMware.Vim.HostInternetScsiHbaDigestCapabilities
    DigestProperties : VMware.Vim.HostInternetScsiHbaDigestProperties
    IpCapabilities : VMware.Vim.HostInternetScsiHbaIPCapabilities
    IpProperties : VMware.Vim.HostInternetScsiHbaIPProperties
    SupportedAdvancedOptions : {ErrorRecoveryLevel, LoginRetryMax, MaxOutstandingR2T, FirstBurstLength...}
    AdvancedOptions : {ErrorRecoveryLevel, LoginRetryMax, MaxOutstandingR2T, FirstBurstLength...}
    IScsiName : iqn.1998-01.com.vmware:vmwlab402-12e05420
    IScsiAlias :
    ConfiguredSendTarget :
    ConfiguredStaticTarget :
    MaxSpeedMb :
    CurrentSpeedMb :
    Key : key-vim.host.InternetScsiHba-vmhba34
    Device : vmhba34
    Bus : -1
    Status : online
    Model : iSCSI Software Adapter
    Driver : iscsi_vmk
    Pci : UNKNOWN - NULL PCI DEV IN VMKCTL
    DynamicType :
    DynamicProperty :

    Please let me know if there's any more information I can give you to help me, or if there's any other commands that I can run.

    -Dillon



  • 6.  RE: Wierd errors with get-VMHostHBA

    Posted Sep 24, 2010 02:38 PM

    Thanks for the details which gives prety clear idea what is going on. As you can see one of the iSCSI adaptors returned has a status "Unbound". According to the API the valid values for the status property of the host bus adapter objects are: "online", "offline", and "fault". This is what is causing our Get-VmHostHBA cmdlet to crash. I'll put an item into our bug tracking system in order to make the cmdlet robust to such undocumented values for the Status property for a future release. Untill then let's try a workaroung:

    1. I'm pretty sure that you will not be able to add a target for the iSCSI which is 'Unbound' state, so I filter it in the code snippet bellow. If I'm wrong you can try to add targets to it by simply removing the "-and $_.Status -notlike 'unbound'" piece of code

    2. I have comment the old invocations and added a few new lines. The rest of the script should stay the same

    # Enable software iSCSI on the host 
    Write-Host "Enabling the software iSCSI initiator" -ForegroundColor yellow -BackgroundColor Black 
    Get-VMHostStorage $ESXiHostIP | Set-VMHostStorage -SoftwareIScsiEnabled $true 
    # Retrieve the iSCSI HBA(s) on the host 
    Write-Host "Retrieving the iSCSI HBA(s) on the host" -ForegroundColor yellow -BackgroundColor Black 
    #$iscsiHba = Get-VMHostHba -Type IScsi
    $iscsiHba = (Get-VmHost $ESXiHostIP).StorageInfo.ExtensionData.StorageDeviceInfo.HostBusAdapter | where {$_.Model -like "iSCSI Software Adapter" -and $_.Status -notlike 'unbound'}
    # Add a new iSCSI target for dynamic discovery (the default port number is 3260) 
    Write-Host "Adding an iSCSI target for dynamic discovery" -ForegroundColor yellow -BackgroundColor Black 
    #$iscsiHba | New-IScsiHbaTarget -Address $ESXiiSCSIgroupIP -Type Send
    $targets = New-Object VMware.Vim.HostInternetScsiHbaSendTarget[] (1)
    $targets[0] = New-Object VMware.Vim.HostInternetScsiHbaSendTarget
    $targets[0].address = $ESXiiSCSIgroupIP
    $targets[0].port = 3260
    $hsView = Get-VMHostStorage $ESXiHostIP | Get-View 
    foreach($hba in $iscsiHba) {
    	$hsView.AddInternetScsiSendTargets($hba.Device, $targets)		
    }
    
    The rest of the script goes here
    



  • 7.  RE: Wierd errors with get-VMHostHBA

    Posted Sep 24, 2010 03:27 PM

    Hi,

    I had a software iSCSI initiator enabled earlier but I have now disabled the iSCSI initiator and did a rescan for all HBA's but still cannot get the Get-VMHostHba command to work. Do I need to reboot the ESX host for these changes to take effect ?

    f10

    VCP3, VCP4, HPCP, HP UX CSA



  • 8.  RE: Wierd errors with get-VMHostHBA

    Posted Sep 24, 2010 11:33 PM

    Excellent! Thank you so much. This work-around is great. There were two things I had to change, but they were very very minor...you did all the heavy lifting. One of the variables was missing its $ before the string and the UNBOUND statement was in single quotes, but it needed to be in double quotes. Here's the final version of that section of the script with my little tweaks:

    1. Enable software iSCSI on the host

    Write-Host "Enabling the software iSCSI initiator" -ForegroundColor yellow -BackgroundColor Black

    Get-VMHostStorage $ESXiHostIP | Set-VMHostStorage -SoftwareIScsiEnabled $true

    1. Retrieve the iSCSI HBA(s) on the host

    Write-Host "Retrieving the iSCSI HBA(s) on the host" -ForegroundColor yellow -BackgroundColor Black

    #$iscsiHba = Get-VMHostHba -Type IScsi

    $iscsiHba = (Get-VmHost $ESXiHostIP).StorageInfo.ExtensionData.StorageDeviceInfo.HostBusAdapter | where {$_.Model -like "iSCSI Software Adapter" -and $_.Status -notlike "unbound"}

    $iscsivmhba = $iscsihba.device

    1. Add a new iSCSI target for dynamic discovery (the default port number is 3260)

    Write-Host "Adding an iSCSI target for dynamic discovery" -ForegroundColor yellow -BackgroundColor Black

    #$iscsiHba | New-IScsiHbaTarget -Address $ESXiiSCSIgroupIP -Type Send

    $targets = New-Object VMware.Vim.HostInternetScsiHbaSendTarget[] (1)

    $targets[0] = New-Object VMware.Vim.HostInternetScsiHbaSendTarget

    $targets[0].address = $ESXiiSCSIgroupIP

    $targets[0].port = 3260

    $hsView = Get-VMHostStorage $ESXiHostIP | Get-View

    foreach($hba in $iscsiHba) {

    $hsView.AddInternetScsiSendTargets($hba.Device, $targets)

    }

    Again, thank you very much!

    -Dillon



  • 9.  RE: Wierd errors with get-VMHostHBA

    Posted Mar 15, 2011 04:27 PM

    Hi,

    I realize this thread is a bit old, but do you know if this fix will be included in a future release? If so, do you know which release?

    Thanks



  • 10.  RE: Wierd errors with get-VMHostHBA

    Posted Mar 16, 2011 07:17 AM

    Hi,

    Yes the fix of this problem will be included in our next release. Unfortunately I'm not allowed to publicly announce the time of the release, but giving the fact historically we have released every six months and our last release was somewhere in December, it shouldn't be too far away. Until then you can use the workaround I have mentioned in the post.

    Regards,

    Yavor