Commit Graph

41433 Commits

Author SHA1 Message Date
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
Olaf Hering
17855c5ca0 libxl: add API wrapper for libxl_retrieve_domain_configuration
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_retrieve_domain_configuration, which got a new parameter
"libxl_asyncop_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
f2332e8f78 libxl: add API wrapper for libxl_domain_create_restore
Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_domain_create_restore, which got a new parameter
"send_back_fd" in Xen 4.7. 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
Jim Fehlig
ad3d6438fa tests: Fix qemuxml2xmltest with audio driver defined in env
If QEMU_AUDIO_DRV is defined in the build host environment, several tests
in qemuxml2xmltest fail.

$ env | grep -i audio
AUDIODRIVER=pulseaudio
QEMU_AUDIO_DRV=pa
SDL_AUDIODRIVER=pulse

An example test failure with the above environment

907) QEMU XML-2-XML-active video-virtio-gpu-sdl-gl
In 'libvirt/tests/qemuxml2xmloutdata/video-virtio-gpu-sdl-gl.xml':
Offset 1244
Expect [v]
Actual [audio id='1' type='pulseaudio'/>
    <v]

Scrub QEMU_AUDIO_DRV from the environment before executing the tests in
qemuxml2xmltest. SDL_AUDIODRIVER also needs scrubbed since it will be
examined if QEMU_AUDIO_DRV=sdl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-01 13:49:13 -06:00
Daniel P. Berrangé
8dac0ca1b2 qemu: implement setting of rotation rate for SCSI/IDE disks
This is available in QEMU with "ide-hd" and "scsi-hd" device
types. It was originally mistakenly added to the "scsi-block"
device type too, but later removed. This doesn't affect libvirt
since we restrict usage to device=disk.

When this property is not set then QEMU's default behaviour
is to not report any rotation rate information, which
causes most guest OS to assume rotational storage.

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

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-01 15:11:38 +01:00
Daniel P. Berrangé
feac14fa2e conf: add support for disk "rotation_rate" property
This lets the app expose the virtual SCSI or IDE disks as solid state
devices by setting a rate of '1', or rotational media by setting a
rate between 1025 and 65534.

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

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-01 15:11:38 +01:00
Daniel P. Berrangé
4e83722a60 run: fix flake8 violations
Two blank lines are needed either side of functions.

Comments must have a single space character immediately after
the "#".

The unused exception variable can be removed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-01 15:10:33 +01:00
Andrea Bolognani
457f4e6e1e meson: Don't check whether /usr/local/bin/grep is GNU grep
Since /usr/local is where ports live, it's reasonable to assume
that a grep binary found in there will have been installed via
ports and will thus be GNU grep.

Suggested-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-01 15:35:04 +02:00
Andrea Bolognani
8526abc454 meson: Look for GNU tools on macOS too
macOS is similar to FreeBSD in that it ships non-GNU versions
of several utilities that we need in the base system.

macOS actually includes GNU make already, but unfortunately due
to licensing reasons the tool is permanently stuck in 2006, so
even in that case users are better off installing a recent
version from Homebrew along with the dozens of other libvirt
dependencies that already need to be obtained that way.

Note that, unlike FreeBSD ports, Homebrew is fully consistent
in adding the 'g' prefix to the name of the GNU tools, so we
can detect GNU grep without additional hacks.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-01 15:34:54 +02:00
Andrea Bolognani
7cbcc9f888 meson: Check GNU sed's availability
As explained in the comment in build-aux/Makefile.in, the
version of sed included in the FreeBSD base system is not GNU
sed, which our syntax-check rules expect; as a result, many
checks will fail with

  gmake: gsed: No such file or directory
  /bin/sh: gsed: not found

Similarly to what we're already doing with GNU make and GNU
grep, look for GNU sed during the configuration step and fail
early if it's not available.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-01 14:14:28 +02:00
Andrea Bolognani
5254532e3a meson: Reorganize looking for programs
While this change doesn't look like it would improve things and
actually introduces a tiny bit of duplication, it's necessary in
order to prepares the stage for further changes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-01 14:14:25 +02:00
Andrea Bolognani
6a023e943e meson: Print custom message when GNU grep is not installed
Currently, if GNU grep is not installed on a FreeBSD system the
configuration step will fail with

  Program grep found: YES (/usr/bin/grep)
  Program /usr/local/bin/grep found: NO

  ERROR: Program '/usr/local/bin/grep' not found

which is confusing and not very useful; after this change, the
message will be

  Program grep found: YES (/usr/bin/grep)
  Program /usr/local/bin/grep found: NO

  ERROR: Problem encountered: GNU grep not found

instead, which should do a better job helping the user figure
out that they need to install GNU grep from ports to proceed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-01 14:14:20 +02:00
Andrea Bolognani
8e2b814ead ci: Call meson consistently
We should always pass --werror and display the contents of the
log file in case of failure.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-01 14:09:47 +02:00
Andrea Bolognani
3ad73d876e ci: Don't use --prefix with meson for Cirrus CI builds
It's no longer used.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-01 14:09:43 +02:00
simmon
9522f8e329 Translated using Weblate (Korean)
Currently translated at 30.5% (3236 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-01 13:37:07 +02:00
Kristina Hanicova
6336fcd9f8 XML <source bridge='VMnet0'/> update in <interface type='bridge'/>
Previously, we accepted empty bridge name, because some old versions of
VMWare Workstation did not put it into the config. But this doesn't make
much sense - to have an interface type bridge with no name. We
circumvented this problem by generating an empty name but that is
equally wrong.

Therefore, fill in missing bridge names (according to the documentation
[1] the default bridge name is VMnet0) and error out if bridge name is
missing.

This partially reverts f246cdb5ac

1: https://docs.vmware.com/en/VMware-Workstation-Player-for-Linux/16.0/com.vmware.player.linux.using.doc/GUID-BAFA66C3-81F0-4FCA-84C4-D9F7D258A60A.html

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-04-01 13:36:35 +02:00
Han Han
65c371fc69 docs: formatnetworkport: Fix typos
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-04-01 13:32:25 +02:00
Daniel P. Berrangé
f0bdd22aad build: teach run script how to temporarily stop systemd units
When testing locally built daemons on a systemd host there can be quite
a few systemd units that need temporarily stopping, and ideally
restarting after the test is complete. This becomes a massive burden
when modular daemons are running and you want to test libvirtd, as a
huge number of units need stopping.

The run script can facilitate this usage by looking at what units are
running and automatically stopping any that are known to conflict with
the daemon that is about to be run. This is only done when running as
root, since non-root libvirtd does not (currently) use systemd.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-01 11:33:36 +01:00
Daniel P. Berrangé
d9dd94711d build: convert the run script to use Python
This fits with the goal of eliminating non-Python scripting languages,
and makes forthcoming changes far easier.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-01 11:32:57 +01:00
Jiri Denemark
caaadd28a1 Post-release version bump to 7.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-04-01 12:21:23 +02:00
Jiri Denemark
21879df8c1 Release of libvirt-7.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-04-01 12:17:47 +02:00
Han Han
af35fa91be docs: Fix broken link in migrationinternals
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2021-03-31 20:09:38 +02:00
Andrea Bolognani
abc8696968 NEWS: Fix typo swtmp -> swtpm
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2021-03-31 19:13:57 +02:00
Michal Privoznik
976f0ed9e7 news: Update for upcoming release
Mention some of the stuff we dealt with in this release.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2021-03-31 17:14:39 +02:00
Peter Krempa
a3c8355f8b NEWS: Mention fix for exec-restart of virtlo(g|ck)d and 'object_add' improvements
Mention that libvirt-7.2 will be needed to do stuff that executes
'object-add'/'object-del' QMP commands with the upcoming qemu-6.0 and
that exec-restart of virtlockd and virtlogd was fixed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2021-03-30 14:00:17 +02:00
Daniel P. Berrangé
a9b1375d7d conf: remove duplicated firmware type attribute
The

  <os firmware='efi'>
    <firmware type='efi'>
      <feature enabled='no' name='enrolled-keys'/>
    </firmware>
  </os>

repeats the firmware attribute twice. This has no functional benefit, as
evidenced by fact that we use a single struct field to store both
attributes, while needlessly introducing an error scenario. The XML can
just be simplified to:

  <os firmware='efi'>
    <firmware>
      <feature enabled='no' name='enrolled-keys'/>
    </firmware>
  </os>

which also means that we don't need to emit the empty element
<firmware type='efi'/> for all existing configs too.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-30 10:19:42 +01:00
Michal Privoznik
cadfefd3ce qemu_driver: Acquire MODIFY job in qemuDomainStartDirtyRateCalc()
This API talks to QEMU and changes its internal state. Therefore,
it should acquire QEMU_JOB_MODIFY instead of QEMU_JOB_QUERY.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2021-03-30 10:05:10 +02:00
Daniel P. Berrangé
dfbe4f4c9b remote: don't allow dirty rate API with read permission
This API interacts with the hypervisor and makes changes to its
behaviour, so must be protected by the write permission.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-29 13:39:23 +01:00
Yuri Chornoivan
ac6d205bbd Translated using Weblate (Ukrainian)
Currently translated at 100.0% (10581 of 10581 strings)

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

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
2021-03-27 15:02:05 +01:00
Weblate
1c76fe02e2 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>
2021-03-27 15:02:03 +01:00
Ricky Tigg
977fa2c83a Translated using Weblate (Finnish)
Currently translated at 20.4% (2161 of 10545 strings)

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

Translated using Weblate (Finnish)

Currently translated at 20.2% (2140 of 10545 strings)

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

Translated using Weblate (Finnish)

Currently translated at 19.9% (2100 of 10545 strings)

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

Translated using Weblate (Finnish)

Currently translated at 19.1% (2020 of 10545 strings)

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

Translated using Weblate (Finnish)

Currently translated at 19.0% (2011 of 10545 strings)

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

Translated using Weblate (Finnish)

Currently translated at 19.0% (2011 of 10545 strings)

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

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
2021-03-27 15:01:59 +01:00
simmon
031cfc8887 Translated using Weblate (Korean)
Currently translated at 30.7% (3238 of 10545 strings)

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

Translated using Weblate (Korean)

Currently translated at 30.7% (3238 of 10545 strings)

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

Translated using Weblate (Korean)

Currently translated at 30.6% (3229 of 10545 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-03-27 15:01:58 +01:00
Jiri Denemark
bb966c28e7 po: Refresh potfile for v7.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-03-26 12:59:30 +01:00
Tim Wiederhake
c5d4d0198f qemuProcessUpdateGuestCPU: Check host cpu for forbidden features
See https://bugzilla.redhat.com/show_bug.cgi?id=1840770

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com
2021-03-26 11:40:55 +01:00
Tim Wiederhake
a839fcbe62 cpu: Introduce virCPUCheckForbiddenFeatures
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com
2021-03-26 11:40:52 +01:00
Tim Wiederhake
1e1db67836 virCPUDefFindFeature: Make first argument const ptr
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com
2021-03-26 11:40:39 +01:00
wangjian
59788a5cae node_device_udev: Serialize access to pci_get_strings)_
Since the functions provided by libpciaccess are not thread-safe,
when the udev-event and nodedev-init threads of libvirt call the
pci_get_strings function provided by libpaciaccess at the same
time the following can happen:

nodedev-init thread:
nodeStateInitializeEnumerate ->
  udevEnumerateDevices->
    udevProcessDeviceListEntry ->
      udevAddOneDevice ->
        udevGetDeviceDetails->
          udevProcessPCI ->
            udevTranslatePCIIds ->
              pci_get_strings -> (libpciaccess)
                find_device_name ->
                  populate_vendor ->
                    d = realloc( vend->devices, (vend->num_devices + 1), * sizeof( struct pci_device_leaf ) );
                    vend->num_devices++;

udev-event thread:
udevEventHandleThread ->
  udevHandleOneDevice ->
    udevAddOneDevice->
      udevGetDeviceDetails->
        udevProcessPCI ->
          udevTranslatePCIIds ->
            pci_get_strings -> (libpciaccess)
              find_device_name ->
                populate_vendor ->
                  d = realloc( vend->devices, (vend->num_devices + 1), * sizeof( struct pci_device_leaf ) );
                  vend->num_devices++;

Signed-off-by: WangJian <wangjian161@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-03-26 11:06:21 +01:00
Michal Privoznik
5f9330e724 lib: Undo some g_steal_pointer() changes
Recently, a few commits back I've switched bunch of code to
g_steal_pointer() using coccinelle. Problem was that the semantic
patch used was slightly off:

  @@
  expression a, b;
  @@

  + b = g_steal_pointer(&a);
  - b = a;
    ... when != a
  - a = NULL;

Problem is that, "... when != a" is supposed to jump over those
lines, which don't contain expression a. My idea was to replace
the following pattern too:

  ptrX = ptrY;
  if (something(ptrZ) < 0) goto error;
  ptrY = NULL;

But what I missed is that the following pattern is also matched
and replaced:

  ptrX = ptrY;
  if (something(ptrX) < 0) goto error;
  ptrY = NULL;

This is not necessarily correct - as demonstrated by our hotplug
code. The real problem is ambiguous memory ownership transfer
(functions which add device to domain def take ownership only on
success), but to not tackle the real issue let's revert those
parts.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-03-26 10:11:57 +01:00
Michal Privoznik
af09d7a37a virnetsocket: Revert part of g_steal_pointer() rewrite
Turns out, the way that glib implements g_steal_pointer() is not
compatible with function callbacks. And that's what my recent
patch did in virNetSocketEventFree(). Revert that part.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-03-26 10:11:57 +01:00
Andrea Bolognani
228a87d307 ci: Refresh information
Notable changes:

  * HAL is no longer installed on FreeBSD;

  * the native version of libwsman is no longer installed in
    containers intended for cross-compilation;

  * Meson 0.55 rather than 0.54 is requested when installing
    it from PyPI;

  * GNU sed and GNU grep are installed explicitly everywhere.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2021-03-26 09:17:22 +01:00
Michal Privoznik
ae1201fab4 vz: Add case for VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER
In one of my recent patches I've introduced new connection
feature VIR_DRV_FEATURE_NETWORK_UPDATE_HAS_CORRECT_ORDER.
However, I forgot to add corresponding case into a switch in
vzConnectSupportsFeature().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2021-03-25 13:01:09 +01:00
Michal Privoznik
b0f78d626a lib: Fix calling of virNetworkUpdate() driver callback
The order in which virNetworkUpdate() accepts @section and
@command arguments is not the same as in which it passes them
onto networkUpdate() callback. Until recently, it did not really
matter, because calling the API on client side meant arguments
were encoded in reversed order (compared to the public API), but
then on the server it was fixed again - because the server
decoded RPC (still swapped), called public API (still swapped)
and in turn called the network driver callback (with reversing
the order - so magically fixing the order).

Long story short, if the public API is called even number of
times those swaps cancel each other out. The problem is when the
API is called an odd numbed of times - which happens with split
daemons and the right URI. There's one call in the client (e.g.
virsh net-update), the other in a hypervisor daemon (say
virtqemud) which ends up calling the API in the virnetworkd.

The fix is obvious - fix the order in which arguments are passed
to the callback.

But, to maintain compatibility with older, yet unfixed, daemons
new connection feature is introduced. The feature is detected
just before calling the callback and allows client to pass
arguments in correct order (talking to fixed daemon) or in
reversed order (talking to older daemon).

Unfortunately, older client talking to newer daemon can't be
fixed. Let's hope that it's less frequent scenario.

Fixes: 574b9bc66b
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1870552
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-03-25 10:10:23 +01:00
Michal Privoznik
94741bc53e network: Implement virConnectSupportsFeature()
So far, it was not needed, but shortly a client will want to know
whether virNetworkUpdate() API is fixed or not. See next commits
for more info.

Side note, this driver's implementation is called only when using
sub-driver's connection, i.e. "network:///system". For any other
URI the corresponding hypervisor's driver callback is called.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-03-25 10:10:14 +01:00
Laine Stump
98e22ff749 qemu: increase locked memory limit when a vDPA device is present
Just like VFIO devices, vDPA devices may need to have all guest memory
pages locked/pinned in order to operate properly. In the case of VFIO
devices (including mdev and NVME, which also use VFIO) libvirt
automatically increases the locked memory limit when one of those
devices is present. This patch modifies that code to also increase the
limit if there are any vDPA devices present.

Resolves: https://bugzilla.redhat.com/1939776
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2021-03-24 15:06:08 -04:00
Laine Stump
e7068a0bc2 qemu: account for mdev devices in getPPC64MemLockLimitBytes()
This function is a specialized version of
qemuDomainGetMemLockLimitBytes() for PPC64. Simplifying it in the same
manner as the previous patch has the nice side effect of accounting
for the possibility of an mdev device

(I don't know if mdev devices are supported on PPC, but even if not
then a) the additional check for mdev devices gained by using
qemuDomainNeedsVFIO() in place of open coding will be an effective
NOP, and b) if mdev devices are supported on PPC64 in the future, this
function will be prepared for it).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2021-03-24 15:06:08 -04:00
Laine Stump
0789edc86a qemu: simplify qemuDomainGetMemLockLimitBytes()
This function goes through a loop checking if each hostdev is a VFIO
or mdev device, and then later it calls virDomainDefHasNVMEDisk(). The
function qemuDomainNeedsVFIO() does exactly the same thing, so let's
just call that instead.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2021-03-24 15:06:08 -04:00