Commit Graph

46920 Commits

Author SHA1 Message Date
Peter Krempa
1531eacb64 virDomainNetDef: Use virTristateBool for 'managed_tap' instead of int
Convert the struct member to proper type.

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
acc5b92af1 virDomainNetDefParseXML: Refactor parsing of <virtualport>
Base whether virtualport is supported for a given interface on a new
variable named 'virtualport_flags' which also configures the parser for
the virtualports subelement and fill it in the appropriate interface
type branches.

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
a94375aef0 conf: domain: Move pure validation code from virDomainNetDefParseXML to virDomainNetDefValidate
The moved code is pure validation of semantics of the definition and not
actual parsed values. Move it to the validation code.

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
16c332aa60 virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_HOSTDEV
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
e55721e0e3 virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_UDP/MCAST/SERVER/CLIENT
This also removes the confusing use of variables named 'tmpNode' and
'tmp_node' right next to each other.

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
ad29c254b6 util: xml: Introduce VIR_XPATH_NODE_AUTORESTORE_NAME
VIR_XPATH_NODE_AUTORESTORE_NAME is a more generic version of the
VIR_XPATH_NODE_AUTORESTORE macro used to save the 'node' inside a XPath
context struct. The new macro allows specifying the name of the variable
used to save the context so that it can be used multiple times inside a
function's nested scopes.

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
d9b8d0c6bd virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_VDPA
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
053b7d3bd7 virDomainNetDefParseXML: Refactor parsing of data for VIR_DOMAIN_NET_TYPE_VHOSTUSER
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
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