Make failure to apply XML domain update non fatal (#1581)

As this is the first time people may be alerted to an issue applying
changes, given that previously they would be silently discarded, better
to switch to warning the end user rather than blocking the domain start.
This is no worse than the previous position, and allows previous
configurations that were understood to be working, to continue to work
as they are, with hopefully issues logged by users that will allow
more correct XML to be sent before making failure to match the changes
applied fatal.
This commit is contained in:
Darragh Bailey
2022-09-07 11:35:25 +01:00
committed by GitHub
parent 1db6618f76
commit 7d48c5ec46
2 changed files with 16 additions and 12 deletions

View File

@@ -438,16 +438,17 @@ module VagrantPlugins
error_msg = "Libvirt failed to fully update the domain with the specified XML. Result differs from requested:\n" +
"--- requested\n+++ result\n#{diff}\n" +
"Typically this means there is a bug in the XML being sent, please log an issue"
"Typically this means there is a bug in the XML being sent, please log an issue as this will halt machine start in the future."
env[:ui].error("Updated domain settings did not fully apply, attempting restore to previous definition: #{error_msg}")
begin
env[:machine].provider.driver.connection.define_domain(descr)
rescue Fog::Errors::Error => e
env[:ui].error("Failed to restore previous domain definition: #{e.message}")
end
env[:ui].warn(error_msg)
#env[:ui].error("Updated domain settings did not fully apply, attempting restore to previous definition: #{error_msg}")
#begin
# env[:machine].provider.driver.connection.define_domain(descr)
#rescue Fog::Errors::Error => e
# env[:ui].error("Failed to restore previous domain definition: #{e.message}")
#end
raise Errors::UpdateServerError, error_message: error_msg
#raise Errors::UpdateServerError, error_message: error_msg
end
end