Jume - My Virtualization Blog

My personal and professional virtualization blog. Everything about VMware, PowerCLI, Powershell, Agile, Scrum, VSAN and Cloud related.

The query execution timed out (DatastorePropertyProvider)

In case of a host with a lot of snapshots or read-only enabled LUNs (which could be the case when you've got a host dedicated as standby host in DR site), mounting an existing datastore can be a challenge through the UI. The activity bar keeps running for minutes and then presents an error: The query execution timed out because of a back-end property provider 'com.vmware.vpshere.client.storage.impl.DatastorePropertyProvider' which took more than 120 seconds.

​There are a couple of ways to resolve this, either through the ESXi Shell, or PowerCLI.

# List the available snapshots

esxcli storage vmfs snapshot list

# And then mount it with either -l or -u

Usage: esxcli storage vmfs snapshot mount [cmd options]

  mount                 Mount a snapshot/replica of a VMFS volume.

Cmd options:
  -n|--no-persist       Mount the volume non-peristently; the volume will not be automounted after a restart.
                        The VMFS volume label of the snapshot to mount.
                        The VMFS volume uuid of the snapshot to mount.

esxcli storage vmfs snapshot mount -u "6ab931db-746fa8eb-18ea-e0071befc801" 

​My preferred way is PowerCLI, since I so not have to enable SSH and I can run it all in a script:

function Mount-SnapShotLun {
    param (
        [parameter(Mandatory = $true,
            ValueFromPipeline = $false)]
        [parameter(Mandatory = $true,
            ValueFromPipeline = $false)]

    $Hostview = Get-View -ViewType "HostSystem" -Filter @{name = $HostName } -Property "ConfigManager.StorageSystem"
    $StorageSys = Get-View $HostView.ConfigManager.StorageSystem -Property $null

    $HUVRS = New-Object vmware.vim.HostUnresolvedVmfsResolutionSpec
    $newPaths = New-Object System.String[] (1)
    $newPaths[0] = "/vmfs/devices/disks/$($TargetDiskName):1"

    $HUVRS.ExtentDevicePath = $newPaths
    $HUVRS.UuidResolution = "forceMount"
    $HUVRSArray = New-Object vmware.vim.HostUnresolvedVmfsResolutionSpec[] (1)
    $HUVRSArray[0] = $HUVRS

    $Result = $StorageSys.ResolveMultipleUnresolvedVmfsVolumes($HUVRSarray)

    If ($Result[0].Fault.LocalizedMessage -eq "Cannot change the host configuration.") {
        # There is a fault, rescan and retry
        Write-Host "Cannot mount: $($TargetDiskname), running rescan a try again."
        Start-Sleep 10
        $Result = $StorageSys.ResolveMultipleUnresolvedVmfsVolumes($HUVRSarray)
        if ($Result.Fault.LocalizedMessage) {
            Write-Host "There is something wrong, please investigate: $($Result.Fault.LocalizedMessage) for $($TargetDiskname)"

$HostName = "<yourhost>"
$TargetDiskName = "naa.60060a8007e483001030f49300000299"

Mount-SnapShotLun -HostName $HostName -TargetDiskName $TargetDiskName 

​This function has some assumptions (the full LUN is used for a single VMFS partition), so you might want to rewrite a thing or two. But here is a line to line explanation:

1-10: initialize the function, required two parameters, HostName and TargetDiskName (which you can get from the UI);
12-13: Get the host object and connect to the StorageSystem of that host;
15-22: Create a new 'HostUnresolvedVmfsResolutionSpec';
24: Run the action mount action;
26-37: If it's not able to mount it, rescan all HBAs, rescan all VMFSs and refresh the storagesystem and retry.
40-43: Example how to call the function.

I made this script more or less for myself to keep me reminded how to handle these snapshot LUNs, but it might come in handy for you too.

VMUG Advantage - cont.
Some short PowerShell tips #3


No comments made yet. Be the first to submit a comment
Friday, 03 December 2021

By accepting you will be accessing a service provided by a third-party external to https://jume.nl/