Commit Graph

41428 Commits

Author SHA1 Message Date
Jonathon Jongsma
a48a2abe60 nodedev: add function to generate mdevctl define command
Abstract out the function used to generate the commandline for 'mdevctl
start' since they take the same arguments. Add tests to ensure that
we're generating the command properly.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:08:59 -05:00
Jonathon Jongsma
2c57b28191 nodedev: Refresh mdev devices when changes are detected
We need to query mdevctl for changes to device definitions since an
administrator can define new devices by executing mdevctl outside of
libvirt.

In the future, mdevctl may add a way to signal device add/remove via
events, but for now we resort to a bit of a workaround: monitoring the
mdevctl config directory for changes to files. When a change is
detected, we query mdevctl and update our device list. The mdevctl
querying is handled in a throwaway thread, and these threads are
synchronized with a mutex.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:08:59 -05:00
Jonathon Jongsma
259ed0ff28 nodedev: handle mdevs that disappear from mdevctl
mdevctl does not currently provide any events when the list of defined
devices changes, so we will need to poll mdevctl for the list of defined
devices periodically. When a mediated device no longer exists from one
iteration to the next, we need to treat it as an "undefine" event.

When we get such an event, we remove the device from the list if it's
not active. Otherwise, we simply mark it as non-persistent.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:08:59 -05:00
Jonathon Jongsma
00b649d0cf nodedev: add helper functions to remove node devices
When a mediated device is stopped or undefined by an application outside
of libvirt, we need to remove it from our list of node devices within
libvirt. This patch introduces virNodeDeviceObjListRemoveLocked() and
virNodeDeviceObjListForEachRemove() (which are analogous to other types
of object lists in libvirt) to facilitate that. They will be used in
coming commits.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:08:59 -05:00
Jonathon Jongsma
aa897d46d5 nodedev: add mdevctl devices to node device list
At startup, query devices that are defined by 'mdevctl' and add them to
the node device list.

This adds a complication: we now have two potential sources of
information for a node device:
 - udev for all devices and for activated mediated devices
 - mdevctl for persistent mediated devices

Unfortunately, neither backend returns full information for a mediated
device. For example, if a persistent mediated device in the list (with
information provided from mdevctl) is 'started', that same device will
now be detected by udev. If we simply overwrite the existing device
definition with the new one provided by the udev backend, we will lose
extra information that was provided by mdevctl (e.g. attributes, etc).
To avoid this, make sure to copy the extra information into the new
device definition.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:08:45 -05:00
Jonathon Jongsma
94187b8004 nodedev: add DEFINED/UNDEFINED lifecycle events
Since a mediated device can be persistently defined by the mdevctl
backend, we need additional lifecycle events beyond CREATED/DELETED to
indicate that e.g. the device has been stopped but the device definition
still exists.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:07:45 -05:00
Jonathon Jongsma
d4375403ff nodedev: add persistence to virNodeDeviceObj
Consistent with other objects (e.g. virDomainObj), add a field to
indicate whether the node device is persistent or transient.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:07:45 -05:00
Jonathon Jongsma
066c13de66 nodedev: add ability to list defined mdevs
This adds an internal API to query for persistent mediated devices
that are defined by mdevctl. Upcoming commits will make use of this
information.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:07:35 -05:00
Jonathon Jongsma
58d093a55f nodedev: add ability to parse mdevs from mdevctl
This function will parse the list of mediated devices that are returned
by mdevctl and convert it into our internal node device representation.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:05:31 -05:00
Jonathon Jongsma
eb27a233f2 tests: trivial change to mdevctl test macro
In order to be able to pass a string as user data to the test function,
change the DO_TEST_FULL() macro to expect a pointer and pass it directly
to virTestRun(). Previously we expected the caller to pass a struct
variable and then passed the address of that to virTestRun().

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:05:19 -05:00
Jonathon Jongsma
8fed1d9636 nodedev: expose internal helper for naming devices
Expose a helper function that can be used by udev and mdevctl to
generate device names for node devices.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:03:34 -05:00
Jonathon Jongsma
e3107a1862 nodedev: fix docs for virConnectListAllNodeDevices()
It doesn't make sense to list all of the flag values in the function
documentation. This is unnecessary duplication, we already refer to the
enum type.  Also, remove reference to exclusive groups of flags, since
that does not apply to this API.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:03:34 -05:00
Jonathon Jongsma
b1bfe3e5c4 nodedev: Add ability to filter by active state
Add two flag values for virConnectListAllNodeDevices() so that we can
list only node devices that are active or inactive.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:03:34 -05:00
Jonathon Jongsma
b7a823177b nodedev: introduce concept of 'active' node devices
we will be able to define mediated devices that can be started or
stopped, so we need to be able to indicate whether the device is active
or not, similar to other resources (storage pools, domains, etc.)

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:03:34 -05:00
Jonathon Jongsma
682a65a322 tests: remove extra trailing semicolon
The macro should not have a trailing semicolon so that when the macro is
used, the user can add a semicolon themselves.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:03:34 -05:00
Jonathon Jongsma
ab1703191b nodedev: capture and report stderror from mdevctl
When an mdevctl command fails, there is not much information available
to the user about why it failed. This is partly because we were not
making use of the error message that mdevctl itself prints upon failure.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-07 15:03:22 -05:00
Daniel P. Berrangé
ffda44030a qemu: wire up command line support for ACPI index
This makes it possible to enable stable NIC device names in most modern
Linux distros.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-07 18:11:13 +01:00
Daniel P. Berrangé
1b80c6f0d0 qemu: probe for "acpi-index" property
This property is exposed by QEMU on any PCI device, but we have to pick
some specific device(s) to probe it against. We expect that at least one
of the virtio devices will be present, so probe against them.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-07 18:11:11 +01:00
Daniel P. Berrangé
b7bef84395 qemu: use a switch when building device addresses
The compiler can more easily optimize a switch, and more importantly can
also warn when new address types are added which are not handled.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-07 18:11:09 +01:00
Daniel P. Berrangé
49ba650965 qemu: fix indentation off-by-1
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-07 18:11:07 +01:00
Daniel P. Berrangé
a9fe9569ab conf: add support for <acpi index='NNN'/> for PCI devices
PCI devices can be associated with a unique integer index that is
exposed via ACPI. In Linux OS with systemd, this value is used for
provide a NIC device naming scheme that is stable across changes
in PCI slot configuration.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-07 18:10:56 +01:00
Daniel P. Berrangé
ee4abd6312 conf: add ABI stability check for disk rotation rate
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-07 17:08:28 +01:00
Jim Fehlig
62edbca6c4 NEWS: Mention Xen support for domains with more than 4TB
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2021-04-07 08:18:20 -06:00
Peter Krempa
a82a0b248e tests: qemucapabilitiesdata: Update qemu capabilities on x86_64 to 6.0.0-rc2
'block_passwd' command was removed 'display-reload' command was added
and the 'acpi-index' property for PCI devices was added.

There are no noticable changes for us.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-07 12:45:29 +02:00
Daniel P. Berrangé
a8c9b49747 tests: add warning that qemucapsprobe prefers native host/guest arch
Generally we want the QEMU capabilities data in git to report KVM
related features, and thus we strongly prefer that the capabilities are
generated on a native host.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-07 11:42:31 +01:00
Daniel P. Berrangé
713ad30004 run: fix spawning of daemons
The "args" array already contains the binary name, so does not need to
be concatenated with "prog".

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-07 11:41:26 +01:00
simmon
8c1a89999a Translated using Weblate (Korean)
Currently translated at 31.7% (3356 of 10581 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
2021-04-07 08:02:02 +02:00
Peter Krempa
c54b1bdcfb qemu: command: Handle formatting of '-compat' options
Enable '-compat' if requested in qemu.conf and supported by qemu to
instruct qemu to crash when a deprecated command is used and stop
returning deprecated fields.

This setting is meant for libvirt developers and such.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-04-06 17:08:25 +02:00
Peter Krempa
a6444c8019 qemu: Add per-VM control of deprecation behavior
Similar to the qemu.conf knob 'deprecation_behavior' add a per-VM knob
in the QEMU namespace:

  <qemu:deprecation behavior='...'/>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-04-06 17:07:56 +02:00
Peter Krempa
ceb00a5ade qemuxml2xmltest: Enable 'qemu-ns' case
The XML formatter validation was missing for this code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-04-06 17:07:35 +02:00
Peter Krempa
7004504493 qemu: conf: Add 'deprecation_behavior' setting to qemu.conf
New QEMU supports a harsh, but hard to ignore way to notify that the
QMP user used a deprecated command. This is useful e.g. for developers
to see that something needs to be fixed.

This patch introduces a qemu.conf option to enable the setting in cases
when qemu supports it so that developers and continiuous integration
efforts are notified about use of deprecated fields before it's too
late.

The option is deliberately stored as string and not validated to prevent
failures when downgrading qemu or libvirt versions. While we don't
support this, the knob isn't meant for public consumption anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-04-06 17:07:05 +02:00
Peter Krempa
d8793c6832 qemu: capabilities: Introduce QEMU_CAPS_COMPAT_DEPRECATED
The capability is asserted if qemu supports the -compat
deprecated-input= and deprecated-output= settings to control what should
happen if deprecated fields are used in QMP.

This will be used for a developer/tester-oriented setting which will
aid us in catching use of deprecated settings sooner.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-04-06 17:07:01 +02:00
Peter Krempa
eff7f412cf docs/drvqemu: Convert to RST
There are two links to this document using anchors so they need to be
updated as well.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-04-06 17:00:11 +02:00
Peter Krempa
8ccf97fa15 syntax-check: Remove GFDL format check
Our docs don't use the GFDL so checking its format is pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-06 16:53:49 +02:00
Peter Krempa
cf60d9999b syntax-check: Remove unused header check for 'strings.h'
Libvirt doesn't use it and we also require use of wrappers for such
string operations. Remove the pointless check.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-06 16:53:49 +02:00
Peter Krempa
153564e3ce syntax-check: Remove check for prohibited 'WITH_MBRTOWC'
While our code uses mbrtowc, we don't do any detection of it.
Additionally it was recently changed from HAVE_MBRTOWC to WITH_MBRTOWC
so even if it came from an included file it would no longer work.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-06 16:53:49 +02:00
Peter Krempa
fa5d8520e2 syntax-check: Remove used header checks for gnulib modules
We removed gnulib support, so all the checks whether a header is
included only when it's used are pointless now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-06 16:53:49 +02:00
Peter Krempa
65f702020e syntax-check: Clean up check for g_auto*
Remove the old libvirt variants that are no longer in use and include
g_autostringlist.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-06 16:53:49 +02:00
Peter Krempa
7676062272 syntax-check: Remove check for proper spelling of 'Red Hat'
Don't single out this one, and also don't waste computational resources
on it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-06 16:53:49 +02:00
simmon
73b526ec28 Translated using Weblate (Korean)
Currently translated at 31.3% (3313 of 10581 strings)

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

Co-authored-by: simmon <simmon@nplob.com>
Signed-off-by: simmon <simmon@nplob.com>
2021-04-04 09:02:01 +02:00
Olaf Hering
2fc3a704e7 libxl: use API 4.13 to support domUs with more than 4TB
To support domUs with more than 4TB memory it is required to use
LIBXL_API_VERSION >= 0x040800, which uses uint64_t for certained guest
memory related quantities.

Unfortunately this change is not straight forward. While most of the
code in libxl.h handles the various LIBXL_API_VERSION variants
correctly, the check for valid a LIBXL_API_VERSION at the beginning of
the file was broken between Xen 4.7 and 4.13 - it did not cover for
API changes introduced in Xen 4.7 and 4.8. This was fixed with
xen-project/xen@c3999835df, which for libvirt means in practice either
the libxl API from Xen 4.5 or 4.13+ can be used.

This change uses pkgconfig to decide which API can be safely selected.
Xen provides a pkgconfig file since Xen 4.6, which is also the lowest
version expected by libvirt.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Olaf Hering
8bc6a55f1b libxl: add API wrapper for libxl_set_memory_target
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_set_memory_target, which changed the storage size of
parameter "target_memkb" in Xen 4.8.

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Olaf Hering
4d6e2c0f89 libxl: add API wrapper for libxl_send_trigger
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_send_trigger, which got a new parameter
"ao_how" in Xen 4.12. libvirt does not use this parameter.

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Olaf Hering
06393ff7d3 libxl: add API wrapper for libxl_set_vcpuonline
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_set_vcpuonline, which got a new parameter
"ao_how" in Xen 4.12. libvirt does not use this parameter.

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Olaf Hering
e8fd24d810 libxl: add API wrapper for libxl_get_free_memory
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_get_free_memory, which changed storage size of parameter
"memkb" in Xen 4.8.

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Olaf Hering
0acd258e2e libxl: add API wrapper for libxl_domain_need_memory
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_domain_need_memory, which changed the storage size of
"need_memkb" in Xen 4.8. With Xen 4.12 the libxl_domain_config
parameter was changed

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Olaf Hering
9960337cd6 libxl: add API wrapper for libxl_domain_unpause
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_domain_unpause, which got a new parameter
"ao_how" in Xen 4.12. libvirt does not use this parameter.

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Olaf Hering
c44c970aa8 libxl: add API wrapper for libxl_domain_pause
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_domain_pause, which got a new parameter
"ao_how" in Xen 4.12. libvirt does not use this parameter.

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Olaf Hering
439942f395 libxl: add API wrapper for libxl_domain_reboot
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_domain_reboot, which got a new parameter
"ao_how" in Xen 4.12. libvirt does not use this parameter.

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Olaf Hering
f8a890a6a4 libxl: add API wrapper for libxl_domain_shutdown
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_domain_shutdown, which got a new parameter
"ao_how" in Xen 4.12. libvirt does not use this parameter.

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00