VMware Cloud Community
vmwaredude99
Contributor
Contributor

Rescan HBA in powershell seems to wait

HI All,

Trying to automated the adding of snapshot RDM drives to a machine and when the script does  the rescan of the HBA using the following command I can see it finishes in vcenter quickly put it does not return to the powershell for quite some time.

Get-Cluster -Name $VClusterName | Get-VMHost | Get-VMHostStorage -RescanAllHba | Out-Null
 
Any Ideas
0 Kudos
11 Replies
LucD
Leadership
Leadership

What type of HBA is that (FC, iSCSI...)?

Could it be that the perennially-reserved settings is causing this long rescan.

See Cormac's post A LIST OF ESXCLI STORAGE COMMANDS YOU CAN’T LIVE WITHOUT


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vmwaredude99
Contributor
Contributor

it is iSCSI

0 Kudos
vmwaredude99
Contributor
Contributor

The rescan does not take long in Vsphere, but the powershell script does not move on from the rescan for a long time after vsphere reports that it is complete

0 Kudos
LucD
Leadership
Leadership

Since it is iSCSI the pernellially-reserved doesn't come into play afaik.

Just tried the same in my lab, also with iSCSI HBA, and for the Web Client and the PowerCLI tell me approximately at the same time that the task is finished.
Could be something between the station where you run the cmdlet and the vCenter.

Do you see similar with other long running cmdlets/tasks?
For example, deploying a new VM from a (somewhat) big template


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vmwaredude99
Contributor
Contributor

We do not do any sciptable deployments currently so I do not have those to test with.  What I do know is that out of the entire script which is removing the disk drives from vms, detaching them, removing them from esx, adding new ones in, re scanning the hosts, renaming the devices, and adding them to the guest the only part that appears to hang is the re-scan.  All other parts run timely and return to the powershell script

0 Kudos
LucD
Leadership
Leadership

Strange.
I would need to dive in to try and determine what could be causing this.
Checking the ESXi logs and vpxd logs for clues, running a network trace, ...
All rather hard remotely I'm afraid.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vmwaredude99
Contributor
Contributor

Can I send you logs?  I just ran it on a simple two host cluster and the rescan in the vsphere HTML5 page says complete in 3 - 5 seconds.  The powershell script does not continue for approx 2 minutes.

0 Kudos
LucD
Leadership
Leadership

Can you first try a couple of things, to check if it makes a difference?

1) Connect to the ESXi node instead of the vCenter, then do the rescan from there.

2) Give it a try with the esxcli command

$esxName = 'MyEsx'

$esx = Get-VMHost -Name $esxName

$esxcli = Get-EsxCli -VMHost $esx -V2


$sScan = $esxcli.storage.core.adapter.rescan.CreateArgs()

$sSCan['all'] = $true

$esxcli.storage.core.adapter.rescan.Invoke($sScan)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vmwaredude99
Contributor
Contributor

I assume I will have to preform this on each host in the cluster?

0 Kudos
vmwaredude99
Contributor
Contributor

So the CLI calls work much faster.  Comes back in few seconds as opposed to the 2 minutes in the cmdlet version.

This will save a ton of time

Thanks

0 Kudos
LucD
Leadership
Leadership

Ok, that seems to demonstrate that the issue might be with the PowerCLI cmdlet.
Now we just need to make sure that both options get to the same result.
I think they do, but I'm not 100% sure.

I would suggest to open  a SR.
This is not in your script, but in the cmdlet (we think).
And you don't need a Developer Support contract to get support fro PowerCLI.

Refer to PowerCLI Support Breakdown


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos