]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
3 years agoqemu: Check usage count of qemu:override node
Justin Gatzen [Thu, 21 Apr 2022 01:48:03 +0000 (21:48 -0400)]
qemu: Check usage count of qemu:override node

When <qemu:override> is the only usage of the qemu namespace the entire
section is mistakenly removed. Add check for use count.

Signed-off-by: Justin Gatzen <justin.gatzen@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu_processpriv: Fix #error message
Michal Privoznik [Thu, 14 Apr 2022 12:04:02 +0000 (14:04 +0200)]
qemu_processpriv: Fix #error message

The point of qemu_processpriv.h file is to allow a small subset
of functions to be called from test suite but not elsewhere. This
is implemented by requiring everybody that includes the file to
define a macro. If not done so, an error is printed at compile
time. However, this error message contains a typo because it
mentions qemu_process_priv.h while the file is called
qemu_processpriv.h.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoapparmor: Allow swtpm to use its own apparmor profile
Lena Voytek [Wed, 13 Apr 2022 21:21:19 +0000 (14:21 -0700)]
apparmor: Allow swtpm to use its own apparmor profile

Signed-off-by: Lena Voytek <lena.voytek@canonical.com>
3 years agodomain_cgroup: Fix a condition in virDomainCgroupConnectCgroup()
Michal Privoznik [Tue, 19 Apr 2022 15:22:22 +0000 (17:22 +0200)]
domain_cgroup: Fix a condition in virDomainCgroupConnectCgroup()

While parts of QEMU's CGroup code were moved under hypervisor
agnostic location (src/hypervisor/) a typo sneaked in. The
inspiration for virDomainCgroupConnectCgroup() comes from
qemuConnectCgroup(). The former is called upon reconnecting to a
running domain (after daemon restart). While the latter returned
early if the daemon was running unprivileged, the former returns
early if the daemon runs privileged. This is obviously wrong,
because root can set up CGroups.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075765
Fixes: 788e2b58cb1896f1c25ebbdbde4bafddc5ed4dc9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoFix copy-paste error in virNetServerSetClientAuthenticated
Tim Wiederhake [Tue, 19 Apr 2022 15:07:07 +0000 (17:07 +0200)]
Fix copy-paste error in virNetServerSetClientAuthenticated

Fixes: db16792aa90cab5c9886fc2990ec13fbb20a3fb5
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'formatnode' page to rst
Peter Krempa [Fri, 8 Apr 2022 08:25:27 +0000 (10:25 +0200)]
docs: Convert 'formatnode' page to rst

The conversion also included a change to the layout of the document.
Specifically the individual 'capabilty' types are now separated under
individual headings rather than part of the original definition list.

This reduces nesting but also esures that proper anchors are generated
automatically.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'formatnetwork' page to rst
Peter Krempa [Fri, 8 Apr 2022 08:25:27 +0000 (10:25 +0200)]
docs: Convert 'formatnetwork' page to rst

Additionally hyperlinks in other parts of the documentation are updated
to match.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'formatcaps' page to rst
Peter Krempa [Fri, 8 Apr 2022 08:25:27 +0000 (10:25 +0200)]
docs: Convert 'formatcaps' page to rst

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'formatnwfilter' page to rst
Pavel Hrdina [Thu, 25 Mar 2021 15:02:59 +0000 (16:02 +0100)]
docs: Convert 'formatnwfilter' page to rst

Also adjust direct links from other pages.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: pci-hotplug: Fix local anchor links
Peter Krempa [Wed, 13 Apr 2022 13:27:49 +0000 (15:27 +0200)]
docs: pci-hotplug: Fix local anchor links

Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: kbase/tlscerts: Fix local anchor links
Peter Krempa [Wed, 13 Apr 2022 13:27:49 +0000 (15:27 +0200)]
docs: kbase/tlscerts: Fix local anchor links

Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: kbase/launch_security_sev: Fix local anchor links
Peter Krempa [Wed, 13 Apr 2022 13:27:49 +0000 (15:27 +0200)]
docs: kbase/launch_security_sev: Fix local anchor links

Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: drvsecret: Fix local anchor links
Peter Krempa [Wed, 13 Apr 2022 13:27:49 +0000 (15:27 +0200)]
docs: drvsecret: Fix local anchor links

Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: drvnodedev: Fix local anchor links
Peter Krempa [Wed, 13 Apr 2022 13:27:49 +0000 (15:27 +0200)]
docs: drvnodedev: Fix local anchor links

Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: drvesx: Fix local anchor links
Peter Krempa [Wed, 13 Apr 2022 13:27:49 +0000 (15:27 +0200)]
docs: drvesx: Fix local anchor links

Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: drvbhve: Fix local anchor links
Peter Krempa [Wed, 13 Apr 2022 13:27:49 +0000 (15:27 +0200)]
docs: drvbhve: Fix local anchor links

Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: drivers: Fix local anchor links
Peter Krempa [Wed, 13 Apr 2022 13:27:49 +0000 (15:27 +0200)]
docs: drivers: Fix local anchor links

Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: api: Fix local anchor links
Peter Krempa [Wed, 13 Apr 2022 13:27:49 +0000 (15:27 +0200)]
docs: api: Fix local anchor links

Original conversion didn't properly convert local links. Fix them by
pointing to the section name. In certain cases this requires
reformulation of the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: meson: Sort list of RST files to build
Peter Krempa [Wed, 13 Apr 2022 12:26:17 +0000 (14:26 +0200)]
docs: meson: Sort list of RST files to build

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: Retire QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT
Andrea Bolognani [Fri, 15 Apr 2022 13:22:44 +0000 (15:22 +0200)]
qemu: Retire QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Stop setting QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT
Andrea Bolognani [Fri, 15 Apr 2022 13:21:55 +0000 (15:21 +0200)]
qemu: Stop setting QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Assume QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT
Andrea Bolognani [Fri, 15 Apr 2022 13:21:00 +0000 (15:21 +0200)]
qemu: Assume QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT

All QEMU versions we support have this feature.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Retire QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT
Andrea Bolognani [Fri, 15 Apr 2022 13:17:01 +0000 (15:17 +0200)]
qemu: Retire QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Stop setting QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT
Andrea Bolognani [Fri, 15 Apr 2022 13:16:56 +0000 (15:16 +0200)]
qemu: Stop setting QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Assume QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT
Andrea Bolognani [Fri, 15 Apr 2022 13:09:48 +0000 (15:09 +0200)]
qemu: Assume QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT

All QEMU versions we support have this feature.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agotests: Drop pseries-machine-max-cpu-compat
Andrea Bolognani [Fri, 15 Apr 2022 13:08:34 +0000 (15:08 +0200)]
tests: Drop pseries-machine-max-cpu-compat

This was supposed to test the behavior when
QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT is present, but these
days that's always the case and pseries-cpu-compat already
provides all the coverage we need.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoutil: Fix stubs for virProcessGet{Stat,Sched}Info()
Andrea Bolognani [Fri, 15 Apr 2022 13:58:27 +0000 (15:58 +0200)]
util: Fix stubs for virProcessGet{Stat,Sched}Info()

Commit d73852c49962 moved the original QEMU-specific helpers to
the utils module, which resulted in build failures on non-Unix
platforms due to the unconditional use of Unix-only symbols such
as _SC_CLK_TCK.

To deal with that situation, commit d7c64453aa0e made the helpers
Linux-only and added stubs for other platforms that, when called,
would always fail with ENOSYS.

However the original helpers had been carefully written so that,
while they would only be able to produce useful output on Linux,
they would still succeed on the other Unix platforms where we
build the QEMU driver.

Restore the original behavior so that calling APIs such as
virDomainGetInfo() can once again work on FreeBSD and macOS.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/298
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: Fetch info on NVDIMM-s too when updating memory devices
Michal Privoznik [Tue, 19 Apr 2022 08:41:07 +0000 (10:41 +0200)]
qemu: Fetch info on NVDIMM-s too when updating memory devices

Sometimes it may come handy to learn what address is a NVDIMM
mapped to inside a guest. While users can provide an address they
want to have NVDIMM mapped to, it's optional. Fortunately, when a
domain is being started we issue the 'query-memory-devices'
monitor command and the reply is the same for 'dimm' and 'nvdimm'
types. Therefore, updating NVDIMM address is trivial.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovz_driver: Use automatic mutex management
Tim Wiederhake [Mon, 4 Apr 2022 09:03:51 +0000 (11:03 +0200)]
vz_driver: Use automatic mutex management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agosecurity_manager: Use automatic mutex management
Tim Wiederhake [Mon, 4 Apr 2022 08:56:21 +0000 (10:56 +0200)]
security_manager: Use automatic mutex management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetserverclient: Use automatic mutex management
Tim Wiederhake [Mon, 4 Apr 2022 09:37:35 +0000 (11:37 +0200)]
virnetserverclient: Use automatic mutex management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirnetserver: Use automatic mutex management
Tim Wiederhake [Tue, 12 Apr 2022 11:28:51 +0000 (13:28 +0200)]
virnetserver: Use automatic mutex management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNetServerProcessClients: Remove goto
Tim Wiederhake [Tue, 12 Apr 2022 11:05:19 +0000 (13:05 +0200)]
virNetServerProcessClients: Remove goto

This gets rid of the goto and prepares the function for automatic
mutex management.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirstorageobject: Use automatic mutex management
Tim Wiederhake [Mon, 11 Apr 2022 09:57:51 +0000 (11:57 +0200)]
virstorageobject: Use automatic mutex management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirStorageVolObjNew: Move locking to usage site
Tim Wiederhake [Mon, 11 Apr 2022 13:59:36 +0000 (15:59 +0200)]
virStorageVolObjNew: Move locking to usage site

This allows a later patch to replace virObjectLock/Unlock
pairs with automatic mutex management code.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirStorageVolObjEndAPI: Remove
Tim Wiederhake [Mon, 11 Apr 2022 11:36:44 +0000 (13:36 +0200)]
virStorageVolObjEndAPI: Remove

This allows a later patch to replace virObjectLock/Unlock
pairs with automatic mutex management code.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirStoragePoolObjAddVol: Simplify error path
Tim Wiederhake [Mon, 11 Apr 2022 11:27:41 +0000 (13:27 +0200)]
virStoragePoolObjAddVol: Simplify error path

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirstorageobj: Replace deprecated virHash functions
Tim Wiederhake [Mon, 11 Apr 2022 14:52:34 +0000 (16:52 +0200)]
virstorageobj: Replace deprecated virHash functions

Checking for duplicate / NULL keys beforehand will simplify error
handling in a later patch significantly.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoci: Drop openSUSE Leap 15.2
Andrea Bolognani [Tue, 12 Apr 2022 15:21:45 +0000 (17:21 +0200)]
ci: Drop openSUSE Leap 15.2

It has reached end of life in January 2022.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoci: Move codestyle job to openSUSE Leap 15.3
Andrea Bolognani [Tue, 12 Apr 2022 15:29:05 +0000 (17:29 +0200)]
ci: Move codestyle job to openSUSE Leap 15.3

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoci: Add openSUSE Leap 15.3
Andrea Bolognani [Tue, 12 Apr 2022 15:22:24 +0000 (17:22 +0200)]
ci: Add openSUSE Leap 15.3

It was released in June 2021.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoci: Add Alpine Linux 3.15
Andrea Bolognani [Tue, 12 Apr 2022 16:59:40 +0000 (18:59 +0200)]
ci: Add Alpine Linux 3.15

It was released in November 2021.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoci: Simplify Alpine Linux 3.14 definition
Andrea Bolognani [Tue, 12 Apr 2022 16:57:20 +0000 (18:57 +0200)]
ci: Simplify Alpine Linux 3.14 definition

Using the extended definition format is only necessary when
the defaults are not good enough, but that's not the case here.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoci: Drop FreeBSD -CURRENT
Andrea Bolognani [Tue, 12 Apr 2022 16:56:23 +0000 (18:56 +0200)]
ci: Drop FreeBSD -CURRENT

All build jobs for the target are explicitly disabled, so
there's no point in keeping the variables file around and we
can simply not mention it in the manifest at all.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agodocs: Fix spelling for Homebrew
Andrea Bolognani [Thu, 14 Apr 2022 09:54:28 +0000 (11:54 +0200)]
docs: Fix spelling for Homebrew

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
3 years agoqemu: fix one more race on undefining and create
Nikolay Shirokovskiy [Tue, 28 Mar 2017 09:22:14 +0000 (12:22 +0300)]
qemu: fix one more race on undefining and create

[1] closes gap in virDomainObjListRemove so that concurrent thread can
not step in and obtain the domain while domain is temporary unlocked. But
there is another gap exist:

thread B - executes create API
thread C - executes undefine API

- thread A executes some job on domain
- threads B and C obtains domain from list and wait for job condition
- thread A finishes its job and C grabs job condition, removes domain
  from list and finishes
- thread B grabs job condition and start the domain, unfortunately
  is not in the list already

[1] commit c7d1c139ca3402e875002753952e80ce8054374e
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Thu Dec 11 11:14:08 2014 +0100

    qemu: avoid rare race when undefining domain

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: drop needless acquiring job removing domain
Nikolay Shirokovskiy [Tue, 12 Apr 2022 12:34:09 +0000 (15:34 +0300)]
qemu: drop needless acquiring job removing domain

Acquiring job introduced in commit [1] to fix a race described in the
commit. Actually it does not help because we get domain in create API
before acuiring job. Then [2] fixed the race but [1] was not reverted even
it is does not required by [2] to work properly.

[1] commit b629c64e5e0a32ef439b8eeb3a697e2cd76f3248
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Thu Oct 30 14:38:35 2014 +0100

    qemu: avoid rare race when undefining domain

[2] commit c7d1c139ca3402e875002753952e80ce8054374e
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Thu Dec 11 11:14:08 2014 +0100

    qemu: avoid rare race when undefining domain

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: cleanup code to relece SPICE ports
Nikolay Shirokovskiy [Tue, 12 Apr 2022 06:58:11 +0000 (09:58 +0300)]
qemu: cleanup code to relece SPICE ports

SPICE ports cleanup looks overly complicated. We can just set *reserved
flags whenever port is reserved (auto or non auto).

Also *Reserved flags are not cleared on stop in case of reconnect with
autoport (flags are set on reconnect in qemuProcessGraphicsReservePorts
call). Yeah config is freed in the end of stopping domain but still.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: cleanup code to release VNC websocket port
Nikolay Shirokovskiy [Mon, 11 Apr 2022 13:43:58 +0000 (16:43 +0300)]
qemu: cleanup code to release VNC websocket port

VNC websocket port cleanup looks a bit repetetive. Let's set websocketReserved
flag whenever we reserve port (auto or not).

Also websocketReserved flag is not cleared on stop in case of reconnect with
auto port (flags is set on reconnect in qemuProcessGraphicsReservePorts
call). Yeah config is freed in the end of stopping domain but still.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: fix releasing VNC websocket port domain does not own
Nikolay Shirokovskiy [Mon, 11 Apr 2022 12:25:25 +0000 (15:25 +0300)]
qemu: fix releasing VNC websocket port domain does not own

Scenario is with two domains with same VNC websocket port.

- start first domain
- start second, it will fail as port is occupied

As a result port will be released which breaks port reservation logic.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agoqemu: cleanup code to release VNC port
Nikolay Shirokovskiy [Mon, 11 Apr 2022 12:02:42 +0000 (15:02 +0300)]
qemu: cleanup code to release VNC port

Code to release VNC port looks repetitive. The reason is there were
originally 2 functions to release ports - for auto and non-auto cases.

Also portReserved flag is not cleared on stop in case of reconnect with
auto port (flags is set on reconnect in qemuProcessGraphicsReservePorts call).
Yeah config is freed in the end of stopping domain but still.

Let's use this flag whenever we reserve port (auto or not). This makes
things clearer.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agodocs: Adapt to semantic tag usage of docutils-0.17 and later
Peter Krempa [Tue, 12 Apr 2022 11:00:45 +0000 (13:00 +0200)]
docs: Adapt to semantic tag usage of docutils-0.17 and later

Docutils-0.17 switched to using <main> instead of a <div
class='document'> and <section> instead of <div class='section'>.

To ensure that our pages still work we need to slightly adapt our XSL
stylesheet to select the <main> tag properly and adapt the CSS to also
select the 'section' element instead of a class and to apply to a <main>
tag with the appropriate names.

Docutils-0.17 also changed to use 'h2' for section heading instead of
'h1'.

Note the styles applied to the 'main' element with certain id can't be
made more universal by just applying to the id itself, as in certain
cases (e.g. 'documentation') we also have sections with that name. This
was previously ensured by also matching the 'document' class which would
make it equal to the 'main' element.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agodocs/css: Simplify selector for heading of 'knowledge-base' and 'documentation' pages
Peter Krempa [Tue, 12 Apr 2022 11:33:00 +0000 (13:33 +0200)]
docs/css: Simplify selector for heading of 'knowledge-base' and 'documentation' pages

Select direct 'h1' children of elements named 'knowledge-base' and
'documentation. It's simpler and will also work properly with
docutils-0.17 and later where we don't have a div with class 'document'
wrapping everything.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
3 years agodocs: man: Add description of 'calc_mode' and 'vcpu.<num>.megabytes_per_second' dirty...
Peter Krempa [Tue, 12 Apr 2022 12:05:39 +0000 (14:05 +0200)]
docs: man: Add description of 'calc_mode' and 'vcpu.<num>.megabytes_per_second' dirtyrate mode

Commit 42d36b65a31 added new fields to the API docs but didn't add the
virsh man page equivalent.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2073867
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: kbase: internals: Make 'overview' page useful and link to it
Peter Krempa [Thu, 7 Apr 2022 12:08:41 +0000 (14:08 +0200)]
docs: kbase: internals: Make 'overview' page useful and link to it

While the content is slightly outdated it's still a good primer on how
an API call traverses through the client library and to the remote
driver.

To make the page useful, this commit:
 - removes the paragraphs which were intended to serve as a directory
   page for the 'internals' subdirectory
 - adds a note saying that some facts might not be up to date
 - adds linking to this page from the kbase directory page
 - adds more monospace formatting around function names

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'internals' to RST and move it to 'kbase/internal/overview.rst'
Peter Krempa [Mon, 4 Apr 2022 14:14:32 +0000 (16:14 +0200)]
docs: Convert 'internals' to RST and move it to 'kbase/internal/overview.rst'

Note that this document was not referenced from any top level page. This
patch does a straight conversion and leaves it unreferenced.

Next patch will then modify it to serve as an overview (hence the new
name) of how an API call happens.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Remove empty 'internals' subfolder
Peter Krempa [Wed, 6 Apr 2022 14:42:19 +0000 (16:42 +0200)]
docs: Remove empty 'internals' subfolder

All documents were now moved away so we don't need this any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'internals/rpc' page to RST and move it to 'kbase/internals'
Peter Krempa [Tue, 5 Apr 2022 11:58:56 +0000 (13:58 +0200)]
docs: Convert 'internals/rpc' page to RST and move it to 'kbase/internals'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'internals/locking' page to rst and move it to 'kbase/internals'
Peter Krempa [Tue, 5 Apr 2022 11:58:56 +0000 (13:58 +0200)]
docs: Convert 'internals/locking' page to rst and move it to 'kbase/internals'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'internals/eventloop' page to rst and move it to 'kbase/internals'
Peter Krempa [Tue, 5 Apr 2022 11:58:56 +0000 (13:58 +0200)]
docs: Convert 'internals/eventloop' page to rst and move it to 'kbase/internals'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'internals/command' to rst and move it to 'kbase/internals'
Peter Krempa [Tue, 5 Apr 2022 11:58:56 +0000 (13:58 +0200)]
docs: Convert 'internals/command' to rst and move it to 'kbase/internals'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'docs' index page to rst
Peter Krempa [Mon, 4 Apr 2022 14:14:31 +0000 (16:14 +0200)]
docs: Convert 'docs' index page to rst

Along with the conversion we need to adapt the stylesheets to apply to
the new document similarly to how we do that in the knowledge base.

Note that one visible difference is that now a 'Documentation' heading
is visible on top of the page.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: kbase: Section of 'internals' documents into a subfolder
Peter Krempa [Tue, 5 Apr 2022 11:27:42 +0000 (13:27 +0200)]
docs: kbase: Section of 'internals' documents into a subfolder

Add an 'internals' subfolder to 'docs/kbase' to house all the documents
under internals. The output files are still under 'docs/kbase'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Simplify passing of 'href_base' XSL variable
Peter Krempa [Tue, 5 Apr 2022 14:52:57 +0000 (16:52 +0200)]
docs: Simplify passing of 'href_base' XSL variable

Historically we had two top level XSL files for top level and nested
documents which only differ in what they pass for 'href_base' to the
main 'page.xsl' file.

We can instead pass the variable as argument from the build system so
that we have just one XSL file and also allow for more nested document
trees in the future.

The '404' page is special even with the current XSL way so we add a
special case for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agokbase: index: Split off 'internals' section
Peter Krempa [Tue, 5 Apr 2022 11:17:30 +0000 (13:17 +0200)]
kbase: index: Split off 'internals' section

Add a separate column of documents regarding internals of libvirt and
move the 'migrationinternals' and 'incrementalbackupinternals' pages
under the new heading.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoconf: Move validation checks from virDomainDiskDefIotuneParse into domain_validate.c
Moteen Shah [Mon, 11 Apr 2022 12:40:49 +0000 (18:10 +0530)]
conf: Move validation checks from virDomainDiskDefIotuneParse into domain_validate.c

Move validation from virDomainDiskDefIotuneParse into the validation callback.

Signed-off-by: Moteen Shah <codeguy.moteen@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirsh: fix event registration for single event
Ján Tomko [Mon, 11 Apr 2022 07:30:12 +0000 (09:30 +0200)]
virsh: fix event registration for single event

Allocate a larger 'data' array than strictly needed
for simplicity and use 'ndata' as the index when
filling it to put the single event at the first unused
place, instead of at its index in the virshDomainEventCallbacks
array.

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

Fixes: c6bb2746933bbe65877a5f8a8d60e100b0bf8a59
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonwfilterStateInitialize: Simplify and fix error handling
Tim Wiederhake [Fri, 8 Apr 2022 11:54:09 +0000 (13:54 +0200)]
nwfilterStateInitialize: Simplify and fix error handling

Under certain circumstances nwfilterStateInitialize could leak memory:
If e.g. the call to virNWFilterConfLayerInit fails, the error path
err_techdrivers_shutdown does not free the previously allocated memory
held in driver->stateDir.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNWFilterDriverState: Destroy mutex safely
Tim Wiederhake [Fri, 8 Apr 2022 11:46:23 +0000 (13:46 +0200)]
virNWFilterDriverState: Destroy mutex safely

Allow nwfilterStateCleanupLocked to be called on a partially constructed
driver object.

This enables the next patch to simplify and fix error handling in
nwfilterStateInitialize.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonwfilterDriverRemoveDBusMatches: Prevent unsubscribing from null id
Tim Wiederhake [Fri, 8 Apr 2022 11:42:30 +0000 (13:42 +0200)]
nwfilterDriverRemoveDBusMatches: Prevent unsubscribing from null id

Allow nwfilterDriverRemoveDBusMatches to be called without
nwfilterDriverInstallDBusMatches being called previously.

This enables a later patch to use nwfilterDriverRemoveDBusMatches
as a cleanup function safely.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNWFilterSnoopState: Prevent mutex leak
Tim Wiederhake [Fri, 8 Apr 2022 10:50:35 +0000 (12:50 +0200)]
virNWFilterSnoopState: Prevent mutex leak

virNWFilterDHCPSnoopShutdown would never destroy the mutexes created
in virNWFilterDHCPSnoopInit. Additionally, if in virNWFilterDHCPSnoopInit
the call to virMutexInitRecursive succeeds and the call to virMutexInit
fails, this would lead to either virNWFilterSnoopState.snoopLock being
initialized twice or virNWFilterSnoopState.activeLock destroyed without
being initialized first.

This enables a later patch to use virNWFilterDHCPSnoopShutdown as a
cleanup function safely, as it is a no-op if virNWFilterSnoopState was
not yet initialized.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirNWFilterObjListFree: Prevent null pointer derefernce
Tim Wiederhake [Fri, 8 Apr 2022 10:38:14 +0000 (12:38 +0200)]
virNWFilterObjListFree: Prevent null pointer derefernce

Allow virNWFilterObjListFree to be called with a NULL argument.
This enables a later patch to use virNWFilterObjListFree as a
cleanup function safely, as it is a no-op if virNWFilterObj was
not yet initialized.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: Drop QEMU_CAPS_INCOMING_DEFER
Jiri Denemark [Thu, 7 Apr 2022 16:04:38 +0000 (18:04 +0200)]
qemu: Drop QEMU_CAPS_INCOMING_DEFER

The capability is not used anymore since "-incoming defer" is supported
by all QEMU versions we care about.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: Simplify qemuProcessIncomingDef
Jiri Denemark [Thu, 7 Apr 2022 15:30:20 +0000 (17:30 +0200)]
qemu: Simplify qemuProcessIncomingDef

All QEMU releases currently supported by libvirt already understand
"-incoming defer". We can drop the code handling "-incoming URI".

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agovboxSetBootDeviceOrder: Remove whitespace alignment in VIR_DEBUG statements
Peter Krempa [Mon, 28 Mar 2022 14:15:12 +0000 (16:15 +0200)]
vboxSetBootDeviceOrder: Remove whitespace alignment in VIR_DEBUG statements

Don't try to align the output, it's not future-proof and it's for
debugging only.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainLoaderDefFormat: Use modern XML formatting approach
Peter Krempa [Mon, 28 Mar 2022 13:18:39 +0000 (15:18 +0200)]
virDomainLoaderDefFormat: Use modern XML formatting approach

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirXMLFormatElement: Introduce virXMLFormatElementInternal
Peter Krempa [Mon, 28 Mar 2022 14:00:58 +0000 (16:00 +0200)]
virXMLFormatElement: Introduce virXMLFormatElementInternal

The new function aggregates the internal working of virXMLFormatElement
and virXMLFormatElementEmpty and also allows skipping the newline
after the opening tag to allow using this helper also in cases where we
don't format any child elements but directly a value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodrivers: Group global features together
Andrea Bolognani [Wed, 16 Feb 2022 17:50:42 +0000 (18:50 +0100)]
drivers: Group global features together

All these features are supposed to be handled by the call to
virDriverFeatureIsGlobal() placed right above the switch
statement, so if any of them is actually encountered inside
the switch statement it means there's a bug in the driver and
we should report an error.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'formatstoragecaps' page to rST
Peter Krempa [Thu, 10 Mar 2022 16:57:54 +0000 (17:57 +0100)]
docs: Convert 'formatstoragecaps' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agodocs: Convert 'formatdomaincaps' to rST
Peter Krempa [Thu, 10 Mar 2022 16:57:53 +0000 (17:57 +0100)]
docs: Convert 'formatdomaincaps' to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
3 years agoci: Refresh Dockerfiles and vars files
Erik Skultety [Wed, 6 Apr 2022 11:14:56 +0000 (13:14 +0200)]
ci: Refresh Dockerfiles and vars files

In this batch:
- dnsmasq is dropped as build dependency
- Alpine Edge rpcgen package collision fix

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: convert 'csharp' page to rst
Peter Krempa [Mon, 4 Apr 2022 12:49:54 +0000 (14:49 +0200)]
docs: convert 'csharp' page to rst

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agodocs: csharp: Remove project-specific information
Peter Krempa [Mon, 4 Apr 2022 12:13:37 +0000 (14:13 +0200)]
docs: csharp: Remove project-specific information

The enumeration of functions and types supported by the bindings was
moved to the 'README.rst' file in the 'libvirt-csharp' repo:

https://gitlab.com/libvirt/libvirt-csharp/-/merge_requests/8

Remove the corresponding bits from the main repository.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agodocs: convert 'windows' page to rst
Pavel Hrdina [Thu, 25 Mar 2021 17:08:51 +0000 (18:08 +0100)]
docs: convert 'windows' page to rst

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agodocs: Move 'tlscerts' page to 'kbase/'
Peter Krempa [Mon, 4 Apr 2022 14:40:45 +0000 (16:40 +0200)]
docs: Move 'tlscerts' page to 'kbase/'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agodocs: convert 'tlscerts' page to rst
Pavel Hrdina [Thu, 25 Mar 2021 16:09:04 +0000 (17:09 +0100)]
docs: convert 'tlscerts' page to rst

Note that links from the first table leading to sections of this
document further below were removed for simplicity.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agodocs: convert 'python' page to rst
Pavel Hrdina [Thu, 25 Mar 2021 15:58:44 +0000 (16:58 +0100)]
docs: convert 'python' page to rst

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agodocs: convert 'dbus' page to rst
Pavel Hrdina [Tue, 23 Mar 2021 23:10:39 +0000 (00:10 +0100)]
docs: convert 'dbus' page to rst

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3 years agolib: Set up cpuset controller for restrictive numatune
Michal Privoznik [Fri, 1 Apr 2022 12:30:05 +0000 (14:30 +0200)]
lib: Set up cpuset controller for restrictive numatune

The aim of 'restrictive' numatune mode is to rely solely on
CGroups to have QEMU running on configured NUMA nodes.  However,
we were never setting the cpuset controller when a domain was
starting up. We are doing so only when
virDomainSetNumaParameters() is called (aka live pinning).

This is obviously wrong. Fortunately, fix is simple as
'restrictive' is similar to 'strict' - every location where
VIR_DOMAIN_NUMATUNE_MEM_STRICT occurs can be audited and
VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE case can be added.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2070380
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoch: Explicitly forbid live changing nodeset for strict numatune
Michal Privoznik [Fri, 1 Apr 2022 13:35:58 +0000 (15:35 +0200)]
ch: Explicitly forbid live changing nodeset for strict numatune

This is similar to v7.10.0-354-g06f405c627 except this time it
fixes CH driver.

With strict numatune we can't guarantee that all memory is moved
to new location. Therefore, let's forbid moving memory in that
case. However, allow it for restrictive mode, which is documented
to be best effort.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agohypervisor: Drop dead code in virDomainCgroupSetupGlobalCpuCgroup()
Michal Privoznik [Fri, 1 Apr 2022 11:14:59 +0000 (13:14 +0200)]
hypervisor: Drop dead code in virDomainCgroupSetupGlobalCpuCgroup()

Since its introduction in v1.3.2-43-gef1fa55e46 there is a dead
code in virDomainCgroupSetupGlobalCpuCgroup() (well,
qemuSetupGlobalCpuCgroup() back then). The code formats NUMA
nodeset but never sets it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolib: Don't short circuit around virDomainCgroupSetupVcpuBW()
Michal Privoznik [Fri, 1 Apr 2022 11:13:10 +0000 (13:13 +0200)]
lib: Don't short circuit around virDomainCgroupSetupVcpuBW()

The virDomainCgroupSetupVcpuBW() is a NOP if both period and
quota to set are zero. There's no need to check in all the
callers for this special case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolib: Use virReportSystemError() more
Michal Privoznik [Tue, 29 Mar 2022 08:10:59 +0000 (10:10 +0200)]
lib: Use virReportSystemError() more

Instead of reporting virReportError(..., g_strerror(), ...) let's
use proper virReportSystemError(). Generated with help of cocci:

  @@
  expression c;
  @@
      <...
  -   virReportError(c,
  +   virReportSystemError(errno,
                         ...,
  -                      g_strerror(errno),
                         ...);
      ...>

But then I had to hand fix format strings, because I'm not sure
if cocci even knows how to do that. And even if it did, I surely
don't.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotools: snapshot: remove pointless checks
Ján Tomko [Fri, 1 Apr 2022 13:11:01 +0000 (15:11 +0200)]
tools: snapshot: remove pointless checks

There's no need to check whether a flag is not set just to set it
in that case.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3 years agoqemu: Rename @main variable in qemuDomainRemoveLogs()
Michal Privoznik [Wed, 6 Apr 2022 08:10:24 +0000 (10:10 +0200)]
qemu: Rename @main variable in qemuDomainRemoveLogs()

Older GCC fails to understand that 'char *main' is a variable and
not main() function. Rename the variable to appease old GCC.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
3 years agoAUTHORS: change my (Nikolay Shirokovskiy) email
Nikolay Shirokovskiy [Wed, 6 Apr 2022 07:56:10 +0000 (10:56 +0300)]
AUTHORS: change my (Nikolay Shirokovskiy) email

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
3 years agotools: support --remove-logs flag on destroing domain
Nikolay Shirokovskiy [Mon, 14 Feb 2022 12:19:53 +0000 (15:19 +0300)]
tools: support --remove-logs flag on destroing domain

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoqemu: support VIR_DOMAIN_DESTROY_REMOVE_LOGS flag
Nikolay Shirokovskiy [Mon, 14 Feb 2022 12:19:52 +0000 (15:19 +0300)]
qemu: support VIR_DOMAIN_DESTROY_REMOVE_LOGS flag

Note that we attempt to remove logs only if virtlogd is in use.
Otherwise we do not know the pattern for rotated files.

For example for VM named "foo" we can not use "foo.log*" pattern to
remove rotated logs as we can have VM named "foo.log" with log
"foo.log.log".  We can add extra check that filename does not end with
".log" but for VM "foo.log" we can have rotated log "foo.log.log.1". Ok
let's check we don't have "log" in filename part corresponging to * but
what if someone will use logrotate with "%Y.log-%m-%d" 'dateformat'
option. In this case the check will exclude proper rotated files.

Yes, the last example if quite artificial but it shows it is difficult
to find out correctly rotated files when rotated files pattern is not
known. Thus the above decision only to support case with virtlogd when
we know the pattern.

Another reason for not removing log files when logrotate is present is
that due to races some files can escape deletion. For example foo.log.3
will be rotated to foo.log.4 after removing function will read directory
files and thus foo.log.4 will not be deleted.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolibvirt: introduce VIR_DOMAIN_DESTROY_REMOVE_LOGS flag
Nikolay Shirokovskiy [Mon, 14 Feb 2022 12:19:51 +0000 (15:19 +0300)]
libvirt: introduce VIR_DOMAIN_DESTROY_REMOVE_LOGS flag

If this flag is set on calling virDomainDestroyFlags flags then remove
per domain logs if possible.

This can be used by libguestfs to delete logs for temporary domain.
Otherwise such logs will stay wasting disk resources.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirsh: Remove any reference of KVM device assignment
Michal Privoznik [Tue, 5 Apr 2022 08:38:47 +0000 (10:38 +0200)]
virsh: Remove any reference of KVM device assignment

The KVM device assignment was removed in v5.7.0-rc1~103 but virsh
and its manpage still mention it. Don't do that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>