Commit Graph

46094 Commits

Author SHA1 Message Date
Andrea Bolognani
de2a338dce conf: Validate firmware configuration more thoroughly
Generally speaking, when firmware autoselection is in use we
don't want any information to be provided manually. There are
two exceptions:

  * we still want the path to the NVRAM file to be customizable;

  * using <loader secure='yes'/> was how you would ask for a
    firmware that implements the Secure Boot feature in the
    original approach to firmware autoselection, so we want to
    keep that working.

Anything else should result in a descriptive error.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/327
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:34 +02:00
Andrea Bolognani
f5dcd8b979 conf: Refactor virDomainDefOSValidate()
This makes it explicit that there are two possible scenarios
(whether or not firmware autoselection is in use) and will make
upcoming changes cleaner to implement.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:32 +02:00
Andrea Bolognani
421d4f1fa8 conf: Always parse all firmware information
Currently we're simply ignoring some elements and attributes,
such as the loader path, when firmware autoselection is enabled
because we know we're not going to use them.

This makes sense, but has the unfortunate consequence of
confusing users who experience part of their configuration
simply going away for no apparent reason.

A more user-friendly approach is to produce meaningful error
messages in those scenarios. As a first step towards that goal,
stop conditionally parsing information.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:31 +02:00
Andrea Bolognani
161b31f958 conf: Reject enrolled-keys=yes with secure-boot=no
This combination doesn't make sense and so the firmware
autoselection logic will not be able to find a suitable firmware,
but it's more user-friendly to report a detailed error upfront.

Note that this check would ideally happen in the validate phase,
but if we moved it there we would no longer be able to
automatically enable secure-boot when enrolled-keys=yes. Since
the combination never resulted in a working configuration, the
chances of this causing real-world VMs to disappear are
extremely low.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:30 +02:00
Andrea Bolognani
c98910d011 conf: Add return value to virDomainDefPostParseOs()
There are currently no failure scenarios for the function, but
we're about to add one.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:29 +02:00
Andrea Bolognani
6cacfc751e conf: Enable secure-boot when enrolled-keys is enabled
The latter doesn't make sense without the former, so make that
visible in the XML.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:27 +02:00
Andrea Bolognani
9c7499ce54 conf: Always parse NVRAM path if present
Currently, the lack of a <loader> element results in the <nvram>
element being completely ignored, but this is unnecessarily
limiting: even when firmware autoselection is in use, it should
be possible for the user to specify a custom path for the NVRAM
file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:26 +02:00
Andrea Bolognani
bdd9ce0fda conf: Use nodes in virDomainLoaderDefParseXMLNvram()
This makes the function more consistent with
virDomainLoaderDefParseXML() by preferring the virXMLProp
class of functions to XPath access.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:25 +02:00
Andrea Bolognani
f0e68d28e1 conf: Rename virDomainLoaderDefParseXML() argument
We're going to start passing multiple nodes to the function in
a moment, so we need a more specific name.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:23 +02:00
Andrea Bolognani
28c689dc61 conf: Handle NVRAM in virDomainLoaderDefParseXML()
All the data in the <nvram> element ends up in the same struct
as that coming from the <loader> element, so it makes sense to
have a single entry point for parsing an XML document into a
virDomainLoaderDef instance.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:22 +02:00
Andrea Bolognani
5943e4ade6 conf: Move nvramTemplate parsing
It belongs to virDomainLoaderDefParseXMLNvram(), where the other
parts of the <nvram> element are handled.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:21 +02:00
Andrea Bolognani
cec35f4a52 conf: Move setting type for NVRAM source
When the 'type' attribute is present we'd end up overwriting
this value via virDomainStorageSourceParse(). Moving this
assignment makes the current code clearer and will also help
with upcoming changes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:19 +02:00
Andrea Bolognani
040ebb9d1b conf: Rename virDomainLoaderDefParseXMLNvram()
The previous name was identical, modulo the case, to the
completely unrelated virDomainNVRAMDefParseXML().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:18 +02:00
Andrea Bolognani
628c018344 conf: Move virDomainLoaderDefParseXML()
Pure code movement, needed to prepare for upcoming changes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:17 +02:00
Andrea Bolognani
1afc026c73 tests: Add more firmware tests
Note that some of these new tests are displaying incorrect or
suboptimal behavior. When we address those in upcoming patches,
this will be highlighted by changes in the test data.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:16 +02:00
Andrea Bolognani
29bbd927f8 tests: Don't use loader.secure=no with firmware autoselection
This currently has not effect whatsoever, so it's just cluttering
the input files.

We're going to add specific handling for this scenario, as well
as a test case covering it, in an upcoming commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:14 +02:00
Andrea Bolognani
2ce1dcc6b5 tests: Don't set NVRAM path manually
This does the opposite of

  commit 392292cd99
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Wed Feb 23 12:45:51 2022 +0000

    tests: don't use auto-generated NVRAM path in tests

in order to minimize input files.

We're going to add a test case specifically covering the use of
custom NVRAM paths with firmware autoselection in an upcoming
commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:13 +02:00
Andrea Bolognani
53cdfd7994 tests: Use minimal hardware for firmware tests
When testing firmware selection, we don't really care about any
of the hardware assigned to the VM, and in fact it's better to
keep it as minimal as possible to make sure that the focus
remains on the firmware bits.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:12 +02:00
Andrea Bolognani
f29a8bcef1 tests: Rename and reorganize firmware tests
Group all tests related to firmware selection together and give
them consistent names that leave room for further tests to be
added in an upcoming commit.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:10 +02:00
Andrea Bolognani
acb8733924 tests: Drop bios-nvram-os-interleave test
This was introduced in

  commit 5882064084
  Author: Martin Kletzander <mkletzan@redhat.com>
  Date:   Wed Feb 25 15:45:26 2015 +0100

    tests: Add test for os interleaving

to ensure a recent change in the schema was behaving correctly.

Seven years later, it no longer seems very useful to keep it
around.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:09 +02:00
Andrea Bolognani
031f379573 tests: Use firmware autoselection on aarch64
This simplifies the test data without negatively impacting test
coverage.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:10:05 +02:00
Andrea Bolognani
c76e595131 tests: Remove firmware bits from unrelated tests
The pci-bridge-many-disks test case is not related to firmware
handling at all, so we can trim it without losing any coverage.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 15:09:50 +02:00
David Michael
9f13f54a63 security_selinux.c: Relabel existing mode="bind" UNIX sockets
This supports sockets created by libvirt and passed by FD using the
same method as in security_dac.c.

Signed-off-by: David Michael <david@bigbadwolfsecurity.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 14:51:19 +02:00
Michal Privoznik
09010f7e76 virnettlscontext: Don't set DH parameters ourselves
According to [1]:

  Prior to GnuTLS 3.6.0 for the ephemeral or anonymous
  Diffie-Hellman (DH) TLS ciphersuites the application was
  required to generate or provide DH parameters. That is no
  longer necessary as GnuTLS utilizes DH parameters and
  negotiation from [RFC7919].

This allows us to:

  a) drop the code that's setting DH params,
  b) drop @dhParams member from _virNetTLSContext struct. and
  c) drop gnutls_dh_params_generate2() mock.

1: https://www.gnutls.org/manual/html_node/Parameter-generation.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-01 13:04:59 +02:00
Michal Privoznik
4d7e848418 meson: Require gnutls-3.6.0 or newer
Released almost 5 years ago, gnutls-3.6.0 brings some important
features (which are utilized in next commit). Hence, require that
version at least.

Per repology, currently shipped versions are:

                 RHEL-8: 3.6.16
                 RHEL-9: 3.7.3
              Debian 11: 3.7.1
              Debian 12: 3.7.6
     openSUSE Leap 15.3: 3.6.7
       Ubuntu LTS 20.04: 3.6.13
       Ubuntu LTS 22.04: 3.7.3
             FreeBSD 12: 3.7.6
              Fedora 34: 3.7.4
              Fedora 35: 3.7.6

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-07-01 13:04:58 +02:00
Michal Privoznik
91e96ab71a virnetdevbandwidthtest: Test QoS for OVS
Ever since v7.6.0-rc1~235 we can use ovs-vsctl to set QoS instead
of tc. However, we don't have a test that's verifying generated
cmd line for ovs-vsctl.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-07-01 13:04:18 +02:00
Michal Privoznik
5f6aa07303 virnetdevbandwidthtest: Reformat TC cmd line
Our coding style expects a long line to be broken into shorter
lines which are then aligned on the first character, for
instance:

  "some string that's broken "
  "into multiple lines"

However, one can argue that there are few cases where shifting
the alignment makes the code more readable. And this is the case
of expected cmd line for DO_TEST_SET() where a long cmd line can
be aligned on the arguments rather than the binary:

  TC " filter ..."
     " police ..."

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-07-01 13:04:18 +02:00
Michal Privoznik
5c5ca1970f virnetdevbandwidthtest: Drop unused testMinimalStruct
The last usage of the testMinimalStruct struct was removed in
v1.2.2-rc1~206 which forgot to remove the struct as well. Remove
it now.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-07-01 13:04:17 +02:00
Michal Privoznik
b7ab6a6bd6 virnetdevbandwidthtest: Drop unnecessary brackets
Some cases that call DO_TEST_SET() macro wrap each argument in
curved brackets. This is unnecessary, drop the brackets.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-07-01 13:04:17 +02:00
Jiri Denemark
766abdc291 qemu_migration: Apply max-postcopy-bandwidth on post-copy resume
When resuming post-copy migration users may want to limit the bandwidth
used by the migration and use a value that is different from the one
specified when the migration was originally started.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/333

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 11:28:34 +02:00
Jiri Denemark
8c335b5530 qemu_migration: Pass migParams to qemuMigrationSrcResume
So the we can apply selected migration parameters even when resuming
post-copy migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 11:28:34 +02:00
Jiri Denemark
184749691f qemu_migration_params: Replace qemuMigrationParamTypes array
We will need to annotate individual parameters a bit more than just
noting their type. Let's introduce qemuMigrationParamInfo replacing
simple qemuMigrationParamTypes with an array of structs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 11:28:34 +02:00
Jiri Denemark
0eae541257 qemu: Pass migration flags to qemuMigrationParamsApply
The flags will later be used to determine which parameters should
actually be applied.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 11:28:34 +02:00
Jiri Denemark
f9dcc01a0f qemu_migration: Avoid mem.hard_limit > 0 check
My original commit v8.4.0-288-gf01fc4d119 accidentally forgot to fix
both instances of the same problem. While it fixed the destination side
of migration, the source one remained broken.

However, that commit was also wrong in saying the issue could have
caused unlimited memory locking to be allowed for QEMU when RDMA
migration was used. It could not, because the code would refuse to even
think about starting RDMA migration if hard_limit was not set. But
avoiding the "mem.hard_limit > 0" check is useful anyway.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-07-01 11:28:34 +02:00
Jiri Denemark
10008f5810 Post-release version bump to 8.6.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-07-01 11:27:31 +02:00
Jiri Denemark
a9cc9f6612 Release of libvirt-8.5.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-07-01 11:19:54 +02:00
Michal Privoznik
f3f877cfa6 qemu_hotplug: Don't skip cleanup in qemuDomainAttachNetDevice()
Introduced in v8.4.0-rc1~183 but the first real problem
introduced in v8.4.0-rc1~170, there's a
qemuBuildInterfaceConnect() call inside of
qemuDomainAttachNetDevice(). If the former fails, then the
function is immediately returned from instead of jumping onto the
cleanup label. This is crucial, because at this point the domain
definition contains 'borrowed' net definition, which is then
freed, since an error was met. The domain definition is then left
with a dangling pointer which leads to all sorts of different
crashes.

Fixes: 29d022b1eb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2102009
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-07-01 10:45:26 +02:00
Michal Privoznik
0ba3870406 API: Remove internal impl detail from VIR_DOMAIN_IOTHREAD_THREAD_POOL_{MIN,MAX} description
When introducing VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN and
VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX typed parameters, I've made a
shortcut. Since at the monitor level these two are set in two
separate calls and minimum has to be always smaller than maximum
(or equal to it), it may happen that one of the values we want to
set violates this restriction. So I've put a little note in the
public API description warning users about this.

However, the proper solution is to have a logic that checks the
current values and based on that set either minimum or maximum
value first. But until we get there, remove that note from the
public API before it gets released.

Related: https://gitlab.com/libvirt/libvirt/-/issues/339
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-06-30 09:54:40 +02:00
Peter Krempa
7989edd742 NEWS: Mention 3 user-visible regressions fixed in this release
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-06-30 09:49:19 +02:00
김인수
55daf23446 Translated using Weblate (Korean)
Currently translated at 99.5% (10424 of 10472 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Translated using Weblate (Korean)

Currently translated at 99.5% (10424 of 10472 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/ko/

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2022-06-30 02:21:26 +02:00
Weblate
93f4ad2996 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
2022-06-30 02:21:24 +02:00
Göran Uddeborg
f8e7b4fed2 Translated using Weblate (Swedish)
Currently translated at 37.5% (3942 of 10491 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 37.4% (3920 of 10472 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Translated using Weblate (Swedish)

Currently translated at 37.3% (3901 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2022-06-30 02:21:21 +02:00
Peter Krempa
170eccd03c qemucapabilitiestest: Update capabilities for the 7.1 release cycle on x86_64
Update to v7.0.0-2187-g2a8835cb45

Notable changes:
    - VFU_CLIENT_HANGUP event added
    - query-stats and query-stats-schemas commands added
    - 'vduse-blk' block export export
    - 'loongarch64' arch added
    - added new qom types:
        - cxl-downstream
        - cxl-upstream
        - qio-channel-block
        - qio-channel-null
    - added smi-irq[0], smm-enabled, unnamed-gpio-out[0] properties for PIIX4_PM

    - removed:
        - piix3-ide-xen

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-06-29 15:37:40 +02:00
Liu Yiding
0dd1fdae2e conf: virDomainMemoryDefValidate: Improve error message
An explicit limit would be more user friendly. Add the limit to error message.

Before this commit:
```
error: requested size must be smaller than or equal to @size
```

Now:
```
error: requested size must be smaller than or equal to @size (8388608KiB)
```

Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-06-28 12:33:38 +02:00
Michal Privoznik
088e92e0cc NEWS: Document my contributions for the upcoming release
There are couple of features/improvements/bugfixes I contributed
into the upcoming release. Include those worth mentioning in the
NEWS.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-06-27 15:00:00 +02:00
Jiri Denemark
e324569691 po: Refresh potfile for v8.5.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-06-27 08:56:55 +02:00
Göran Uddeborg
148b39c657 Translated using Weblate (Swedish)
Currently translated at 37.0% (3861 of 10431 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/sv/

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2022-06-25 10:18:52 +02:00
Jonathon Jongsma
790f3b214b schema: Be more flexible for diskSourceNetworkProtocolPropsCommon
Add <interleave> to allow the subproperties to be specified in any
order.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-06-24 09:04:06 -05:00
Jonathon Jongsma
4260a642d3 docs: clarify 'readahead' and 'timeout' for disks
Document the format of the 'readahead' and 'timeout' XML elements more
accurately.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-06-24 09:03:54 -05:00
Jiri Denemark
d375993ab3 qemu_migration: Implement VIR_MIGRATE_ZEROCOPY flag
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/306

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-06-23 16:45:39 +02:00