Commit Graph

45 Commits

Author SHA1 Message Date
Pavel Hrdina
fa60251b01 tests: domaincapstest: add test for Q35 machine type
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-18 13:27:11 +02:00
Pavel Hrdina
8ddd44806b qemu: report IDE bus in domain capabilities only if it's supported
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441964

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-04-18 13:27:11 +02:00
Jiri Denemark
385c1cc96c qemu: Check non-migratable host CPU features
CPU features which change their value from disabled to enabled between
two calls to query-cpu-model-expansion (the first with no extra
properties set and the second with 'migratable' property set to false)
can be marked as enabled and non-migratable in qemuMonitorCPUModelInfo.

Since the code consuming qemuMonitorCPUModelInfo currently ignores the
migratable flag, this change is effectively changing the CPU model
advertised in domain capabilities to contain all features (even those
which block migration). And this matches what we do for QEMU older than
2.9.0, when we detect all CPUID bits ourselves without asking QEMU.

As a result of this change

    <cpu mode='host-model'>
      <feature name='invtsc' policy='require'/>
    </cpu>

will work with all QEMU versions. Such CPU definition would be forbidden
with QEMU >= 2.9.0 without this patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-30 09:59:42 +02:00
Erik Skultety
ec783d7c77 conf: Introduce new hostdev device type mdev
A mediated device will be identified by a UUID (with 'model' now being
a mandatory <hostdev> attribute to represent the mediated device API) of
the user pre-created mediated device. We also need to make sure that if
user explicitly provides a guest address for a mdev device, the address
type will be matching the device API supported on that specific mediated
device and error out with an incorrect XML message.

The resulting device XML:
<devices>
  <hostdev mode='subsystem' type='mdev' model='vfio-pci'>
    <source>
      <address uuid='c2177883-f1bb-47f0-914d-32a22e3a8804'>
    </source>
  </hostdev>
</devices>

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2017-03-27 15:39:35 +02:00
Roman Bogorodskiy
74cfb5bb85 domaincapstest: add bhyve caps test
* Extract filling bhyve capabilities from virBhyveDomainCapsBuild()
   into a new function virBhyveDomainCapsFill() to make testing
   easier by not having to mock firmware directory listing and
   hypervisor capabilities probing
 * Also, just presence of the firmware files is not sufficient
   to enable os.loader.supported, hypervisor should support UEFI
   boot too
 * Add tests to domaincapstest for the main caps possible flows:
    - when UEFI bootrom is supported
    - when video (fbus) is supported
    - neither of above is supported
2017-03-26 18:44:46 +04:00
Fabian Freyer
04664327c6 bhyve: add video support
bhyve supports 'gop' video device that allows clients to connect
to VMs using VNC clients. This commit adds support for that to
the bhyve driver:

 - Introducr 'gop' video device type
 - Add capabilities probing for the 'fbuf' device that's
   responsible for graphics
 - Update command builder routines to let users configure
   domain's VNC via gop graphics.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2017-03-11 23:30:56 +04:00
Pavel Hrdina
2149d405a0 qemu_capabilities: report SATA bus in domain capabilities
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-03-07 09:11:03 +01:00
Jiri Denemark
bb3363c90b qemu: Use full CPU model expansion on x86
The static CPU model expansion is designed to return only canonical
names of all CPU properties. To maintain backwards compatibility libvirt
is stuck with different spelling of some of the features, but we need to
use the full expansion to get the additional spellings. In addition to
returning all spelling variants for all properties the full expansion
will contain properties which are not guaranteed to be migration
compatible. Thus, we need to combine both expansions. First we need to
call the static expansion to limit the result to migratable properties.
Then we can use the result of the static expansion as an input to the
full expansion to get both canonical names and their aliases.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
f013828992 qemu: Get host CPU model from QEMU on x86_64
Until now host-model CPU mode tried to enable all CPU features supported
by the host CPU even if QEMU/KVM did not support them. This caused a
number of issues and made host-model quite unreliable. Asking QEMU for
the CPU it can provide and the current host makes host-model much more
robust.

This commit fixes the following bugs:

    https://bugzilla.redhat.com/show_bug.cgi?id=1018251
    https://bugzilla.redhat.com/show_bug.cgi?id=1371617
    https://bugzilla.redhat.com/show_bug.cgi?id=1372581
    https://bugzilla.redhat.com/show_bug.cgi?id=1404627
    https://bugzilla.redhat.com/show_bug.cgi?id=870071

In addition to that, the following bug should be mostly limited to cases
when an unsupported feature is explicitly requested:

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
0bde051f3d domaincapstest: Add test data for QEMU 2.9.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:56 +01:00
Jiri Denemark
390a1e2bfd qemu: Fix CPU model fallback in domain capabilities
Our documentation of the domain capabilities XML says that the fallback
attribute of a CPU model is used to indicate whether the CPU model was
detected by libvirt itself (fallback="allow") or by asking the
hypervisor (fallback="forbid"). We need to properly set
fallback="forbid" when CPU model comes from QEMU to match the
documentation.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-02-24 14:10:57 +01:00
Jiri Denemark
5d513d4659 qemu-caps: Get host model directly from Qemu when available
When qmp query-cpu-model-expansion is available probe Qemu for its view of the
host model. In kvm environments this can provide a more complete view of the
host model because features supported by Qemu and Kvm can be considered.

Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
2017-01-06 12:24:57 +01:00
Collin L. Walling
9486dbb339 tests: domain capabilities: qemu 2.7 and 2.8 on s390x
Tests domain capabilities on s390x using the Qemu 2.8 capabilities data.

Signed-off-by: Collin L. Walling <walling@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
2017-01-06 12:24:57 +01:00
Jiri Denemark
a1adfb0f06 qemu: Add support for unavailable-features
QEMU 2.8.0 adds support for unavailable-features in
query-cpu-definitions reply. The unavailable-features array lists CPU
features which prevent a corresponding CPU model from being usable on
current host. It can only be used when all the unavailable features are
disabled. Empty array means the CPU model can be used without
modifications.

We can use unavailable-features for providing CPU model usability info
in domain capabilities XML:

    <domainCapabilities>
      ...
      <cpu>
        <mode name='host-passthrough' supported='yes'/>
        <mode name='host-model' supported='yes'>
          <model fallback='allow'>Skylake-Client</model>
          ...
        </mode>
        <mode name='custom' supported='yes'>
          <model usable='yes'>qemu64</model>
          <model usable='yes'>qemu32</model>
          <model usable='no'>phenom</model>
          <model usable='yes'>pentium3</model>
          <model usable='yes'>pentium2</model>
          <model usable='yes'>pentium</model>
          <model usable='yes'>n270</model>
          <model usable='yes'>kvm64</model>
          <model usable='yes'>kvm32</model>
          <model usable='yes'>coreduo</model>
          <model usable='yes'>core2duo</model>
          <model usable='no'>athlon</model>
          <model usable='yes'>Westmere</model>
          <model usable='yes'>Skylake-Client</model>
          ...
        </mode>
      </cpu>
      ...
    </domainCapabilities>

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-28 09:11:22 +01:00
Jiri Denemark
fe66e2fffe tests: Add QEMU 2.8.0 domain capabilities tests
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-28 09:11:22 +01:00
Jiri Denemark
0d2c389fad tests: Update capabilities for QEMU 2.6.0 (ppc64le)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:59:57 +01:00
Jiri Denemark
f8b7b075b6 tests: Update capabilities for QEMU 2.6.0 (aarch64, GICv3)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:59:34 +01:00
Jiri Denemark
73411a7ff1 qemu: Avoid reporting "host" as a supported CPU model
"host" CPU model is supported by a special host-passthrough CPU mode and
users is not allowed to specify this model directly with custom mode.
Thus we should not advertise "host" CPU model in domain capabilities.
This worked well on architectures for which libvirt provides a list of
supported CPU models in cpu_map.xml (since "host" is not in the list).
But we need to explicitly filter "host" model out for all other
architectures.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:59:19 +01:00
Jiri Denemark
451dc19353 tests: Update capabilities for QEMU 2.6.0 (aarch64, GICv2)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:34:27 +01:00
Jiri Denemark
e6bad6b63d tests: Update capabilities for QEMU 2.6.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:34:27 +01:00
Jiri Denemark
58c7620cdc tests: Update capabilities for QEMU 1.7.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:34:27 +01:00
Jiri Denemark
7bf6f345e0 qemu: Probe CPU models for KVM and TCG
CPU models (and especially some additional details which we will start
probing for later) differ depending on the accelerator. Thus we need to
call query-cpu-definitions in both KVM and TCG mode to get all data we
want.

Tests in tests/domaincapstest.c are temporarily switched to TCG to avoid
having to squash even more stuff into this single patch. They will all
be switched back later in separate commits.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-25 20:34:27 +01:00
Eric Farman
fc0e627bac Introduce framework for a hostdev SCSI_host subsystem type
We already have a "scsi" hostdev subsys type, which refers to a single
LUN that is passed through to a guest.  But what of things where
multiple LUNs are passed through via a single SCSI HBA, such as with
the vhost-scsi target?  Create a new hostdev subsys type that will
carry this.

Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
2016-11-24 12:15:26 -05:00
Pavel Hrdina
34a4447bd4 qemu_capabilities: join capabilities for qxl and qxl-vga devices
This patch simplifies QEMU capabilities for QXL video device.  QEMU
exposes this device as *qxl-vga* and *qxl* and they are both the same
device with the same set of parameters, the only difference is that
*qxl-vga* includes VGA compatibility.

Based on QEMU code they are tied together so it's safe to check only for
presence of only one of them.

This patch also removes an invalid test case "video-qxl-sec-nodevice"
where there is only *qxl-vga* device and *qxl* device is not present.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-10-12 17:46:47 +02:00
Jiri Denemark
14319c81a0 Show host model in domain capabilities
The domain capabilities XML is capable of showing whether each guest CPU
mode is supported or not with a possibility to provide additional
details. This patch enhances host-model capability to advertise the
exact CPU model which will be used as a host-model:

    <cpu>
        ...
        <mode name='host-model' supported='yes'>
            <model fallback='allow'>Broadwell</model>
            <vendor>Intel</vendor>
            <feature policy='disable' name='aes'/>
            <feature policy='require' name='vmx'/>
        </mode>
        ...
    </cpu>

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jiri Denemark
d4c007e6d5 domcaps: Add CPU usable flag
In case a hypervisor is able to tell us a list of supported CPU models
and whether each CPU models can be used on the current host, we can
propagate this to domain capabilities. This is a better alternative
to calling virConnectCompareCPU for each supported CPU model.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jiri Denemark
33f9ccc141 domcaps: Show only CPU models supported by libvirt
Listing all CPU models supported by QEMU in domain capabilities makes
little sense when libvirt will refuse any model it doesn't know about.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jiri Denemark
84d38307fe qemu: Fill in CPU domain capabilities
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jiri Denemark
167280e7f6 domcaps: Add support for listing supported CPU models
The patch adds <cpu> element to domain capabilities XML:

    <cpu>
        <mode name='host-passthrough' supported='yes'/>
        <mode name='host-model' supported='yes'/>
        <mode name='custom' supported='yes'>
            <model>Broadwell</model>
            <model>Broadwell-noTSX</model>
            ...
        </mode>
    </cpu>

Applications can use it to inspect what CPU configuration modes are
supported for a specific combination of domain type, emulator binary,
guest architecture and machine type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:08 +02:00
Jim Fehlig
8bab1e7c05 libxl: add USB to hostdev domcapabilities
Commit 2a58ed0b added support for creating guests with USB
hostdevs. Commit fc21d10 later added support for hotplut of
USB hostdevs. Advertise support for USB hostdevs in the
domcapabilities.

In addition add the appropriate caps for USB support on
domaincapstest when libvirt is built on a Xen with
LIBXL_HAVE_PVUSB. Otherwise domaincapstest would fail i.e.
testing the wrong domain capabilities.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
2016-06-17 14:25:02 -06:00
Jim Fehlig
11567cf66f libxl: implement connectGetDomainCapabilities
Add domain capabilities for PV and HVM domains.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2016-06-13 14:13:17 -06:00
Pavel Hrdina
c81415065e qemucapstest: replace caps-1.6.50 with updated caps-1.7.0
The qemu-1.6.50 is a beta before the new minor version, let's replace it with
the release qemu-1.7.0.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-25 17:04:22 +02:00
Pavel Hrdina
750b83137b qemucapstest: update caps for qemu-2.6.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:03 +02:00
Jiri Denemark
9ac9b039c4 domaincapstest: Give better names to test data files
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-16 10:37:29 +02:00
Cole Robinson
5ed235c68f domaincaps: Report video modelType
Requires adding the plumbing for <device><video>
The value is <enum name='modelType'> to match the associated domain
XML of <video><model type='XXX'/>

Wire it up for qemu too
2016-05-09 16:05:31 -04:00
Cole Robinson
6da27ad1b5 domaincaps: Report graphics type enum
Requires adding the plumbing for <device><graphics>
Wire it up for qemu too
2016-05-09 16:05:31 -04:00
Jiri Denemark
3957dd1acf domaincapstest: Add tests for QEMU 2.6
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-06 10:38:31 +02:00
Jiri Denemark
f51e8a6282 domaincapstest: Use default machine type
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-06 10:38:30 +02:00
Jiri Denemark
55b1073451 qemucapabilitiestest: Test all capabilities
Enhance the test to cover all capabilities we probe for rather than
testing the flags only.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-06 10:35:32 +02:00
Andrea Bolognani
4e2d82f72b conf: Expose GIC capabilities
Add information about GIC capabilities to virDomainCaps and update
the formatter to include them in the XML output.
2016-04-20 12:52:41 +02:00
Michal Privoznik
436dcf0b74 qemu: Add AAVMF to the list of known UEFIs
Well, even though users can pass the list of UEFI:NVRAM pairs at the
configure time, we may maintain the list of widely available UEFI
ourselves too. And as arm64 begin to rises, OVMF was ported there too.
With a slight name change - it's called AAVMF, with AAVMF_CODE.fd
being the UEFI firmware and AAVMF_VARS.fd being the NVRAM store file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-01-29 15:20:47 +01:00
Michal Privoznik
f05b6a918e domaincaps: Expose UEFI binary path, if it exists
Check to see if the UEFI binary mentioned in qemu.conf actually
exists, and if so expose it in domcapabilities like

<loader ...>
  <value>/path/to/ovmf</value>
</loader>

We introduce some generic domcaps infrastructure for handling
a dynamic list of string values, it may be of use for future bits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-09-17 16:29:49 +02:00
Michal Privoznik
4f76621c0e domaincaps: Expose UEFI capability
As of 542899168c we learned libvirt to use UEFI for domains.
However, management applications may firstly query if libvirt
supports it. And this is where virConnectGetDomainCapabilities()
API comes handy.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-09-17 09:42:33 +02:00
Michal Privoznik
94e3f23e8a qemu: Implement virConnectGetDomainCapabilities
So far only information on disks and host devices are exposed in the
capabilities XML. Well, at least something. Even a new test is
introduced. The qemu capabilities are stolen from already existing
qemucapabilities test. There's one tricky point though. Functions that
checks host's KVM and VFIO capabilities, are impossible to mock
currently. So in the test, we are setting the capabilities by hand.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-07-03 12:22:38 +02:00
Michal Privoznik
614581f32b Introduce domain_capabilities
This new module holds and formats capabilities for emulator. If you
are about to create a new domain, you may want to know what is the
host or hypervisor capable of. To make sure we don't regress on the
XML, the formatting is not something left for each driver to
implement, rather there's general format function.

The domain capabilities is a lockable object (even though the locking
is not necessary yet) which uses reference counter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-07-03 12:22:37 +02:00