mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-01-06 14:03:07 -06:00
Handle pmsuspended resume and add state translation message (#1686)
Ensure there is a translation message for state and call the correct wakeup depending on which form of suspend/pause the machine is in. Closes: #1200
This commit is contained in:
parent
612eb67f5f
commit
431cf867ba
@ -20,7 +20,7 @@ module VagrantPlugins
|
|||||||
if libvirt_domain.has_managed_save?
|
if libvirt_domain.has_managed_save?
|
||||||
env[:result] = env[:machine].state.id == :shutoff
|
env[:result] = env[:machine].state.id == :shutoff
|
||||||
else
|
else
|
||||||
env[:result] = env[:machine].state.id == :paused
|
env[:result] = [:paused, :pmsuspended].include?(env[:machine].state.id)
|
||||||
if env[:result]
|
if env[:result]
|
||||||
env[:ui].warn('One time switching to pause suspend mode, found a paused VM.')
|
env[:ui].warn('One time switching to pause suspend mode, found a paused VM.')
|
||||||
config.suspend_mode = 'pause'
|
config.suspend_mode = 'pause'
|
||||||
@ -32,7 +32,7 @@ module VagrantPlugins
|
|||||||
env[:result] = [:shutoff, :paused].include?(env[:machine].state.id)
|
env[:result] = [:shutoff, :paused].include?(env[:machine].state.id)
|
||||||
config.suspend_mode = 'managedsave'
|
config.suspend_mode = 'managedsave'
|
||||||
else
|
else
|
||||||
env[:result] = env[:machine].state.id == :paused
|
env[:result] = [:paused, :pmsuspended].include?(env[:machine].state.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +20,9 @@ module VagrantPlugins
|
|||||||
|
|
||||||
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(env[:machine].id)
|
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(env[:machine].id)
|
||||||
config = env[:machine].provider_config
|
config = env[:machine].provider_config
|
||||||
if config.suspend_mode == 'managedsave'
|
if env[:machine].state.id == :pmsuspended
|
||||||
|
libvirt_domain.pmwakeup
|
||||||
|
elsif config.suspend_mode == 'managedsave'
|
||||||
domain.start
|
domain.start
|
||||||
else
|
else
|
||||||
domain.resume
|
domain.resume
|
||||||
|
@ -205,6 +205,8 @@ en:
|
|||||||
states:
|
states:
|
||||||
paused: |-
|
paused: |-
|
||||||
The Libvirt domain is suspended. Run `vagrant resume` to resume it.
|
The Libvirt domain is suspended. Run `vagrant resume` to resume it.
|
||||||
|
pmsuspended: |-
|
||||||
|
The Libvirt domain is suspended. Run `vagrant resume` to resume it.
|
||||||
shutting_down: |-
|
shutting_down: |-
|
||||||
The Libvirt domain is shutting down. Wait for it to complete and
|
The Libvirt domain is shutting down. Wait for it to complete and
|
||||||
then run `vagrant up` to start it or `vagrant destroy` to remove.
|
then run `vagrant up` to start it or `vagrant destroy` to remove.
|
||||||
|
Loading…
Reference in New Issue
Block a user