Commit Graph

44364 Commits

Author SHA1 Message Date
Jim Fehlig
d46142a2f9 libvirt: Introduce virDomainSetLaunchSecurityState public API
This API allows setting a launch secret within a guests's memory. The
launch secret is created by the guest owner after retrieving and
verifying the launch measurement with virDomainGetLaunchSecurityInfo.

The API uses virTypedParameter for input, allowing it to be expanded
to support other confidential computing technologies. In the case of
SEV, a basic guest launch workflow is described in the SEV API spec
in section "1.3.1 Launch"

https://www.amd.com/system/files/TechDocs/55766_SEV-KM_API_Specification.pdf

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-04 10:56:00 -07:00
Andrea Bolognani
4c7316b2f0 ci: Refresh configuration
Notable changes:

  * drop parted and XFS headers.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-01-04 18:08:28 +01:00
Jim Fehlig
be3f6fefba NEWS: Add entries for libxl changes during 8.0.0 development
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-04 09:46:35 -07:00
Michal Privoznik
e429c062cb virnetdevopenvswitch: Fix 'burst' value passed to ovs-vsctl
As described in the previous commit, the units for 'burst' are
kibibytes and not kilobytes, i.e. multiples of 1024 not 1000.
Therefore, when constructing ovs-vsctl command the burst value
must be multiplied by 1024 and not just 1000. And because ovs
expects this size in bits the value has to be multiplied again by
8.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1510237#c26
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-01-04 16:40:10 +01:00
Michal Privoznik
f3b422d9cc docs: Clarify 'burst' units for QoS
The burst attribute for bandwidth specifies how much bytes can be
transmitted in a single burst. Therefore, the unit is in
multiples of 1024 (thus kibibytes) not SI-like 1000. It has
always been like that.

The 'tc' output is still confusing though, for instance:

  # tc class add dev $DEV parent 1: classid 1:1 htb rate 1000kbps burst 2097152
  # tc class show dev vnet2
  class htb 1:1 root rate 8Mbit ceil 8Mbit burst 2Mb cburst 1600b

Please note that 2097152 = 2*1024*1024. Even the man page is
confusing. From tc(8):

  kb or k        Kilobytes
  mb or m        Megabytes

But I guess this is because 'tc' predates IEC standardisation of
binary multiples and thus can't change without breaking scripts
parsing its output.

And while at it, adjust _virNetDevBandwidthRate struct member
description, to make it obvious which members use SI/IEC units.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-01-04 16:40:10 +01:00
Michal Privoznik
d2a9c24b84 domain_conf: Use virXMLFormatElement*() more in virDomainDefFormatFeatures()
There are few places in virDomainDefFormatFeatures() which can
use virXMLFormatElement() or virXMLFormatElementEmpty() instead
of writing directly into the output buffer.

After this, there are still a lot of places left, but that is
much bigger task.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-04 16:40:10 +01:00
Michal Privoznik
51f7f7d109 qemuxml2xmloutdata: Turn kvm-features*.xml into symlinks
There's no real difference between input and output XMLs for
kvm-features and kvm-features-off test cases. Do what we usually
do in such case - turn the output file into a symlink of the
input file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2022-01-04 16:40:10 +01:00
Andrea Bolognani
8c2d9794dc docs: Move font definitions with other CSS files
We have a subdirectory specifically for CSS files now, so it makes
sense to have the stylesheet that defines fonts to be there too.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-04 15:47:28 +01:00
Andrea Bolognani
7163515aa9 docs: Move all CSS files to a subdirectory
This unclutters the top-level docs directory.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-04 15:47:27 +01:00
Andrea Bolognani
630f376bc0 docs: Move all images to a subdirectory
This unclutters the top-level docs directory.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-04 15:47:25 +01:00
Andrea Bolognani
19cc4e0eb8 docs: Drop structures.svg
It was introduced in ff4ede0055 but it doesn't seem to have
ever actually been used anywhere.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-04 15:47:21 +01:00
Andrea Bolognani
f58533b367 spec: Drop BuildRequires on xfsprogs-devel
We no longer need its contents.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-04 15:46:11 +01:00
Andrea Bolognani
4512f3203f meson: Don't look for btrfs and xfs headers
We no longer use them anywhere.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-04 15:46:08 +01:00
Andrea Bolognani
59d21d2c2e storage: Use the FICLONE ioctl unconditionally on Linux
According to ioctl_ficlonerange(2)

  These ioctl operations [FICLONE and FICLONERANGE] first
  appeared in Linux 4.5. They were previously known as
  BTRFS_IOC_CLONE and BTRFS_IOC_CLONE_RANGE, and were private
  to Btrfs.

We no longer target any distro that comes with a kernel older
than 4.5, so we can stop looking for the btrfs and xfs
specific versions of the constant and just use the generic
version directly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-01-04 15:45:45 +01:00
Michal Privoznik
5cd76ef97f rpc: Require dtrace sources to be generated first
The virt_socket_lib is built from virnetsocket.c (among others).
But this file includes virprobe.h which includes libvirt_probes.h
which is a generated file. But this dependency is not recorded in
meson which may lead to a failed build.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-04 13:54:35 +01:00
Michal Privoznik
fbe70d9525 conf: Make virDomainTPMDefFormat() return void
The virDomainTPMDefFormat() function can't fail really. There's
no point in it returning an integer then. Make it return void and
fix both places which check for its retval.

And while at it, turn @def into a const pointer to make it
obvious the function does not modify passed struct.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-04 10:23:17 +01:00
Michal Privoznik
dcc278d04e qemuxml2xmloutdata: Turn tpm-*.xml files into symlinks
Make the tpm-*.xml files symlinks to their respective input XMLs
from qemuxml2argvdata/ directory. Neither of the XMLs relies on
autofill of any TPM data.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-04 10:23:11 +01:00
Michal Privoznik
5e2a368c61 conf: Rework <tpm/> formatting
The <tpm/> element formatting is handled in
virDomainTPMDefFormat() which uses the "old style" - appending
strings directly into the output buffer. With this, it's easy to
get conditions that tell when an element has ended wrong. In this
particular case, if both <encryption/> and <active_pcr_banks/>
are to be formatted the current code puts a stray '>' into the
output buffer, resulting in invalid XML.

Rewrite the function to use virXMLFormatElement() which is more
clever.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2016599#c15
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-04 09:59:10 +01:00
Michal Privoznik
d00e6dfe6b qemuxml2xmltest: Introduce tpm-emulator-spapr test
We already have the input xml because of xml2arg test. However,
the corresponding xml2xml test case is missing. Make the expected
XML a symlink to the input XML and clean the latter up a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-04 09:43:35 +01:00
Michal Privoznik
1ce27fa776 conf: Extend TPM ABI stability check for <active_pcr_banks/>
Changing <active_pcr_banks/> means changing the guest ABI and as
such must be prevented on both restoring from a file or
migration.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2035888
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2022-01-04 09:42:01 +01:00
Andrea Bolognani
d004171806 ci: Refresh configuration
Notable changes:

  * drop libdbus and radvd;
  * add codespell.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2022-01-03 16:52:25 +01:00
Peter Krempa
c574a25932 tests: Remove 'qemucapsfixreplies'
The 'qemucapabilitiesnumbering' tool now replaces the role of this
script and provides way to programmatically modify the replies file on
top.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 13:14:43 +01:00
Peter Krempa
06fb078fea tests: Tool for programatic modification of qemucapabilitiesdata/*.replies
The tool is assembled from individual bits used for tests and actual
capturing of the replies files. The tool ensures correct numbering and
formatting of entries.

In normal usage mode it masks as a test which validates formatting and
numbering of the tests/qemucapabilitiesdata/*.replies files. This tool
was actually used to produce commits 096ac87a1a and aa21615ccb.

In case a manual modification of the replies file is needed the
'modify()' function provides a convenient way to do programatic
modification of the caps file.

As an example the modify() function has commented-out code which
provides a basic scaffold to do modifications along with a how-to.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 13:14:43 +01:00
Peter Krempa
984952842f qemumonitortestutils: Extract parser for the monitor conversation dump file
Make the parser reusable by extracting it and making it parse into
command,reply tuples.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 13:14:43 +01:00
Peter Krempa
93093b8089 tests: qemumonitortestutils.h: Reformat header file
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 13:14:43 +01:00
Peter Krempa
a2c758398e util: json: Introduce virJSONValueObjectReplaceValue
The new helper replaces the 'value' part of the key-value tuple in an
object. The advantage of this new helper is that it preserves the
ordering of the key in the object when compared to a combination of
stealing the old key and adding a new value. This will be needed for a
new test/helper for validating and modifying qemu capabilities data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 13:14:43 +01:00
Andrea Bolognani
5a781738d1 meson: Don't require the parted command at build time
We need libparted to be available at build time otherwise we
can't link against it; we don't, however, need the parted
command to be present until runtime and, just as is the case
for other commands, we already perform a lookup through the
virCommand API so making sure it's available at build time
is unnecessary.

This doesn't make any difference for platform such as Fedora
and CentOS, where both the library and the command are in the
same package, but others like Debian, Ubuntu and openSUSE
have separate packages for the two components and this change
means that we can install one less package at build time.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-01-03 11:39:49 +01:00
Andrea Bolognani
868df2a768 spec: Drop BuildRequires on ZFS
We're no longer performing build time detection.

Fixes: 506c3a39d6
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-01-03 11:39:19 +01:00
Michal Privoznik
4b77b19406 virnettlscontext: Don't pass static key length to gnutls_dh_params_generate2()
As encryption norms get more strict it's easy to fall on the
insecure side. For instance, so far we are generating 2048 bits
long prime for Diffie-Hellman keys. Some systems consider this
not long enough. While we may just keep increasing the value
passed to the corresponding gnutls_* function, that is not well
maintainable. Instead, we may do what's recommended in the
gnutls_* manpage. From gnutls_dh_params_generate2(3):

  It is recommended not to set the number of bits directly, but
  use gnutls_sec_param_to_pk_bits() instead.

Looking into the gnutls_sec_param_to_pk_bits() then [1], 2048
bits corresponds to parameter MEDIUM.

1: https://www.gnutls.org/manual/gnutls.html#tab_003akey_002dsizes

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 10:23:29 +01:00
Michal Privoznik
fb474c33cc virnettlscontext: Drop gnutls_dh_set_prime_bits()
According to the gnutls_dh_set_prime_bits() manpage:

  The function has no effect in server side.

Therefore, don't call it when creating server side context.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-01-03 10:23:29 +01:00
Andrea Bolognani
a8f4298175 tests: virtimetest: Mention GLib version containing fix
We now know exactly which GLib version we need to depend on
for the workaround to no longer be necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-01-03 09:39:35 +01:00
Andrea Bolognani
9be0889234 tests: virtimetest: Skip more tests near year's end
All of these are affected by the same issue as the ones that
we're already skipping during this specific time interval.

Suggested-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-01-03 09:38:48 +01:00
Andrea Bolognani
4e0acd34c9 tests: virtimetest: Move comment
Will keep things reasonable as we perform further code
movements.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2022-01-03 09:38:44 +01:00
Andrea Bolognani
cac854e4d4 spec: Demote netcat to Recommends
It is only needed if compatibility with clients that have
libvirt < 6.9.0 is required, and can be uninstalled otherwise.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-01-03 09:37:50 +01:00
Andrea Bolognani
81971f1de7 docs: Fix indentation in shell snippet
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2021-12-24 10:47:44 +01:00
Olaf Hering
4ed8f5b67d spec: relocate pre script of daemon-driver-qemu
Reduce the delta in an upcoming change.
No change in behavior intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-12-23 16:51:37 +01:00
Olaf Hering
42cbffd715 spec: fix %preun of virtnetworkd
Fixes: 50eae3f885
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-12-23 16:51:27 +01:00
Peter Krempa
019eab7240 ci: Refresh dockerfiles
Apart from some churn, the important is the removal of 'netcf-devel'
from the fedora rawhide container.

Update to state as of 174fe4999204afcae (libvirt-ci).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
2021-12-22 17:24:43 +01:00
Tim Wiederhake
39f3025232 qemu: Fix typo in comment
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-22 14:20:19 +01:00
Peter Krempa
67f2fa6b75 util: virjson.h: Reformat headers to conform with new style
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-12-22 13:48:35 +01:00
Peter Krempa
591bb51d37 util: json: Remove virJSONValueIsNull/virJSONValueObjectIsNull
If needed 'virJSONValueIsNull' can be easily replaced by
'virJSONValueGetType(obj) == VIR_JSON_TYPE_NULL'.

'virJSONValueObjectIsNull' has confusing name because it checks that a
virJSONValue of OBJECT type has a key which is NULL, not that the object
itself is NULL. This can be replaced according to the needs e.g. by
virJSONValueObjectHasKey or the above check.

Both are unused.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-12-22 13:48:35 +01:00
Peter Krempa
36d6c3bb67 util: json: Open-code only call of virJSONValueNewStringLen
Replace the function by a call to virJSONValueNewString, when we copy
the string using g_strndup. Remove the unused helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-12-22 13:48:35 +01:00
Peter Krempa
a8b4a41731 util: json: Don't copy string in virJSONValueNewString
With 'g_strdup' not needing error handling we can ask callers to pass a
copy of the string which will be adopted by the JSON value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-12-22 13:48:35 +01:00
Peter Krempa
f668e17bea Replace open coded virJSONValueArrayAppendString
In two instances we've created a string virJSONValue just to append it
to the array. Replace it by use of the virJSONValueArrayAppendString
helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-12-22 13:48:35 +01:00
Peter Krempa
b58f88a919 qemuBlockStorageSourceGetRBDProps: Simplify generation of auth modes
The auth mode array is static, parse it from a JSON string.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
2021-12-22 13:48:35 +01:00
Peter Krempa
4273b74b82 qemuBlockStorageSourceCreateDetectSize: Propagate 'extended_l2' feature to new overlays
In cases where the qcow2 image is using subclusters/extended_l2 entries
we should propagate them to the new images which are based on such
images.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-21 13:23:09 +01:00
Peter Krempa
3275be238c qemu: monitor: Extract whether qcow2 image uses extended L2 allocation data
In order to be able to propagate image configuration to newly formatted
images we need to be able to query it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-21 13:23:09 +01:00
Peter Krempa
df0e867447 qemuBlockStorageSourceCreateGetFormatPropsQcow2: Add support for 'extended-l2' feature
Allow creating the qcow2 with the new subcluster format if required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-21 13:23:09 +01:00
Peter Krempa
58f5597a77 storage_file_probe: Add support for probing qcow2's incompatible features
Add machinery for probing the incompatible feature flags field and
specifically extract whether the extended l2 feature (1 << 4) is
present.

For now we don't care abot the other features.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-21 13:23:09 +01:00
Peter Krempa
fe330b58c4 qcow2GetFeatures: Extract population of features bitmap
Prepare for extraction of features from the 'incompatible features'
group.

This is done by moving the extraction loop into a new function called
qcow2GetFeaturesProcessGroup. The new function also allows to ingore
features we don't care about by passing VIR_STORAGE_FILE_FEATURE_LAST as
the target flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-12-21 13:23:09 +01:00