add Vagrant Guest Halt capability to vagrant-libvirt. Reference

[Builtin Guest Halt
capability](https://github.com/hashicorp/vagrant/blob/master/lib/vagrant/action/builtin/graceful_halt.rb#L50)
This commit is contained in:
stanley karunditu
2017-11-03 11:23:06 -04:00
parent c8a2ed8f34
commit d3af858425

View File

@@ -16,8 +16,14 @@ module VagrantPlugins
domain = env[:machine].provider.driver.connection.servers.get(env[:machine].id.to_s)
raise Errors::NoDomainError if domain.nil?
@logger.info('Trying gracefull shutdown.')
begin
env[:machine].guest.capability(:halt)
rescue
@logger.info('Trying libvirt graceful shutdown.')
domain.shutdown
end
begin
domain.wait_for(30) do
!ready?