Be tolerant about drivers not supporting listing snapshots

This commit is contained in:
Michal Sylwester 2017-01-30 17:04:37 +01:00
parent c065c1e6e5
commit ecea549e7f

View File

@ -20,6 +20,7 @@ module VagrantPlugins
libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid( libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(
env[:machine].id env[:machine].id
) )
begin
libvirt_domain.list_snapshots.each do |name| libvirt_domain.list_snapshots.each do |name|
@logger.info("Deleting snapshot '#{name}'") @logger.info("Deleting snapshot '#{name}'")
begin begin
@ -28,6 +29,11 @@ module VagrantPlugins
raise Errors::DeleteSnapshotError, error_message: e.message raise Errors::DeleteSnapshotError, error_message: e.message
end end
end end
rescue
# Some drivers (xen) don't support getting list of snapshots,
# not much can be done here about it
@logger.warn("Failed to get list of snapshots")
end
# must remove managed saves # must remove managed saves
libvirt_domain.managed_save_remove if libvirt_domain.has_managed_save? libvirt_domain.managed_save_remove if libvirt_domain.has_managed_save?