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

@@ -88,13 +88,16 @@ describe VagrantPlugins::ProviderLibvirt::Action::StartDomain do
end
it 'should error and revert the update' do
expect(ui).to receive(:error).with(/\+ <cpu mode="host-passthrough" \/>.*Typically this means there is a bug in the XML being sent, please log an issue/m)
expect(ui).to receive(:warn).with(/\+ <cpu mode="host-passthrough" \/>.*Typically this means there is a bug in the XML being sent, please log an issue/m)
expect(connection).to receive(:define_domain).and_return(libvirt_domain)
expect(connection).to receive(:define_domain).with(domain_xml) # undo
#expect(connection).to receive(:define_domain).with(domain_xml) # undo
expect(libvirt_domain).to receive(:xml_desc).and_return(domain_xml, updated_domain_xml)
expect(domain).to_not receive(:start)
#expect(domain).to_not receive(:start)
expect { subject.call(env) }.to raise_error(VagrantPlugins::ProviderLibvirt::Errors::UpdateServerError)
#expect { subject.call(env) }.to raise_error(VagrantPlugins::ProviderLibvirt::Errors::UpdateServerError)
expect(libvirt_domain).to receive(:autostart=)
expect(domain).to receive(:start)
expect(subject.call(env)).to be_nil
end
end