From 64d087d2f90c520f9d33948685e8481187ba5591 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Fri, 11 Jun 2021 16:04:43 -0700 Subject: [PATCH] Use builtin GracefulHalt action on halt Updates the halt action to use the GracefulHalt builtin action. If the GracefulHalt builtin action fails to properly transition the state of the guest, it will use the HaltDomain action to forcibly stop it. --- lib/vagrant-libvirt/action.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-libvirt/action.rb b/lib/vagrant-libvirt/action.rb index c9b726c..32be744 100644 --- a/lib/vagrant-libvirt/action.rb +++ b/lib/vagrant-libvirt/action.rb @@ -143,7 +143,11 @@ module VagrantPlugins next unless env2[:result] # VM is running, halt it. - b3.use HaltDomain + b3.use Call, GracefulHalt, :shutoff, :running do |env3, b4| + if !env3[:result] + b4.use HaltDomain + end + end end end end