Corrupt Snapshot Causing View Composer Service Crash

Error during provisioning:Unexpected VC fault from View Composer

The above error might show up in Horizon View, if you try to use a corrupt snapshot for the deployment of new VMs.

How To Identify If  A Corrupt Snapshot Is The Cause?

  • Look at the Microsoft System Event Log on your View Composer
    • You should see something like this:

      The VMware View Composer service terminated unexpectedly. M It has done this 2 time(s).  The following corrective action will be taken in 60000 milliseconds: Restart the service.

       

  • Search for FATAL messages in the vmware-viewcomposer.log
    • The following message will indicate a corrupt snapshot

      2015-10-06 17:52:53,956 | WFE thread 9 | FATAL | ServiceCore.WorkflowEngine.WorkflowEngine – Unexpected exception occurred.Error reading single property ‘config.hardware.device’ from managed object: snapshot-15587

       

Based on the message in vmware-viewcomposer.log, you know what snapshot is corrupted. Unfortunately, the message does not tell you the parent VM of the snapshot.

I wrote a small Powershell/Powercli script, which will allow you to find the parent VM and delete the snapshot.

# Prompt user for vCenter details

$hostname = Read-Host -Prompt 'Please specify your vCenter server'
$username = Read-Host -Prompt 'Please specify your username'
$password = Read-Host -Prompt 'Please specify your password'
$snapshot = Read-Host -Prompt 'What snapshot are you looking for?'

Connect-VIServer $hostname -Protocol https -User $username -Password $password -Force

Write-Host "Successfully connected to '$hostname'"

Get-VM | Get-Snapshot | where {$_.name -eq $snapshot} | Select Name, VM
$snaplist = Get-VM | Get-Snapshot | where {$_.name -eq $snapshot} | Select Name, VM
if ($snaplist) {
	Write-Host "Found snapshot, listed above"}
else {
	Write-Host "Couldn't find any snapshots named '$snapshot' !"
	Disconnect-VIServer -Confirm:$false
	break}

$delete = Read-Host -Prompt 'Do you want to delete all of the above snapshot? [yes/no]'
If ($delete -eq "yes") {
	Get-VM | Get-Snapshot | where {$_.name -eq $snapshot} | Remove-Snapshot -Confirm:$false
	Write-Host "Successfully deleted all snapshots called '$snapshot'"}
Else {
	Write-Host "Did not delete '$snapshot'"}
	
Disconnect-VIServer -Confirm:$false

Just copy the code above and save it as a PowerCLI or PowerShell script.
Upon execution, it will prompt you to specify the vCenter, a user, password and the name of the snapshot, which you try to find.

I hope this script is helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.