]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoqemu: snapshot: Pass 'cfg' to external snapshot functions
Peter Krempa [Mon, 3 Jun 2019 15:42:30 +0000 (17:42 +0200)]
qemu: snapshot: Pass 'cfg' to external snapshot functions

The caller has it so there's no point in getting it again.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: qemuhotplug: Use schema testing with qemuMonitorTestNewFromFileFull
Peter Krempa [Fri, 7 Jun 2019 11:56:14 +0000 (13:56 +0200)]
tests: qemuhotplug: Use schema testing with qemuMonitorTestNewFromFileFull

Pass in the schema since it works with the 'file' test now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agotests: Allow QMP schema testing in qemuMonitorTestNewFromFileFull
Peter Krempa [Fri, 7 Jun 2019 11:53:45 +0000 (13:53 +0200)]
tests: Allow QMP schema testing in qemuMonitorTestNewFromFileFull

Pass in the schema data from the caller if QMP schema testing is
desired.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agotests: qemu: Add QMP schema checking in qemuMonitorTestProcessCommandVerbatim
Peter Krempa [Fri, 7 Jun 2019 08:38:06 +0000 (10:38 +0200)]
tests: qemu: Add QMP schema checking in qemuMonitorTestProcessCommandVerbatim

In case when we are testing a QMP command we can try to schema check it
so that we catch inconsistencies.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agotests: Refactor cleanup in qemuMonitorTestProcessCommandVerbatim
Peter Krempa [Fri, 7 Jun 2019 08:27:50 +0000 (10:27 +0200)]
tests: Refactor cleanup in qemuMonitorTestProcessCommandVerbatim

Use VIR_AUTOFREE and get rid of the cleanup section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
5 years agogitdm: Add gitdm configuration
Andrea Bolognani [Wed, 5 Jun 2019 14:52:32 +0000 (16:52 +0200)]
gitdm: Add gitdm configuration

This configuration can be used by gitdm to generate reports about
libvirt development.

The goal I was working with was being able to generate a report
for every single libvirt release and having zero "email address
as company" entries; picking different commit ranges might result
in some contributions not being accounted for.

I had to make some judgement calls when the situation was not
entirely clear-cut: when in doubt, and not finding any obvious
signs of the opposite being true, I mostly ended up dumping
people in the "unaffiliated contributions" bin. If I got it
wrong, and companies want to get recognition for their sponsored
contributions to libvirt, they can send patches.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agomailmap: Remove some duplicates
Andrea Bolognani [Thu, 6 Jun 2019 14:09:31 +0000 (16:09 +0200)]
mailmap: Remove some duplicates

Fabiano Fidencio was working for Red Hat when he contributed to
libvirt, Shi Lei's non-company email address contains the company
name so it's fair to assume contributions using it were made on
company time, and Adrian Brzezinski's personal email was used
for the S-o-b while the git authorship information clearly pointed
at the company being involved.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotest_driver: implement virDomainSendKey
Ilias Stamatis [Sat, 1 Jun 2019 12:46:56 +0000 (14:46 +0200)]
test_driver: implement virDomainSendKey

Validate @keycodes before successfully returning. Since this is test
driver, @holdtime is being unused here.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agoqemu: Fix NULL pointer access in qemuProcessInitCpuAffinity()
Andrea Bolognani [Thu, 6 Jun 2019 13:38:29 +0000 (15:38 +0200)]
qemu: Fix NULL pointer access in qemuProcessInitCpuAffinity()

Commit 2f2254c7f4e5 attempted to fix a memory leak by ensuring
cpumapToSet is always a freshly allocated bitmap, but regrettably
introduced a NULL pointer access while doing so, because it called
virBitmapCopy() without allocating the destination bitmap first.

Solve the issue by using virBitmapNewCopy() instead.

Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
5 years agovirsh: undefine: Clarify that --delete-storage-volume-snapshots causes failures
Peter Krempa [Wed, 5 Jun 2019 11:16:47 +0000 (13:16 +0200)]
virsh: undefine: Clarify that --delete-storage-volume-snapshots causes failures

The flag causes undefine to fail if trying to remove a non-RBD disk. Add
a warning about that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agovirsh: undefine: Rename --delete-snapshots to --delete-storage-volume-snapshots
Peter Krempa [Wed, 5 Jun 2019 11:06:58 +0000 (13:06 +0200)]
virsh: undefine: Rename --delete-snapshots to --delete-storage-volume-snapshots

The old flag name confused some users into thinking it's the correct way
to undefine a VM with libvirt (not storage volume) snapshots.

The correct flag in that case is way less obvious: --snapshots-metadata.

Rename the flag (by adding an alias) to something which will promote
looking up the actual purpose of the flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agovirsh: undefine: Clarify help string for --snapshots-metadata
Peter Krempa [Wed, 5 Jun 2019 10:57:42 +0000 (12:57 +0200)]
virsh: undefine: Clarify help string for --snapshots-metadata

Reword the end of the help string to make it more obvious that the VM
must be inactive.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agocpu_conf: Fix XPath for parsing TSC frequency
Jiri Denemark [Thu, 6 Jun 2019 07:29:38 +0000 (09:29 +0200)]
cpu_conf: Fix XPath for parsing TSC frequency

Due to this bug the following command would fail on any host where TSC
frequency can be probed:

    $ virsh capabilities | virsh cpu-baseline /dev/stdin
    error: unsupported configuration: Invalid TSC frequency

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirDomainObjListAddLocked: Drop useless @cleanup label
Michal Privoznik [Tue, 28 May 2019 13:47:12 +0000 (15:47 +0200)]
virDomainObjListAddLocked: Drop useless @cleanup label

It's a premature optimization. It's perfectly acceptable for
'error' label to deal with @vm == NULL case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
5 years agotests: Fix parentheses order in an assignment-comparison conditional
Erik Skultety [Tue, 4 Jun 2019 18:56:58 +0000 (20:56 +0200)]
tests: Fix parentheses order in an assignment-comparison conditional

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
5 years agoqemu: Drop cleanup label from qemuProcessInitCpuAffinity()
Andrea Bolognani [Tue, 4 Jun 2019 12:37:18 +0000 (14:37 +0200)]
qemu: Drop cleanup label from qemuProcessInitCpuAffinity()

We're using VIR_AUTOPTR() for everything now, plus the
cleanup section was not doing anything useful anyway.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Fix leak in qemuProcessInitCpuAffinity()
Andrea Bolognani [Tue, 4 Jun 2019 12:36:21 +0000 (14:36 +0200)]
qemu: Fix leak in qemuProcessInitCpuAffinity()

In two out of three scenarios we are cleaning up properly after
ourselves, but commit 5f2212c062c7 has changed the remaining one
in a way that caused it to start leaking cpumapToSet.

Refactor the logic so that cpumapToSet is always a freshly
allocated bitmap that gets cleaned up automatically thanks to
VIR_AUTOPTR(); this also allows us to remove the hostcpumap
variable.

Reported-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: Propagate numad failures correctly
Andrea Bolognani [Mon, 3 Jun 2019 16:45:27 +0000 (18:45 +0200)]
util: Propagate numad failures correctly

Right now, if numad fails, we raise an error but return an
empty string to the caller instead of a NULL pointer, which
means processing will continue and the user will see

  # virsh start guest
  error: Failed to start domain guest
  error: invalid argument: Failed to parse bitmap ''

instead of a more reasonable

  # virsh start guest
  error: Failed to start domain guest
  error: operation failed: Failed to query numad for the advisory nodeset

Make sure the user gets a better error message.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Fix qemuProcessInitCpuAffinity()
Andrea Bolognani [Thu, 30 May 2019 17:20:34 +0000 (19:20 +0200)]
qemu: Fix qemuProcessInitCpuAffinity()

Ever since the feature was introduced with commit 0f8e7ae33ace,
it has contained a logic error in that it attempted to use a NUMA
node map where a CPU map was expected.

Because of that, guests using <numatune> might fail to start:

  # virsh start guest
  error: Failed to start domain guest
  error: cannot set CPU affinity on process 40055: Invalid argument

This was particularly easy to trigger on POWER 8 machines, where
secondary threads always show up as offline in the host: having

  <numatune>
    <memory mode='strict' placement='static' nodeset='1'/>
  </numatune>

in the guest configuration, for example, would result in libvirt
trying to set the process affinity so that it would prefer
running on CPU 1, but since that's a secondary thread and thus
shows up as offline, the operation would fail, and so would
starting the guest.

Use the newly introduced virNumaNodesetToCPUset() to convert the
NUMA node map to a CPU map, which in the example above would be
48,56,64,72,80,88 - a valid input for virProcessSetAffinity().

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: Introduce virNumaNodesetToCPUset()
Andrea Bolognani [Thu, 30 May 2019 16:01:35 +0000 (18:01 +0200)]
util: Introduce virNumaNodesetToCPUset()

This helper converts a set of NUMA node to the set of CPUs
they contain.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: Introduce virBitmapUnion()
Andrea Bolognani [Thu, 30 May 2019 17:08:28 +0000 (19:08 +0200)]
util: Introduce virBitmapUnion()

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirDomainSendKey: validate codeset argument
Ilias Stamatis [Sat, 1 Jun 2019 12:40:12 +0000 (14:40 +0200)]
virDomainSendKey: validate codeset argument

This argument wasn't validated anywhere, neither in the generic
implementation nor in the individual drivers. As a result a call to this
function with a large enough codeset value prior to this change causes
libvirtd to crash.

This happens because all drivers call virKeycodeValueTranslate which
uses codeset as an index to the virKeymapValues array, causing an
out-of-bounds error.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agotest_driver: implement virDomainGetHostname
Ilias Stamatis [Fri, 31 May 2019 14:31:35 +0000 (16:31 +0200)]
test_driver: implement virDomainGetHostname

Always return "domain_name" + "host".

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agonews: Drop empty section
Andrea Bolognani [Mon, 3 Jun 2019 16:24:53 +0000 (18:24 +0200)]
news: Drop empty section

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: Check TSC frequency before starting QEMU
Jiri Denemark [Thu, 30 May 2019 22:03:59 +0000 (00:03 +0200)]
qemu: Check TSC frequency before starting QEMU

When migrating a domain with invtsc CPU feature enabled, the TSC
frequency of the destination host must match the frequency used when the
domain was started on the source host or the destination host has to
support TSC scaling.

If the frequencies do not match and the destination host does not
support TSC scaling, QEMU will fail to set the right TSC frequency when
starting vCPUs on the destination and thus migration will fail. However,
this is quite late since both host might have spent significant time
transferring memory and perhaps even storage data.

By adding the check to libvirt we can let migration fail before any data
starts to be sent over. If for some reason libvirt is unable to detect
the host's TSC frequency or scaling support, we'll just let QEMU try and
the migration will either succeed or fail later.

Luckily, we mandate TSC frequency to be explicitly set in the domain XML
to even allow migration of domains with invtsc. We can just check
whether the requested frequency is compatible with the current host
before starting QEMU.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 years agocpu_x86: Probe TSC frequency and scaling support
Jiri Denemark [Thu, 30 May 2019 19:47:38 +0000 (21:47 +0200)]
cpu_x86: Probe TSC frequency and scaling support

When the host CPU supports invariant TSC the host CPU definition created
by virCPUx86GetHost will contain (unless probing fails for some reason)
addition TSC related data.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 years agocpu_x86: Fix placement of *CheckFeature functions
Jiri Denemark [Tue, 16 Apr 2019 11:24:45 +0000 (13:24 +0200)]
cpu_x86: Fix placement of *CheckFeature functions

Commit 0a97486e09 moved them outside #ifdef, but after virCPUx86GetHost,
which will start calling them in the following patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoconf: Report TSC frequency in host CPU capabilities
Jiri Denemark [Thu, 30 May 2019 19:47:49 +0000 (21:47 +0200)]
conf: Report TSC frequency in host CPU capabilities

This patch adds a new

    <counter name='tsc' frequency='N' scaling='on|off'/>

element into the host CPU capabilities XML.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoutil: Add virHostCPUGetTscInfo
Jiri Denemark [Thu, 30 May 2019 14:34:59 +0000 (16:34 +0200)]
util: Add virHostCPUGetTscInfo

On a KVM x86_64 host which supports invariant TSC this function can be
used to detect the TSC frequency and the availability of TSC scaling.

The magic MSR numbers required to check if VMX scaling is supported on
the host are documented in Volume 3 of the Intel® 64 and IA-32
Architectures Software Developer’s Manual.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemuargv2xmltest: Use mocked virQEMUCapsProbeHostCPU
Jiri Denemark [Mon, 3 Jun 2019 11:15:19 +0000 (13:15 +0200)]
qemuargv2xmltest: Use mocked virQEMUCapsProbeHostCPU

The qemuTestParseCapabilitiesArch call would eventually lead to the host
CPU being probed via virCPUGetHost. Let's divert this to a mocked
version already used by the qemuxml2argvtest.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu: Make virQEMUCapsProbeHostCPUForEmulator more generic
Jiri Denemark [Mon, 3 Jun 2019 11:13:38 +0000 (13:13 +0200)]
qemu: Make virQEMUCapsProbeHostCPUForEmulator more generic

The function is renamed as virQEMUCapsProbeHostCPU and it does not get
the list of allowed CPU models from qemuCaps anymore. This is
responsibility is moved to the caller. The result is just a very thin
wrapper around virCPUGetHost mostly required mocking in tests.

The generic function is used in place of a direct call to virCPUGetHost
in virQEMUCapsInitHostCPUModel to make sure tests don't accidentally
probe host CPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
5 years agovirSysinfoReadARM: Try reading DMI table
Michal Privoznik [Thu, 9 May 2019 14:10:37 +0000 (16:10 +0200)]
virSysinfoReadARM: Try reading DMI table

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

Turns out, some aarch64 systems have SMBIOS info. That means we
can use dmidecode to fetch some information. If that fails, fall
back to the old behaviour.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agovirsysinfo: Rename virSysinfoReadX86 to virSysinfoReadDMI
Michal Privoznik [Fri, 10 May 2019 12:08:09 +0000 (14:08 +0200)]
virsysinfo: Rename virSysinfoReadX86 to virSysinfoReadDMI

There's nothing x86 specific about this function. Rename the
function so that it has DMI suffix which enables it to be reused
on different arches (as using X86 from say ARM would look
suspicious).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agotests: Add aarch64-gigabyte sysinfo test case
Andrea Bolognani [Thu, 30 May 2019 08:05:28 +0000 (10:05 +0200)]
tests: Add aarch64-gigabyte sysinfo test case

This test case uses (anonimized) data pulled from a
GIGABYTE R120-T34 server.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: Tweak x86 sysinfo test case
Andrea Bolognani [Thu, 30 May 2019 08:00:58 +0000 (10:00 +0200)]
tests: Tweak x86 sysinfo test case

We have a single mock dmidecode script right now, but we're
going to add another one soon, so we need to make sure its
name contains the test case name as a prefix, just like we
already do with all data files.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonews: Update for SMMUv3 IOMMU support
Andrea Bolognani [Tue, 28 May 2019 14:03:56 +0000 (16:03 +0200)]
news: Update for SMMUv3 IOMMU support

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Format SMMUv3 IOMMU
Andrea Bolognani [Tue, 28 May 2019 12:18:15 +0000 (14:18 +0200)]
qemu: Format SMMUv3 IOMMU

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Move capability checks for IOMMU features
Andrea Bolognani [Tue, 28 May 2019 14:00:57 +0000 (16:00 +0200)]
qemu: Move capability checks for IOMMU features

All current IOMMU features are specific to Intel IOMMU, so
understandably we check for the corresponding capabilities
inside the Intel-specific switch() branch; however, we want
to make sure SMMUv3 IOMMU users get an error if they try to
enable any of those features in their guest, and performing
the capability checks unconditionally is both the easiest
way to achieve that, as well as the one least likely to
result in us inadvertently letting users enable some new
Intel-specific IOMMU feature for ARM guests later on.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Add validation for SMMUv3 IOMMU
Andrea Bolognani [Tue, 28 May 2019 12:34:20 +0000 (14:34 +0200)]
qemu: Add validation for SMMUv3 IOMMU

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: Parse and format SMMUv3 IOMMU
Andrea Bolognani [Fri, 17 May 2019 11:23:16 +0000 (13:23 +0200)]
conf: Parse and format SMMUv3 IOMMU

SMMUv3 is an IOMMU implementation for ARM virt guests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Introduce QEMU_CAPS_MACHINE_VIRT_IOMMU
Andrea Bolognani [Fri, 17 May 2019 07:15:27 +0000 (09:15 +0200)]
qemu: Introduce QEMU_CAPS_MACHINE_VIRT_IOMMU

This capability can be used to figure out whether the
QEMU binary at hand supports the machine type property
we need in order to enable SMMUv3 IOMMU support.

Unfortunately we can't avoid probing the RISC-V binaries
along with the ARM ones, since both architectures have
their own 'virt' machine type.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Move capability checks inside switch() statements
Andrea Bolognani [Tue, 28 May 2019 10:49:32 +0000 (12:49 +0200)]
qemu: Move capability checks inside switch() statements

Current capability checks are specific to Intel IOMMU, so
we need to move them inside the switch() statement before
we can introduce more virDomainIOMMUModel values.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Move virBuffer inside switch() statement
Andrea Bolognani [Tue, 28 May 2019 10:45:26 +0000 (12:45 +0200)]
qemu: Move virBuffer inside switch() statement

This doesn't make a whole lot of difference now, but once
we introduce more virDomainIOMMUModel values the current
structure will no longer work.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Use VIR_AUTOCLEAN() in qemuBuildIOMMUCommandLine()
Andrea Bolognani [Tue, 28 May 2019 10:42:22 +0000 (12:42 +0200)]
qemu: Use VIR_AUTOCLEAN() in qemuBuildIOMMUCommandLine()

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Drop 'ret' from qemuBuildIOMMUCommandLine()
Andrea Bolognani [Tue, 28 May 2019 10:40:05 +0000 (12:40 +0200)]
qemu: Drop 'ret' from qemuBuildIOMMUCommandLine()

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Fix switch() statements for virDomainIOMMUModel
Andrea Bolognani [Tue, 28 May 2019 10:35:42 +0000 (12:35 +0200)]
qemu: Fix switch() statements for virDomainIOMMUModel

Ensure unexpected values are dealt with correctly, that
is by invoking virReportEnumRangeError() and immediately
returning a negative value to the caller.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoexamples: Group all C programs together
Andrea Bolognani [Wed, 22 May 2019 16:16:59 +0000 (18:16 +0200)]
examples: Group all C programs together

All other examples are organized using the either the format/
or the format/category/ hierarchy already, and grouping all
C programs together removes the last remaining outliers.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Rework C examples installation
Andrea Bolognani [Wed, 22 May 2019 16:07:01 +0000 (18:07 +0200)]
examples: Rework C examples installation

Now that all C examples are neatly sorted into only three
categories, getting rid of our custom installation machinery
and replacing it with the standard autotools mechanism
finally becomes feasible.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Organize C examples into categories
Andrea Bolognani [Wed, 22 May 2019 15:49:43 +0000 (17:49 +0200)]
examples: Organize C examples into categories

Most C examples live in their own directory, which seems a
bit unnecessary especially considering that all virt-admin
related examples share a single admin/ directory. Reorganize
non-admin C examples in two categories: domain/ for those
that act on a domain, and misc/ for everything else.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Move and install shell examples
Andrea Bolognani [Wed, 22 May 2019 15:29:44 +0000 (17:29 +0200)]
examples: Move and install shell examples

The virt-lxc-convert shell script is at this point the
only example we don't install on the target system.

Create a sh/ subdirectory, following the example set by
the existing polkit/, systemtap/ and xml/, and move the
script there; then add rules that will install all example
shell scripts as documentation.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Install remaining XML examples
Andrea Bolognani [Wed, 22 May 2019 14:13:43 +0000 (16:13 +0200)]
examples: Install remaining XML examples

We already install nwfilters separately.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Install SystemTap examples
Andrea Bolognani [Wed, 22 May 2019 12:16:27 +0000 (14:16 +0200)]
examples: Install SystemTap examples

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Install Polkit examples
Andrea Bolognani [Wed, 22 May 2019 11:10:12 +0000 (13:10 +0200)]
examples: Install Polkit examples

Right now we install the files in RPMs only, and we include
them in the -daemon package which is probably not the best
option either. Start installing them via autotools; the RPMs
will get them automatically in the -docs package.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Install nwfilters without shell scripting
Andrea Bolognani [Tue, 21 May 2019 12:11:57 +0000 (14:11 +0200)]
examples: Install nwfilters without shell scripting

We're doing nothing more than copying files to a target
directory, so we don't need any custom shell commands and
can just use the standard autotools data installation
support instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Drop unnecessary $(mkinstalldirs) call
Andrea Bolognani [Tue, 21 May 2019 14:42:28 +0000 (16:42 +0200)]
examples: Drop unnecessary $(mkinstalldirs) call

$(mkinstalldirs) works like 'mkdir -p' in that it will
create all the necessary parts of the path leading up to
the actual directory, which means creating $(examplesdir)
beforehand is not necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Move $(WARN_CFLAGS) to $(AM_CFLAGS)
Andrea Bolognani [Wed, 22 May 2019 17:15:49 +0000 (19:15 +0200)]
examples: Move $(WARN_CFLAGS) to $(AM_CFLAGS)

$(AM_CPPFLAGS) is for passing options to the C preprocessor,
not the C compiler, and the stuff in $(WARN_CFLAGS) belongs
to the latter category.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Move $(STATIC_BINARIES) to $(AM_LDFLAGS)
Andrea Bolognani [Wed, 22 May 2019 17:14:17 +0000 (19:14 +0200)]
examples: Move $(STATIC_BINARIES) to $(AM_LDFLAGS)

$(LDADD) is for object files that should be added during
linking, not for options that should be passed to the
linker: that's what $(AM_LDFLAGS) is for.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Don't look for headers in $(top_srcdir)
Andrea Bolognani [Wed, 22 May 2019 17:12:15 +0000 (19:12 +0200)]
examples: Don't look for headers in $(top_srcdir)

The C programs in this directory are supposed to be only
using public functions, so having $(top_srcdir) in the
header search path is unnecessary at best and actively
harmful at worst.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Remove $(WARN_CFLAGS) from $(LDADD)
Andrea Bolognani [Tue, 21 May 2019 12:19:07 +0000 (14:19 +0200)]
examples: Remove $(WARN_CFLAGS) from $(LDADD)

$(WARN_CFLAGS) contains options intended for the compiler,
whereas $(LDADD) is supposed to list additional objects
required during linking, so the former clearly doesn't
belong in the latter.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Reformat $(AM_CPPFLAGS) and $(LDADDS)
Andrea Bolognani [Wed, 22 May 2019 17:05:11 +0000 (19:05 +0200)]
examples: Reformat $(AM_CPPFLAGS) and $(LDADDS)

This will make further changes easier to review.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoexamples: Drop object_events_event_test_CFLAGS
Andrea Bolognani [Tue, 21 May 2019 12:08:35 +0000 (14:08 +0200)]
examples: Drop object_events_event_test_CFLAGS

$(AM_CPPFLAGS) already includes $(WARN_CFLAGS), so this is
not doing anything useful.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agospec: Don't install libvirt-api.xml as documentation
Andrea Bolognani [Wed, 22 May 2019 10:33:58 +0000 (12:33 +0200)]
spec: Don't install libvirt-api.xml as documentation

We already install the file, along with its driver-specific
counterparts, into ${datadir}/libvirt/api/ where language
bindings will actually look for them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agomaint: Post-release version bump to 5.5.0
Andrea Bolognani [Mon, 3 Jun 2019 15:16:27 +0000 (17:16 +0200)]
maint: Post-release version bump to 5.5.0

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
5 years agoRelease of libvirt-5.4.0
Daniel Veillard [Mon, 3 Jun 2019 14:17:15 +0000 (16:17 +0200)]
Release of libvirt-5.4.0

* docs/news.xml: update for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
5 years agocpu_x86: Drop extra empty lines
Jiri Denemark [Mon, 3 Jun 2019 13:56:47 +0000 (15:56 +0200)]
cpu_x86: Drop extra empty lines

They were introduced by commit 0a97486e09 when moving functions.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agomaint: Add support for .ctags.d
Jiri Denemark [Thu, 30 May 2019 18:47:47 +0000 (20:47 +0200)]
maint: Add support for .ctags.d

Depending on the way ctags was compiled, it may look for
.ctags.d/*.ctags files rather than .ctags for reading configuration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: Drop the external AMD SEV links
Erik Skultety [Fri, 31 May 2019 05:39:47 +0000 (07:39 +0200)]
docs: Drop the external AMD SEV links

One of the current SEV document links went dead as AMD moved the
resource to another place (document store), so there's probably very
little point in maintaining 3rd party links if the resources are being
moved.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonews: Update for 5.4.0 release
Andrea Bolognani [Thu, 30 May 2019 14:31:26 +0000 (16:31 +0200)]
news: Update for 5.4.0 release

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonews: Reformat overgrown line
Andrea Bolognani [Thu, 30 May 2019 14:12:16 +0000 (16:12 +0200)]
news: Reformat overgrown line

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agobuild: fix linking libqemutestdriver with LTO enabled
Jim Fehlig [Wed, 29 May 2019 17:28:33 +0000 (11:28 -0600)]
build: fix linking libqemutestdriver with LTO enabled

openSUSE Factory is in the process of enabling Link Time Optimization [0]
and stumbled upon missing symbols when linking libqemutestdriver

libtool: link: gcc -shared  -fPIC -DPIC  ../src/libvirt_qemu_probes.o  \
-Wl,--whole-archive ../src/.libs/libvirt_driver_qemu_impl.a \
../src/.libs/libvirt_driver_network_impl.a \
../src/.libs/libvirt_driver_storage_impl.a -Wl,--no-whole-archive  \
-lcap-ng -lgnutls -lnl-route-3 -lnl-3 -ldbus-1 -lselinux -lapparmor \
/usr/lib/libxml2.so -ldl -lz -llzma -lm -lblkid -ltirpc  \
-fstack-protector-strong -O2 -fstack-protector-strong -flto=16 -g -O2 \
-fstack-protector-strong -flto=16 -g \
-Wl,-soname -Wl,libqemutestdriver.so -o .libs/libqemutestdriver.so
...
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `mdir_name'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `rpl_ioctl'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `rpl_pipe2'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `recvfd'
/usr/lib/gcc/i586-suse-linux/9/../../../../i586-suse-linux/bin/ld: ./.libs/libqemutestdriver.so: undefined reference to `c_strcasecmp'

The missing symbols are provided by GNUlib. Add it when linking
libqemutestdriver.

[0] https://en.opensuse.org/openSUSE:LTO

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovz: fixes: snapshot: s/parent/parent_name/ as prep for virObject
Nikolay Shirokovskiy [Tue, 28 May 2019 10:33:22 +0000 (13:33 +0300)]
vz: fixes: snapshot: s/parent/parent_name/ as prep for virObject

Apply renaming of 36603bc56 for the vz driver.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
5 years agodocs: Add emulatorsched fix info to news.xml
Martin Kletzander [Wed, 22 May 2019 09:09:11 +0000 (11:09 +0200)]
docs: Add emulatorsched fix info to news.xml

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
5 years agoqemu: Set emulator thread scheduler only after QEMU starts
Martin Kletzander [Wed, 22 May 2019 08:40:58 +0000 (10:40 +0200)]
qemu: Set emulator thread scheduler only after QEMU starts

If the scheduler is set before vCPU0 cannot be moved into its cpu,cpuacct
cgroup.  While it is not yet known whether this is a bug or not, it makes sense
for us to do that later as otherwise the scheduler would be inherited by vCPU
and I/O Threads even when they do not have any such setting specified.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
5 years agotest_driver: implement virDomainMemoryPeek
Ilias Stamatis [Thu, 23 May 2019 11:37:01 +0000 (13:37 +0200)]
test_driver: implement virDomainMemoryPeek

Begins by writing a @start byte in the first position of @buffer and
then for every next byte it stores the value of its previous one
incremented by one.

Behaves the same for both supported flags.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agospec: Improve handling for default network
Andrea Bolognani [Mon, 27 May 2019 10:56:04 +0000 (12:56 +0200)]
spec: Improve handling for default network

This is exactly how we already treat nwfilters, which require
the same kind of care (aka nasty hacks) as the default network,
because in both cases the UUID is generated and written to
disk the first time libvirtd is started after installing the
corresponding subpackage.

After this patch, RPM will be aware of the fact that the
libvirt-daemon-config-network subpackage owns the default
network.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agospec: Fix permissions of /var/run/libvirt/qemu
Jiri Denemark [Thu, 23 May 2019 12:55:13 +0000 (14:55 +0200)]
spec: Fix permissions of /var/run/libvirt/qemu

While libvirtd creates this directory with the default 0755 mode, the
spec file stores 0700 in the RPM database. Thus RPM verification always
complains about this directory. Let's fix the spec file to match
reality.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
5 years agospec: Fix permissions of nwfilter XMLs
Jiri Denemark [Thu, 23 May 2019 12:31:37 +0000 (14:31 +0200)]
spec: Fix permissions of nwfilter XMLs

The nwfilter XML files stored in /etc/libvirt/nwfilter are copied in a
%post scriptlet from /usr/share/libvirt/nwfilter/*.xml. While the files
in /usr/share are created with mode 0644, libvirt creates the files in
/etc/libvirt/nwfilter with mode 0600. Since 0600 is also stored in the
RPM database, we need to chmod the files copied from /usr/share to make
sure RPM verification does not complain about changed permissions.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agospec: Unconditionally set ownership of /var/lib/libvirt/sanlock
Jiri Denemark [Tue, 21 May 2019 11:09:22 +0000 (13:09 +0200)]
spec: Unconditionally set ownership of /var/lib/libvirt/sanlock

The libvirt-lock-sanlock subpackage requires sanlock to be installed
first and the sanlock package creates the sanlock group on all distros
we care about in the spec file (Fedora and RHEL >= 7). Thus instead of
setting the ownership and permissions in a post scriptlet only when the
sanlock group exists we can just install the directory with the
appropriate metadata.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: Get default hugepage size only if needed
Michal Privoznik [Mon, 27 May 2019 09:07:12 +0000 (11:07 +0200)]
qemu: Get default hugepage size only if needed

Fixes: 6864d8f740e2502dc7625bdf18ffde4465b14f69
Hugepages don't work in session mode but when building memory
part of command line we query for the default size anyway. This
breaks creating domains under session daemon. Query the page size
only if it's clear we need hugepages.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agodocs: Link the relevant SEV formatdomain section from formatdomaincaps
Erik Skultety [Fri, 24 May 2019 11:15:56 +0000 (13:15 +0200)]
docs: Link the relevant SEV formatdomain section from formatdomaincaps

formatdomaincaps.html provides explanation of SEV fields, but doesn't
link to the domain XML docs to show how it can be actually used in
libvirt.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
5 years agodriver: test: Fix the mingw build caused by wrong printf format specifier
Erik Skultety [Fri, 24 May 2019 10:49:50 +0000 (12:49 +0200)]
driver: test: Fix the mingw build caused by wrong printf format specifier

Caused by commit 326c3f54.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
5 years agovirDomainDefPostParse: use DOMAIN_DEVICE_ITERATE_MISSING_INFO
Ján Tomko [Thu, 23 May 2019 12:18:24 +0000 (14:18 +0200)]
virDomainDefPostParse: use DOMAIN_DEVICE_ITERATE_MISSING_INFO

Apart from virDomainDefValidate, virDomainDefPostParse is another
place where operating on info-less devices makes sense.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agotest_driver: implement virDomainInterfaceAddresses
Ilias Stamatis [Thu, 23 May 2019 12:50:00 +0000 (14:50 +0200)]
test_driver: implement virDomainInterfaceAddresses

Ignore @source in the case of the test driver and return fixed private
IPv4 addresses for all the interfaces defined in the domain.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agotest_driver: add a guest interface in the default config
Ilias Stamatis [Thu, 23 May 2019 12:50:01 +0000 (14:50 +0200)]
test_driver: add a guest interface in the default config

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agonetwork: delay global firewall setup if no networks are running
Daniel P. Berrangé [Tue, 21 May 2019 11:40:13 +0000 (12:40 +0100)]
network: delay global firewall setup if no networks are running

Creating firewall rules for the virtual networks causes the kernel to
load the conntrack module. This imposes a significant performance
penalty on Linux network traffic. Thus we want to only take that hit if
we actually have virtual networks running.

We need to create global firewall rules during startup in order to
"upgrade" rules for any running networks created by older libvirt.
If no running networks are present though, we can safely delay setup
until the time we actually start a network.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agonetwork: add more debugging of firewall chain creation
Daniel P. Berrangé [Wed, 22 May 2019 12:08:13 +0000 (13:08 +0100)]
network: add more debugging of firewall chain creation

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agonetwork: pull global chain init into separate method
Daniel P. Berrangé [Tue, 21 May 2019 10:37:37 +0000 (11:37 +0100)]
network: pull global chain init into separate method

Pull the logic for creating global iptables chains into a separate
method and protect its invocation with virOnce, to make it possible
to reuse it in non-startup paths.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Tweak Intel IOMMU command line generation
Andrea Bolognani [Mon, 20 May 2019 10:48:01 +0000 (12:48 +0200)]
qemu: Tweak Intel IOMMU command line generation

Mostly add comments explaining why there are two capabilites
for the same feature and how they interact.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Introduce qemuDomainDeviceDefValidateIOMMU()
Andrea Bolognani [Fri, 17 May 2019 11:37:35 +0000 (13:37 +0200)]
qemu: Introduce qemuDomainDeviceDefValidateIOMMU()

Device validation should not have to wait until command line
generation time. Moving the code to a separate function also
allows us to avoid some unnecessary repetition.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoIntroduce DOMAIN_DEVICE_ITERATE_MISSING_INFO
Ján Tomko [Tue, 21 May 2019 13:05:37 +0000 (15:05 +0200)]
Introduce DOMAIN_DEVICE_ITERATE_MISSING_INFO

Rename the DOMAIN_DEVICE_ITERATE_GRAPHICS flag.
It was introduced by commit dd45c2710f6fd2d4f8a47f97960532d0e0091e7d
with the intention to run the Validate callback even on the graphics
device.

However, enumerating every single device in virDomainDeviceIterateFlags
is unsustainable and what really was special about the graphics device
was the lack of DeviceInfo.

Rename the flag and iterate over more info-less devices. (and leases)

Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: Change the 'Launch Security' section id to "launchSecurity"
Erik Skultety [Thu, 23 May 2019 12:26:40 +0000 (14:26 +0200)]
docs: Change the 'Launch Security' section id to "launchSecurity"

Although there's currently only support for SEV, it's likely other
solutions will appear, so we should not refer to the documentation
section simply with 'sev'.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
5 years agomisc: Drop useless checks from *Dispose() functions
Michal Privoznik [Thu, 23 May 2019 10:10:21 +0000 (12:10 +0200)]
misc: Drop useless checks from *Dispose() functions

Due to the way that our virObjectUnref() is written it's not
possible that a NULL is passed into *Dispose() function. However,
some functions check for that regardless.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agotests: Add negative test for Intel IOMMU
Andrea Bolognani [Fri, 17 May 2019 14:37:56 +0000 (16:37 +0200)]
tests: Add negative test for Intel IOMMU

Make sure validation is working as intended by trying to use
Intel IOMMU with the i440fx machine type, though we know it's
a q35-only feature, and expecting an error to be returned.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: Use DO_TEST_CAPS_*() for Intel IOMMU
Andrea Bolognani [Fri, 17 May 2019 12:45:36 +0000 (14:45 +0200)]
tests: Use DO_TEST_CAPS_*() for Intel IOMMU

We can drop the intel-iommu-machine test case while doing so,
since it is supposed to showcase how we generate different
command lines for older QEMU versions and we can do that
using a single input file now.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: Simplify Intel IOMMU testing
Andrea Bolognani [Fri, 17 May 2019 13:38:40 +0000 (15:38 +0200)]
tests: Simplify Intel IOMMU testing

Remove a bunch of irrelevant devices and make sure all input
files explicitly opt out of USB controllers: the latter change
will help later, when we start using DO_TEST_CAPS_*().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agodocs: hacking: Discourage use of the ternary operator and ban it's abuse
Peter Krempa [Thu, 9 May 2019 10:27:25 +0000 (12:27 +0200)]
docs: hacking: Discourage use of the ternary operator and ban it's abuse

Forbid breaking lines inside the two branches of the ternary operator
and nesting them. Using it in these instances does not help readability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agodocs: hacking: Add good practices for shortening conditional expressions
Peter Krempa [Thu, 9 May 2019 10:20:42 +0000 (12:20 +0200)]
docs: hacking: Add good practices for shortening conditional expressions

Document that checking if a integer is (non-)zero should (not must)
avoid the shortened form that C allows as it may confuse readers into
overlooking the other possible values which might be interresting to
handle.

While pointers have distinct values from the point of view of the code
we only care whether it's non-NULL and thus it's documented it's okay
to shorten those.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agodocs: hacking: Document few practices for creating error messages
Peter Krempa [Tue, 7 May 2019 14:47:00 +0000 (16:47 +0200)]
docs: hacking: Document few practices for creating error messages

State that error messages should not be broken into multiple lines for
programmer friendliness and should not be concatenated on the fly for
translator friendliness and few other details.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
5 years agoqemu: monitor: Use VIR_AUTOPTR in qemuMonitorJSON(Drive/Blockdev)Mirror
Peter Krempa [Fri, 17 May 2019 16:17:26 +0000 (18:17 +0200)]
qemu: monitor: Use VIR_AUTOPTR in qemuMonitorJSON(Drive/Blockdev)Mirror

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Don't pass full flags to qemuMonitorJSONDriveMirror
Peter Krempa [Fri, 17 May 2019 16:13:53 +0000 (18:13 +0200)]
qemu: monitor: Don't pass full flags to qemuMonitorJSONDriveMirror

Split out the 'shallow' and 'reuse' flags as booleans rather than passing
in flags and constructing them in irrelevant APIs.

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