Commit Graph

14 Commits

Author SHA1 Message Date
Uli Fahrer
0363459bec feat: add websocket graphics config (#1672)
This adds websocket functionality for VNC. The websocket attribute may 
be used to specify the port to listen on (with -1 meaning 
auto-allocation and autoport having no effect due to security reasons).
2022-11-21 11:05:51 +00:00
Darragh Bailey
7813ad3740 Emit default for bootmenu to be off (#1621)
Ensure the bootmenu is disabled by default. When not specified it will
default to the hypervisor default behaviour, however this is not
necessarily defined consistently across different distros. Therefore for
a consistent behaviour, simply ensure it is always configured to be off,
unless explicitly required to be enabled when the boot order is
configured.

Fixes: #947
2022-09-30 22:36:21 +01:00
Darragh Bailey
f111842dbe Handle different attribute and element ordering (#1592)
Normalise the XML to ensure the attributes for both documents have the
same ordering to prevent excessive noise when differences are detected.
Additionally sort various elements based on attributes that make
ordering irrelevant to allow for simpler comparison using xmlsimple.

Closes: #1583
2022-09-22 17:14:49 +01:00
Darragh Bailey
fc5598ddb8 Use equivalent-xml to compare xml (#1564)
Using diffy alone is insufficient to spot when the XML returned by
libvirt for the changes applied is equivalent but formatted differently.

When libvirt returns slightly differently formatted XML corresponding to
what changes were actually applied, it can result in an error being
assumed to have happened when the update actually worked as expected.

Equivalent-xml handles detecting XML documents as being identical,
therefore switching to using it instead of diffy should produce more
reliable results, while retaining diffy for better formatted diffs
should an issue occur is useful.

Fixes: #1556
2022-08-28 12:10:46 +01:00
Darragh Bailey
c7bcb50b2b Avoid domain undefine on configuration update (#1496)
Calling undefine on a domain and recreating it can result in some edge
case errors where if the current capabilities of libvirt have been
reduced, it may not be possible to restore the old definition.

Instead switch to calling `domain_define` with the new definition and
check that the resulting libvirt domain definition has been updated in
the expected manner, otherwise report an error to the user.

Fixes: #949
Relates-to: #1329
Relates-to: #1027
Relates-to: #1371
2022-06-03 09:42:28 +00:00
Darragh Bailey
f498f102e1 Ensure updating loader tag supported (#1494)
The loader tag is required when nvram is being enabled. Ensure it is
marked as a requirement of validation and also support it's
configuration during the start domain action.
2022-05-17 15:03:55 +01:00
byonoy-dne
c4fcfee510 Set undefine flags to keep NVRAM (#1329)
Handle enabling and disabling of NVRAM during start domain.

This patch contains latent support for upstream PR fog-libvirt#102 to support destroy
with NVRAM enabled once that is merged.

Fixes #1027.
2022-05-06 12:43:42 +01:00
Ruben Kerkhof
a9e0fefa1d Change the default amount of video ram to 16MB (#1435)
Libvirt did already change the current 9216kb
to 16384kb when starting a domain so in practice this is a no-op.

The libvirt default was changed in 2014 in 81ba2298b2
2022-01-17 14:10:23 +00:00
Darragh Bailey
f221daaaaf Tidy up XML generated (#1407)
To make it easier to see when the XML generated has deviated from
expected, tidy up the emitted XML to use a more consistent formatting
that would be inline with what would be expected to be output by virsh
directly.
2021-11-22 17:29:11 +00:00
Darragh Bailey
b49b1991b9 Improve handling of cpu model and initrd settings (#1333)
Avoid triggering a reconfig of the domain when the cpu model and the
initrd haven't been set via the config.
2021-09-11 22:00:33 +01:00
zzambers
d0787c803d Add support for clock setup (#1047)
This adds support for setting clock offset and timers.

See https://libvirt.org/formatdomain.html#elementsTime for more info.
2020-12-16 19:19:24 +00:00
Jason Tarasovic
1251189145 Add ability to use emulated tpm (#1166)
Qemu has supported tpm 2 and the ability to start swtpm. Additionally 
it expands the tests for the tpm configuration to ensure that only when 
the options cause a change to the domain XML will the domain be updated 
on a subsequent start. This change just allows passing through the 
necessary config.

Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    libvirt.tpm_model = "tpm-crb"
    libvirt.tpm_type = "emulator"
    libvirt.tpm_version = "2.0"
  end
end

closes #965
2020-12-15 12:43:46 +00:00
Darragh Bailey
21f7a796ff Reduce start domain unnecessary domain redefines (#1178)
Various checks in the start domain action were accidentally causing a
redefine right after initial create. Update to provide debug output when
the domain needs to be changed to allow capture of the redefines
occurring in the future and to make it easy for the tests to pick up
where the redefine was triggered by setting an expectation on the log
output.

Include a small fix to avoid running strip on what might be a nil object
returned for elements without any text attributes.

Fix a bug where changes to tpm settings made to the config after an
initial domain creation where there was previously no tpm defined, would
be ignored.

Adds a logger double and updates other tests that trigger log calls.

should fix #1176
2020-12-05 15:24:42 +00:00
Darragh Bailey
71503ed62e Rudimentary start domain action spec (#1167)
Add default domain start spec test and fix bug triggered by whitespace
mismatch in string comparison that would trigger unexpected domain
undefine and recreate.
2020-11-15 23:28:43 +00:00