I'm using a powershell script to export some Clustered (2012 R2 Hyper-V) VMs through task scheduler.
Every now and then a VM is restarted by cluster during the export-vm. The errors found from the event viewer are located in the end of this message. I cannot see a proper cause for the failure, is there anyway to debug this problem more deeply?
I would also like to know if there is some switch I could set on the cluster-resource, while doing the export-vm, to prevent cluster from trying to restart the VM, even if it is not responding for a while during the export-vm.
The powershell script used:
$VMS = get-vm -Name VM1,VM2,VM3 -EA SilentlyContinueforeach ($VM in $VMS.vmname) {
del \\fileserver\HyperVexport\$VM -force -recurse
Export-VM -Name $VM -Path \\fileserver\HyperVexport
if ( $? -ne "True" )
{
$date = get-date -format s
"$date $VM Export failed" | out-file -FilePath c:\hyper-v\scripts\ExportVMs.log -Append
send-mailmessage -from "xxx@xx.xx" -to "xxx@xx.xx" -subject "Export of $VM in $env:COMPUTERNAME failed" -smtpServer mailserver
}
} #close foreach
Event logs from the Hyper-V host where the VM is running at the time of the failure:
Time | Log | Event-ID | Description |
22:56:07 | Applications and Services Logs/Microsoft/Windows/FailoverClustering/Operational | 1637 | Cluster resource 'Virtual Machine VM1' in clustered role 'VM1' has transitioned from state Online to state ProcessingFailure. |
22:56:07 | Applications and Services Logs/Microsoft/Windows/FailoverClustering/Operational | 1637 | Cluster resource 'Virtual Machine VM1' in clustered role 'VM1' has transitioned from state ProcessingFailure to state WaitingToTerminate. Cluster resource 'Virtual Machine VM1' is waiting on the following resources: . |
22:56:07 | Applications and Services Logs/Microsoft/Windows/FailoverClustering/Operational | 1637 | Cluster resource 'Virtual Machine VM1' in clustered role 'VM1' has transitioned from state WaitingToTerminate to state Terminating. |
22:56:07 | Windows Logs/System | 1069 | Cluster resource 'Virtual Machine VM1' of type 'Virtual Machine' in clustered role 'VM1' failed. Based on the failure policies for the resource and role, the cluster service may try to bring the resource online on this node or move the group to another node of the cluster and then restart it. Check the resource and group state using Failover Cluster Manager or the Get-ClusterResource Windows PowerShell cmdlet. |
22:57:07 | Applications and Services Logs/Microsoft/Windows/Hyper-V-High-Availability/Admin | 21128 | Virtual Machine VM1' failed to shutdown the virtual machine during the resource termination. The virtual machine will be forcefully stopped. |
22:57:07 | Applications and Services Logs/Microsoft/Windows/Hyper-V-High-Availability/Admin | 21119 | Virtual Machine VM1' succesfully started the virtual machine during the resource termination. The virtual machine. |
22:57:13 | Applications and Services Logs/Microsoft/Windows/FailoverClustering/Operational | 1637 | Cluster resource 'Virtual Machine VM1' in clustered role 'VM1' has transitioned from state Terminating to state DelayRestartingResource. |
22:57:13 | Applications and Services Logs/Microsoft/Windows/FailoverClustering/Operational | 1637 | Cluster resource 'Virtual Machine VM1' in clustered role 'VM1' has transitioned from state DelayRestartingResource to state OnlineCallIssued. |
22:57:13 | Applications and Services Logs/Microsoft/Windows/FailoverClustering/Operational | 1637 | Cluster resource 'Virtual Machine VM1' in clustered role 'VM1' has transitioned from state OnlineCallIssued to state OnlinePending. |
22:57:13 | Applications and Services Logs/Microsoft/Windows/Hyper-V-VMMS/Admin | 14070 | Virtual machine 'VM1' (ID=9510686F-BE3C-4CAA-99A5-EB756ED8DED1) has quit unexpectedly. |
22:57:13 | Applications and Services Logs/Microsoft/Windows/Hyper-V-VMMS/Admin | 15190 | VM1' failed to take a checkpoint. (Virtual machine ID 9510686F-BE3C-4CAA-99A5-EB756ED8DED1) |
22:57:13 | Applications and Services Logs/Microsoft/Windows/Hyper-V-VMMS/Admin | 15140 | VM1' failed to turn off. (Virtual machine ID 9510686F-BE3C-4CAA-99A5-EB756ED8DED1) |
22:57:13 | Applications and Services Logs/Microsoft/Windows/Hyper-V-VMMS/Admin | 18350 | Export failed for virtual machine 'VM1' (9510686F-BE3C-4CAA-99A5-EB756ED8DED1) with error 'The process terminated unexpectedly.' (0x8007042B). |
22:57:17 | Applications and Services Logs/Microsoft/Windows/FailoverClustering/Operational | 1637 | Cluster resource 'Virtual Machine VM1' in clustered role 'VM1' has transitioned from state OnlinePending to state Online. |
22:57:17 | Applications and Services Logs/Microsoft/Windows/FailoverClustering/Operational | 1201 | The Cluster service successfully brought the clustered role 'VM1' online. |
In the VM1 event-viewer I can only see the "The previous system shutdown at ... was unexpected", so it was forcefully shutdown as can be seen from the logs above.