Commit Graph

43943 Commits

Author SHA1 Message Date
Daniel P. Berrangé
e674218dc2 tools: fix iterating over argv when recovering xattr
The libvirt_recover_xattrs.sh tool hangs when run. When no flags
are provided OPTIND is 1, so the loop expands to 'shift 0' which
has not effect. Rewrite to just loop over $@ instead which involves
less cleverness.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-11-30 10:45:35 +00:00
Michal Privoznik
010613cfd8 wireshark: Drop needless comment in dissect_xdr_bytes()
In the dissect_xdr_bytes() there's a comment that the string
allocated by xdr_bytes() can't be freed using xdr_free(). Well,
that is expected because xdr_bytes() used plain calloc() AND the
string is not an XDR struct but plain 'char *' type. Passing it
to xdr_free() must result in weird things happening.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2021-11-29 15:05:43 +01:00
Michal Privoznik
7e299ba649 wireshark: Switch to tvb_bytes_to_str()
When the dissector sees a byte sequence that is either an opaque
data (xdr_opaque) or a byte sequence (xdr_bytes) it formats the
bytes as a hex numbers using our own implementation. But
wireshark already provides a function for it: tvb_bytes_to_str().
NB, the reason why it returns a const string is so that callers
don't try to free it - the string is allocated using an allocator
which will decide when to free it.

The wireshark formatter was introduced in wireshark commit of
v1.99.2~479 and thus is present in the version we require at
least (2.6.0).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2021-11-29 15:05:33 +01:00
Yuri Chornoivan
540c8cbef0 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (10439 of 10439 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-11-27 16:16:17 +01:00
simmon
37255ba0e2 Translated using Weblate (Korean)
Currently translated at 100.0% (10439 of 10439 strings)

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

Translated using Weblate (Korean)

Currently translated at 99.8% (10423 of 10439 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-11-27 16:16:17 +01:00
Weblate
67ff445c23 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-11-27 16:16:14 +01:00
Peter Krempa
a453ebcd2b qemu: Fix validation of PCI option rom settings on hotplug
Commit 24be92b8e moved the option rom settings validation code to the
validation callbacks, but that doesn't work properly with device hotplug
as we assign addresses only after parsing the whole XML. The check is
too strict for that and caused failures when hotplugging devices such
as:

 <interface type='network'>
   <source network='default'/>
   <model type='virtio'/>
   <rom enabled='no'/>
 </interface>

This patch relaxes the check in the validation callback to accept also
_NONE and _UNASSIGNED address types and returns the check to
'qemuBuildRomProps' so that we preserve the full validation as we've
used to.

Fixes: 24be92b8e3
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2021437
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-26 10:02:32 +01:00
Peter Krempa
d120fc5253 qemu: monitor: Fix usage of 'query-blockstats'
Commit bc24810c2c modified code querying blockstats to use the
'query-nodes' parameter so that we can fetch stats also for images which
are not attached to a frontend such as block copy and backup scratch
images.

Unfortunately that broke the old blockstats because if 'query-nodes' is
enabled qemu doesn't output the 'qdev' parameter which our code used for
matching to the disk and also qemu neglects to populate the frontend
stats at all so we can't even switch to using nodename for matching.

To fix this we need to do two calls, one with 'query-nodes' disabled
using the old logic to populate everything and then an additional one
which populates all the remaining images.

Closes: https://gitlab.com/libvirt/libvirt/-/issues/246
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Tested-by: Erik Skultety <eskultet@redhat.com>
2021-11-25 15:27:56 +01:00
Ján Tomko
4b453bbb2f NEWS: document tcp_min_ssf
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-25 11:41:10 +01:00
Jiri Denemark
b9af0cdfd6 po: Refresh potfile for v7.10.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-11-25 10:19:23 +01:00
Göran Uddeborg
39f439df37 Translated using Weblate (Swedish)
Currently translated at 29.0% (3037 of 10441 strings)

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

Translated using Weblate (Swedish)

Currently translated at 29.0% (3036 of 10441 strings)

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

Translated using Weblate (Swedish)

Currently translated at 29.0% (3030 of 10441 strings)

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

Translated using Weblate (Swedish)

Currently translated at 28.9% (3020 of 10441 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>
2021-11-25 09:20:59 +01:00
simmon
dea4342036 Translated using Weblate (Korean)
Currently translated at 100.0% (10441 of 10441 strings)

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

Translated using Weblate (Korean)

Currently translated at 100.0% (10441 of 10441 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-11-25 09:20:59 +01:00
Kristina Hanicova
80885d9add qemu_alias: change return type to void if possible
These functions always return success so it seems logical to not
return anything and remove unnecessary checks.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-25 09:19:59 +01:00
Kristina Hanicova
e9b7ebee1e qemu_alias: Rewrite of code pattern
This patch rewrites the pattern using early return where it is
not needed and changes the return type of the functions to 'void'
if possible.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-25 09:10:36 +01:00
Kristina Hanicova
46caf6bac9 qemu: Rewrite code to the pattern
I have seen this pattern a lot in the project, so I decided to
rewrite code I stumbled upon to the same pattern as well.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-25 09:06:57 +01:00
Jim Fehlig
b85cef1b2d libxl: Don't derive libxlDomainObjPrivate from virObjectLockable
The libxlDomainObjPrivate object is never locked and hence does not need to
be a virObjectLockable object.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-24 09:47:52 -07:00
Jim Fehlig
c6d2d2d7a5 libxl: Remove unused macros
Remove unused JOB_MASK and DEFAULT_JOB_MASK macros.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-24 09:47:04 -07:00
Kristina Hanicova
679824d44a qemu: Remove 'else' branches after 'return' or 'goto'
I think it makes no sense to have else branches after return or
goto as it will never reach them in cases it should not. This
patch makes the code more readable (at least to me).

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2021-11-24 15:54:20 +01:00
Michal Privoznik
6bcd263011 virDomainObjListAdd: Transfer definition ownership
Upon successful return from virDomainObjListAdd() the
virDomainObj is the owner of secret definition. To make this
ownership transfer even more visible, lets pass the definition as
a double pointer and use g_steal_pointer().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-11-24 13:12:20 +01:00
Michal Privoznik
900fb1a315 virStoragePoolObjListAdd: Transfer definition ownership
Upon successful return from virStoragePoolObjListAdd() the
virStoragePoolObj is the owner of secret definition. To make this
ownership transfer even more visible, lets pass the definition as
a double pointer and use g_steal_pointer().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-11-24 13:12:20 +01:00
Michal Privoznik
8196a213b4 virSecretObjListAdd: Transfer definition ownership
Upon successful return from virSecretObjListAdd() the
virSecretObj is the owner of secret definition. To make this
ownership transfer even more visible, lets pass the definition as
a double pointer and use g_steal_pointer().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-11-24 13:12:20 +01:00
Michal Privoznik
10c68f5dd4 virInterfaceObjListAssignDef: Transfer definition ownership
Upon successful return from virInterfaceObjListAssignDef() the
virInterfaceObj is the owner of secret definition. To make this
ownership transfer even more visible, lets pass the definition as
a double pointer and use g_steal_pointer().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2021-11-24 13:12:20 +01:00
Daniel P. Berrangé
e18fff6c85 util: fix cache invalidation of swtpm capabilities
The check for whether the swtpm binary was modified is checking pointers
to the mtime field in two distinct structs, so will always compare
different. This resulted in re-probing swtpm capabilities every time,
as many as 20 times for a single VM launch.

Fixes:

  commit 01cf7a1bb9
  Author: Stefan Berger <stefanb@us.ibm.com>
  Date:   Thu Jul 25 14:22:04 2019 -0400

    tpm: Check whether previously found executables were updated

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-11-24 11:31:16 +00:00
Daniel P. Berrangé
4f08dfa5f4 ci: display installed packages at start of build
When a build fails it is helpful to know what packages were installed,
because by the time we look at the build job output, the original
container image might have changed.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-11-24 11:17:10 +00:00
Xu Chao
6fac961b08 util: virExec may blocked by reading pipe if grandchild prematurely exit
When VIR_EXEC_DAEMON is set, if virPidFileAcquirePath/virSetInherit failed,
then pipesync[0] can not be closed when granchild process exit, because
pipesync[1] still opened in child process. and then saferead in child
process may blocked forever, and left grandchild process in defunct state.

Signed-off-by: Xu Chao <xu.chao6@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-24 11:59:50 +01:00
Peter Krempa
c1a85daf99 util: xml: Remove virXMLPropStringLimit and virXPathStringLimit
The functions have very difficult semantics where callers are not able
to tell whether the property is missing or failed the length check. Only
the latter produces errors.

Since usage of the functions was phased out, remove them completely to
avoid further broken code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:39 +01:00
Peter Krempa
01ab6513bd virSecurityLabelDefParseXML: Don't use virXMLPropStringLimit
The function produces an error which is ignored in this code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:39 +01:00
Peter Krempa
f3a8f26339 virSecurityDeviceLabelDefParseXML: Don't use 'virXPathStringLimit'
virXPathStringLimit doesn't give callers a way to differentiate between
the queried XPath being empty and the length limit being exceeded.

This means that the callers is completely ignoring the error.

Move the length check into the caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:39 +01:00
Peter Krempa
33f2cc0712 virSecurityDeviceLabelDefParseXML: Use automatic memory clearing for temp strings
Apart from code simplification the refactor of 'model' fixes an unlikely
memory leak of the string if a duplicate model is found.

While the coversion of 'label' variable may seem unnecessary it will
come in handy in the next patch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:39 +01:00
Peter Krempa
a0e84f21b2 virSecurityLabelDefParseXML: Don't use 'virXPathStringLimit'
virXPathStringLimit doesn't give callers a way to differentiate between
the queried XPath being empty and the length limit being exceeded.

This means that callers are either overwriting the error message or
ignoring it altogether.

Move the length checks into the caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:39 +01:00
Peter Krempa
8f9bc6e5f6 virNodeDeviceCapVPDParseCustomFields: Don't use 'virXPathStringLimit'
virXPathStringLimit doesn't give callers a way to differentiate between
the queried XPath being empty and the length limit being exceeded.

This means that callers are overwriting the error message.

Move the length checks into the caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:39 +01:00
Peter Krempa
712a04bca1 virSecurityLabelDefParseXML: Remove pointless 'error' label
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:39 +01:00
Peter Krempa
1e67130b63 virSecurityLabelDefParseXML: Use automatic freeing for 'seclabel'
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:39 +01:00
Peter Krempa
0cb3e162a6 virSecurityLabelDefParseXML: Don't reuse temporary string 'p'
Use separate variables for 'model' and 'relabel' properties.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:38 +01:00
Peter Krempa
b63c70810c virSecurityLabelDefParseXML: Directly assign strings into appropriate variables
'seclabel->label', 'seclabel->imagelabel' and 'seclabel->baselabel' are
populated by stealing the pointer from the 'p' temporary string. Remove
the extra step.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:38 +01:00
Peter Krempa
f7ff8556ad virSecurityLabelDef: Declare 'type' as 'virDomainSeclabelType'
Use the appropriate enum type instead of an int and fix the XML parser
and one missing fully populated switch.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:38 +01:00
Peter Krempa
396ce0b568 util: seclabel: Define autoptr cleanup func for virSecurityLabelDef and virSecurityDeviceLabelDef
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-24 09:20:38 +01:00
Roman Bogorodskiy
537c8e5e24 meson: fix cpuset_getaffinity() detection
The cpuset_getaffinity() function is checked in sys/cpuset.h to see if
BSD CPU affinity APIs are available. This check requires including
sys/param.h to work properly, otherwise the test program fails with
unrelated errors like:

/usr/include/sys/cpuset.h:155:1: error: unknown type name
'__BEGIN_DECLS'
__BEGIN_DECLS
^
/usr/include/sys/cpuset.h:156:12: error: unknown type name 'cpusetid_t';
did you mean 'cpuset_t'?
int     cpuset(cpusetid_t *);

and so forth.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-24 10:43:28 +04:00
Kristina Hanicova
fa7023f4eb qemu: Remove unnecessary variables and labels
This patch removes variables such as 'ret', 'rc' and others which
are easily replaced. Therefore, making the code look cleaner and
easier to understand.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-11-23 18:14:01 +01:00
Daniel P. Berrangé
c7edcb320b ci: run a mingw64 job on stable Fedora
Both of the current mingw jobs are marked as 'allow_failure' because
they are running against Fedora rawhide which is an unstable distro.

We need at least one mingw job to be gating to more reliably detect
problems.

This introduces dockerfiles for both mingw variants on Fedora 35
and sets the mingw64 build to run on Fedora 34, and mingw32 on
Fedora rawhide.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-11-23 16:44:18 +00:00
Daniel P. Berrangé
3ca8611455 ci: refresh variables/dockerfiles with latest content
- The Cirrus CI variables are now sorted
  - The dockerfiles update commands changed for some distros
  - Meson in CentOS is now new enough to use

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-11-23 16:44:15 +00:00
Daniel P. Berrangé
4e2dcfcb82 ci: replace Fedora 33 with Fedora 35
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-11-23 16:43:57 +00:00
Ján Tomko
05cd957836 tests: pcivpdtest: check return value of virCreateAnonymousFile
Fixes: 59c1bc3a0e
Fixes: 43820e4b80
Fixes: 600f580d62
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristína Hanicová <khanicov@redhat.com>
2021-11-23 16:59:36 +01:00
Ján Tomko
096412f1ba ch: fix logic in virCHMonitorBuildPtyJson
There is a leftover 'ptys' variable, which we only assign
to and one assignment to 'content', where we add an empty
'pty' object.

Remove 'ptys'.

Fixes: 93accefd9e
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristína Hanicová <khanicov@redhat.com>
2021-11-23 16:59:36 +01:00
Ján Tomko
f5dd918978 vbox: fix vboxCapsInit
There is a stray mis-indented 'return NULL' left after a recent
refactor.

Fixes: c18d9e23fa
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristína Hanicová <khanicov@redhat.com>
2021-11-23 16:59:36 +01:00
Ján Tomko
097d3a4f56 tools: virt-host-validate: fix memory leak
virHostValidateGetCPUFlags returns an allocated virBitmap and
it needs to be freed.

Fixes: a0ec7165e3
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Kristína Hanicová <khanicov@redhat.com>
2021-11-23 16:59:36 +01:00
Martin Kletzander
edd1fd8ca9 Use virProcessGetStat
This eliminates one incorrect parsing implementation which relied on the
command field not having a closing bracket.  This possibility is already
tested against in the virProcessGetStat() tests.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-23 16:43:08 +01:00
Martin Kletzander
e370d4056b util: Add virProcessGetStat
This reads and separates all fields from /proc/<pid>/stat or
/proc/<pid>/task/<tid>/stat as there are easy mistakes to be done in the
implementation.  Some tests are added to show it works correctly.  No number
parsing is done as it would be unused for most of the fields most, if not all,
of the time.  No struct is used for the result as the length can vary (new
fields can be added in the future).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-23 16:43:08 +01:00
Pavel Hrdina
2fe7622d19 virsh: man: update snapshot-revert description
We've changed the behavior of this API that from now on it will always
restart the VM process and we are no longer able to revert to snapshots
created by libvirt older then 0.9.5.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-23 16:03:19 +01:00
Pavel Hrdina
4b3c0d1aba qemu_monitor: remove unused load snapshot code
Recent cleanup of snapshot revert code made these function unused.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-11-23 16:03:07 +01:00