]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
4 years agonetwork: Drop @custom_lease_file_len variable from networkGetDHCPLeases()
Michal Privoznik [Fri, 18 Dec 2020 15:09:12 +0000 (16:09 +0100)] 
network: Drop @custom_lease_file_len variable from networkGetDHCPLeases()

We don't need to track the lease file size. Instead, we can
simply check if the file was empty by comparing the buffer the
file was read into with an empty string.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirlease: Allow infinite lease expiry time
Michal Privoznik [Fri, 18 Dec 2020 15:09:11 +0000 (16:09 +0100)] 
virlease: Allow infinite lease expiry time

When adding a new lease by our leaseshelper then virLeaseNew() is
called. Here, we check for DNSMASQ_LEASE_EXPIRES environment
variable which is the expiration time for the lease. For infinite
lease time the value is zero. However, our code is not prepared
for that and adds "expiry-time" into the JSON file only if lease
expiry time is non-zero. This breaks the assumption that the
"expiry-time" attribute is always present (as can be seen in
virLeaseReadCustomLeaseFile() and virLeasePrintLeases()).

Store "expiry-time" always.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirlease: Use virTrimSpaces() instead of open coded alternative
Michal Privoznik [Fri, 18 Dec 2020 15:09:10 +0000 (16:09 +0100)] 
virlease: Use virTrimSpaces() instead of open coded alternative

In virLeaseNew() we are trying to remove trailing space (per
comment it may happen that older versions of dnsmasq put it into
an env variable). Well, instead of open coding it, we can use
virTrimSpaces().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agovirlease: Rework virLeaseReadCustomLeaseFile()
Michal Privoznik [Fri, 18 Dec 2020 15:09:09 +0000 (16:09 +0100)] 
virlease: Rework virLeaseReadCustomLeaseFile()

There are some variables which are used only inside the single
loop the function has. Let's declare them inside the loop body to
make that obvious. Also, fix indendation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoleaseshelper: Report errors on failure
Michal Privoznik [Fri, 18 Dec 2020 15:09:08 +0000 (16:09 +0100)] 
leaseshelper: Report errors on failure

If leasehelper fails all that we are left with is a simple error
message produced by dnsmasq:

  lease-init script returned exit code 1

This is because the leasehelper did not write any message to
stderr. According to dnsmasq's manpage, whenever it's invoking
leasehelper the stderr is kept open:

  All file descriptors are closed except stdin, which is open to
  /dev/null, and stdout and stderr which capture output for
  logging by dnsmasq.

As debugging leasehelper is not trivial (because dnsmasq invokes
it with plenty of env vars set - that's how data is passed onto
helper), let's print an error into stderr if exiting with an
error. And since we are not calling public APIs, we have to call
virDispatchError() explicitly and since we don't have any
connection open, we have to pass NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agodocs: Document ability to configure lease time
Michal Privoznik [Fri, 18 Dec 2020 15:09:07 +0000 (16:09 +0100)] 
docs: Document ability to configure lease time

In v6.3.0-rc1~64 we've introduced ability to configure lease
time, but forgot to document the feature. Let's fix that.

Fixes: 97a0aa246799c97d0a9ca9ecd6b4fd932ae4756c
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1908631
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoUpdate translation files
Weblate [Mon, 4 Jan 2021 13:36:42 +0000 (14:36 +0100)] 
Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

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

Co-authored-by: Weblate <noreply@weblate.org>
Signed-off-by: Fedora Weblate Translation <i18n@lists.fedoraproject.org>
4 years agoTranslated using Weblate (Bulgarian)
Nickys Music Group [Mon, 4 Jan 2021 13:36:42 +0000 (14:36 +0100)] 
Translated using Weblate (Bulgarian)

Currently translated at 3.1% (329 of 10440 strings)

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

Co-authored-by: Nickys Music Group <nickys.music.group@gmail.com>
Signed-off-by: Nickys Music Group <nickys.music.group@gmail.com>
4 years agoTranslated using Weblate (Polish)
Piotr Drąg [Mon, 4 Jan 2021 13:36:41 +0000 (14:36 +0100)] 
Translated using Weblate (Polish)

Currently translated at 23.4% (2444 of 10440 strings)

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

Co-authored-by: Piotr Drąg <piotrdrag@gmail.com>
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 4 Jan 2021 13:36:40 +0000 (14:36 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 20.2% (2119 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 20.0% (2089 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 19.1% (1999 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 18.5% (1941 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 18.0% (1880 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 17.7% (1852 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 17.1% (1790 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 16.8% (1760 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 16.2% (1698 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 15.9% (1669 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 15.7% (1640 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 15.4% (1610 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 15.1% (1580 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 14.8% (1550 of 10440 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agoqemu: Drop has_ccw_address from _qemuAgentDiskAddress
Michal Privoznik [Thu, 10 Dec 2020 11:37:26 +0000 (12:37 +0100)] 
qemu: Drop has_ccw_address from _qemuAgentDiskAddress

In recent patches new mambers to _qemuAgentDiskAddress struct
were introduced to keep optional CCW address sent by the guest
agent. These two members are a struct to store CCW address into
and a boolean to keep track whether the CCW address is valid.
Well, we can hold the same information with a pointer - instead
of storing the CCW address structure let's keep just a pointer to
it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
4 years agokbase: debuglogs: Fix typo in unprivileged libvirtd config path
Tomáš Janoušek [Mon, 4 Jan 2021 10:35:02 +0000 (11:35 +0100)] 
kbase: debuglogs: Fix typo in unprivileged libvirtd config path

Signed-off-by: Tomáš Janoušek <tomi@nomi.cz>
4 years agodomain_conf: Allow to look up scsi disks when controller uses a CCW address
Thomas Huth [Wed, 25 Nov 2020 11:06:48 +0000 (12:06 +0100)] 
domain_conf: Allow to look up scsi disks when controller uses a CCW address

On s390x, devices are attached to the channel IO subsytem by default,
so we need to look up scsi controllers via their CCW address there
instead of using PCI.

This fixes "virsh domfsinfo" on s390x for virtio-scsi devices (the first
attempt from commit f8333b3b0a7 did it in the wrong way, reporting the
device name on the guest side instead of the target name on the host side).

Fixes: f8333b3b0a ("qemu: Fix domfsinfo for non-PCI device information ...")
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1858771
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agodomain_conf: Allow to look up virtio-block devices by their CCW address
Thomas Huth [Wed, 25 Nov 2020 11:06:47 +0000 (12:06 +0100)] 
domain_conf: Allow to look up virtio-block devices by their CCW address

On s390x, devices are accessed via the channel subsystem by default,
so we need to look up the devices via their CCW address there instead
of using PCI.

This fixes "virsh domfsinfo" on s390x for virtio-block devices (the first
attempt from commit f8333b3b0a7 did it in the wrong way, reporting the
device name on the guest side instead of the target name on the host side).

Fixes: f8333b3b0a ("qemu: Fix domfsinfo for non-PCI device information ...")
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1858771
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: agent: Store CCW address in qemuAgentDiskInfo if provided by the guest
Thomas Huth [Wed, 25 Nov 2020 11:06:46 +0000 (12:06 +0100)] 
qemu: agent: Store CCW address in qemuAgentDiskInfo if provided by the guest

Newer versions of the QEMU guest agent will provide the CCW address
of devices on s390x. Store this information in the qemuAgentDiskInfo
so that we can use this later.

We also map the CSSID 0 from the guest to the value 0xfe on the host,
see https://www.qemu.org/docs/master/system/s390x/css.html for details.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Add IA32_CORE_CAPABILITY_MSR
Tim Wiederhake [Tue, 15 Dec 2020 16:25:15 +0000 (17:25 +0100)] 
cpu-gather: Add IA32_CORE_CAPABILITY_MSR

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Prepare gather_msr for reading multiple msr
Tim Wiederhake [Tue, 15 Dec 2020 16:25:14 +0000 (17:25 +0100)] 
cpu-gather: Prepare gather_msr for reading multiple msr

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Allow gathering and parsing data in one step.
Tim Wiederhake [Tue, 15 Dec 2020 16:25:13 +0000 (17:25 +0100)] 
cpu-gather: Allow gathering and parsing data in one step.

Make
  ./cpu-gather.py --gather --parse
an alias of
  ./cpu-gather.py [--gather] | ./cpu-gather.py --parse

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Parse cpuid leaves early
Tim Wiederhake [Tue, 15 Dec 2020 16:25:12 +0000 (17:25 +0100)] 
cpu-gather: Parse cpuid leaves early

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Ignore shutdown messages from qemu
Tim Wiederhake [Tue, 15 Dec 2020 16:25:11 +0000 (17:25 +0100)] 
cpu-gather: Ignore shutdown messages from qemu

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Ignore empty responses from qemu
Tim Wiederhake [Tue, 15 Dec 2020 16:25:10 +0000 (17:25 +0100)] 
cpu-gather: Ignore empty responses from qemu

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-parse: Delete old script
Tim Wiederhake [Tue, 15 Dec 2020 16:25:09 +0000 (17:25 +0100)] 
cpu-parse: Delete old script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-parse: Move call to cpu-cpuid.py to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:25:08 +0000 (17:25 +0100)] 
cpu-parse: Move call to cpu-cpuid.py to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-parse: Move json output to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:25:07 +0000 (17:25 +0100)] 
cpu-parse: Move json output to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-parse: Move xml output to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:25:06 +0000 (17:25 +0100)] 
cpu-parse: Move xml output to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-parse: Move file name generation to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:25:05 +0000 (17:25 +0100)] 
cpu-parse: Move file name generation to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-parse: Move model name detection to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:25:04 +0000 (17:25 +0100)] 
cpu-parse: Move model name detection to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Transport data as json
Tim Wiederhake [Tue, 15 Dec 2020 16:25:03 +0000 (17:25 +0100)] 
cpu-gather: Transport data as json

More reliable, easier to parse, easier to edit.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-parse: Wrap with python script
Tim Wiederhake [Tue, 15 Dec 2020 16:25:02 +0000 (17:25 +0100)] 
cpu-parse: Wrap with python script

This changes the invocation from
  ./cpu-gather.py | ./cpu-parse.sh
to
  ./cpu-gather.py [--gather] | ./cpu-gather.py --parse

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Separate data input and output
Tim Wiederhake [Tue, 15 Dec 2020 16:25:01 +0000 (17:25 +0100)] 
cpu-gather: Separate data input and output

This is a preparatory step to replace the output format with
something more readable.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Delete old script
Tim Wiederhake [Tue, 15 Dec 2020 16:25:00 +0000 (17:25 +0100)] 
cpu-gather: Delete old script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Merge model gathering logic
Tim Wiederhake [Tue, 15 Dec 2020 16:24:59 +0000 (17:24 +0100)] 
cpu-gather: Merge model gathering logic

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Move full model extraction to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:24:58 +0000 (17:24 +0100)] 
cpu-gather: Move full model extraction to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Move simple model extraction to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:24:57 +0000 (17:24 +0100)] 
cpu-gather: Move simple model extraction to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Move static model extraction to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:24:56 +0000 (17:24 +0100)] 
cpu-gather: Move static model extraction to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Move static model expansion to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:24:55 +0000 (17:24 +0100)] 
cpu-gather: Move static model expansion to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Move qemu detection to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:24:54 +0000 (17:24 +0100)] 
cpu-gather: Move qemu detection to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Move msr decoding to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:24:53 +0000 (17:24 +0100)] 
cpu-gather: Move msr decoding to new script

Fixes the leaking file descriptors. Does not silently ignore errors
(e.g. permission denied on /dev/cpu/0/msr if run as non-root) and
always attempt to read from /dev/kvm if /dev/cpu/0/msr failed.

'gather_msr()' returns a dictionary of values, as a later patch will
add more registers to be interrogated.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Allow overwriting cpuid binary location
Tim Wiederhake [Tue, 15 Dec 2020 16:24:52 +0000 (17:24 +0100)] 
cpu-gather: Allow overwriting cpuid binary location

This is useful if cpuid was compiled from source in a non-standard
location.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Move cpuid call to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:24:51 +0000 (17:24 +0100)] 
cpu-gather: Move cpuid call to new script

Turn the comment on how to aquire cpuid into a runtime error message.
Use "http" instead of "https" in the URL, as the latter is broken.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Allow overwriting model name
Tim Wiederhake [Tue, 15 Dec 2020 16:24:50 +0000 (17:24 +0100)] 
cpu-gather: Allow overwriting model name

Some hardware, e.g. exotic platforms or pre-production hardware, may
report wrong or random data for the cpu model name. As the name of
the created files is derived from that name, this may lead to issues.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Move model_name to new script
Tim Wiederhake [Tue, 15 Dec 2020 16:24:49 +0000 (17:24 +0100)] 
cpu-gather: Move model_name to new script

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-gather: Create python wrapper for shell script
Tim Wiederhake [Tue, 15 Dec 2020 16:24:48 +0000 (17:24 +0100)] 
cpu-gather: Create python wrapper for shell script

This changes the invocation from
  ./cpu-gather.sh | ./cpu-parse.sh
to
  ./cpu-gather.py | ./cpu-parse.sh

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agocpu-cpuid: Shorten overly long line
Tim Wiederhake [Tue, 15 Dec 2020 16:24:47 +0000 (17:24 +0100)] 
cpu-cpuid: Shorten overly long line

flake8 was complaining.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoschema: Allow counter element in host cpu definition
Tim Wiederhake [Tue, 15 Dec 2020 12:16:48 +0000 (13:16 +0100)] 
schema: Allow counter element in host cpu definition

If the capabilities include a counter element, e.g.
  <counter name='tsc' frequency='2591999000' scaling='no'/>
the XML could not be validated:
  $ virsh capabilities > cap.xml
  $ virsh [hypervisor-]cpu-compare cap.xml --validate
  error: Failed to compare hypervisor CPU with cap.txt
  error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/cpu.rng
  Did not expect element counter there

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoschemas: Deduplicate cpuTopology in cputypes.rng
Tim Wiederhake [Tue, 15 Dec 2020 12:16:47 +0000 (13:16 +0100)] 
schemas: Deduplicate cpuTopology in cputypes.rng

The duplicate had the "dies" attribute missing, causing
  $ virsh capabilities > cap.xml
  $ virsh [hypervisor-]cpu-compare cap.xml --validate
to fail with
  error: Failed to compare hypervisor CPU with cap.xml
  error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/cpu.rng
  Invalid attribute dies for element topology

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: add capabilities for QEMU 5.2.0 on s390x
Shalini Chellathurai Saroja [Tue, 15 Dec 2020 10:46:25 +0000 (11:46 +0100)] 
tests: add capabilities for QEMU 5.2.0 on s390x

Let us introduce the xml and reply files for QEMU 5.2.0 on s390x.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
4 years agolxd_domain: Require that VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NONE is zero
Michal Privoznik [Tue, 15 Dec 2020 19:06:35 +0000 (20:06 +0100)] 
lxd_domain: Require that VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NONE is zero

Our parser code relies on the fact that
VIR_LXC_DOMAIN_NAMESPACE_SOURCE_NONE has value of zero and thus
uses g_new0().  But strictly speaking, this is not mandated by
the enum typedef. Fix that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agolxc: Rework lxcDomainDefNamespaceParse()
Michal Privoznik [Tue, 15 Dec 2020 19:06:22 +0000 (20:06 +0100)] 
lxc: Rework lxcDomainDefNamespaceParse()

While fixing our schema for <lxc:namespace/> I've looked into the
parser and realized it could use some treating.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agolxc: Allow NULL argument to lxcDomainDefNamespaceFree()
Michal Privoznik [Tue, 15 Dec 2020 19:04:58 +0000 (20:04 +0100)] 
lxc: Allow NULL argument to lxcDomainDefNamespaceFree()

As all other free functions, NULL should be accepted. Even though
there currently is no caller that would pass NULL, there will be
in future patches.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoschema: Allow lxc:namepsace children to appear individually
Michal Privoznik [Tue, 15 Dec 2020 15:27:47 +0000 (16:27 +0100)] 
schema: Allow lxc:namepsace children to appear individually

Since its introduction in v1.2.19-rc1~8 our schema mandates that
LXC domain namespace child elements appear either all three at
once or not at all:

     <lxc:namespace>
       <lxc:sharenet type='netns' value='red'/>
       <lxc:shareipc type='pid' value='12345'/>
       <lxc:shareuts type='name' value='container1'/>
     </lxc:namespace>

This is not mandated by our parser though. Neither by code that
later uses it (virLXCProcessSetupNamespaces()). Relax the schema.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agovirnetdevopenvswitch: Try to unescape ovs-vsctl reply in one specific case
Michal Privoznik [Wed, 16 Dec 2020 16:52:14 +0000 (17:52 +0100)] 
virnetdevopenvswitch: Try to unescape ovs-vsctl reply in one specific case

During testing of my patch v6.10.0-rc1~221 it was found that

  'ovs-vsctl get Interface $name name' or
  'ovs-vsctl find Interface options:vhost-server-path=$path'

may return a string in double quotes, e.g. "vhost-user1". Later
investigation of openvswitch code showed, that early versions
(like 1.3.0) have somewhat restrictive set of safe characters
(isalpha() || '_' || '-' || '.'), which is then refined with
increasing version. For instance, version 2.11.4 has: isalnum()
|| '_' || '-' || '.'. If the string that ovs-vsctl wants to
output contains any other character it is escaped. You want to be
looking at ovsdb_atom_to_string() which handles outputting of a
single string and calls string_needs_quotes() and possibly
json_serialize_string() in openvswitch code base.

Since the interfaces are usually named "vhost-userN" we are
facing a problem where with one version we get the name in double
quotes and with another we get plain name without funny business.

Because of json involved I thought, let's make ovs-vsctl output
into JSON format and then use our JSON parser, but guess what -
ovs-vsctl ignores --format=json. But with a little help of
g_strdup_printf() it can be turned into JSON.

Fixes: e4c29e2904197472919d050c67acfd59f0144bbc
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1767013
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agovirNetDevOpenvswitchGetVhostuserIfname: Actually use @path to lookup interface
Michal Privoznik [Wed, 16 Dec 2020 17:52:48 +0000 (18:52 +0100)] 
virNetDevOpenvswitchGetVhostuserIfname: Actually use @path to lookup interface

In v6.10.0-rc1~221 I wanted to make virNetDevOpenvswitchGetVhostuserIfname()
lookup interface name even for vhostuser interfaces with mode='server'. For
these, we are given a socket path which is then created by QEMU and to which
OpenVSwitch connects to and creates an interface. Because of this, we don't
know the name of the interface upfront (when starting QEMU) and have to use
the path to query OpenVSwitch later (using ovs-vsctl). What I intended to use
was:

  ovs-vsctl --no-headings --columns=name find Interface options:vhost-server-path=$path

But what my code does is:

  ovs-vsctl --no-headings --columns=name find Interface options:vhost-server-path=path

and it's all because the argument to the function is named "path"
which I then enclosed in double quotes while it should have been
used as a variable.

Fixes: e4c29e2904197472919d050c67acfd59f0144bbc
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1767013
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agolxc: skip the netdev autogenerated name counter past existing devices
Laine Stump [Wed, 16 Dec 2020 19:58:21 +0000 (14:58 -0500)] 
lxc: skip the netdev autogenerated name counter past existing devices

the lxc driver uses virNetDevGenerateName() for its veth device names
since patch 2dd0fb492, so it should be using virNetDevReserveName()
during daemon restart/reconnect to skip over the device names that are
in use.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: minor comment/formatting changes to virNetDevTapCreate()
Laine Stump [Tue, 15 Dec 2020 20:14:45 +0000 (15:14 -0500)] 
util: minor comment/formatting changes to virNetDevTapCreate()

The comment about auto-generating names was obsoleted by recent
changes, and there was an unnecessary set of braces around a single
line conditional body.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: simplify virNetDevMacVLanCreateWithVPortProfile()
Laine Stump [Tue, 15 Dec 2020 19:50:40 +0000 (14:50 -0500)] 
util: simplify virNetDevMacVLanCreateWithVPortProfile()

Since commit 282d135ddbb the parser for <interface> has cleared out
any interface name from the input XML that used the macvtap/macvlan
name as a prefix. Along with that, the switch to use the new
virNetDevGenerateName() function for auto-generating macvtap/macvlan
device names (commit 9b5d741a9), has realized two facts:

1) virNetDevGenerateName() can be called with a name already filled
   in, and in that case it is an effective NOP.

2) because virNetDevGenerate() will always find an unused name, there
   is no need to retry device creation in a loop - if it fails the
   first time, it would fail any subsequent time as well.

that, combined with the aforementioned parser change allow us to
simplify virNetDevMacVLanCreateWithVPortProfile() - we no longer need
any extra code to determine if a template "AutoName" was requested,
and don't need a separate code path for creating the device in the
case that a specific name was given in the XML - all we need to do is
log any requested name, and then call exactly the same code as we
would if no name was given.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: remove redundant code that adds "template" netdev name
Laine Stump [Tue, 15 Dec 2020 19:35:35 +0000 (14:35 -0500)] 
qemu: remove redundant code that adds "template" netdev name

The lower level function virNetDevGenerateName() now understands that
a blank ifname should be replaced with a generated name based on a
template that it knows about itself - there is no need for the higher
level functions to stuff a template name ("vnet%d") into ifname.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agobhyve: remove redundant code that adds "template" netdev name
Laine Stump [Tue, 15 Dec 2020 19:32:23 +0000 (14:32 -0500)] 
bhyve: remove redundant code that adds "template" netdev name

The FreeBSD version of virNetDevTapCreate() now calls
virNetDevGenerateName(), and virNetDevGenerateName() understands that
a blank ifname should be replaced with a generated name based on a
device-type-specific template - so there is no longer any need for the
higher level functions to stuff a template name ("vnet%d") into
ifname.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: fix tap device name auto-generation for FreeBSD
Laine Stump [Tue, 15 Dec 2020 20:21:57 +0000 (15:21 -0500)] 
util: fix tap device name auto-generation for FreeBSD

The Linux implementation of virNetDevCreate() doesn't require a
template ifname (e.g. "vnet%d") when it is called, but just generates
a new name if ifname is empty. The FreeBSD implementation requires
that the caller actually fill in a template ifname, and will fail if
ifname is empty. Since we want to eliminate all the special code in
callers that is setting the template name, we need to make the
behavior of the FreeBSD virNetDevCreate() match the behavior of the
Linux virNetDevCreate().

The simplest way to do this is to use the new virNetDevGenerateName()
function - if ifname is empty it generates a new name with the proper
prefix, and if it's not empty, it leaves it alone.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agolxc: fix a memory leak
Shi Lei [Wed, 16 Dec 2020 06:01:06 +0000 (14:01 +0800)] 
lxc: fix a memory leak

In virLXCProcessSetupInterfaceTap, containerVeth needs to be freed on
failure.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoutil:veth: Create veth device pair by netlink
Shi Lei [Wed, 16 Dec 2020 06:01:05 +0000 (14:01 +0800)] 
util:veth: Create veth device pair by netlink

When netlink is supported, use netlink to create veth device pair
rather than 'ip link' command.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoutil:netlink: Enable virNetlinkNewLink to support veth
Shi Lei [Wed, 16 Dec 2020 06:01:04 +0000 (14:01 +0800)] 
util:netlink: Enable virNetlinkNewLink to support veth

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoqemu: Extra check for NBD URI being specified
Martin Kletzander [Wed, 16 Dec 2020 10:34:50 +0000 (11:34 +0100)] 
qemu: Extra check for NBD URI being specified

It must be used when migration URI uses `unix:` transport because otherwise we
cannot just guess where to connect for disk migration.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
4 years agodocs: Slightly alter disks-uri description in virsh man
Martin Kletzander [Sun, 13 Dec 2020 21:27:33 +0000 (22:27 +0100)] 
docs: Slightly alter disks-uri description in virsh man

It's more accurate this way.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
4 years agoqemu: Fix possible segfault when migrating disks
Martin Kletzander [Sun, 13 Dec 2020 14:49:29 +0000 (15:49 +0100)] 
qemu: Fix possible segfault when migrating disks

Users can provide URI without a schema.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
4 years agonetdevveth: Simplify virNetDevVethCreate by using virNetDevGenerateName
Shi Lei [Mon, 14 Dec 2020 01:50:35 +0000 (09:50 +0800)] 
netdevveth: Simplify virNetDevVethCreate by using virNetDevGenerateName

Simplify virNetDevVethCreate by using common GenerateName/ReserveName
functions.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agonetdevmacvlan: Use helper function to create unique macvlan/macvtap name
Shi Lei [Mon, 14 Dec 2020 01:50:34 +0000 (09:50 +0800)] 
netdevmacvlan: Use helper function to create unique macvlan/macvtap name

Simplify ReserveName/GenerateName for macvlan and macvtap by using
common functions.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agonetdevtap: Use common helper function to create unique tap name
Shi Lei [Mon, 14 Dec 2020 01:50:33 +0000 (09:50 +0800)] 
netdevtap: Use common helper function to create unique tap name

Simplify GenerateName/ReserveName for netdevtap by using common
functions.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agoutil: Introduce helper functions for generating unique netdev name
Shi Lei [Mon, 14 Dec 2020 01:50:32 +0000 (09:50 +0800)] 
util: Introduce helper functions for generating unique netdev name

Extract ReserveName/GenerateName from netdevtap and netdevmacvlan as
common helper functions.

Signed-off-by: Shi Lei <shi_lei@massclouds.com>
Reviewed-by: Laine Stump <laine@redhat.com>
4 years agolxc: don't try to reserve macvtap name for LXC domains
Laine Stump [Mon, 14 Dec 2020 21:19:26 +0000 (16:19 -0500)] 
lxc: don't try to reserve macvtap name for LXC domains

Commit 729a06c41 added code to the LXC driver (patterned after similar
code in the QEMU driver) that called
virNetDevMacVlanReserveName(net->ifname) for all type='direct'
interfaces during a libvirtd restart, to prevent other domains from
attempting to use a macvtap device name that was already in use by a
domain.

But, unlike a QEMU domain, when an LXC domain creates a macvtap
device, that device is almost immediately moved into the namespace of
the container (and it's then renamed, but that part isn't
important). Because of this, the LXC driver doesn't keep track (in
net->ifname) of the name used to create the device (as the QEMU driver
does).

The result of this is that if libvirtd is restarted while there is an
active LXC domain that has <interface type='direct'>, libvirtd will
segfault (since virNetDevMacVLanReserveName() doesn't check for a NULL
pointer).

The fix is to just not call that function in the case of the LXC
driver, since it is pointless anyway.

Fixes: 729a06c41afaab419a70841b6749646e2f8fad1d
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
4 years agoci: containers: Refresh the Dockerfiles
Erik Skultety [Mon, 14 Dec 2020 15:24:37 +0000 (16:24 +0100)] 
ci: containers: Refresh the Dockerfiles

Contains changes utilizing "nosync" and "eatmydata" for speedup as well
as fixes for CentOS-8 repoid regression.
ci-commit: b098ec6631a85880f818f2dd25c437d509e53680

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
4 years agoqemu: Relax validation for mem->access if guest has no NUMA
Michal Privoznik [Mon, 14 Dec 2020 11:20:07 +0000 (12:20 +0100)] 
qemu: Relax validation for mem->access if guest has no NUMA

In v6.8.0-27-g88957116c9 and friends I've switched the way the
default RAM is specified for QEMU (from plain -m to
memory-backend-*). This means, that even if a guest doesn't have
any NUMA nodes configured we can use memory-backend-* attributes
to translate user config requests. For instance, we can allow
memory to be shared (<access mode='shared'/> under
<memoryBacking/>). But what my original commits are missing is
allowing such configuration in our validator.

Fixes: 88957116c9d3cb4705380c3702c9d4315fb500bb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1839034#c12
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
4 years agodomain_validate.c: use VIR_ERR_CONFIG_UNSUPPORTED in validate functions
Daniel Henrique Barboza [Fri, 11 Dec 2020 13:04:04 +0000 (10:04 -0300)] 
domain_validate.c: use VIR_ERR_CONFIG_UNSUPPORTED in validate functions

Some functions in domain_validate.c are throwing VIR_ERR_XML_ERROR,
when in reality none of these errors are exclusive to XML parsing.

Change to VIR_ERR_CONFIG_UNSUPPORTED to be more adequate.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_validate.c: put IOMMU validation into a new function
Daniel Henrique Barboza [Fri, 11 Dec 2020 12:58:28 +0000 (09:58 -0300)] 
domain_validate.c: put IOMMU validation into a new function

All other validations from virDomainDefValidateInternal() are done
in their own functions. Take IOMMU validation out of the function
body and into its own function.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_validate.c: make virDomainDeviceDefValidateInternal() helpers static
Daniel Henrique Barboza [Fri, 11 Dec 2020 12:37:46 +0000 (09:37 -0300)] 
domain_validate.c: make virDomainDeviceDefValidateInternal() helpers static

After the move from the previous patch, these functions are now all
used in domain_validate.c and doesn't need to be public.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: move virDomainDeviceDefValidate() to domain_validate.c
Daniel Henrique Barboza [Fri, 11 Dec 2020 12:27:17 +0000 (09:27 -0300)] 
domain_conf.c: move virDomainDeviceDefValidate() to domain_validate.c

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf: move all DeviceDefValidateInternal() helpers to domain_validate
Daniel Henrique Barboza [Fri, 11 Dec 2020 10:39:00 +0000 (07:39 -0300)] 
domain_conf: move all DeviceDefValidateInternal() helpers to domain_validate

Moving all remaining static helpers of virDomainDeviceDefValidateInternal()
will allow the next patch to move the function itself, and
virDomainDeviceDefValidate(), to domain_validate.c.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf: move net device validation to domain_validate.c
Daniel Henrique Barboza [Fri, 11 Dec 2020 00:38:07 +0000 (21:38 -0300)] 
domain_conf: move net device validation to domain_validate.c

The next objective is to move virDomainDeviceDefValidate() to
domain_validate.c. First let's move all the static helpers.

The net device validation functions are used across multiple
drivers, so let's move them separately first.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_validate.c: make local functions static
Daniel Henrique Barboza [Fri, 11 Dec 2020 00:12:16 +0000 (21:12 -0300)] 
domain_validate.c: make local functions static

virDomainDefValidateInternal() helpers can now be made static again
since they're all in the same file.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: move virDomainDeviceDefValidate() to domain_validate.c
Daniel Henrique Barboza [Thu, 10 Dec 2020 22:12:30 +0000 (19:12 -0300)] 
domain_conf.c: move virDomainDeviceDefValidate() to domain_validate.c

Move virDomainDeviceDefValidate() and all its helper functions to
domain_validate.c.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf: move all virDomainDefValidateInternal() helpers to domain_validate.c
Daniel Henrique Barboza [Thu, 10 Dec 2020 20:36:27 +0000 (17:36 -0300)] 
domain_conf: move all virDomainDefValidateInternal() helpers to domain_validate.c

This patches moves the remaining static functions that
virDomainDefValidateInternal() uses to domain_validate.c. This
allows the next patch to move virDomainDefValidateInternal(),
and virDomainDefValidate(), without too much hassle.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf: move address validation functions to domain_validate.c
Daniel Henrique Barboza [Thu, 10 Dec 2020 18:58:44 +0000 (15:58 -0300)] 
domain_conf: move address validation functions to domain_validate.c

virDomainDefValidateAliases() is one of the static functions that
needs to be handled before moving virDomainDefValidateInternal().
Let's move all related validate functions to domain_validate.c
at the same time.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf.c: rename virDomainDeviceInfoIterateInternal()
Daniel Henrique Barboza [Thu, 10 Dec 2020 19:10:33 +0000 (16:10 -0300)] 
domain_conf.c: rename virDomainDeviceInfoIterateInternal()

Next patch will move virDomainDefValidateAliases() to domain_validate.c,
which uses virDomainDeviceInfoIterateInternal(), meaning that this
function will be made public. Rename it now to remove the 'Internal'
of its name.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agodomain_conf: move duplicate check functions to domain_validate.c
Daniel Henrique Barboza [Thu, 10 Dec 2020 18:32:43 +0000 (15:32 -0300)] 
domain_conf: move duplicate check functions to domain_validate.c

virDomainDefCheckDuplicateDiskInfo() and virDomainDefCheckDuplicateDriveAddresses()
are static functions used by virDomainDefValidateInternal(). Let's
move them to domain_validate.c to start clearing up the path to
move virDomainDefValidateInternal().

Change the functions name slightly to be more on par with their
new home.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
4 years agoTranslated using Weblate (German)
Fabian Affolter [Mon, 14 Dec 2020 11:18:17 +0000 (12:18 +0100)] 
Translated using Weblate (German)

Currently translated at 51.1% (5342 of 10440 strings)

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

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
Signed-off-by: Fabian Affolter <mail@fabian-affolter.ch>
4 years agoTranslated using Weblate (Swedish)
Göran Uddeborg [Mon, 14 Dec 2020 11:18:16 +0000 (12:18 +0100)] 
Translated using Weblate (Swedish)

Currently translated at 14.5% (1520 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 14.2% (1490 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 13.9% (1460 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 13.6% (1430 of 10440 strings)

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

Translated using Weblate (Swedish)

Currently translated at 13.4% (1400 of 10440 strings)

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

Co-authored-by: Göran Uddeborg <goeran@uddeborg.se>
Signed-off-by: Göran Uddeborg <goeran@uddeborg.se>
4 years agoTranslated using Weblate (Finnish)
Ricky Tigg [Mon, 14 Dec 2020 11:18:15 +0000 (12:18 +0100)] 
Translated using Weblate (Finnish)

Currently translated at 10.7% (1126 of 10440 strings)

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

Co-authored-by: Ricky Tigg <ricky.tigg@gmail.com>
Signed-off-by: Ricky Tigg <ricky.tigg@gmail.com>
4 years agonode_device: pacify grumpy coverity due to addr override
Boris Fiuczynski [Thu, 10 Dec 2020 17:32:36 +0000 (18:32 +0100)] 
node_device: pacify grumpy coverity due to addr override

With commit 09364608b4 node_device: refactor address retrieval of node device
"if-else if" was replaced by "switch".
The contained break statement now is no longer in context of the for loop
but instead of the switch causing the legitimate grumpiness of coverity.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Suggested-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: remove redundant check for file length when determining PCIe vs. PCI
Laine Stump [Tue, 8 Dec 2020 19:44:30 +0000 (14:44 -0500)] 
qemu: remove redundant check for file length when determining PCIe vs. PCI

Now that virPCIDeviceIsPCIExpress() checks the length of the file when
the process lacks sufficient privilege to read the entire PCI config
file in sysfs, we can remove the open-coding for that case from its
consumer.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: make virPCIDeviceIsPCIExpress() more intelligent
Laine Stump [Tue, 8 Dec 2020 19:34:19 +0000 (14:34 -0500)] 
util: make virPCIDeviceIsPCIExpress() more intelligent

Until now there has been an extra bit of code in
qemuDomainDeviceCalculatePCIConnectFlag() (one of the two callers of
virPCIDeviceIsPCIExpress()) that tries to determine if a device is
PCIe by looking at the *length* of its sysfs config file; it only does
this when libvirt is running as a non-root process.

This patch takes advantage of our newfound ability to tell the
difference between "I read a 0 from the device PCI config file" and "I
couldn't read the PCI Express Capabilities because I don't have
sufficient permission" to put the file length check down in
virPCIDeviceIsPCIExpress(), and do that check any time we fail while
reading the config file (not only when the process is non-root).

Fixes: https://bugzilla.redhat.com/1901685
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: change call sequence for virPCIDeviceFindCapabilityOffset()
Laine Stump [Mon, 7 Dec 2020 20:46:54 +0000 (15:46 -0500)] 
util: change call sequence for virPCIDeviceFindCapabilityOffset()

Previously there was no way to differentiate between this function 1)
encountering an error while reading the pci config, and 2) determining
that the device in question is a conventional PCI device, and so has
no Express Capabilities.

The difference between these two conditions is important, because an
unprivileged libvirtd will be unable to read all of the pci config (it
can only read the first 64 bytes, and will get ENOENT when it tries to
seek past that limit) even though the device is in fact a PCIe device.

This patch changes virPCIDeviceFindCapabilityOffset() to put the
determined offset into an argument of the function (rather than
sending it back as the return value), and to return the standard "0 on
success, -1 on failure". Failure is determined by checking the value
of errno after each attemptd read of the config file (which can only
work reliably if errno is reset to 0 before each read, and after
virPCIDeviceFindCapabilityOffset() has finished examining it).

(NB: if the config file is read successfully, but no Express
Capabilities are found, then the function returns success, but the
returned offset will be 0 (which is an impossible offset for Express
Capabilities, and so easily recognizeable).

An upcoming patch will take advantage of the change made here.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: make read error of PCI config file more detailed
Laine Stump [Mon, 7 Dec 2020 01:26:01 +0000 (20:26 -0500)] 
util: make read error of PCI config file more detailed

The new message is more verbose/useful, but only logged at debug level
instead of as a warning (since it could easily happen in a non-error
situation).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: simplify call to virPCIDeviceDetectPowerManagementReset()
Laine Stump [Sun, 6 Dec 2020 21:20:23 +0000 (16:20 -0500)] 
util: simplify call to virPCIDeviceDetectPowerManagementReset()

This function returned an int, but would only return 0 or 1, and the
one place it was called would just use !! to convert that value to a
bool. Change the function to directly return bool instead.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoutil: simplify calling of virPCIDeviceDetectFunctionLevelReset()
Laine Stump [Sun, 6 Dec 2020 21:05:03 +0000 (16:05 -0500)] 
util: simplify calling of virPCIDeviceDetectFunctionLevelReset()

This function returned an int, and that int was being checked for < 0
in its solitary caller, but within the function it would only ever
return 0 or 1. Change the function itself to return a bool, and the
caller to just directly set the flag in the virPCIDevice.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agoqemu: use g_autoptr for a virPCIDevice
Laine Stump [Tue, 24 Nov 2020 21:56:52 +0000 (16:56 -0500)] 
qemu: use g_autoptr for a virPCIDevice

The one instance of a virPCIDevice in
qemuDomainDeviceCalculatePCIConnectFlags() needs to be converted to
use g_autoptr as a prerequisite for a bugfix. It's in this patch by
itself (rather than in a patch converting all virPCIDevice usages to
g_autoptr) to simplify any backport of said bugfix.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: qemucapabilities: Update capabilities for qemu-5.2 release (x86_64)
Peter Krempa [Thu, 19 Nov 2020 15:40:25 +0000 (16:40 +0100)] 
tests: qemucapabilities: Update capabilities for qemu-5.2 release (x86_64)

qemu-5.2 is out! Let's update the capabilities for the final version.

Note that the 'enable-fips' feature vanishing in this update is expected
as the removal was tied to a version check (see commit 7b1ed1cd733a0 ).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: Add capabilities for QEMU 5.2 on riscv64
Andrea Bolognani [Thu, 10 Dec 2020 13:12:59 +0000 (14:12 +0100)] 
tests: Add capabilities for QEMU 5.2 on riscv64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: Add capabilities for QEMU 5.2 on ppc64
Andrea Bolognani [Thu, 10 Dec 2020 12:51:53 +0000 (13:51 +0100)] 
tests: Add capabilities for QEMU 5.2 on ppc64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agotests: Add capabilities for QEMU 5.2 on aarch64
Andrea Bolognani [Thu, 10 Dec 2020 12:51:43 +0000 (13:51 +0100)] 
tests: Add capabilities for QEMU 5.2 on aarch64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
4 years agospec: don't touch existing nwfilters on update
Nikolay Shirokovskiy [Mon, 7 Dec 2020 07:49:12 +0000 (10:49 +0300)] 
spec: don't touch existing nwfilters on update

Nwfilter can be edited by the user and we don't want to overwrite the editings.
Also the filters in %{datadir} does not have UUIDs and these are generated on
libvirtd start. Thus this patch also fixes regeneration of UUIDs on libvirtd
update.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>