mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
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:
@@ -16,8 +16,14 @@ module VagrantPlugins
|
|||||||
domain = env[:machine].provider.driver.connection.servers.get(env[:machine].id.to_s)
|
domain = env[:machine].provider.driver.connection.servers.get(env[:machine].id.to_s)
|
||||||
raise Errors::NoDomainError if domain.nil?
|
raise Errors::NoDomainError if domain.nil?
|
||||||
|
|
||||||
@logger.info('Trying gracefull shutdown.')
|
begin
|
||||||
domain.shutdown
|
env[:machine].guest.capability(:halt)
|
||||||
|
rescue
|
||||||
|
@logger.info('Trying libvirt graceful shutdown.')
|
||||||
|
domain.shutdown
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
domain.wait_for(30) do
|
domain.wait_for(30) do
|
||||||
!ready?
|
!ready?
|
||||||
|
|||||||
Reference in New Issue
Block a user