Commit Graph

46812 Commits

Author SHA1 Message Date
Peter Krempa
a2c05f1a03 conf: domain: Move 'virDomainChrSourceReconnectDefParseXML'
Move the function in place of its forward declaration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:18 +02:00
Peter Krempa
6a86e47a6e virDomainNetDefParseXML: Extract network device model earlier
Move the code fetching the model of the net device before the main code
parsing individual device types so that the data is available before the
upcoming refactor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:18 +02:00
Peter Krempa
8b21305287 virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_DIRECT
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:18 +02:00
Peter Krempa
3dfb39e44f conf: domain: Convert 'mode' field of the 'direct' type of virDomainNetDef to proper type
Use 'virNetDevMacVLanMode'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:18 +02:00
Peter Krempa
61faa98546 virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_BRIDGE
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:18 +02:00
Peter Krempa
3b682a510b virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_INTERNAL
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:18 +02:00
Peter Krempa
c7ed55d389 virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_VDS
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
3387eae871 util: xml: Introduce virXMLPropLongLong
Add a helper for parsing long long values from XML properties with
semantics like virXMLPropInt.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
b50d8f0c1f virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_NETWORK
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
4736d3d617 virDomainNetDefParseXML: Convert parsing of 'source_node' to a switch() statement
Convert the individual 'if' clauses to a switch statement.

By moving the check that 'source_node' is non-null inside of each case
rather we will be able to move more type specific code into the switch
statement when it will be refactored in subsequent patches.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
65eaf58335 util: xml: Introduce virXMLPropStringRequired
Similarly to virXMLPropString it extracts a string but reports an error
similar to the newer virXMLProp helpers if the attribute is not present.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
4bab4de9b9 util: xml: Adjust documentation of virXMLPropString
All callers treat NULL as if the string is not present in the XML.
Adjust the description so that it's implied that it's not an error and
thus also no error reporting is expected.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
fe54d2a94f util: xml: Introduce virXMLPropUUID
The helper function extracts a UUID with semantics similar to other
helpers we have.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
a38c47bfb9 virDomainNetIPInfoParseXML: Don't force callers to set proper 'ctxt->node'
In certain cases it's inconvenient to move the XPath's context current
node in the caller. Add a 'node' argument and override it inside the
function. VIR_XPATH_NODE_AUTORESTORE handles the cleanup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
eb738a75be virDomainNetIPInfoParseXML: Simplify cleanup
Do the XPath fetches first as they don't require cleanup and rename
'cleanup' to 'error' and take it only on failure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
39892e6f2e virDomainNetIPInfoParseXML: Don't VIR_FREE and overwrite autofreed 'nodes'
Use two separate variables for the nodes and count instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
ecdbc4ea4e virDomainNetIPInfoParseXML: Remove pointless automatic clearing of 'route' and 'ip'
The variables are only used in code paths which can't fail after they
are allocated.

Additionally decrease scope of the variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
5832c73a82 virDomainNetDefParseXML: Use virXMLPropEnumDefault for parsing 'def->type'
Replace ad-hoc logic that fills the default by use of the proper helper
function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
9de4835987 virDomainNetDefParseXML: Split out parsing of 'driver' subelement
Separate the code into virDomainNetDefParseXMLDriver. Some local
variables were renamed and the scope decreased.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
f6cbd4e1d5 virDomainNetDefParseXML: Separate and localize parsing of 'backend/@vhost'
Move it into an independent block and move temporary variables locally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
09753fbac6 virDomainNetDefParseXML: Remove unnecessary temporary variables
Some values were extracted into a temporary variable and then assigned
to the definition later without a modification.

Directly assign them instead.

One slight modification was done to 'ifname' which was cleared in
certain cases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:17 +02:00
Peter Krempa
1ebbeb29ba conf: domain: Remove 'error' label in virDomainNetDefParseXML
The 'error' label was an alias to 'return NULL;'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:16 +02:00
Peter Krempa
4721354f44 conf: domain: Automatically free 'def' and 'actual' in virDomainNetDefParseXML
Convert the last two variables having inline cleanup to automatic
cleanup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:16 +02:00
Peter Krempa
d409d25cea conf: domain: Register automatic pointer freeing for virDomainActualNetDef
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 14:43:16 +02:00
Pavel Hrdina
84d9279aef ci: refresh generated files
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 12:05:20 +02:00
Pavel Hrdina
69045df5c4 spec: add systemd-rpm-macros build dependency
We should explicitly depend on this package as we use some macros
defined by files that are installed from systemd-rpm-macros.

Currently the build works only because some of our other build
dependencies pull in systemd which will install systemd-rpm-macros if
rpm-build is installed as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-10-03 12:05:06 +02:00
Jiri Denemark
55f3ed17d7 Post-release version bump to 8.9.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-10-03 10:03:44 +02:00
Jiri Denemark
7282ab865b Release of libvirt-8.8.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-10-03 09:57:00 +02:00
Yuri Chornoivan
6a77628a7e Translated using Weblate (Ukrainian)
Currently translated at 100.0% (10432 of 10432 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>
2022-10-02 14:19:52 +02:00
Göran Uddeborg
33d4c18012 Translated using Weblate (Swedish)
Currently translated at 47.9% (5002 of 10432 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2022-10-02 14:19:51 +02:00
Sergey A
e4dd3ffd24 Translated using Weblate (Russian)
Currently translated at 91.1% (9505 of 10432 strings)

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

Co-authored-by: Sergey A <sw@atrus.ru>
Signed-off-by: Sergey A. <sw@atrus.ru>
2022-10-02 14:19:50 +02:00
김인수
43f0fd7468 Translated using Weblate (Korean)
Currently translated at 100.0% (10432 of 10432 strings)

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

Co-authored-by: 김인수 <simmon@nplob.com>
Signed-off-by: 김인수 <simmon@nplob.com>
2022-10-02 14:19:49 +02:00
Jim Fehlig
30899c65a2 docs: compiling: Add link to latest openSUSE libvirt package
This is a follow-up to fbd6b2480a, adding a link to the latest libvirt
package for openSUSE.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-30 09:05:59 -06:00
Michal Privoznik
f12bc4a7ab NEWS: Document my contributions for upcoming release
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-09-30 15:38:47 +02:00
Michal Privoznik
b1fc788957 virgdbusmock: Mock g_dbus_connection_call_with_unix_fd_list_sync() only on UNIX-like systems
As of GLib commit c9874f817be51d3b652457daef3b10766b59db9a,
relesed in GLib 2.73, the g_dbus_connection_call_with_unix_fd_list_sync()
function is not defined always, only when G_OS_UNIX condition is
set. This is also the reason why our virGDBusCallMethodWithFD()
function is guarded with that macro. But virgdbusmock is compiled
always, even on !UNIX systems, e.g. mingw. Therefore, we need to
use the same macro to condition compile its mock.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-30 15:38:47 +02:00
Kristina Hanicova
39e98f4113 virdomainjob: check if cb is not NULL before dereferencing
The callback struct does not always have to be set which could
cause a dereferencing of a NULL pointer. This patch adds check
against NULL in missing places before dereferencing.

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>
2022-09-30 14:13:13 +02:00
Michal Privoznik
3478cca80e qemuProcessReconnect: Don't build memory paths
Let me take you on a short trip to history. A long time ago,
libvirt would configure all QEMUs to use $hugetlbfs/libvirt/qemu
for their hugepages setup. This was problematic, because it did
not allow enough separation between guests. Therefore in
v3.0.0-rc1~367 the path changed to a per-domain basis:

  $hugetlbfs/libvirt/qemu/$domainShortName

And to help with migration on daemon restart a call to
qemuProcessBuildDestroyMemoryPaths() was added to
qemuProcessReconnect() (well, it was named
qemuProcessBuildDestroyHugepagesPath() back then, see
v3.10.0-rc1~174). This was desirable then, because the memory
hotplug code did not call the function, it simply assumes
per-domain paths to exist. But this changed in v3.5.0-rc1~92
after which the per-domain paths are created on memory hotplug
too.

Therefore, it's no longer necessary to create these paths in
qemuProcessReconnect(). They are created exactly when needed
(domain startup and memory hotplug).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-30 10:09:42 +02:00
Michal Privoznik
135233df26 qemuNamespaceMknodOne: Call g_file_read_link() in async-signal-safe fashion
When creating a node in QEMU's namespace the whole link chain is
created with it. Here, we use g_file_read_link() from the child
(running inside the namespace) to learn whether a link exists and
points to expected target. Now, when building the namespace there
can't be any symlinks and this g_file_read_link() returns NULL
always. And because we pass a local GError variable to it, glib
tries to set it to a localized error message. This comes with
creating a (static) hash table inside of g_strerror() and is
guarded with a mutex. The hash table is also allocated using
GSlice allocator instead of g_malloc, and since the latter is
safe to use after fork (because it's documented to use plain
malloc), glib went with the former, naturally. Now, GSlice
allocator has plenty of internal mutexes and thus hitting a
locked mutex is not that hard.

Fortunately, we don't care about any error from
g_file_read_link() and thus we can pass NULL which avoids calling
g_strerror().

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2120965
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-09-30 10:09:32 +02:00
Michal Privoznik
84adb87105 qemuNamespaceMknodPaths: Don't fork needlessly
The qemuNamespaceMknodPaths() function is responsible for
creating files/directories in QEMU's mount namespace. When
called, it is given list of paths that have to be created in the
namespace. It processes this list and removes items that are not
directly under /dev, but on a 'shared' filesystem (note that all
other mount points are preserved). And it may so happen that
after this pre-process no files/directories need to be created in
the namespace. If that's the case, exit early and avoid
fork()-ing only to find out the same.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-09-29 16:48:54 +02:00
Lin Ma
85aafea449 qemu: Remove host-passthrough validation check for host-phys-bits=on
Besides the -cpu host, The host-phys-bits=on applies to custom or max
cpu model, So the host-passthrough validation check is unnecessary for
maxphysaddr with mode='passthrough'.

Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2022-09-29 08:45:03 -06:00
Kristina Hanicova
ba884de786 virdomainjob: preserveJob: memdup the cb structure instead of copying it
In case of variable 'oldjob' (job structure) in
qemuProcessReconnect() the cb pointer was just copied from the
existing job structure in virDomainObjPreserveJob(). This caused
the job and oldjob sharing the same pointer, which was later
freed at the end of the qemuProcessReconnect() function by
automatic call to virDomainObjClearJob(). This caused an invalid
read in and subsequent daemon crash as the job structure was
trying to read cb which had been already freed.

This patch changes the copying to g_memdup that allocates
different pointer, which can be later safely freed.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-09-29 14:03:20 +02:00
Weblate
8ead926cb4 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
2022-09-27 11:41:06 +02:00
Jiri Denemark
9dfa7132f2 spec: Use consistent versioning for Obsoletes
rpmbuild is complaining it's not recommended to have unversioned
Obsoletes. On the other hand using dynamic version/release is a bit too
much as we know in which release a particular subpackage was removed.
Let's just use the corresponding version in both cases to be consistent
with all other Obsoletes in our spec file.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2022-09-27 11:27:06 +02:00
Jiri Denemark
274639ce26 po: Refresh potfile for v8.8.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2022-09-27 11:01:35 +02:00
lu zhipeng
d95c79fbd0 qemu: fix memory leak about virDomainEventTunableNew
For prevent memory leak and easier to use, So change
virDomainEventTunableNew to get virTypedParameterPtr *params
and set it = NULL.

Signed-off-by: lu zhipeng <luzhipeng@cestc.cn>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2022-09-27 10:04:20 +02:00
Kristina Hanicova
fa2a7f888c qemu_monitor_json: remove unnecessary variable 'rc'
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2022-09-26 15:53:37 +02:00
Martin Kletzander
59d30adacd libvirt-guests: Fix dependency ordering in service file
After some debugging and discussion with systemd team it turns out we
are misusing the ordering in libvirt-guests.service.  That happened
because we want to support both monolithic and modular daemon setups and
on top of that we also want to support socket activation and services
without socket activation.  Unfortunately this is impossible to express
in the unit file because of how transactions are handled in systemd when
dependencies are resolved and multiple actions (jobs) are queued.  For
explanation from Michal Sekletar see comment #7 in the BZ this patch is
fixing:

https://bugzilla.redhat.com/show_bug.cgi?id=1964855#c7

In order to support all the scenarios this patch also amends the
manpages so that users that are changing the default can also read how
to correct the dependency ordering in libvirt-guests unit file.

Ideally we would also keep the existing configuration during upgrade,
but due to our huge support matrix this seems hardly feasible as it
could introduce even more problems.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-09-26 13:04:48 +02:00
zhanchun li
e9fd6de8fc Translated using Weblate (Chinese (Simplified) (zh_CN))
Currently translated at 99.8% (10420 of 10440 strings)

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

Co-authored-by: zhanchun li <lzc777@126.com>
Signed-off-by: zhanchun li <lzc777@126.com>
2022-09-25 14:19:43 +02:00
Göran Uddeborg
f27cf29e96 Translated using Weblate (Swedish)
Currently translated at 47.2% (4932 of 10440 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
2022-09-25 14:19:43 +02:00
Michal Privoznik
0377177c78 qemu_process.c: Propagate hugetlbfs mounts on reconnect
When reconnecting to a running QEMU process, we construct the
per-domain path in all hugetlbfs mounts. This is a relict from
the past (v3.4.0-100-g5b24d25062) where we switched to a
per-domain path and we want to create those paths when libvirtd
restarts on upgrade.

And with namespaces enabled there is one corner case where the
path is not created. In fact an error is reported and the
reconnect fails. Ideally, all mount events are propagated into
the QEMU's namespace. And they probably are, except when the
target path does not exist inside the namespace. Now, it's pretty
common for users to mount hugetlbfs under /dev (e.g.
/dev/hugepages), but if domain is started without hugepages (or
more specifically - private hugetlbfs path wasn't created on
domain startup), then the reconnect code tries to create it.
But it fails to do so, well, it fails to set seclabels on the
path because, because the path does not exist in the private
namespace. And it doesn't exist because we specifically create
only a subset of all possible /dev nodes. Therefore, the mount
event, whilst propagated, is not successful and hence the
filesystem is not mounted. We have to do it ourselves.

If hugetlbfs is mount anywhere else there's no problem and this
is effectively a dead code.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2123196
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2022-09-23 16:33:48 +02:00