Commit Graph

7669 Commits

Author SHA1 Message Date
Peter Krempa
22acc863c7 qemu: capabilities: Retire QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_MIGRATABLE
The flag was based on a version check which no longer made sense. Remove
the flag by replacing it's only use by an arch-check which is equivalent
at this point.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
b72318f36d qemu: capabilities: Retire QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
47b6829edc qemu: Always assume QEMU_CAPS_CHARDEV_FD_PASS_COMMANDLINE
All qemu versions now support FD passing either directly or via FDset.
Assume that we always have this capability so that we can simplify
chardev handling in many cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:59 +02:00
Peter Krempa
931c1de5d3 tests: qemucapabilities: Remove qemu-3.0 test data
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
c7e09b7b5f tests: qemucapabilities: Remove qemu-2.12 test data
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
04748f0cef tests: qemucapabilities: Remove qemu-2.11 test data
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
e6c8705b7f qemuxml2agvtest: Retire tests based on qemu-3.0
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
6139ac8b5e qemuxml2agvtest: Retire tests based on qemu-2.12
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Peter Krempa
7674bafe4f qemuxml2agvtest: Retire tests based on qemu-2.11
Upcoming patches will raise the minimum required qemu version to 3.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 12:26:58 +02:00
Andrea Bolognani
19734c3050 qemu: Generate command line for virtio-iommu
https://bugzilla.redhat.com/show_bug.cgi?id=1653327

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-04 10:36:28 +02:00
Andrea Bolognani
e015606984 tests: Add test for virtio-iommu address
virtio-iommu needs to be an integrated device, and our address
assignment code will make sure that is the case. If the user has
provided an explicit address, however, we should make sure any
addresses pointing to a different bus are rejected.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:31:00 +02:00
Andrea Bolognani
fc6cde6cb1 qemu: Validate address type for virtio-iommu
virtio-iommu is a PCI device and attempts to use a different
address type should be rejected.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:31:00 +02:00
Andrea Bolognani
f119336162 qemu: Assign PCI address to virtio-iommu
The device is configured to be an integrated endpoint, as is
necessary for it to function correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
7620b1a09a qemu: Validate use of ACPI with virtio-iommu
virtio-iommu doesn't work without ACPI, so we need to make sure
the latter is enabled.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
28ddd917be qemu: Validate capabilities for virtio-iommu
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
d8072c0015 qemu: Validate machine type used with virtio-iommu
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
428ba3608a tests: Add test cases for virtio-iommu
These represent valid uses of the device.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
672c227037 qemu: Introduce QEMU_CAPS_VIRTIO_IOMMU_BOOT_BYPASS
This capability detects the availability of the boot-bypass
property of the virtio-iommu-pci device.

This property was only introduced in QEMU 7.0 but, since the
device has been around for much longer, we end up querying its
properties for several more releases. As I don't have convenient
access to the 10+ binaries necessary to regenerate the replies,
I just put some fake data in there.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
fd6442f381 qemu: Introduce QEMU_CAPS_DEVICE_VIRTIO_IOMMU_PCI
This capability detects the availability of the virtio-iommu-pci
device.

Note that, while this device is present even in somewhat old
versions of QEMU, it's only some recent changes that made it
actually usable for our purposes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-04-01 19:30:59 +02:00
Andrea Bolognani
b7f5ad4610 tests: Add capabilities for QEMU 7.0.0 on aarch64
The QEMU binary is built from the v7.0.0-rc2 tag.

This causes the argument to -device to be generated in JSON
format, same as what 1a691fe1c8 has done for x86_64.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-01 19:29:50 +02:00
Andrea Bolognani
c3d0236e67 tests: Update capabilities for QEMU 7.0.0 on ppc64
The QEMU binary is built from the v7.0.0-rc2 tag.

Some of the additional capabilities that show up are a
consequence of more features being enabled in this build than
in the one used to generate the replies initially.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-01 19:29:23 +02:00
Andrea Bolognani
fd10c72f1c tests: Update capabilities for QEMU 7.0.0 on x86_64
The QEMU binary is built from the v7.0.0-rc2 tag.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-04-01 18:35:44 +02:00
Jonathon Jongsma
3832db2108 qemu: fix hotplug for multiqueue vdpa net device
While commit a5e659f0 removed the restriction against multiple queues
for the vdpa net device, there were some missing pieces. Configuring a
device statically and then starting the domain worked as expected, but
hotplugging a device didn't have the expected multiqueue support
enabled. Add the missing bits.

Consider the following device xml:
    <interface type="vdpa">
      <mac address="00:11:22:33:44:03" />
      <source dev="/dev/vhost-vdpa-0" />
      <model type="virtio" />
      <driver queues='2' />
    </interface>

Without this patch, hotplugging the above XML description resulted in
the following:
    {"execute":"netdev_add","arguments":{"type":"vhost-vdpa","vhostdev":"/dev/fdset/0","id":"hostnet1"},"id":"libvirt-392"}
    {"execute":"device_add","arguments":{"driver":"virtio-net-pci","netdev":"hostnet1","id":"net1","mac":"00:11:22:33:44:03","bus":"pci.5","addr":"0x0"},"id":"libvirt-393"}

With the patch, hotplugging results in the following:
    {"execute":"netdev_add","arguments":{"type":"vhost-vdpa","vhostdev":"/dev/fdset/0","queues":2,"id":"hostnet1"},"id":"libvirt-392"}
    {"execute":"device_add","arguments":{"driver":"virtio-net-pci","mq":true,"vectors":6,"netdev":"hostnet1","id":"net1","mac":"00:11:22:33:44:03","bus":"pci.5","addr":"0x0"},"id":"libvirt-393"}

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024406

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-30 10:14:28 -05:00
Peter Krempa
38ab5c9ead qemu: command: Override device definition according to the namespace config
Apply the user-requested changes to the device definition as requested
by the <qemu:deviceOverride> element from the custom qemu XML namespace.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/287
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 13:15:25 +02:00
Peter Krempa
b2d4ae0ec3 qemu: domain: Add XML namespace code for overriding device config
Implement the XML parser and formatter for overriding of device
properties such as:

  <qemu:override>
    <qemu:device alias='ua-disk'>
      <qemu:frontend>
        <qemu:property name='prop1' type='string' value='propval1'/>
        <qemu:property name='prop2' type='signed' value='-321'/>
        <qemu:property name='prop3' type='unsigned' value='123'/>
        <qemu:property name='prop4' type='bool' value='true'/>
        <qemu:property name='prop5' type='bool' value='false'/>
        <qemu:property name='prop6' type='bool' value='false'/>
        <qemu:property name='prop6' type='remove'/>
      </qemu:frontend>
    </qemu:device>
  </qemu:override>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-28 13:15:25 +02:00
Michal Privoznik
087473a3ef Revert "qemu: add support for tsc.on_reboot element"
This reverts commit 06c960e477.

Turns out, this feature is not needed and QEMU will fix TSC
without any intervention from outside.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>P
2022-03-28 10:00:18 +02:00
Paolo Bonzini
06c960e477 qemu: add support for tsc.on_reboot element
QEMU 7.0.0 adds a new property tsc-clear-on-reset to x86 CPU, corresponding
to Libvirt's <tsc on_reboot="clear"/> element.  Plumb it in the validation,
command line handling and tests.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 16:31:02 +01:00
Paolo Bonzini
5cef757875 tests: add dependencies to meson declaration
Make sure that all tests are run after the helpers and mocks are
(re)built.  This enables for example using "meson test" as the
command line passed to "git bisect run".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-03-25 15:36:25 +01:00
Michal Privoznik
b8d6ecc70c qemu_command: Generate prealloc-threads property
Let's generate prealloc-threads property onto the cmd line if
domain configuration requests so.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-24 15:46:00 +01:00
Michal Privoznik
a30dac15dc qemu_capabilities: Detect memory-backend-*.prealloc-threads property
The prealloc-threads is property of memory-backend class which is
parent to the other three classes memory-backend-{ram,file,memfd}.
Therefore the property is present for all, or none if QEMU is
older than v5.0.0-rc0~75^2~1^2~3 which introduced the property.

Anyway, the .reserve property is the same story, and we chose
memory-backend-file to detect it, so stick with our earlier
decision and use the same backend to detect this new property.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-24 15:46:00 +01:00
Michal Privoznik
ba7f98126f conf: Introduce memory allocation threads
Since its v5.0.0 release QEMU is capable of specifying number of
threads used to allocate memory. It defaults to 1, which may be
too low for humongous guests with gigantic pages.

In general, on QEMU cmd line level it is possible to use
different number of threads per each memory-backend-* object, in
practical terms it's not useful. Therefore, use <memoryBacking/>
to set guest wide value and let all memory devices 'inherit' it,
silently. IOW, don't introduce per device knob because that would
only complicate things for a little or no benefit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-24 15:45:41 +01:00
Claudio Fontana
76ddf2d2e3 schemas: move out of docs, fix no-docs build
schemas are used for more than just documentation,
virsh edit fails if schemas are not available.

Therefore, fix the no-docs build by moving schemas/
to the parsing code inside src/conf/.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-03-22 11:05:09 +01:00
Peter Krempa
e6d1ed4a76 conf: Add support for setting expected TLS hostname for NBD disks
In cases when the hostname of the NBD server doesn't match the hostname
in the TLS certificate the new attribute 'tlsHostname' can be used to
override it.

Add the XML infrastructure and tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
fd6f49034d qemu: capabilities: Introduce QEMU_CAPS_BLOCKDEV_NBD_TLS_HOSTNAME
Detect that qemu can override TLS hostname setting for NBD clients.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
2c47088e76 tests: qemucapabilities: Update caps_7.0.0.x86_64
Update to commit v6.2.0-2296-g9f0369efb0

Notable changes:
  - 'tls-hostname' field for NBD client to override local hostname
  - machine types 'pc-i440fx-1.7' and older are now deprecated
  - 'snapshot-access' block driver added
  - The 'protocol' field of 'set_password' and 'expire_password'
    parameter is now an enum instead of a pure string allowing 'vnc' and
    'spice' as value and the arguments are also covered by the schema.
  - 'copy-before-write' block driver now has a 'bitmap' property
  - 'query-migrate' now reports 'precopy-bytes', 'downtime-bytes',
    'postcopy-bytes' for 'ram' and 'disk' statistics
  - RTC_CHANGE event now has a 'qom-path' property to identify the RTC
  - 'umip' cpu feature is now migratable
  - SGX property 'section-size' reinstated after regression

Changes in build setting:
  - fuse block export support now enabled

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 15:17:06 +01:00
Peter Krempa
c250ab90ac conf: snapshot: Remove VIR_DOMAIN_SNAPSHOT_PARSE_DISKS flag
All callers except the one in the 'esx' driver pass the flag. The 'esx'
driver has a check that 'def->ndisks' is zero after parsing the
definition. This means that we can simply always parse the disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-11 13:55:50 +01:00
Jonathon Jongsma
a5e659f071 qemu: support multiqueue for vdpa net device
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024406

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-03-09 16:23:02 -06:00
Daniel P. Berrangé
2a95dbd03c nwfilter: drop support for legacy iptables conntrack direction
Long ago we adapted to Linux kernel changes which inverted the
behaviour of the conntrack --ctdir setting:

  commit a6a04ea47a
  Author: Stefan Berger <stefanb@us.ibm.com>
  Date:   Wed May 15 21:02:11 2013 -0400

    nwfilter: check for inverted ctdir

    Linux netfilter at some point (Linux 2.6.39) inverted the meaning of the
    '--ctdir reply' and newer netfilter implementations now expect
    '--ctdir original' instead and vice-versa.
    We check for the kernel version and assume that all Linux kernels with version
    2.6.39 have the newer inverted logic.

    Any distro backporting the Linux kernel patch that inverts the --ctdir logic
    (Linux commit 96120d86f) must also backport this patch for Linux and
    adapt the kernel version being tested for.

    Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

Given our supported platform targets, we no longer need to
consider a version of Linux before 2.6.39, so can drop
support for the old direction behaviour.

The test suite updates are triggered because that never
probed for the ctdir direction, and so the iptables syntax
generator unconditionally dropped the ctdir args.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-09 11:37:32 +00:00
Daniel P. Berrangé
02b8045517 nwfilter: drop support for legacy iptables match syntax
Long ago we adapted to iptables changes by introducing support
for '-m conntrack':

  commit 06844ccbaa
  Author: Stefan Berger <stefanb@us.ibm.com>
  Date:   Tue Aug 6 20:30:46 2013 -0400

    nwfilter: Use -m conntrack rather than -m state

    Since iptables version 1.4.16 '-m state --state NEW' is converted to
    '-m conntrack --ctstate NEW'. Therefore, when encountering this or later
    versions of iptables use '-m conntrack --ctstate'.

Given our supported platform targets, we no longer need to
consider a version of iptables before 1.4.16, so can drop
support for the old syntax.

The test suite updates are triggered because that never
probed for the new syntax, and so unconditionally
generated the old syntax.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-03-09 11:37:12 +00:00
Martin Kletzander
3c61c9bea6 tests: Allow expansion of mocked stat symbols
When libc uses a define to rewrite stat64 to stat our mocks do not work if they
are chained because the symbol that we are looking up is being stringified and
therefore preventing the stat64->stat expansion per C-preprocessor rules.  One
stringification macro is just enough to make it work.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-07 10:31:24 +01:00
Michal Privoznik
86c691e6de tests: Update IPv4-in-IPv6 addresses
We have couple of tests where the obsolete IPv4-in-IPv6 notation
is used (::10.1.2.3). Change them to the correct format
(::ffff:10.1.2.3).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-04 15:08:59 +01:00
Michal Privoznik
c7a0b89065 sockettest: Check for IPv4-in-IPv6 parsing and formatting
There are two standards how IPv4 address in IPv6 can be
expressed:

  ::10.1.2.3
  ::ffff:10.1.2.3

The former is obsolete and the latter should be used instead [1].
Add test cases to our sockettest to exercise parsing/formatting
of the valid address format.

1: https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.1

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-04 15:08:59 +01:00
Michal Privoznik
c3c1293984 vircgroupmock: Make global variables static
Apparently clang was fixed as it no longer considers having
global variables static a problem. Make the variables static to
be sure they aren't used outside of the source file.

This effectively reverts v1.0.6-rc1~198 which started the trend.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-04 15:08:59 +01:00
Michal Privoznik
61a12ffe08 vircgroupmock: Be wiser about detecting fakerootdir change
The way that vircgroupmock works is that the vircgrouptest
creates a temporary directory and sets LIBVIRT_FAKE_ROOT_DIR env
variable which is then checked by the mock at the beginning of
basically every function it overrides (access(), stat in all its
flavours, mkdir(), etc.). The mock then creates a CGroup dir
structure. But the test is allowed to change the directory, to
accommodate environment for the particular test case. This is
done by changing the environment variable which is then detected
by the mock and the whole process repeats.

However, the way the mock detect changes is buggy. After it got
the environment variable it compares it to the last known value
(global variable @fakerootdir) and if they don't match the last
known value is set to point to the new value. Problem is that the
result of getenv() is assigned to the @fakerootdir directly.
Therefore, @fakerootdir points somewhere into the buffer of
environment variables. In turn, when the test sets new value (via
g_setenv()) it may be placed at the very same position in the env
var buffer and thus the mock fails to detect the change.

The solution is to keep our private copy of the value (by
g_strdup()) which makes the variable not rely on
getenv()/setenv() placing values at random positions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-03-04 15:08:59 +01:00
Daniel P. Berrangé
32b9d8b0ae qemu: support firmware descriptor flash 'mode' for optional NVRAM
Currently the 'nvram_template' entry is mandatory when parsing the
firmware descriptor based on flash. QEMU is extending the firmware
descriptor spec to make the 'nvram_template' optional, depending
on the value of a new 'mode' field:

  - "split"
      * "executable" contains read-only CODE
      * "nvram_template" contains read-write VARS

  - "combined"
      * "executable" contains read-write CODE and VARs
      * "nvram_template" not present

  - "stateless"
      * "executable" contains read-only CODE and VARs
      * "nvram_template" not present

In the latter case, the guest OS can write vars but the
firmware will make no attempt to persist them, so any changes
will be lost at poweroff.

For now we parse this new 'mode' but discard any firmware
which is not 'mode=split' when matching for a domain.

In the tests we have a mixture of files with and without the
mode attribute.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-23 18:11:08 +00:00
Daniel P. Berrangé
392292cd99 tests: don't use auto-generated NVRAM path in tests
By using the auto-generated NVRAM path in test data files, we won't see
bugs where a user specified path gets accidentally overwritten by a
post-parse callback, or VM startup. For example, this caused us to miss
the bug fixed by:

  commit 24adb6c7a6
  Author: Michal Prívozník <mprivozn@redhat.com>
  Date:   Wed Feb 23 08:50:44 2022 +0100

    qemu: Don't regenerate NVRAM path if parsed from domain XML

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-23 18:08:49 +00:00
Michal Privoznik
a6929d62cf qemu: Don't ignore failure when building default memory backend
When building the default memory backend (which has id='pc.ram')
and no guest NUMA is configured then
qemuBuildMemCommandLineMemoryDefaultBackend() is called. However,
its return value is ignored which means that on invalid
configuration (e.g. when non-existent hugepage size was
requested) an error is reported into the logs but QEMU is started
anyway. And while QEMU does error out its error message doesn't
give much clue what's going on:

  qemu-system-x86_64: Memory backend 'pc.ram' not found

While at it, introduce a test case. While I could chose a nice
looking value (e.g. 4MiB) that's exactly what I wanted to avoid,
because while such value might not be possible on x84_64 it may
be possible on other arches (e.g. ppc is notoriously known for
supporting wide range of HP sizes). Let's stick with obviously
wrong value of 5MiB.

Reported-by: Charles Polisher <chas@chasmo.org>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-02-22 17:26:19 +01:00
Daniel P. Berrangé
dd163b6c98 tests: add test case for NVRAM with template
This demonstrates that

  <os>
    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
    <nvram template="/usr/share/OVMF/OVMF_VARS.fd"/>
  </os>

gets expanded to give a per-VM NVRAM path.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-22 14:54:41 +00:00
Daniel P. Berrangé
4aad5e1c18 tests: add explicit test case for pflash loader lacking path
The following is expected to raise an error:

  <os>
    <loader readonly='yes' type='pflash'/>
  </os>

because no path to the pflash loader is given and there is
no default built-in.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-02-22 14:54:31 +00:00
Hyman Huang(黄勇)
f8dc72f0ca qemu_capabilities: Introduce QEMU_CAPS_DIRTYRATE_MODE capability
mode option of calc-dirty-rate command since qemu >=6.2.0.
Introduce QEMU_CAPS_DIRTYRATE_MODE capability definition.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-21 13:34:16 +01:00