]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
3 years agopo: Refresh potfile for v8.3.0
Jiri Denemark [Tue, 26 Apr 2022 07:48:53 +0000 (09:48 +0200)]
po: Refresh potfile for v8.3.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3 years agotests: qemucapabilities: Update qemu caps dump for the qemu-7.0.0 release on x86_64
Peter Krempa [Mon, 14 Mar 2022 15:55:43 +0000 (16:55 +0100)]
tests: qemucapabilities: Update qemu caps dump for the qemu-7.0.0 release on x86_64

Few minor changes in qemu since the last update:
    - 'cocoa' display and corresponding props (not present in this build)

Changes in build:
    - dbus display driver re-enabled
    - gtk display support re-disabled
    - xen support re-disabled

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirHostCPUGetCPUIDFilterVolatile: Filter out topology data on AMD
Peter Krempa [Mon, 25 Apr 2022 11:55:12 +0000 (13:55 +0200)]
virHostCPUGetCPUIDFilterVolatile: Filter out topology data on AMD

AMD cpus report Core (compute unit) identifiers of the cpu running the
instruction under leaf 0x8000001e. This data is not needed for libvirt
and actually breaks caching of the qemu capabilities where we check that
all of the CPU flags to be identical.

Mask out all of leaf 0x8000001e.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirHostCPUGetCPUID: Limit the buffer size ranges
Peter Krempa [Mon, 25 Apr 2022 11:37:52 +0000 (13:37 +0200)]
virHostCPUGetCPUID: Limit the buffer size ranges

Raise the lower bound to '64' as that seems to currently be the first
size that can fit the CPU data for a modern cpu.

Lower the upper bound to an arbitrary 65536. So many cpu features ougth
to be enough for everyone.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirHostCPUGetCPUID: Fix possible allocation of huge amount of memory
Peter Krempa [Mon, 25 Apr 2022 11:36:26 +0000 (13:36 +0200)]
virHostCPUGetCPUID: Fix possible allocation of huge amount of memory

In case when the 'KVM_GET_SUPPORTED_CPUID' ioctl on /dev/kvm would
fail for other reason than the documented E2BIG, our code would continue
looping and calling it while always increasing the memory buffer even
when that will not help.

Rewrite the function to allow another iteration only with the correct
errno.

Additionally rename the 'i' variable to 'alloc_size' as it's not a pure
iterator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoutil: virhostcpu: Extract filtering of the returned data from virHostCPUGetCPUID
Peter Krempa [Mon, 25 Apr 2022 11:20:14 +0000 (13:20 +0200)]
util: virhostcpu: Extract filtering of the returned data from virHostCPUGetCPUID

Move the filtering code into virHostCPUGetCPUIDFilterVolatile.

This also removes a safe but very questionable reuse of 'i' iterator in
the both the top level and nested loop. It's safe for now as the to
level loop will not iterate any more in the current state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirHostCPUGetCPUID: Add comment on how KVM_GET_SUPPORTED_CPUID works
Peter Krempa [Mon, 25 Apr 2022 10:47:25 +0000 (12:47 +0200)]
virHostCPUGetCPUID: Add comment on how KVM_GET_SUPPORTED_CPUID works

The commit adding the code fetching host CPU flags via the
KVM_GET_SUPPORTED_CPUID didn't describe at all why such an alghorithm is
needed.

Add a comment from the documentation outlining how the userspace
function is expected to allocate memory here.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirCPUx86DataGetHost: Fix construction of the returned data
Peter Krempa [Mon, 25 Apr 2022 12:47:26 +0000 (14:47 +0200)]
virCPUx86DataGetHost: Fix construction of the returned data

The function returns 'virCPUData' but doesn't do two important steps
which other code takes:

1) leaves with all-zero data is stripped from the XML output
2) the data is expected to be sorted in the array

Now the 'virHostCPUGetCPUID' helper returns both all 0 leaves and
doesn't order them as we expect.

If this is then used in conjunction with 'virCPUx86DataIsIdentical'
together with data which made a roundtrip to XML and back the result
will be always false even if the data itself is identical.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirCPUx86DataIsIdentical: Add debug output
Peter Krempa [Mon, 25 Apr 2022 12:38:08 +0000 (14:38 +0200)]
virCPUx86DataIsIdentical: Add debug output

Without this it's impossible to debug scenarios when this function
returns a mismatch but the formatted data looks identical.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirsh: cmdBlockcopy: Fix generator of block copy disk XML
Peter Krempa [Mon, 25 Apr 2022 08:16:13 +0000 (10:16 +0200)]
virsh: cmdBlockcopy: Fix generator of block copy disk XML

In a recent commit I've attempted to rewrite the XML generator to use
virXMLFormatElement instead of manual steps. Unfortunately the commit
had multiple problems resulting in a garbled XML:

1) in certain cases the wrong buffer was used resulting in misplaced
   snippets
2) the child element buffer was improperly set up so sub-elements were
   not indented

This resulted in following XML being generated:

 $ virsh blockcopy cd vda /tmp/test.copy --raw --print-xml
 type='file''/tmp/test.copy'/>
 <driver type='raw'/>
 <disk>
 <source file=</disk>

To fix this we'll generate the '<source>' element in one go and use the
proper buffer for it and other places.

Fixes: 1cd95f858ab83f2baab0e35070d00766bb06ce3a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2078274
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirsh: cmdBlockcopy: Add '--print-xml' flag
Peter Krempa [Mon, 25 Apr 2022 07:47:26 +0000 (09:47 +0200)]
virsh: cmdBlockcopy: Add '--print-xml' flag

Useful for knowing how to construct the XML and debugging.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agotests: qemuxml2*: Add testing of authenticated http/ftp disks
Peter Krempa [Wed, 20 Apr 2022 07:26:57 +0000 (09:26 +0200)]
tests: qemuxml2*: Add testing of authenticated http/ftp disks

Extend the 'disk-cdrom-network' to cover this instance. This also
validates that the parameters of -blockdev conform to the QAPI schema.

Also add the xml2xml variant of this test case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: schema: Allow authentication for FTP(S) and HTTP(S) disks
Peter Krempa [Wed, 20 Apr 2022 08:27:42 +0000 (10:27 +0200)]
conf: schema: Allow authentication for FTP(S) and HTTP(S) disks

The code already handles this so we just need to allow it in the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: schemas: Split out definition for 'ftp' protocol
Peter Krempa [Fri, 22 Apr 2022 15:04:43 +0000 (17:04 +0200)]
conf: schemas: Split out definition for 'ftp' protocol

Separate it so that further addition can target 'ftp' only.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: domain: Inline qemuDomainStorageSourceHasAuth
Peter Krempa [Fri, 22 Apr 2022 15:15:33 +0000 (17:15 +0200)]
qemu: domain: Inline qemuDomainStorageSourceHasAuth

The iSCSI hostdev code doesn't require the check for the empty drive
and the check for the protocol because those are already guaranteed at
that point.

In qemuDomainSecretStorageSourcePrepare we don't need to check the
network disk type either as it's now guaranteed by the definition
validator.

Thus both callers can simply check whether src->auth is present and the
helper can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: domain: Inline qemuDomainDiskHasEncryptionSecret
Peter Krempa [Fri, 22 Apr 2022 15:11:39 +0000 (17:11 +0200)]
qemu: domain: Inline qemuDomainDiskHasEncryptionSecret

Since we are already checking that the encryption format can be only
_LUKS and _LUKS2 this wrapper function doesn't make much sense any more.

The only one caller can do this internally.

The move of virStorageSourceIsEmpty is correct as there are no secrets
to setup if the disk is empty anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainStorageSourceHasAuth: Don't decide based on protocol
Peter Krempa [Wed, 20 Apr 2022 07:31:47 +0000 (09:31 +0200)]
qemuDomainStorageSourceHasAuth: Don't decide based on protocol

The validation should be the only point to decide whether authentication
is supported for a disk backing protocol. The rest of the code can then
simply always enable it.

This also fixes a crash when authentication is requested e.g. for a HTTP
backed disk as the blockdev props formatter expects that it was already
set up.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainDiskDefValidateSourceChainOne: Reject authentication for protocols which...
Peter Krempa [Fri, 22 Apr 2022 14:59:37 +0000 (16:59 +0200)]
virDomainDiskDefValidateSourceChainOne: Reject authentication for protocols which don't support it

Only certain disk protocols support authentication. Add validation for
this field.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuBlockStorageSourceGetRBDProps: Simplify handling of encryption format
Peter Krempa [Fri, 22 Apr 2022 14:16:18 +0000 (16:16 +0200)]
qemuBlockStorageSourceGetRBDProps: Simplify handling of encryption format

Remove the impossible error message about the 'qcow2' encryption format
not being supported. We validated before that it can't happen.

Additionally the code can be simplified by removing error handling from
impossible code paths as the last resort is virJSONValueCreate not
allowing NULL argument with the 's:' modifier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainValidateStorageSource: Add validation of 'encryption' support
Peter Krempa [Fri, 22 Apr 2022 14:33:28 +0000 (16:33 +0200)]
qemuDomainValidateStorageSource: Add validation of 'encryption' support

Reject encryption requests for unsupported image format types.

Add negative test for the rejected cases as well as modify
'disk-network-rbd-encryption' case to validate that with librbd
encryption the format doesn't matter.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainValidateStorageSource: Reorganize encryption config validation
Peter Krempa [Fri, 22 Apr 2022 14:25:18 +0000 (16:25 +0200)]
qemuDomainValidateStorageSource: Reorganize encryption config validation

Move the two ad-hoc checks below into the block which already tests
whether encryption is requested.

If we first disallow the old-style qcow2 encryption we can remove a
whole block of validation later on.

Also the capability check for qcow2+luks can be simplified by moving it
into the same block.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: schema: Fix alignment in 'diskSourceNetworkProtocolHTTPS' schema definition
Peter Krempa [Wed, 20 Apr 2022 07:45:06 +0000 (09:45 +0200)]
conf: schema: Fix alignment in 'diskSourceNetworkProtocolHTTPS' schema definition

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: formatdomain: Remove old unreferenced HTML anchors
Peter Krempa [Thu, 14 Apr 2022 08:24:16 +0000 (10:24 +0200)]
docs: formatdomain: Remove old unreferenced HTML anchors

Most of the anchors that were forward ported to formatdomain.rst when it
was converted are not actually referenced by our documentation. Since
it's now quite some time after the conversion was done we can remove
them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: bugs: Remove raw HTML anchor 'quality'
Peter Krempa [Thu, 14 Apr 2022 07:42:58 +0000 (09:42 +0200)]
docs: bugs: Remove raw HTML anchor 'quality'

Modify the gitlab templates linking to it and remove the raw HTML.

Note that also the default template needs to be changed directly in
gitlab.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: contact: Remove HTML anchors and adjust documents using them
Peter Krempa [Thu, 14 Apr 2022 07:39:02 +0000 (09:39 +0200)]
docs: contact: Remove HTML anchors and adjust documents using them

Modify the name of the 'IRC discussion' paragraph to just 'IRC' so that
the links keep working and remove the raw HTML anchors.

Adjustment is needed for documents which were using the '#email' anchor
which has now become '#mailing-lists'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: governance: Remove unused HTML anchors
Peter Krempa [Thu, 14 Apr 2022 07:34:25 +0000 (09:34 +0200)]
docs: governance: Remove unused HTML anchors

The 'codeofconduct' anchor is unused as of 523f2de82e0f523bd552947 .

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: uri: Rewrite section about transport protocols and extra parameters
Peter Krempa [Wed, 20 Apr 2022 16:04:36 +0000 (18:04 +0200)]
docs: uri: Rewrite section about transport protocols and extra parameters

Avoid the table and add a brief description of the transport protocol.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: uri: Move the 'test' hypervisor under a 'local hypervisors heading
Peter Krempa [Tue, 19 Apr 2022 15:15:03 +0000 (17:15 +0200)]
docs: uri: Move the 'test' hypervisor under a 'local hypervisors heading

Add a new heading 'Local hypervisor URIs' and move the sections about
'qemu', 'xen' and 'test' under it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: uri: Consolidate paragraphs on Xen URIs
Peter Krempa [Tue, 19 Apr 2022 15:12:07 +0000 (17:12 +0200)]
docs: uri: Consolidate paragraphs on Xen URIs

Mention the legacy 'xen' string usage under the Xen hypervisor uri
section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: uri: Remove old 'NULL URI' section
Peter Krempa [Tue, 19 Apr 2022 15:02:35 +0000 (17:02 +0200)]
docs: uri: Remove old 'NULL URI' section

We now have an paragraph about default URI choice if the passed pointer
is NULL. Add the two related bits from the 'NULL and empty string URIs'
from the legacy section to the current one and remove the old stuff.

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

Adjust links in the process.

Note that the conversion to the table is temporary and upcoming patch
will modify it for better readability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: remote: Remove 'Limitations' paragraph
Peter Krempa [Thu, 14 Apr 2022 11:36:11 +0000 (13:36 +0200)]
docs: remote: Remove 'Limitations' paragraph

The paragraph talks about lack of fine grained access control which was
already added a long time ago.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'storage' page to rst
Pavel Hrdina [Mon, 29 Mar 2021 20:24:40 +0000 (22:24 +0200)]
docs: Convert 'storage' page to rst

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: storage: rename headers to remove duplicate names
Pavel Hrdina [Mon, 29 Mar 2021 20:24:13 +0000 (22:24 +0200)]
docs: storage: rename headers to remove duplicate names

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 agoCorrect links to TLS certificate setup page
Peter Krempa [Thu, 14 Apr 2022 12:20:09 +0000 (14:20 +0200)]
Correct links to TLS certificate setup page

When the setup of TLS certs was originally split out of
'docs/remote.html' ( df99aa311a33e87d4 ) links refering to it were not
fixed.

Adjust them to point to the correct document.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: formatsecret: Correct link to storage volume XML definition
Peter Krempa [Thu, 14 Apr 2022 11:48:43 +0000 (13:48 +0200)]
docs: formatsecret: Correct link to storage volume XML definition

The anchor name was not fixed when the 'formatstorage' document was
converted to rst.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agoinclude: Fix vertical spacing between comments and symbols
Andrea Bolognani [Fri, 22 Apr 2022 12:12:07 +0000 (14:12 +0200)]
include: Fix vertical spacing between comments and symbols

There should be no empty lines between a docstring comment and
the symbol it documents.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoinclude: Fix vertical spacing inside comments
Andrea Bolognani [Fri, 22 Apr 2022 12:05:12 +0000 (14:05 +0200)]
include: Fix vertical spacing inside comments

There should be no empty lines between the Since tag in a
docstring comment and the end marker.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: Fix generated documentation of virStorageVolInfoFlags
Victor Toso [Wed, 20 Apr 2022 19:08:07 +0000 (21:08 +0200)]
docstring: Fix generated documentation of virStorageVolInfoFlags

The API xml description file generator doesn't properly handle cases
when there's either a single comment or mixed use of pre- and post-
comments explaining the values.

Modify the comments to avoid the problem and also append version
information for the exposed values.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: libvirt-common: Add 'Since version' metadata
Victor Toso [Wed, 20 Apr 2022 19:08:06 +0000 (21:08 +0200)]
docstring: libvirt-common: Add 'Since version' metadata

Similarly to previous commits but with the targeting libvirt-common
in a batch.

Either create or append to existing docstring, the version (git tag)
that a given typedef, enum value, macro or function was introduced
in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: function: lxc: Add 'Since version' metadata
Victor Toso [Wed, 20 Apr 2022 19:08:04 +0000 (21:08 +0200)]
docstring: function: lxc: Add 'Since version' metadata

Either create or append to existing docstring, the version (git tag)
that a given function was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: function: qemu: Add 'Since version' metadata
Victor Toso [Wed, 20 Apr 2022 19:08:03 +0000 (21:08 +0200)]
docstring: function: qemu: Add 'Since version' metadata

Either create or append to existing docstring, the version (git tag)
that a given function was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: typedef: qemu:: Add 'Since version' metadata
Victor Toso [Wed, 20 Apr 2022 19:08:00 +0000 (21:08 +0200)]
docstring: typedef: qemu:: Add 'Since version' metadata

Either create or append to existing docstring, the version (git tag)
that a given typedef was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: typedef: libvirt:: Add 'Since version' metadata
Victor Toso [Wed, 20 Apr 2022 19:07:59 +0000 (21:07 +0200)]
docstring: typedef: libvirt:: Add 'Since version' metadata

Either create or append to existing docstring, the version (git tag)
that a given typedef was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: macros: libvirt: Add 'Since version' metadata
Victor Toso [Wed, 20 Apr 2022 19:07:57 +0000 (21:07 +0200)]
docstring: macros: libvirt: Add 'Since version' metadata

Either create or append to existing docstring, the version (git tag)
that a given macro was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: enums: qemu: Add 'Since version' metadata
Victor Toso [Wed, 20 Apr 2022 19:07:55 +0000 (21:07 +0200)]
docstring: enums: qemu: Add 'Since version' metadata

Either create or append to existing docstring, the version (git tag)
that a given enum value was introduced in the format:

    Since: v1.2.3

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: variable: Move docstring from source to header file
Victor Toso [Wed, 20 Apr 2022 19:07:53 +0000 (21:07 +0200)]
docstring: variable: Move docstring from source to header file

virConnectAuthPtrDefault is the only variable that we export and
with the documentation being at the C file, it makes harder to find
it.

With this patch, the documentation of this variable can be found by
those who look at the header file for guidance plus, it will also be
included in the XML API, as the followup patch will fix apibuild.py
to store what is documented in the header file for this variable.

Note that the apibuild, does not do the same with .c files. It'd
require adding it for (parsing) recursion, similar to what is done
for functions.  Considering the pros/cons, seems more reasonable to
move the docstring to the header file instead.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agodocstring: Fix generated documentation of virConnectListAllNodeDeviceFlags
Victor Toso [Wed, 20 Apr 2022 19:07:52 +0000 (21:07 +0200)]
docstring: Fix generated documentation of virConnectListAllNodeDeviceFlags

scripts/apibuild.py does not handle well enum's with comments
between values.  The outcome depends on whether the enum value has
its own docstring or not and if there is spaces between the enum
values or not.

Either way, virConnectListAllNodeDeviceFlags documentation is
explicit that this enum is about filtering node devices. We can move
the information that it is either by "capability" or "active" state
to the block of comment above.

Using git diff --word-diff to show the fixed ouput xml (redacted).

  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_ACTIVE' ... [-info='Inactive-]{+info='Active+} devices'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD' ... [-info='vDPA-]{+info='s390 AP Card+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX' ... [-Queue'/>-]{+Matrix'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE' ... [-Card device'/>-]{+Queue'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV' ... [-info='Mediated-]{+info='CCW+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV' ... [-info='CCW-]{+info='CSS+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM' ... [-info='Capable of scsi_generic'/>-]{+info='DRM device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST' ... [-info='Storage device'/>-]{+info='FC Host Bus Adapter'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV' ... [-info='Capable of mediated devices'/>-]{+info='Mediated device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES' ... [-info='DRM device'/>-]{+info='Capable of mediated devices'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET' ... [-info='USB interface'/>-]{+info='Network device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV' ... [-info='System capability'/>-]{+info='PCI device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI' ... [-Target'/>-]{+device'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC' ... [-vport'/>-]{+scsi_generic'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST' ... [-info='Network device'/>-]{+info='SCSI Host Bus Adapter'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET' ... [-Host Bus Adapter'/>-]{+Target'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE' ... [-info='SCSI-]{+info='Storage+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM' ... [-info='filter the devices by cap type'/>-]{+info='System capability'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV' ... [-info='PCI-]{+info='USB+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE' ... [-device'/>-]{+interface'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA' ... [-info='CSS-]{+info='vDPA+} device'/>
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPD' ... [-info='s390 AP Matrix'/>-]{+info='Device with VPD'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS' ... [-info='FC Host Bus Adapter'/>-]{+info='Capable of vport'/>+}
  <enum name='VIR_CONNECT_LIST_NODE_DEVICES_INACTIVE' ... [-info='Device with VPD filter the devices by active state'/>-]{+info='Inactive devices'/>+}

Signed-off-by: Victor Toso <victortoso@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoqemu: disarm fake reboot flag on reset
Maxim Nestratov [Tue, 5 Apr 2022 11:52:59 +0000 (14:52 +0300)]
qemu: disarm fake reboot flag on reset

This is a quite an old (created at 2016) patch fixing an issue for at
that time contemporary Fedora 23. virsh reboot returns success (yet
after hanging for a while), VM is rebooted sucessfully too but then
shutdown from inside guest causes reboot and not shutdown.

VM has agent installed. So virsh reboot first tries to reboot VM thru
the agent. The agent calls 'shutdown -r' command. Typically it returns
instantly but on this distro for some reason it takes time. I did not
investigate the cause but the command waits in dbus client code,
probably waits for reply. The libvirt waits 60s for agent command to
execute and then errors out. Next reboot API falls back to ACPI shutdown
which returns successfully thus the reboot command return success too.

Yet shutdown command in guest eventually successfull and guest is truly
rebooted. So libvirt does not receive SHUTDOWN event and fake reboot
flag which is armed on fallback path stays armed. Thus next shutdown
from guest leads to reboot.

The issue has 100% repro on Fedora 23. On modern distros I can't
reproduce it at all. Shutdown command is asynchronous and returns
immediately even if I start some service that ignores TERM signal and
thus shutdown procedure waits for 90s (if I not mistaken) before sending
KILL.

Yet I guess it is nice to have this patch to be more robust.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Nikolay Shirokovskiy <nikolay.shirokovskiy@openvz.org>
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>