srodenburg
Expert
Expert

VS6.2 - Applying Storage-Policy via PowerCLI killed Performance Service

Hello,

I applied a VSAN Storage Policy to all VM's via PowerCLI that only targets VM objects on the vsan Datastore. This worked fine. All the VM's recieved the policy and all is well.

However, afterwards, I noticed that the Performance Service has been "Turned off". When I tried to turn it it, it ends with the error:

"Cannot complete the operation because the file or folder 041bb527-117b-0d4f-0d62-a1369f613924 already exists. Failed to create directory .vsan.stats (File already exists)".

Surely that folder (which is the service's DB) already exists.

I already tried restarting the "/etc/init.d/vsanmgmtd" to no effect.

In the end, I found this in the VSAN 6.2 release-notes:

Virtual SAN performance service is disabled when you delete the storage policy applied to the Stats database object

If you delete the storage policy applied to the performance service, the vSphere Web Client displays the following message:

The Performance Service is disabled.

Workaround: Perform to the following steps to restore the deleted storage policy or apply an existing storage policy to the performance service Stats database object using RVC commands:

    1. Log in to the vCenter Server using SSH and access the Bash shell.

For example:

vsan.perf.stats_object_setpolicy -o "/localhost/VSAN-DC/storage/vmprofiles/Virtual SAN Default Storage Policy" MyCluster

That was the solution.

I used RVC to re-apply the policy to the Stats database object and the Service turned itself on again automatically. Problem fixed.

So why did applying a storage policy via powercli script, that clearly only targets VM objects, kill (turn off) the perf.service by deleting/changing the storage policy applied to the Stats DB object? That I have not been able to figure out. But at least the fix is easy to implement.

This is the script I used to mass-apply a new Storage Policy to all VM's by the way. It applies the Default "out of the box" VSAN Policy

$VMlist = get-datastore vsandatastore | get-vm

foreach ($VM in $VMlist)

{

  # First do the VM Home objects:

  Get-VM -Name $VM | Set-SpbmEntityConfiguration

  # Then all their VMDK's

  Get-VM -Name $VM | Get-Harddisk | Set-SpbmEntityConfiguration

}

I hope this helps someone else.

Kind regards,

Steven Rodenburg

0 Kudos
2 Replies
1Gav1
Contributor
Contributor

Thanks Steven!

This helped me fix my VSAN performance service which was giving the same trouble.

Cheers,

Gavin

0 Kudos
sschlabs
Contributor
Contributor

Hi Steven,

just wanted to say thank you! I was able to solve the same issue by the description given by you.

Cheers,

Sebastian

0 Kudos