]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agosecurity: selinux: Label externalDataStore
Cole Robinson [Mon, 7 Oct 2019 20:20:16 +0000 (16:20 -0400)]
security: selinux: Label externalDataStore

We mirror the labeling strategy that was used for its top image

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: break out SetImageLabelRelative
Cole Robinson [Mon, 7 Oct 2019 19:40:49 +0000 (15:40 -0400)]
security: selinux: break out SetImageLabelRelative

This will be used for recursing into externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: Restore image label for externalDataStore
Cole Robinson [Sat, 5 Oct 2019 23:45:21 +0000 (19:45 -0400)]
security: selinux: Restore image label for externalDataStore

Rename the existing virSecuritySELinuxRestoreImageLabelInt
to virSecuritySELinuxRestoreImageLabelSingle, and extend the new
ImageLabelInt handle externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: Add is_toplevel to SetImageLabelInternal
Cole Robinson [Mon, 7 Oct 2019 19:55:20 +0000 (15:55 -0400)]
security: selinux: Add is_toplevel to SetImageLabelInternal

This will simplify future patches and make the logic easier to follow

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: Drop !parent handling in SetImageLabelInternal
Cole Robinson [Mon, 7 Oct 2019 19:53:27 +0000 (15:53 -0400)]
security: selinux: Drop !parent handling in SetImageLabelInternal

The only caller always passes in a non-null parent

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: selinux: Simplify SetImageLabelInternal
Cole Robinson [Sat, 5 Oct 2019 14:24:44 +0000 (10:24 -0400)]
security: selinux: Simplify SetImageLabelInternal

All the SetFileCon calls only differ by the label they pass in.
Rework the conditionals to track what label we need, and use a
single SetFileCon call

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: Label externalDataStore
Cole Robinson [Mon, 7 Oct 2019 20:20:12 +0000 (16:20 -0400)]
security: dac: Label externalDataStore

We mirror the labeling strategy that was used for its sibling
image

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: break out SetImageLabelRelative
Cole Robinson [Mon, 7 Oct 2019 20:12:22 +0000 (16:12 -0400)]
security: dac: break out SetImageLabelRelative

This will be used for recursing into externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: Restore image label for externalDataStore
Cole Robinson [Sat, 5 Oct 2019 23:47:43 +0000 (19:47 -0400)]
security: dac: Restore image label for externalDataStore

Rename the existing virSecurityDACRestoreImageLabelInt
to virSecurityDACRestoreImageLabelSingle, and extend the new
ImageLabelInt handle externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: Add is_toplevel to SetImageLabelInternal
Cole Robinson [Mon, 7 Oct 2019 20:14:02 +0000 (16:14 -0400)]
security: dac: Add is_toplevel to SetImageLabelInternal

This will simplify future patches and make the logic easier to follow

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: dac: Drop !parent handling in SetImageLabelInternal
Cole Robinson [Mon, 7 Oct 2019 20:13:19 +0000 (16:13 -0400)]
security: dac: Drop !parent handling in SetImageLabelInternal

The only caller always passes in a non-null parent

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Fill in meta->externalDataStore
Cole Robinson [Sat, 5 Oct 2019 18:39:32 +0000 (14:39 -0400)]
storagefile: Fill in meta->externalDataStore

Add virStorageSourceNewFromExternalData, similar to
virStorageSourceNewFromBacking and use it to fill in a
virStorageSource for externalDataStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Add externalDataStore member
Cole Robinson [Sat, 5 Oct 2019 18:39:22 +0000 (14:39 -0400)]
storagefile: Add externalDataStore member

Add the plumbing to track a externalDataStoreRaw as a virStorageSource

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Split out virStorageSourceNewFromChild
Cole Robinson [Sat, 5 Oct 2019 18:13:46 +0000 (14:13 -0400)]
storagefile: Split out virStorageSourceNewFromChild

Future patches will use this for external data file handling

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Don't access backingStoreRaw directly in FromBackingRelative
Cole Robinson [Sat, 5 Oct 2019 18:07:06 +0000 (14:07 -0400)]
storagefile: Don't access backingStoreRaw directly in FromBackingRelative

For the only usage, the rel == parent->backingStoreRaw, so drop
the direct access

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Fill in meta->externalDataStoreRaw
Cole Robinson [Sat, 5 Oct 2019 00:19:22 +0000 (20:19 -0400)]
storagefile: Fill in meta->externalDataStoreRaw

Call qcow2GetExtensions to actually fill in the virStorageSource
externalDataStoreRaw member

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Add externalDataStoreRaw member
Cole Robinson [Fri, 4 Oct 2019 21:18:21 +0000 (17:18 -0400)]
storagefile: Add externalDataStoreRaw member

Add the plumbing to track a qcow2 external data file path in
virStorageSource

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Fix backing format \0 check
Cole Robinson [Fri, 4 Oct 2019 23:41:36 +0000 (19:41 -0400)]
storagefile: Fix backing format \0 check

From qemu.git docs/interop/qcow2.txt

  == String header extensions ==

  Some header extensions (such as the backing file format name and
  the external data file name) are just a single string. In this case,
  the header extension length is the string length and the string is
  not '\0' terminated. (The header extension padding can make it look
  like a string is '\0' terminated, but neither is padding always
  necessary nor is there a guarantee that zero bytes are used
  for padding.)

So we shouldn't be checking for a \0 byte at the end of the backing
format section. I think in practice there always is a \0 but we
shouldn't depend on that.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Rename qcow2GetExtensions 'format' argument
Cole Robinson [Fri, 4 Oct 2019 22:47:24 +0000 (18:47 -0400)]
storagefile: Rename qcow2GetExtensions 'format' argument

To backingFormat, which makes it more clear. Move it to the end of
the argument list which will scale nicer with future patches

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Rename qcow2GetBackingStoreFormat
Cole Robinson [Fri, 4 Oct 2019 23:59:23 +0000 (19:59 -0400)]
storagefile: Rename qcow2GetBackingStoreFormat

...to qcow2GetExtensions. We will extend it for more extension
parsing in future patches

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Push extension_end calc to qcow2GetBackingStoreFormat
Cole Robinson [Fri, 4 Oct 2019 23:57:55 +0000 (19:57 -0400)]
storagefile: Push extension_end calc to qcow2GetBackingStoreFormat

This is a step towards making this qcow2GetBackingStoreFormat into
a generic qcow2 extensions parser

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Push 'start' into qcow2GetBackingStoreFormat
Cole Robinson [Fri, 4 Oct 2019 23:51:31 +0000 (19:51 -0400)]
storagefile: Push 'start' into qcow2GetBackingStoreFormat

This is a step towards making this qcow2GetBackingStoreFormat into
a generic qcow2 extensions parser

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Use qcowXGetBackingStore directly
Cole Robinson [Fri, 4 Oct 2019 22:14:49 +0000 (18:14 -0400)]
storagefile: Use qcowXGetBackingStore directly

The qcow1 and qcow2 variants are identical, so remove the wrappers

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Drop now unused isQCow2 argument
Cole Robinson [Fri, 4 Oct 2019 22:13:21 +0000 (18:13 -0400)]
storagefile: Drop now unused isQCow2 argument

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Check version to determine if qcow2 or not
Cole Robinson [Fri, 4 Oct 2019 22:12:14 +0000 (18:12 -0400)]
storagefile: Check version to determine if qcow2 or not

Rather than require a boolean to be passed in

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: qcow1: Let qcowXGetBackingStore fill in format
Cole Robinson [Fri, 4 Oct 2019 22:04:46 +0000 (18:04 -0400)]
storagefile: qcow1: Let qcowXGetBackingStore fill in format

Letting qcowXGetBackingStore fill in format gives the same behavior
we were opencoding in qcow1GetBackingStore

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: qcow1: Fix check for empty backing file
Cole Robinson [Fri, 4 Oct 2019 22:00:55 +0000 (18:00 -0400)]
storagefile: qcow1: Fix check for empty backing file

From f772b3d91fd the intention of this code seems to be to set
format=NONE when the image does not have a backing file. However
'buf' here is the whole qcow1 file header. What we want to be
checking is 'res' which is the parsed backing file path.
qcowXGetBackingStore sets this to NULL when there's no backing file.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: qcow1: Check for BACKING_STORE_OK
Cole Robinson [Fri, 4 Oct 2019 21:57:32 +0000 (17:57 -0400)]
storagefile: qcow1: Check for BACKING_STORE_OK

Check explicitly for BACKING_STORE_OK and not its 0 value

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agostoragefile: Make GetMetadataInternal static
Cole Robinson [Sat, 5 Oct 2019 19:17:48 +0000 (15:17 -0400)]
storagefile: Make GetMetadataInternal static

It is only used in virstoragefile.c

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agotests: add a test for driver.c:virConnectValidateURIPath()
Daniel Henrique Barboza [Wed, 9 Oct 2019 19:11:44 +0000 (16:11 -0300)]
tests: add a test for driver.c:virConnectValidateURIPath()

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agosecurity: Don't remember labels for TPM
Michal Privoznik [Tue, 1 Oct 2019 08:32:26 +0000 (10:32 +0200)]
security: Don't remember labels for TPM

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

The /dev/tpmN file can be opened only once, as implemented in
drivers/char/tpm/tpm-dev.c:tpm_open() from the kernel's tree. Any
other attempt to open the file fails. And since we're opening the
file ourselves and passing the FD to qemu we will not succeed
opening the file again when locking it for seclabel remembering.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity_dac: Allow selective remember/recall for chardevs
Michal Privoznik [Tue, 1 Oct 2019 09:02:36 +0000 (11:02 +0200)]
security_dac: Allow selective remember/recall for chardevs

While in most cases we want to remember/recall label for a
chardev, there are some special ones (like /dev/tpm0) where we
don't want to remember the seclabel nor recall it. See next
commit for rationale behind.

While the easiest way to implement this would be to just add new
argument to virSecurityDACSetChardevLabel() this one is also a
callback for virSecurityManagerSetChardevLabel() and thus has
more or less stable set of arguments. Therefore, the current
virSecurityDACSetChardevLabel() is renamed to
virSecurityDACSetChardevLabelHelper() and the original function
is set to call the new one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: Try to lock only paths with remember == true
Michal Privoznik [Tue, 1 Oct 2019 08:30:05 +0000 (10:30 +0200)]
security: Try to lock only paths with remember == true

So far all items on the chown/setfilecon list have the same
.remember value.  But this will change shortly. Therefore, don't
try to lock paths which we won't manipulate XATTRs for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: apparmor: Allow RO /usr/share/edk2/
Cole Robinson [Wed, 9 Oct 2019 18:21:24 +0000 (14:21 -0400)]
security: apparmor: Allow RO /usr/share/edk2/

On Fedora, already whitelisted paths to AAVMF and OVMF binaries
are symlinks to binaries under /usr/share/edk2/. Add that directory
to the RO whitelist so virt-aa-helper-test passes

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agotests: Add capabilities for QEMU 4.2.0 on aarch64
Andrea Bolognani [Thu, 10 Oct 2019 13:38:37 +0000 (15:38 +0200)]
tests: Add capabilities for QEMU 4.2.0 on aarch64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agotests: Add capabilities for QEMU 4.2.0 on ppc64
Andrea Bolognani [Thu, 10 Oct 2019 10:44:20 +0000 (12:44 +0200)]
tests: Add capabilities for QEMU 4.2.0 on ppc64

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agolibxl: add slic_table <-> acpi_firmware conversion
Marek Marczykowski-Górecki [Sun, 15 Sep 2019 19:43:24 +0000 (21:43 +0200)]
libxl: add slic_table <-> acpi_firmware conversion

This isn't exactly equivalent setting (acpi_firmware may point to
non-SLIC ACPI table), but it's the most behavior preserving option.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
5 years agotests: libxl: ACPI slic table test
Marek Marczykowski-Górecki [Sun, 15 Sep 2019 19:43:23 +0000 (21:43 +0200)]
tests: libxl: ACPI slic table test

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
5 years agolibxl: add acpi slic table support
Ivan Kardykov [Sun, 15 Sep 2019 19:43:22 +0000 (21:43 +0200)]
libxl: add acpi slic table support

Libxl driver did not support setup additional acpi firmware to xen
guest. It is necessary to activate OEM Windows installs. This patch
allow to define in OS section acpi table param (which supported domain
common schema).

Signed-off-by: Ivan Kardykov <kardykov@tabit.pro>
[added info to docs/formatdomain.html.in]
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
5 years agosrc/driver.c: remove duplicated code in virGetConnect* functions
Daniel Henrique Barboza [Tue, 8 Oct 2019 21:02:00 +0000 (18:02 -0300)]
src/driver.c: remove duplicated code in virGetConnect* functions

All the 6 virGetConnect* functions in driver.c shares the
same code base. This patch creates a new static function
virGetConnectGeneric() that contains the common code to
be used with all other virGetConnect*.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agotests: delete objectlocking test code
Daniel P. Berrangé [Tue, 8 Oct 2019 15:18:00 +0000 (16:18 +0100)]
tests: delete objectlocking test code

The object locking test code is not run by any CI tests and has
bitrotted to the point where it isn't worth the effort to try to
fix it.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu_process: Initialize domain definition for QMP query
Michal Privoznik [Thu, 10 Oct 2019 07:44:12 +0000 (09:44 +0200)]
qemu_process: Initialize domain definition for QMP query

When constructing QMP capabilities we allocate a dummy domain
object to pass to qemuMonitorOpen(). However, after 75dd595861
the function also expects domain definition to be allocated for
the domain object. The referenced commit already fixed
qemumonitortestutils.c but forgot to fix the other caller:
qemuProcessQMPConnectMonitor().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonews: Update for the ccf-assist pSeries feature
Daniel Henrique Barboza [Tue, 8 Oct 2019 20:06:25 +0000 (17:06 -0300)]
news: Update for the ccf-assist pSeries feature

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: Implement the ccf-assist pSeries feature
Daniel Henrique Barboza [Tue, 8 Oct 2019 20:06:24 +0000 (17:06 -0300)]
qemu: Implement the ccf-assist pSeries feature

This patch adds the implementation of the ccf-assist pSeries
feature, based on the QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST
capability that was added in the previous patch.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: Add capability for the ccf-assist pSeries feature
Daniel Henrique Barboza [Tue, 8 Oct 2019 20:06:23 +0000 (17:06 -0300)]
qemu: Add capability for the ccf-assist pSeries feature

Linux kernel 5.1 added a new PPC KVM capability named
KVM_PPC_CPU_CHAR_BCCTR_FLUSH_ASSIST, which is exposed to the QEMU guest
since QEMU commit 8ff43ee404d under a new sPAPR capability called
SPAPR_CAP_CCF_ASSIST. This cap indicates whether the processor supports
hardware acceleration for the count cache flush workaround, which
is a software workaround that flushes the count cache on context
switch. If the processor has this hardware acceleration, the software
flush can be shortened, resulting in performance gain.

This hardware acceleration is defaulted to 'off' in QEMU. The reason
is that earlier versions of the Power 9 processor didn't support
it (it is available on Power 9 DD2.3 and newer), and defaulting this
option to 'on' would break migration compatibility between the Power 9
processor class.

However, the user running a P9 DD2.3+ hypervisor might want to create
guests with ccf-assist=on, accepting the downside of only being able
to migrate them only between other P9 DD2.3+ hosts running upstream
kernel 5.1+, to get a performance boost.

This patch adds this new capability to Libvirt, with the name of
QEMU_CAPS_MACHINE_PSERIES_CAP_CCF_ASSIST.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: add a new video device model 'ramfb'
Jonathon Jongsma [Fri, 13 Sep 2019 21:20:29 +0000 (16:20 -0500)]
qemu: add a new video device model 'ramfb'

This device is a very simple framebuffer device supported by qemu that
is mostly intended to use as a boot framebuffer in conjunction with a
vgpu. However, there is also a standalone ramfb device that can be used
as a primary display device and is useful for e.g. aarch64 guests where
different memory mappings between the host and guest can prevent use of
other devices with framebuffers such as virtio-vga.

https://bugzilla.redhat.com/show_bug.cgi?id=1679680 describes the
issues in more detail.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
5 years agoqemu: add ramfb capability
Jonathon Jongsma [Fri, 13 Sep 2019 21:20:28 +0000 (16:20 -0500)]
qemu: add ramfb capability

Add a qemu capbility to see if the standalone ramfb device is available.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
5 years agoqemu: validate bochs-display capability
Jonathon Jongsma [Fri, 13 Sep 2019 21:20:27 +0000 (16:20 -0500)]
qemu: validate bochs-display capability

When the bochs display type was added, the capability was never checked.
Add that check in the same place as the other video device capability
checks.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
5 years agosecurity: apparmor: Make storage_source_add_files recursively callable
Cole Robinson [Tue, 8 Oct 2019 16:07:17 +0000 (12:07 -0400)]
security: apparmor: Make storage_source_add_files recursively callable

This will simplify adding support for qcow2 external data_file

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: apparmor: Use only virStorageSource for disk paths
Cole Robinson [Tue, 8 Oct 2019 16:04:57 +0000 (12:04 -0400)]
security: apparmor: Use only virStorageSource for disk paths

This is closer to what security_selinux.c does, and will help add
support for qcow2 external data_files

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: apparmor: Push virStorageSource checks to add_file_path
Cole Robinson [Tue, 8 Oct 2019 15:55:24 +0000 (11:55 -0400)]
security: apparmor: Push virStorageSource checks to add_file_path

This mirrors the code layout in security_selinux.c. It will also make
it easier to share the checks for qcow2 external data_file support
eventually

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: apparmor: Pass virStorageSource to add_file_path
Cole Robinson [Tue, 8 Oct 2019 15:53:21 +0000 (11:53 -0400)]
security: apparmor: Pass virStorageSource to add_file_path

The virStorageSource must have everything it needs

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: apparmor: Drop disk_foreach_iterator
Cole Robinson [Tue, 8 Oct 2019 15:50:55 +0000 (11:50 -0400)]
security: apparmor: Drop disk_foreach_iterator

There's only one caller, so open code the file_add_path behavior

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agosecurity: apparmor: Remove unused ignoreOpenFailure
Cole Robinson [Tue, 8 Oct 2019 15:42:21 +0000 (11:42 -0400)]
security: apparmor: Remove unused ignoreOpenFailure

true is always passed here, so delete the unused code path and
adjust the associated comment

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoconf: Move -virDomainDiskDefForeachPath to virt-aa-helper
Cole Robinson [Tue, 8 Oct 2019 15:40:30 +0000 (11:40 -0400)]
conf: Move -virDomainDiskDefForeachPath to virt-aa-helper

It is the only user. Rename it to match the local style

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agobuild: merge all syntax-check logic into one file
Daniel P. Berrangé [Wed, 2 Oct 2019 16:51:19 +0000 (17:51 +0100)]
build: merge all syntax-check logic into one file

The gnulib syntax-check rules are spread across GNUmakefile, cfg.mk and
maint.mk. This made sense when we were getting two of the files from the
gnulib submodule. Now that we own all files though, we can at least
merge maint.mk and cfg.mk together. GNUmakefile can be eliminated when
we switch to meson.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: delete all syntax check rules we're skipping
Daniel P. Berrangé [Wed, 2 Oct 2019 16:44:04 +0000 (17:44 +0100)]
build: delete all syntax check rules we're skipping

If we've marked rules as skipped, there's no sense keeping them in the
maint.mk file.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: remove all logic unrelated to syntax-check
Daniel P. Berrangé [Wed, 2 Oct 2019 16:36:23 +0000 (17:36 +0100)]
build: remove all logic unrelated to syntax-check

The standard maint.mk from gnulib provides alot more than just the
'syntax-check' target. This can all be purged to give a more minimal
file.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: move syntax-check code into build-aux directory
Daniel P. Berrangé [Wed, 9 Oct 2019 11:25:08 +0000 (12:25 +0100)]
build: move syntax-check code into build-aux directory

The syntax-check rules are the one bit of make usage that will
stay around for a while after the meson conversion. Move them
into the build-aux directory in preparation for refactoring
to make them independent from automake.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: import gnulib's syntax-check make rules
Daniel P. Berrangé [Wed, 2 Oct 2019 16:04:31 +0000 (17:04 +0100)]
build: import gnulib's syntax-check make rules

We're going to be eliminating autotools and gnulib, but we still wish to
have the 'make syntax-check' functionality.

This imports the minimal set of gnulib files required to keep this
working.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoRevert "qemu: Obtain reference on monConfig"
Michal Privoznik [Tue, 8 Oct 2019 07:49:18 +0000 (09:49 +0200)]
Revert "qemu: Obtain reference on monConfig"

This reverts commit a5a777a8bae61cb9e41c4dcd12d2962ad1a65a0d.

After previous commit the domain won't disappear while connecting
to monitor. There's no need to ref monitor config then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: Fix @vm locking issue when connecting to the monitor
Michal Privoznik [Tue, 8 Oct 2019 07:24:23 +0000 (09:24 +0200)]
qemu: Fix @vm locking issue when connecting to the monitor

When connecting to qemu's monitor the @vm object is unlocked.
This is justified - connecting may take a long time and we don't
want to wait with the domain object locked. However, just before
the domain object is locked again, the monitor's FD is registered
in the event loop. Therefore, there is a small window where the
event loop has a chance to call a handler for an event that
occurred on the monitor FD but vm is not initalized properly just
yet (i.e. priv->mon is not set). For instance, if there's an
incoming migration, qemu creates its socket but then fails to
initialize (for various reasons, I'm reproducing this by using
hugepages but leaving the HP pool empty) then the following may
happen:

1) qemuConnectMonitor() unlocks @vm

2) qemuMonitorOpen() connects to the monitor socket and by
   calling qemuMonitorOpenInternal() which subsequently calls
   qemuMonitorRegister() the event handler is installed

3) qemu fails to initialize and exit()-s, which closes the
   monitor

4) The even loop sees EOF on the monitor and the control gets to
   qemuProcessEventHandler() which locks @vm and calls
   processMonitorEOFEvent() which then calls
   qemuMonitorLastError(priv->mon). But priv->mon is not set just
   yet.

5) qemuMonitorLastError() dereferences NULL pointer

The solution is to unlock the domain object for a shorter time
and most importantly, register event handler with domain object
locked so that any possible event processing is done only after
@vm's private data was properly initialized.

This issue is also mentioned in v4.2.0-99-ga5a777a8ba.

Since we are unlocking @vm and locking it back, another thread
might have destroyed the domain meanwhile. Therefore we have to
check if domain is still active, and we have to do it at the
same place where domain lock is acquired back, i.e. in
qemuMonitorOpen(). This creates a small problem for our test
suite which calls qemuMonitorOpen() directly and passes @vm which
has no definition. This makes virDomainObjIsActive() call crash.
Fortunately, allocating empty domain definition is sufficient.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: Adapt to changed ppc64 CPU model names
Jiri Denemark [Thu, 17 May 2018 15:08:42 +0000 (17:08 +0200)]
qemu: Adapt to changed ppc64 CPU model names

QEMU 2.11 for ppc64 changed all CPU model names to lower case. Since
libvirt can't change the model names for compatibility reasons, we need
to translate the matching lower case models to the names known by
libvirt.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoRevert "domcaps: Treat host models as case-insensitive strings"
Jiri Denemark [Wed, 16 May 2018 14:58:47 +0000 (16:58 +0200)]
Revert "domcaps: Treat host models as case-insensitive strings"

This reverts commit 2d8721e2606806164782028ecf1ee33a9bbaa8fe.

This fix was both incomplete and too general. It only fixed domain
startup, but libvirt would still report empty list of supported CPU
models with recent QEMU for ppc64. On the other hand, while ppc64 QEMU
ignores case when looking up CPU model names, x86_64 QEMU does case
sensitive lookup. Without reverting this patch, libvirt could happily
accept CPU model names which are not supported by QEMU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agobuild: stop clang complaining about redefined typedefs
Daniel P. Berrangé [Tue, 8 Oct 2019 14:37:11 +0000 (15:37 +0100)]
build: stop clang complaining about redefined typedefs

Clang's gnu99 mode is not quite the same as GCC's. It will complain
about redefined typedefs being a C11 feature, while GCC does not
complain and allows them in gnu99 mode.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoRevert "src: Document autostart for session demon"
Michal Privoznik [Sat, 5 Oct 2019 07:22:15 +0000 (09:22 +0200)]
Revert "src: Document autostart for session demon"

This reverts commit 61b4e8aaf1bce07f282c152de556c3d6aa8d65be.

After previous commits this is no longer needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agonews: Document autostart fix
Michal Privoznik [Mon, 7 Oct 2019 09:10:13 +0000 (11:10 +0200)]
news: Document autostart fix

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agolib: autostart objects exactly once
Michal Privoznik [Sat, 5 Oct 2019 07:15:24 +0000 (09:15 +0200)]
lib: autostart objects exactly once

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

With the recent work in daemon split and socket activation
daemons can come and go. They can and will be started many times
during a session which results in objects being autostarted
multiple times. This is not optimal. Use
virDriverShouldAutostart() to determine if autostart should be
done or not.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodriver: Introduce virDriverShouldAutostart()
Michal Privoznik [Fri, 4 Oct 2019 14:57:04 +0000 (16:57 +0200)]
driver: Introduce virDriverShouldAutostart()

Some of objects we manage can be autostarted on libvirtd startup
(e.g. domains, network, storage pools). The idea was that when
the host is started up these objects are started too without need
of user intervention. However, with the latest daemon split and
switch to socket activated, short lived daemons (we put --timeout
120 onto each daemon's command line) this doesn't do what we want
it to. The problem is not new though, we already had the session
daemon come and go and we circumvented this problem by
documenting it (see v4.10.0-92-g61b4e8aaf1). But now that we meet
the same problem at all fronts it's time to deal with it.

The solution implemented in this commit is to have a file (one
per each driver) that:

  1) if doesn't exist, is created and autostart is allowed for
     given driver,

  2) if it does exist, then autostart is suppressed for given
     driver.

All the files live in a location that doesn't survive host
reboots (/var/run/ for instance) and thus the file is
automatically not there on fresh host boot.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu_driver: Fix comment of qemuStateCleanup()
Michal Privoznik [Fri, 4 Oct 2019 14:33:37 +0000 (16:33 +0200)]
qemu_driver: Fix comment of qemuStateCleanup()

The comment says that the function kills domains and networks.
This is obviously not the case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agom4: fix setting of warning flags
Daniel P. Berrangé [Tue, 8 Oct 2019 12:41:19 +0000 (13:41 +0100)]
m4: fix setting of warning flags

When adding the -std=gnu99 flag, we set $wantwarn instead
of appending to it. This meant all the compiler warnings
were accidentally discarded.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: ask for -std=gnu99 explicitly
Daniel P. Berrangé [Mon, 7 Oct 2019 13:07:28 +0000 (14:07 +0100)]
build: ask for -std=gnu99 explicitly

We previously got -std=gnu99 secretly enabled as a side-effect
of requesting the 'stdarg' gnulib module. We rely on some
extensions from c99/gnu99 and while RHEL-7 supports this, it
still defaults to gnu89.  RHEL-7 also supports some newer
standards but declares them experimental/incomplete, so sticking
with gnu99 is best bet for now & matches historical usage.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: force -Werror for distcheck target
Daniel P. Berrangé [Mon, 7 Oct 2019 13:03:47 +0000 (14:03 +0100)]
build: force -Werror for distcheck target

The 'make distcheck' target validates that a tarball builds and
is ready for release. We expect that libvirt builds cleanly on
all supported platforms, so we should be enabling -Werror when
running distcheck.

This ensures that our CI systems in turn also use -Werror.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: remove the sched gnulib module
Daniel P. Berrangé [Thu, 3 Oct 2019 15:34:39 +0000 (16:34 +0100)]
build: remove the sched gnulib module

The 'sched' module provides a sched.h header file for platforms which
lack it. We already check for the functions we need in configure, and
protect the use of sched.h where relevant, so don't need the compat
header in libvirt.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: drop the isatty gnulib module
Daniel P. Berrangé [Thu, 3 Oct 2019 15:29:23 +0000 (16:29 +0100)]
build: drop the isatty gnulib module

The isatty gnulib module adds a fix for Win32 platforms where it doesn't
work correctly with character devices like NUL. This is not a compelling
enough problem for libvirt to be concerned with.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: drop the ldexp gnulib module
Daniel P. Berrangé [Thu, 3 Oct 2019 15:27:12 +0000 (16:27 +0100)]
build: drop the ldexp gnulib module

The ldexp gnulib module adds "-lm" to the $LIBS variable if-and-only-if
the ldexp() function require linking to libm. There is no harm in
linking to libm even if it isn't required for ldexp(), so simply drop
the gnulib module.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: drop the ignore-value gnulib module
Daniel P. Berrangé [Thu, 3 Oct 2019 15:25:45 +0000 (16:25 +0100)]
build: drop the ignore-value gnulib module

We don't need to care about very old GCC versions, so implementing the
ignore_value macro directly is not a significant burden.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: remove all gnulib bit manipulation modules
Daniel P. Berrangé [Thu, 3 Oct 2019 14:51:30 +0000 (15:51 +0100)]
build: remove all gnulib bit manipulation modules

We're using gnulib to get ffs, ffsl, rotl32, count_one_bits,
and count_leading_zeros. Except for rotl32 they can all be
replaced with gcc/clangs builtins. rotl32 is a one-line
trivial function.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agofixed handling of sourceless disks in 'domblkinfo' cmd
Pavel Mores [Fri, 4 Oct 2019 11:35:09 +0000 (13:35 +0200)]
fixed handling of sourceless disks in 'domblkinfo' cmd

virDomainGetBlockInfo() returns error if called on a disk with no
source (a sourceless disk might be a removable media drive with no
media in it, for instance an empty CDROM or floppy drive).

So far this caused the virsh domblkinfo --all command to abort and
ignore any remaining (not yet displayed) disk devices.  This patch
fixes the problem by first checking for existence of a <source>
element in the corresponding XML.  If none is found, we avoid calling
virDomainGetBlockInfo() altogether as we know it's bound to fail in
that case.

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

Signed-off-by: Pavel Mores <pmores@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: qemuxml2argv: Make use of versioned cpu-tsc-frequency and cpu-host-model-cmt...
Peter Krempa [Mon, 7 Oct 2019 06:55:31 +0000 (08:55 +0200)]
tests: qemuxml2argv: Make use of versioned cpu-tsc-frequency and cpu-host-model-cmt tests

Commit fb973cfbb4de added versioned test outputs for the above mentioned
tests but didn't actually enable them. Fix that mistake and fix the
output of the tsc-frequency test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: qemuxml2argv: Remove unused output of 'mlock-on' legacy test
Peter Krempa [Mon, 7 Oct 2019 06:47:56 +0000 (08:47 +0200)]
tests: qemuxml2argv: Remove unused output of 'mlock-on' legacy test

The test data was modernized to use actual caps but commit 4dadcaa98e5
forgot to delete this test data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: qemuxml2argv: Remove unused data for s390 keywrap
Peter Krempa [Mon, 7 Oct 2019 07:00:01 +0000 (09:00 +0200)]
tests: qemuxml2argv: Remove unused data for s390 keywrap

The last use was removed in 7b604379ba747cd8 when we deleted the old
commandline parser.

The argv generator tests are provided by:
machine-aeskeywrap-on-caps
machine-aeskeywrap-on-cap
machine-aeskeywrap-off-caps
machine-aeskeywrap-off-cap
machine-deakeywrap-on-caps
machine-deakeywrap-on-cap
machine-deakeywrap-off-caps
machine-deakeywrap-off-cap

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: qemuxml2argv: Remove unused data for 'pseries-disk'
Peter Krempa [Mon, 7 Oct 2019 06:50:10 +0000 (08:50 +0200)]
tests: qemuxml2argv: Remove unused data for 'pseries-disk'

The last use was removed in 7b604379ba747cd8 when we deleted the old
commandline parser. The same functionality is tested by many tests for
pseries guests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: qemuxml2argv: Remove unused data for 'serial-pty'
Peter Krempa [Mon, 7 Oct 2019 06:40:02 +0000 (08:40 +0200)]
tests: qemuxml2argv: Remove unused data for 'serial-pty'

The last use was removed in 7b604379ba747cd8 when we deleted the old
commandline parser. The same functionality is tested by
'serial-pty-chardev'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agobuild: drop the pthread gnulib module
Daniel P. Berrangé [Wed, 2 Oct 2019 17:19:18 +0000 (18:19 +0100)]
build: drop the pthread gnulib module

This was fixing a problem with old versions of mingw which had a
pthread.h that polluted the namespace with random symbols. This is no
longer relevant on our mingw platform targets.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: drop the perror gnulib module
Daniel P. Berrangé [Wed, 2 Oct 2019 17:15:55 +0000 (18:15 +0100)]
build: drop the perror gnulib module

This fixes a problem on mingw where it doesn't know how to report
certain errnos defined by POSIX, but not used on Windows. These are
not a real problem for libvirt.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: drop the gitlog-to-changelog gnulib module
Daniel P. Berrangé [Wed, 2 Oct 2019 17:14:06 +0000 (18:14 +0100)]
build: drop the gitlog-to-changelog gnulib module

The use of this script was discontinued when we stopped providing a full
ChangeLog in the dist with:

  commit ce97c33a795dec053f1e85c65ecd924b8c6ec4ba
  Author: Andrea Bolognani <abologna@redhat.com>
  Date:   Mon Apr 1 17:33:03 2019 +0200

    maint: Stop generating ChangeLog from git

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: drop the stdarg gnulib module
Daniel P. Berrangé [Wed, 2 Oct 2019 17:02:43 +0000 (18:02 +0100)]
build: drop the stdarg gnulib module

gnulib fixes a portability problem on AIX which is a platform we have
never targetted.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoRevert "build: use autobuild module to make build logs nicer"
Daniel P. Berrangé [Wed, 2 Oct 2019 15:34:10 +0000 (16:34 +0100)]
Revert "build: use autobuild module to make build logs nicer"

This reverts commit 83aca30f1e8be524780a60b9dd8a14ec5f9de878.

While the motivation of the original commit is fine, we are intending to
drop autoconf in favour of meson, and similarly wish to drop use of
gnulib. Removing this feature is part of that conversion work.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: drop the stpcpy gnulib module
Daniel P. Berrangé [Wed, 2 Oct 2019 15:14:45 +0000 (16:14 +0100)]
util: drop the stpcpy gnulib module

stpcpy returns a pointer to the end of the string just copied
which in theory makes it easier to then copy another string
after it. We only use stpcpy in one place though and that
is trivially rewritten to avoid stpcpy with no loss in code
clarity or efficiency.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: drop the mktempd gnulib module
Daniel P. Berrangé [Wed, 2 Oct 2019 11:09:08 +0000 (12:09 +0100)]
build: drop the mktempd gnulib module

The mktempd module in gnulib provides an equivalent to 'mktemp -d' on
platforms which lack this shell command. All platforms on which libvirt
runs the affected tests have 'mktemp -d' support, so the gnulib module
is not required.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: drop the inet_pton gnulib module
Daniel P. Berrangé [Wed, 2 Oct 2019 11:04:07 +0000 (12:04 +0100)]
build: drop the inet_pton gnulib module

All use of this function was purged a long time ago in favour
of getaddrinfo

  commit a8ae7d19f4ace62ff3f364c628cbc16baa9b080c
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Oct 21 11:13:05 2010 +0100

    Remove all use of inet_pton and inet_ntop

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: drop the getopt-posix gnulib module
Daniel P. Berrangé [Wed, 2 Oct 2019 10:42:07 +0000 (11:42 +0100)]
build: drop the getopt-posix gnulib module

The getopt-posix module fixes a problem with optind being incorrectly
set after a failed option parse. It was also previously used to allow
the bhyve driver to access a private internal reentrant getopt impl.
None of this matters to libvirt code any more.

This partially reverts

  commit b436a8ae5ccb04f8cf893d882d52ab5efc713307
  Author: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
  Date:   Thu Jun 9 00:50:35 2016 +0000

    gnulib: add getopt module

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobhyve: stop using private gnulib _getopt_internal_r func
Daniel P. Berrangé [Thu, 3 Oct 2019 13:35:44 +0000 (14:35 +0100)]
bhyve: stop using private gnulib _getopt_internal_r func

The _getopt_internal_r func is not intended for public use, it is an
internal function shared between the gnulib getopt and argp modules.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: capabilities: Fill in bochs-display info
Fabiano Fidêncio [Thu, 3 Oct 2019 13:28:40 +0000 (15:28 +0200)]
qemu: capabilities: Fill in bochs-display info

086c19d69 added bochs-display capability but didn't fill in the info for
domain capabilities.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu_driver: hook up query-cpu-model-comparison
Collin Walling [Thu, 19 Sep 2019 20:25:05 +0000 (16:25 -0400)]
qemu_driver: hook up query-cpu-model-comparison

This command is hooked into the virsh hypervisor-cpu-compare command.
As such, the CPU model XML provided to the command will be compared
to the hypervisor CPU contained in the QEMU capabilities file for the
appropriate QEMU binary (for s390x, this CPU definition can be observed
via virsh domcapabilities).

QMP will report that the XML CPU is either identical to, a subset of,
or incompatible with the hypervisor CPU. s390 can also report that
the XML CPU is a "superset" of the hypervisor CPU. This response is
presented as incompatible, as this CPU model would not be able to run
on the hypervisor.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Message-Id: <1568924706-2311-15-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agocpu_conf: xml to cpu definition parse helper
Collin Walling [Thu, 19 Sep 2019 20:25:04 +0000 (16:25 -0400)]
cpu_conf: xml to cpu definition parse helper

Implement an XML to virCPUDefPtr helper that handles the ctxt
prerequisite for virCPUDefParseXML.

This does not alter any functionality.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Message-Id: <1568924706-2311-14-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu_capabilities: introduce QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON
Collin Walling [Thu, 19 Sep 2019 20:25:03 +0000 (16:25 -0400)]
qemu_capabilities: introduce QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON

This capability enables comparison of CPU models via QMP.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Message-Id: <1568924706-2311-13-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu_monitor: implement query-cpu-model-comparison
Collin Walling [Thu, 19 Sep 2019 20:25:02 +0000 (16:25 -0400)]
qemu_monitor: implement query-cpu-model-comparison

Interfaces with QEMU to compare CPU models. The command takes two CPU
models, A and B, that are given a model name and an optional list of
CPU features. Through the query-cpu-model-comparison command issued
via QMP, a result is produced that contains the comparison evaluation
string (identical, superset, subset, incompatible).

The list of properties (aka CPU features) that is returned from the QMP
response is ignored.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielh413@gmail.com>
Message-Id: <1568924706-2311-12-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
5 years agoqemu_driver: expand cpu features after baseline
Collin Walling [Wed, 2 Oct 2019 11:48:17 +0000 (13:48 +0200)]
qemu_driver: expand cpu features after baseline

Perform a full CPU model expansion on the result of the baselined
model name when the features flag is present.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Message-Id: <1568924706-2311-11-git-send-email-walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>