mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
suspend to disk? #411
* Error handler in case of error when saving domain state with a hint how to handle the problem. * Managed saves are deleted prior to undefining a domain. Task-Url: https://github.com/pradels/vagrant-libvirt/issues/411 Signed-off-by: Max Kutsevol <max@coolvds.com>
This commit is contained in:
parent
837a344724
commit
0345bc3bd0
@ -28,6 +28,11 @@ module VagrantPlugins
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# must remove managed saves
|
||||||
|
if libvirt_domain.has_managed_save?
|
||||||
|
libvirt_domain.managed_save_remove
|
||||||
|
end
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
if env[:machine].provider_config.disks.empty?
|
if env[:machine].provider_config.disks.empty?
|
||||||
|
@ -20,7 +20,12 @@ module VagrantPlugins
|
|||||||
config = env[:machine].provider_config
|
config = env[:machine].provider_config
|
||||||
if config.suspend_mode == 'managedsave'
|
if config.suspend_mode == 'managedsave'
|
||||||
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)
|
||||||
libvirt_domain.managed_save
|
begin
|
||||||
|
libvirt_domain.managed_save
|
||||||
|
rescue => e
|
||||||
|
env[:ui].error("Error doing a managed save for domain. It may have entered a paused state.
|
||||||
|
Check the output of `virsh managedsave DOMAIN_NAME --verbose` on the VM host, error: #{e.message}")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
domain.suspend
|
domain.suspend
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user