]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
3 years agotests: qemucapabilities: Update caps_7.0.0.x86_64
Peter Krempa [Tue, 22 Feb 2022 13:42:39 +0000 (14:42 +0100)]
tests: qemucapabilities: Update caps_7.0.0.x86_64

Update to commit v6.2.0-2296-g9f0369efb0

Notable changes:
  - 'tls-hostname' field for NBD client to override local hostname
  - machine types 'pc-i440fx-1.7' and older are now deprecated
  - 'snapshot-access' block driver added
  - The 'protocol' field of 'set_password' and 'expire_password'
    parameter is now an enum instead of a pure string allowing 'vnc' and
    'spice' as value and the arguments are also covered by the schema.
  - 'copy-before-write' block driver now has a 'bitmap' property
  - 'query-migrate' now reports 'precopy-bytes', 'downtime-bytes',
    'postcopy-bytes' for 'ram' and 'disk' statistics
  - RTC_CHANGE event now has a 'qom-path' property to identify the RTC
  - 'umip' cpu feature is now migratable
  - SGX property 'section-size' reinstated after regression

Changes in build setting:
  - fuse block export support now enabled

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: downloads: fix link to libvirt GitLab group
Ján Tomko [Fri, 11 Mar 2022 13:29:31 +0000 (14:29 +0100)]
docs: downloads: fix link to libvirt GitLab group

s/libvirt.org/libvirt/

Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuSnapshotCreateActiveExternal: Remove duplicit assignment
Peter Krempa [Fri, 4 Mar 2022 13:37:13 +0000 (14:37 +0100)]
qemuSnapshotCreateActiveExternal: Remove duplicit assignment

The block of code pausing the VM assigns 'resume' to true but it's
already true because of the previous condition.

The code is deliberately kept in two blocks as upcoming changes will
modify both conditions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: snapshot: Use proper types for snapshot location
Peter Krempa [Wed, 9 Mar 2022 14:52:45 +0000 (15:52 +0100)]
conf: snapshot: Use proper types for snapshot location

Refactor the code to use proper types for the memory and disk snapshot
location and fix the parsing code to be compatible with an unsigned
type.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotDefParse: Decouple parsing of memory snapshot config
Peter Krempa [Wed, 9 Mar 2022 14:43:56 +0000 (15:43 +0100)]
virDomainSnapshotDefParse: Decouple parsing of memory snapshot config

Separate the steps of parsing the memory snapshot config from the
post-processing and validation code. The upcoming patch refactoring the
parsing will be simpler.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotDefParse: Avoid 'memoryfile' temporary variable
Peter Krempa [Wed, 9 Mar 2022 13:29:30 +0000 (14:29 +0100)]
virDomainSnapshotDefParse: Avoid 'memoryfile' temporary variable

Assign directly into the definition. The cleanup code can deal with
that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotDefParse: Refactor cleanup
Peter Krempa [Tue, 8 Mar 2022 17:32:36 +0000 (18:32 +0100)]
virDomainSnapshotDefParse: Refactor cleanup

Use automatic memory cleanup, decrease scope of variables and remove the
'cleanup' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: snapshot: Remove VIR_DOMAIN_SNAPSHOT_PARSE_DISKS flag
Peter Krempa [Tue, 8 Mar 2022 17:20:46 +0000 (18:20 +0100)]
conf: snapshot: Remove VIR_DOMAIN_SNAPSHOT_PARSE_DISKS flag

All callers except the one in the 'esx' driver pass the flag. The 'esx'
driver has a check that 'def->ndisks' is zero after parsing the
definition. This means that we can simply always parse the disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuDomainSnapshotForEachQcow2Raw: Act only on internal snapshots
Peter Krempa [Tue, 8 Mar 2022 17:08:54 +0000 (18:08 +0100)]
qemuDomainSnapshotForEachQcow2Raw: Act only on internal snapshots

Similarly to the external snapshot code the internal inactive snapshot
creation helper should act only when an internal snapshot of the disk is
required. For now the callers ensure that it's either _INTERNAL or _NO
when control reaches this function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoRename VIR_DOMAIN_SNAPSHOT_LOCATION_NONE to VIR_DOMAIN_SNAPSHOT_LOCATION_NO
Peter Krempa [Tue, 8 Mar 2022 14:42:38 +0000 (15:42 +0100)]
Rename VIR_DOMAIN_SNAPSHOT_LOCATION_NONE to VIR_DOMAIN_SNAPSHOT_LOCATION_NO

The string value associated to the enum is "no". Rename the enum
accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoconf: Move definition of 'virDomainSnapshotLocation'
Peter Krempa [Tue, 8 Mar 2022 14:36:17 +0000 (15:36 +0100)]
conf: Move definition of 'virDomainSnapshotLocation'

The snapshot location enum is also needed for the disk definition so if
we house it inside domain_conf we can use the proper type for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirStorageSource: Convert 'type' to proper enum
Peter Krempa [Tue, 8 Mar 2022 14:02:29 +0000 (15:02 +0100)]
virStorageSource: Convert 'type' to proper enum

Use 'virStorageType' as type for the 'type' member and convert the code
to work properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainSnapshotDiskDefParseXML: Automatically free temporary variables and remove...
Peter Krempa [Tue, 8 Mar 2022 08:11:15 +0000 (09:11 +0100)]
virDomainSnapshotDiskDefParseXML: Automatically free temporary variables and remove cleanup

Refactor the function to avoid the cleanup section used to just free
memory associated with the parsed object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuSnapshotCreateAlignDisks: Rewrite logic for selecting default memory snapshot...
Peter Krempa [Fri, 4 Mar 2022 13:37:13 +0000 (14:37 +0100)]
qemuSnapshotCreateAlignDisks: Rewrite logic for selecting default memory snapshot mode

Use an if/else branch rather than a expression with a ternary operator.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemuSnapshotDiskPrepareActiveExternal: Handle only external snapshots
Peter Krempa [Fri, 4 Mar 2022 13:34:02 +0000 (14:34 +0100)]
qemuSnapshotDiskPrepareActiveExternal: Handle only external snapshots

Preparation steps ensure that the 'snapshot' field can only be
'VIR_DOMAIN_SNAPSHOT_LOCATION_NONE' or
VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL' at this point, but upcoming
patches will change that. Handle only external snapshots.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirDomainDiskDefFormat: Refactor to virXMLFormatElement
Peter Krempa [Fri, 4 Mar 2022 12:56:02 +0000 (13:56 +0100)]
virDomainDiskDefFormat: Refactor to virXMLFormatElement

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: downloads: mark GitLab as the primary source
Ján Tomko [Thu, 10 Mar 2022 19:08:17 +0000 (20:08 +0100)]
docs: downloads: mark GitLab as the primary source

Document our usage of GitLab and the read-only mirrors.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: downloads: remove reference to git://
Ján Tomko [Thu, 10 Mar 2022 17:31:44 +0000 (18:31 +0100)]
docs: downloads: remove reference to git://

With the introduction of smart HTTP protocol in git 1.6.6,
the only advantage of plain git:// over https:// is not
having the encryption overhead.

Remove the reference to git://, assuming the overhead
is neligible compared to the value of screen space
on the downloads page.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: downloads: remove links to libvirt.org mirrors
Ján Tomko [Thu, 10 Mar 2022 15:51:23 +0000 (16:51 +0100)]
docs: downloads: remove links to libvirt.org mirrors

While the mirrors themselves are still available, the gitweb
interface on libvirt.org has been disabled.

The mirrors can still be accessible via, e.g.:

  git clone https://libvirt.org/git/libvirt-python.git

But such link gives a 404 error. Remove the links from the website
to avoid confusion.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agovirsh: Provide completer for vol-wipe algorithms
Haonan Wang [Thu, 10 Mar 2022 15:22:24 +0000 (23:22 +0800)]
virsh: Provide completer for vol-wipe algorithms

Related issue: https://gitlab.com/libvirt/libvirt/-/issues/9

Signed-off-by: Haonan Wang <hnwanga1@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agodocs: Convert 'testsuites' page to rST
Peter Krempa [Thu, 10 Mar 2022 15:36:15 +0000 (16:36 +0100)]
docs: Convert 'testsuites' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'testtck' page to rST
Peter Krempa [Thu, 10 Mar 2022 15:34:51 +0000 (16:34 +0100)]
docs: Convert 'testtck' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'pci-hotplug' page to rST
Peter Krempa [Thu, 10 Mar 2022 15:28:52 +0000 (16:28 +0100)]
docs: Convert 'pci-hotplug' page to rST

One internal reference was modified to work properly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'nss' page to rST
Peter Krempa [Thu, 10 Mar 2022 15:25:15 +0000 (16:25 +0100)]
docs: Convert 'nss' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agosyntax-check: Don't check for non-reentrant functions in '.rst' files
Peter Krempa [Thu, 10 Mar 2022 15:30:15 +0000 (16:30 +0100)]
syntax-check: Don't check for non-reentrant functions in '.rst' files

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'testapi' page to rST
Peter Krempa [Thu, 10 Mar 2022 15:23:24 +0000 (16:23 +0100)]
docs: Convert 'testapi' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'contact' page to rST
Peter Krempa [Thu, 10 Mar 2022 15:09:32 +0000 (16:09 +0100)]
docs: Convert 'contact' page to rST

Preserve the 'irc' and 'email' anchors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'downloads' page to rST
Peter Krempa [Thu, 10 Mar 2022 14:32:04 +0000 (15:32 +0100)]
docs: Convert 'downloads' page to rST

The table was manually converted to a set of 'list-table'-s for better
experience of viewing the text.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: formatsnapshot: Remove empty 'seclabel' definition
Peter Krempa [Wed, 9 Mar 2022 08:47:24 +0000 (09:47 +0100)]
docs: formatsnapshot: Remove empty 'seclabel' definition

The security label setting for the external images is part of the
'source' element and documented there. Remove the empty definition added
accidentally in commit ac88a8cfad1

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: formatsnapshot: Remove explicit listing of supported snapshot formats
Peter Krempa [Wed, 9 Mar 2022 08:40:31 +0000 (09:40 +0100)]
docs: formatsnapshot: Remove explicit listing of supported snapshot formats

In blockdev mode we support creating snapshots on all kinds of storage
that qemu allows us to format the image. Drop the part of the sentence
enumerating explicitly supported protocols.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: formatsnapshot: Move paragraphs describing 'disk' element together
Peter Krempa [Wed, 9 Mar 2022 08:34:40 +0000 (09:34 +0100)]
docs: formatsnapshot: Move paragraphs describing 'disk' element together

There was another paragraph describing the attribute 'type' of the
'disk' element under the description of the subelements. Move it to the
top to get all relevant information in one place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: securityprocess: Don't claim that we have maint branches
Peter Krempa [Mon, 7 Mar 2022 13:59:22 +0000 (14:59 +0100)]
docs: securityprocess: Don't claim that we have maint branches

The 'Branch fixing policy' paragraph claims that we have at least one
actively maintained stable branch which isn't currently the case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agorun: gracefully handle SIGHUP, SIGQUIT, SIGTERM
Daniel P. Berrangé [Wed, 9 Mar 2022 10:52:12 +0000 (10:52 +0000)]
run: gracefully handle SIGHUP, SIGQUIT, SIGTERM

When using thue 'run' script to launch a daemon, it is intended to
temporarily stop the systemd units and re-start them again after.

When using this script over an SSH connection, it will get SIGHUP
if the connection goes away, and in this case it fails to re-start
the systemd units. We need to catch SIGHUP and turn it into a
normal python exception. For good measure we do the same for
SIGQUIT and SIGTERM too.  SIGINT already gets turned into an
exception by default which we handle.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agorun: include 'src' in $PATH for the daemons
Daniel P. Berrangé [Wed, 9 Mar 2022 10:51:36 +0000 (10:51 +0000)]
run: include 'src' in $PATH for the daemons

Currently the 'run' script modifies $PATH to add the 'tools'
directly to pick up client programs. It fails to add the 'src'
directory to pick up the daemons.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoconf: remove misleading comments about access being 'lockless'
Daniel P. Berrangé [Tue, 8 Mar 2022 16:56:05 +0000 (16:56 +0000)]
conf: remove misleading comments about access being 'lockless'

For the various structs storing lists of objects, the access
to the hash tables is not lockless. The mutex on the object
owning the hash table must be held.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agovirsh: fflush(stdout) after fputs()
Michal Privoznik [Wed, 9 Mar 2022 13:01:49 +0000 (14:01 +0100)]
virsh: fflush(stdout) after fputs()

We are not guaranteed that the string we are printing onto stdout
contains '\n' and thus that the stdout is flushed. In fact, I've
met this problem when virsh asked me whether I want to edit the
domain XML again (vshAskReedit()) but the prompt wasn't displayed
(as it does not contain a newline character) and virsh just sat
there waiting for my input, I sat there waiting for virsh's
output. Flush stdout after all fputs()-s  which do not flush
stdout.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoqemu: support multiqueue for vdpa net device
Jonathon Jongsma [Tue, 1 Mar 2022 22:55:21 +0000 (16:55 -0600)]
qemu: support multiqueue for vdpa net device

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

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
3 years agonews: Document that we build with musl
Martin Kletzander [Wed, 9 Mar 2022 10:19:02 +0000 (11:19 +0100)]
news: Document that we build with musl

A bit of effort by me and Michal helped make this the case, and it helped us
uncover some potential issues.  I am not documenting it as supported or adding
an Alpine container into the CI, but since there were some distribution bugs
mentioning libvirt issues I thing it would be nice of us to notify those
distribution maintainers that read our release news.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agonwfilter: drop support for legacy iptables conntrack direction
Daniel P. Berrangé [Fri, 25 Feb 2022 16:28:32 +0000 (16:28 +0000)]
nwfilter: drop support for legacy iptables conntrack direction

Long ago we adapted to Linux kernel changes which inverted the
behaviour of the conntrack --ctdir setting:

  commit a6a04ea47a8143ba46150889d8dae1c861df6389
  Author: Stefan Berger <stefanb@us.ibm.com>
  Date:   Wed May 15 21:02:11 2013 -0400

    nwfilter: check for inverted ctdir

    Linux netfilter at some point (Linux 2.6.39) inverted the meaning of the
    '--ctdir reply' and newer netfilter implementations now expect
    '--ctdir original' instead and vice-versa.
    We check for the kernel version and assume that all Linux kernels with version
    2.6.39 have the newer inverted logic.

    Any distro backporting the Linux kernel patch that inverts the --ctdir logic
    (Linux commit 96120d86f) must also backport this patch for Linux and
    adapt the kernel version being tested for.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Given our supported platform targets, we no longer need to
consider a version of Linux before 2.6.39, so can drop
support for the old direction behaviour.

The test suite updates are triggered because that never
probed for the ctdir direction, and so the iptables syntax
generator unconditionally dropped the ctdir args.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agonwfilter: drop support for legacy iptables match syntax
Daniel P. Berrangé [Fri, 25 Feb 2022 16:24:21 +0000 (16:24 +0000)]
nwfilter: drop support for legacy iptables match syntax

Long ago we adapted to iptables changes by introducing support
for '-m conntrack':

  commit 06844ccbaa8544d7d08d568aff37bc4e3648f304
  Author: Stefan Berger <stefanb@us.ibm.com>
  Date:   Tue Aug 6 20:30:46 2013 -0400

    nwfilter: Use -m conntrack rather than -m state

    Since iptables version 1.4.16 '-m state --state NEW' is converted to
    '-m conntrack --ctstate NEW'. Therefore, when encountering this or later
    versions of iptables use '-m conntrack --ctstate'.

Given our supported platform targets, we no longer need to
consider a version of iptables before 1.4.16, so can drop
support for the old syntax.

The test suite updates are triggered because that never
probed for the new syntax, and so unconditionally
generated the old syntax.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoapparmor: Fix QEMU access for UEFI variable files
Martin Pitt [Fri, 25 Feb 2022 14:07:30 +0000 (14:07 +0000)]
apparmor: Fix QEMU access for UEFI variable files

QEMU needs to read, write, and lock the NVRAM *.fd files with UEFI
firmware.

Fixes: https://bugs.debian.org/1006324
Fixes: https://launchpad.net/bugs/1962035
Signed-off-by: Martin Pitt <mpitt@debian.org>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
3 years agodocs: meson: Restore alphabetical order
Peter Krempa [Mon, 7 Mar 2022 15:38:05 +0000 (16:38 +0100)]
docs: meson: Restore alphabetical order

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: formatsecret: Drop few unneeded empty lines
Peter Krempa [Mon, 7 Mar 2022 15:25:19 +0000 (16:25 +0100)]
docs: formatsecret: Drop few unneeded empty lines

The examples contain some whitespace and command prompts which just
waste space.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'formatsecret' page to rST
Peter Krempa [Mon, 7 Mar 2022 15:16:58 +0000 (16:16 +0100)]
docs: Convert 'formatsecret' page to rST

Also update the link from 'formatstorageencryption' to the
'usage-type-volume' anchor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'drivers' page to rST
Peter Krempa [Mon, 7 Mar 2022 15:09:03 +0000 (16:09 +0100)]
docs: Convert 'drivers' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: page.xsl: Update anchor to the 'Code of conduct' paragraph
Peter Krempa [Mon, 7 Mar 2022 15:05:23 +0000 (16:05 +0100)]
docs: page.xsl: Update anchor to the 'Code of conduct' paragraph

Use the anchor name as generated by rst2html.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'governance' page to rST
Peter Krempa [Mon, 7 Mar 2022 15:02:55 +0000 (16:02 +0100)]
docs: Convert 'governance' page to rST

Extra care is taken to preserve the 'codeofconduct' anchor which is used
in our page template. Upcoming patch will change that but we'll retain
the anchor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'securityprocess' page to rST
Peter Krempa [Mon, 7 Mar 2022 13:56:53 +0000 (14:56 +0100)]
docs: Convert 'securityprocess' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'support' page to rST
Peter Krempa [Mon, 7 Mar 2022 13:54:23 +0000 (14:54 +0100)]
docs: Convert 'support' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'errors' page to rST
Peter Krempa [Mon, 7 Mar 2022 13:46:22 +0000 (14:46 +0100)]
docs: Convert 'errors' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'bugs' page to rST
Peter Krempa [Mon, 7 Mar 2022 13:39:24 +0000 (14:39 +0100)]
docs: Convert 'bugs' page to rST

Special care is given to preserve the 'quality' anchor in the 'bugs'
page as we link to it directly from the gitlab issue template.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'contribute' page to rST
Peter Krempa [Mon, 7 Mar 2022 13:29:40 +0000 (14:29 +0100)]
docs: Convert 'contribute' page to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'strategy' to rST
Peter Krempa [Fri, 4 Mar 2022 16:11:45 +0000 (17:11 +0100)]
docs: Convert 'strategy' to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Convert 'goals' to rST
Peter Krempa [Fri, 4 Mar 2022 16:08:31 +0000 (17:08 +0100)]
docs: Convert 'goals' to rST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: formatsnapshot: Convert to 'rst'
Peter Krempa [Fri, 4 Mar 2022 14:55:40 +0000 (15:55 +0100)]
docs: formatsnapshot: Convert to 'rst'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Drop 'devguide' page
Peter Krempa [Mon, 7 Mar 2022 13:14:46 +0000 (14:14 +0100)]
docs: Drop 'devguide' page

The page is not referenced from anywhere and contains dead links for the
output and links to old repos.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: Remove 'virshcmdref' page
Peter Krempa [Fri, 4 Mar 2022 15:50:45 +0000 (16:50 +0100)]
docs: Remove 'virshcmdref' page

The page isn't linked from anywhere and the project was archived.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibvirt-qemu: Fix capitalization of QEMU
Michal Privoznik [Tue, 8 Mar 2022 14:12:04 +0000 (15:12 +0100)]
libvirt-qemu: Fix capitalization of QEMU

In plenty of places we mention qemu, Qemu but the correct form is
all capitals.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolibvirt-qemu: Don't allow NULL cmd in virDomainQemuMonitorCommandWithFiles()
Michal Privoznik [Tue, 8 Mar 2022 14:09:59 +0000 (15:09 +0100)]
libvirt-qemu: Don't allow NULL cmd in virDomainQemuMonitorCommandWithFiles()

Nothing in daemon code is prepared for the command in
virDomainQemuMonitorCommandWithFiles() to be NULL. In fact, the
client side doesn't expect this either as our RPC describes the
argument as:

    remote_nonnull_string cmd;

Validate the argument in the public API implementation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agonwfilter: make some gentech driver methods static
Daniel P. Berrangé [Fri, 25 Feb 2022 14:23:11 +0000 (14:23 +0000)]
nwfilter: make some gentech driver methods static

The virNWFilterTechDriverForName & virNWFilterUpdateInstantiateFilter
methods are only used within the same source file, so don't need to
be exported.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agonwfilter: remove decl of virNWFilterCreateVarHashmap
Daniel P. Berrangé [Fri, 25 Feb 2022 14:21:56 +0000 (14:21 +0000)]
nwfilter: remove decl of virNWFilterCreateVarHashmap

This method doesn't exist since

  commit d1a7c08eb145d8b9d9c4a268f4ffff3b1590049a
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Thu Apr 26 12:26:51 2018 +0100

    nwfilter: convert the gentech driver code to use virNWFilterBindingDefPtr

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoqemu,lxc: remove use to nwfilter update lock
Daniel P. Berrangé [Thu, 24 Feb 2022 19:02:32 +0000 (19:02 +0000)]
qemu,lxc: remove use to nwfilter update lock

Now that the virNWFilterBinding APIs are using the nwfilter
update lock directly, there is no need for the virt drivers
to do it themselves.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agonwfilter: hold filter update lock when creating/deleting bindings
Daniel P. Berrangé [Thu, 24 Feb 2022 18:41:29 +0000 (18:41 +0000)]
nwfilter: hold filter update lock when creating/deleting bindings

The nwfilter update lock is historically acquired by the virt
drivers in order to achieve serialization between nwfilter
define/undefine, and instantiation/teardown of filters.

When running in the modular daemons, however, the mutex that
the virt drivers are locking is in a completely different
process from the mutex that the nwfilter driver is locking.

Serialization is lost and thus call from the virt driver to
virNWFilterBindingCreateXML can deadlock with a concurrent
call to the virNWFilterDefineXML method.

The solution is surprisingly easy, the update lock simply
needs acquiring in the virNWFilterBindingCreateXML method
and virNWFilterBindingUndefine method instead of in the
virt drivers.

The only semantic difference here is that when a virtual
machine has multiple NICs, the instantiation and teardown
of filters is no longer serialized for the whole VM, but
rather for each NIC. This should not be a problem since
the virt drivers already need to cope with tearing down
a partially created VM where only some of the NICs are
setup.

Reviewed-by: Laine Stump <laine@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoTranslated using Weblate (Finnish)
Jan Kuparinen [Thu, 3 Mar 2022 20:16:58 +0000 (21:16 +0100)]
Translated using Weblate (Finnish)

Currently translated at 22.9% (2389 of 10404 strings)

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

Co-authored-by: Jan Kuparinen <copper_fin@hotmail.com>
Signed-off-by: Jan Kuparinen <copper_fin@hotmail.com>
3 years agomeson: Detect newer fuse
Michal Privoznik [Tue, 22 Feb 2022 14:21:49 +0000 (15:21 +0100)]
meson: Detect newer fuse

Now that we have support for fuse-3 we can detect it during the
configure phase. Even better, we can detect fuse-3 first and
fallback to old fuse only if the newer version doesn't exist.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse: Implement support for FUSE3
Michal Privoznik [Mon, 13 Apr 2020 11:17:47 +0000 (13:17 +0200)]
lxc_fuse: Implement support for FUSE3

Plenty of projects switch from FUSE to FUSE3. This commit enables
libvirt to compile with newer fuse-3.1 which allows users to have
just one fuse package on their systems, allows us to set
O_CLOEXEC on the fuse session FD. In general, FUSE3 offers more
features, but apparently we don't need them right now. There is a
rewrite guide at [1] but I've took most inspiration from sshfs
[2].

1: https://github.com/libfuse/libfuse/releases/tag/fuse-3.0.0
2: https://github.com/libfuse/sshfs

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse: Tell FUSE that /proc/meminfo is nonseekable
Michal Privoznik [Tue, 1 Mar 2022 08:35:48 +0000 (09:35 +0100)]
lxc_fuse: Tell FUSE that /proc/meminfo is nonseekable

If an app within a container wishes to read from /proc/meminfo
from a different position than the beginning of the file, we can
have FUSE keep track of all the lseek()-s and reflect them in
@offset argument of read callback (lxcProcRead()). This is done
by setting fuse_file_info::nonseekable. If we don't do this, then
FUSE reports errors back the app that does lseek().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse: Prefer fuse_file_info::direct_io over mount option
Michal Privoznik [Mon, 28 Feb 2022 12:26:14 +0000 (13:26 +0100)]
lxc_fuse: Prefer fuse_file_info::direct_io over mount option

When mounting a FUSE it is possible to bypass kernel cache by
specifying -odirect_io mount option. This is what we currently
do. However, FUSEv3 has a different approach - the open callback
(lxcProcOpen() in our case) can set direct_io member of
fuse_file_info struct. This results in the same behaviour, but
also works with both FUSEv1 and FUSEv3. The latter does not have
the mount option and uses per file approach.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxcProcReadMeminfo: Fix case when @offset != 0
Michal Privoznik [Mon, 28 Feb 2022 15:30:08 +0000 (16:30 +0100)]
lxcProcReadMeminfo: Fix case when @offset != 0

The idea behind lxcProcReadMeminfo() is that we read the host's
/proc/meminfo and copy it line by line producing the content for
container, changing only those lines we need. Thus, when a
process inside container opens the file and lseek()-s to a
different position (or reads the content in small chunks), we
mirror the seek in host's /proc/meminfo. But this doesn't work
really. We are not guaranteed to end up aligned on the beginning
of new line. It's better if we construct the new content and then
mimic seeking in it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxcProcReadMeminfo: Drop @new_meminfo variable
Michal Privoznik [Mon, 28 Feb 2022 14:29:58 +0000 (15:29 +0100)]
lxcProcReadMeminfo: Drop @new_meminfo variable

In the lxcProcReadMeminfo() function we have @buffer variable
which is statically allocated and then @new_meminfo which is just
a pointer to the @buffer. This is needless, the @buffer can be
accessed directly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxcProcReadMeminfo: Drop needless label
Michal Privoznik [Mon, 28 Feb 2022 14:27:24 +0000 (15:27 +0100)]
lxcProcReadMeminfo: Drop needless label

After previous cleanups, the cleanup label is no longer needed
and can be removed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse: Use automatic file closing
Michal Privoznik [Mon, 28 Feb 2022 14:21:31 +0000 (15:21 +0100)]
lxc_fuse: Use automatic file closing

There are two functions (lxcProcHostRead() and
lxcProcReadMeminfo()) that could benefit from automatic file
closing.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxcProcReadMeminfo: Rename @fd to @fp
Michal Privoznik [Mon, 28 Feb 2022 14:21:21 +0000 (15:21 +0100)]
lxcProcReadMeminfo: Rename @fd to @fp

In lxcProcReadMeminfo() there's a variable named @fd which would
suggest it's type of int, but in fact it's type of FILE *. Rename
it to @fp to avoid confusion.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxcSetupFuse: Cleanup error paths
Michal Privoznik [Tue, 22 Feb 2022 12:47:36 +0000 (13:47 +0100)]
lxcSetupFuse: Cleanup error paths

In the lxcSetupFuse() function there are multiple cleanup labels,
but with a bit of rewrite they can be joined into one 'error'
label. And while at it, set the @f argument only in the
successful path (currently is set in error case too).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse: Prefer O_ACCMODE instead of & 3
Michal Privoznik [Mon, 28 Feb 2022 11:53:39 +0000 (12:53 +0100)]
lxc_fuse: Prefer O_ACCMODE instead of & 3

In lxcProcOpen() we want to check whether the /proc/memfile is
being opened only for read. For that we check the fi->flags which
correspond to flags open() call. Instead of explicitly masking
the last two bits use O_ACCMODE constant, which is deemed to be
more portable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse.c: Modernize function declarations
Michal Privoznik [Tue, 1 Mar 2022 08:58:18 +0000 (09:58 +0100)]
lxc_fuse.c: Modernize function declarations

Our style of writing function declarations has changed since the
time the file was introduced. Fix the whole file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse: Drop some G_GNUC_UNUSED attributes
Michal Privoznik [Mon, 28 Feb 2022 11:53:25 +0000 (12:53 +0100)]
lxc_fuse: Drop some G_GNUC_UNUSED attributes

There are few arguments that are marked as G_GNUC_UNUSED even
though they are clearly used within their respective functions.
Drop the annotation in such cases.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse: Move #include <fuse.h>
Michal Privoznik [Mon, 13 Apr 2020 14:01:42 +0000 (16:01 +0200)]
lxc_fuse: Move #include <fuse.h>

There is no need to include the fuse.h from the header file.
Move the include into the lxc_fuse.c then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse.h: Don't include lxc_conf.h
Michal Privoznik [Tue, 22 Feb 2022 11:51:32 +0000 (12:51 +0100)]
lxc_fuse.h: Don't include lxc_conf.h

Nothing in the lxc_fuse.h header file warrants inclusion of
lxc_conf.h. If anything, virconftypes.h must be included because
of virDomainDef required by lxcSetupFuse().

It's actually lxc_fuse.c that requires some macros from
lxc_fuse.h (e.g. LXC_STATE_DIR).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse: Move virLXCMeminfo struct into lxc_cgroup.h
Michal Privoznik [Tue, 22 Feb 2022 11:50:52 +0000 (12:50 +0100)]
lxc_fuse: Move virLXCMeminfo struct into lxc_cgroup.h

The function that fills virLXCMeminfo struct
(virLXCCgroupGetMeminfo()) lives in lxc_cgroup.h. Move the struct
there too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agolxc_fuse: Hide struct virLXCFuse
Michal Privoznik [Mon, 13 Apr 2020 13:59:55 +0000 (15:59 +0200)]
lxc_fuse: Hide struct virLXCFuse

This structure is not used outside of lxc_fuse.c. There is no need
to define it in the header file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agowireshark: Fix dissector for quad types
Martin Kletzander [Mon, 7 Mar 2022 09:08:49 +0000 (10:08 +0100)]
wireshark: Fix dissector for quad types

This uses the right type that is expected to make it work even on platforms
where gint64 != quad_t.

Due to indentation changes it is best to view this patch with -w.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agodocs: remove extra closing tag
Ján Tomko [Mon, 7 Mar 2022 09:37:19 +0000 (10:37 +0100)]
docs: remove extra closing tag

Reported-by: Юлій В. Чирков <juliyvchirkov@gmail.com>
Closes: https://gitlab.com/libvirt/libvirt/-/merge_requests/143
Fixes: d3ac12e3a1c01d1205b4db3f6cd640f3da98579b
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: Allow expansion of mocked stat symbols
Martin Kletzander [Mon, 7 Mar 2022 08:21:26 +0000 (09:21 +0100)]
tests: Allow expansion of mocked stat symbols

When libc uses a define to rewrite stat64 to stat our mocks do not work if they
are chained because the symbol that we are looking up is being stringified and
therefore preventing the stat64->stat expansion per C-preprocessor rules.  One
stringification macro is just enough to make it work.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agonwfilter: Avoid memory alignment issues
Martin Kletzander [Thu, 3 Mar 2022 12:18:14 +0000 (13:18 +0100)]
nwfilter: Avoid memory alignment issues

The returned packet can have less strict alignment (u_char) than the struct
(ether_header) we are casting it to, so to avoid alignment issues just copy the
header into the struct on the stack.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoInclude sys/wait.h instead of wait.h
Martin Kletzander [Thu, 3 Mar 2022 12:17:02 +0000 (13:17 +0100)]
Include sys/wait.h instead of wait.h

That is the proper POSIX way.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoInclude poll.h instead of sys/poll.h
Martin Kletzander [Thu, 3 Mar 2022 12:16:35 +0000 (13:16 +0100)]
Include poll.h instead of sys/poll.h

That is the proper POSIX way.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agosyntax-check: Rework mock-noinline to get all files at once
Martin Kletzander [Thu, 3 Mar 2022 12:14:18 +0000 (13:14 +0100)]
syntax-check: Rework mock-noinline to get all files at once

The script can break if the number of files does not fit one invocation and
xargs has to split it.  Instead pipe the list of files directly into the script
and in the script read them from stdin instead of the arguments.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agotests: Update IPv4-in-IPv6 addresses
Michal Privoznik [Thu, 3 Mar 2022 15:57:30 +0000 (16:57 +0100)]
tests: Update IPv4-in-IPv6 addresses

We have couple of tests where the obsolete IPv4-in-IPv6 notation
is used (::10.1.2.3). Change them to the correct format
(::ffff:10.1.2.3).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agosockettest: Check for IPv4-in-IPv6 parsing and formatting
Michal Privoznik [Thu, 3 Mar 2022 15:43:18 +0000 (16:43 +0100)]
sockettest: Check for IPv4-in-IPv6 parsing and formatting

There are two standards how IPv4 address in IPv6 can be
expressed:

  ::10.1.2.3
  ::ffff:10.1.2.3

The former is obsolete and the latter should be used instead [1].
Add test cases to our sockettest to exercise parsing/formatting
of the valid address format.

1: https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.1

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovircgroupmock: Make global variables static
Michal Privoznik [Thu, 3 Mar 2022 15:23:48 +0000 (16:23 +0100)]
vircgroupmock: Make global variables static

Apparently clang was fixed as it no longer considers having
global variables static a problem. Make the variables static to
be sure they aren't used outside of the source file.

This effectively reverts v1.0.6-rc1~198 which started the trend.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovircgroupmock: Be wiser about detecting fakerootdir change
Michal Privoznik [Thu, 3 Mar 2022 14:42:17 +0000 (15:42 +0100)]
vircgroupmock: Be wiser about detecting fakerootdir change

The way that vircgroupmock works is that the vircgrouptest
creates a temporary directory and sets LIBVIRT_FAKE_ROOT_DIR env
variable which is then checked by the mock at the beginning of
basically every function it overrides (access(), stat in all its
flavours, mkdir(), etc.). The mock then creates a CGroup dir
structure. But the test is allowed to change the directory, to
accommodate environment for the particular test case. This is
done by changing the environment variable which is then detected
by the mock and the whole process repeats.

However, the way the mock detect changes is buggy. After it got
the environment variable it compares it to the last known value
(global variable @fakerootdir) and if they don't match the last
known value is set to point to the new value. Problem is that the
result of getenv() is assigned to the @fakerootdir directly.
Therefore, @fakerootdir points somewhere into the buffer of
environment variables. In turn, when the test sets new value (via
g_setenv()) it may be placed at the very same position in the env
var buffer and thus the mock fails to detect the change.

The solution is to keep our private copy of the value (by
g_strdup()) which makes the variable not rely on
getenv()/setenv() placing values at random positions.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agoremote: dispatch: free and close infiles too
Ján Tomko [Thu, 3 Mar 2022 13:02:28 +0000 (14:02 +0100)]
remote: dispatch: free and close infiles too

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agoremote: close outfiles faster
Ján Tomko [Thu, 3 Mar 2022 13:01:16 +0000 (14:01 +0100)]
remote: close outfiles faster

Switch the operands in the loop condition to make it converge.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
3 years agorpc: Fix memory leak of fds
Peng Liang [Wed, 2 Mar 2022 09:22:05 +0000 (17:22 +0800)]
rpc: Fix memory leak of fds

In virSystemdActivationClaimFDs, the memory of ent->fds has been stolen
and stored in fds, but fds is never freed, which causes a memory leak.
Fix it by declaring fds as g_autofree.

Reported-by: Jie Tang <tangjie18@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
3 years agolibxl: Turn on user aliases
Michal Privoznik [Thu, 17 Feb 2022 11:51:27 +0000 (12:51 +0100)]
libxl: Turn on user aliases

When I implemented user aliases I've invented this
virDomainDefFeatures flag so that individual drivers can signal
support for user provided aliases. The reasoning was that a
device alias might be part of guest ABI, or used in a different
way then in QEMU. Well, neither applies to the libxl driver, so
it's safe to allow user aliases there.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/231
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
3 years agovirsh: cmdDesc: Fix logic when '-edit' is used along with 'desc' argument
Peter Krempa [Wed, 2 Mar 2022 12:47:09 +0000 (13:47 +0100)]
virsh: cmdDesc: Fix logic when '-edit' is used along with 'desc' argument

Historically the use of the '-desc' multiple argument parameter was not
forbidden toghether with '-edit', but use of both together has some
unexpected behaviour. Specifically the editor is filled with the
contents passed via '-desc' but if the user doesn't change the text in
any way virsh will claim that the description was not chaged even if it
differs from the currently set description. Similarly, when the user
would edit the description provided via 'desc' so that it's identical
with the one configured for the domain, virsh would claim that it was
updated:

  # virsh desc cd
  No description for domain: cd
  # EDITOR=true virsh desc cd --edit "test desc"
  Domain description not changed

After the fix:

  # virsh desc cd
  No description for domain: cd
  # EDITOR=true virsh desc cd --edit "test desc"
  Domain description updated successfully
  # EDITOR=true virsh desc cd --edit "test desc"
  Domain description not changed

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: domain: Don't use ternaries inside vshPrint/vshError functions
Peter Krempa [Mon, 28 Feb 2022 17:40:01 +0000 (18:40 +0100)]
virsh: domain: Don't use ternaries inside vshPrint/vshError functions

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: cmdDesc: Remove unneeded 'cleanup'
Peter Krempa [Tue, 1 Mar 2022 16:31:00 +0000 (17:31 +0100)]
virsh: cmdDesc: Remove unneeded 'cleanup'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
3 years agovirsh: cmdDesc: Automatically free memory
Peter Krempa [Tue, 1 Mar 2022 16:29:04 +0000 (17:29 +0100)]
virsh: cmdDesc: Automatically free memory

Decrease scope of variables and use automatic freeing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>