Commit Graph

29945 Commits

Author SHA1 Message Date
Brijesh Singh
45422935c3 libvirt: Introduce virNodeGetSEVInfo public API
The API can be used by application to retrieve the Platform Diffie-Hellman
Key and Platform Certificate chain.

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-06-12 09:52:00 +02:00
Brijesh Singh
5dca09c170 conf: Expose SEV feature in domain capabilities
Extend hypervisor capabilities to include sev feature. When available,
hypervisor supports launching an encrypted VM on AMD platform. The
sev feature tag provides additional details like Platform Diffie-Hellman
(PDH) key and certificate chain which can be used by the guest owner to
establish a cryptographic session with the SEV firmware to negotiate
keys used for attestation or to provide secret during launch.

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-06-12 09:52:00 +02:00
Brijesh Singh
d4005609f3 qemu: Provide support to query the SEV capability
QEMU version >= 2.12 provides support for launching an encrypted VMs on
AMD x86 platform using Secure Encrypted Virtualization (SEV) feature.
This patch adds support to query the SEV capability from the qemu.

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-06-12 09:51:59 +02:00
Anya Harter
2cbdf303dd events: remove remoteEventQueue wrapper function
And replace all calls with virObjectEventStateQueue such that:

    remoteEventQueue(priv, event, callbackID);

becomes:

    virObjectEventStateQueue(priv->eventState, event, callbackID);

Signed-off-by: Anya Harter <aharter@redhat.com>
2018-06-12 07:28:58 +02:00
Anya Harter
aad3a0b5f8 events: move NULL check to EventStateQueueRemote
Remove NULL check around call to virObjectEventStateQueueRemote in
remote_driver.c.

Signed-off-by: Anya Harter <aharter@redhat.com>
2018-06-12 07:28:35 +02:00
Anya Harter
031eb8f6dc events: add NULL check in virObjectEventStateQueue
And remove NULL checking from all callers.

Signed-off-by: Anya Harter <aharter@redhat.com>
2018-06-12 07:28:18 +02:00
John Ferlan
4e3a9daa66 qemu: Allow no address to be defined for virtio-scsi iothread attach
https://bugzilla.redhat.com/show_bug.cgi?id=1583623

When attaching a virtio-scsi with IOThreads for the config of a
live domain, allow the <address> to not be defined thus allowing
post parse processing to fill in the address. This allows parsing
of an individual device to succeed for attach config.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-11 18:46:07 -04:00
John Ferlan
0054c706e9 qemu: Alter error message when IOThread address not correct
Make the error a bit clearer that virtio-scsi IOThreads require
virtio pci or ccw controller address types.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-11 18:44:02 -04:00
John Ferlan
310051c847 qemu: Fix error for attach controller config for live guest
Fix the error message to indicate what exactly is failing - that
the controller index provided matches an existing controller.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-11 18:41:33 -04:00
John Ferlan
c1aaa253d2 conf: Check error from virXMLFormatElement call
Commit id 1bd5a08d added a call to virXMLFormatElement without
also checking the return status.

Found by Coverity.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Katerina Koukiou <kkoukiou@redhat.com>
2018-06-11 18:33:13 -04:00
John Ferlan
05c41f4f1d test: Check return status for libxlxml2domconfigtest
Commit id d8e8b63d introduced the test, but neglected to check for
error from virTestLoadFile in testCompareXMLToDomConfig.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Katerina Koukiou <kkoukiou@redhat.com>
2018-06-11 18:33:13 -04:00
John Ferlan
30b2ebb284 test: Fix resource leak in qemumonitorjsontest
Introduced by commmit id 37bd4571c. Need to goto cleanup and
not return directly.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Katerina Koukiou <kkoukiou@redhat.com>
2018-06-11 18:33:13 -04:00
John Ferlan
462abad2e7 qemu: Fix Coverity build for qemu_monitor
Commit id '7ef0471bf' added a new parameter to qemuMonitorOpen,
but didn't update the ATTTRIBUTE_NONNULL for the @cb (param 5).

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Katerina Koukiou <kkoukiou@redhat.com>
2018-06-11 18:33:13 -04:00
John Ferlan
6cfd49bd4f vbox: Fix resource leak
The @disk was allocated, filled in, and consumed on the normal path,
but for error/cleanup paths it would be leaked.  Rename to newHardDisk
and manage properly.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Katerina Koukiou <kkoukiou@redhat.com>
2018-06-11 18:33:13 -04:00
John Ferlan
b8844727c9 vbox: Fix resource leak
Need to free the allocated hardDiskToOpen array. The contents of the
array are just pointers returned by virVBoxSnapshotConfHardDiskByLocation
and not allocated AFAICT so they don't need to also be freed as well.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Katerina Koukiou <kkoukiou@redhat.com>
2018-06-11 18:33:13 -04:00
Chen Hanxiao
da5b1a9188 virstring: fix a typo
s/glibc's_asprintf/glibc's asprintf

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-06-11 16:00:34 +02:00
Fabiano Fidêncio
cb9868b521 xen_common: Split per-PCI logic from xenParsePCI()
xenParsePCI() does a lot of stuff and, in order to make things cleaner,
let's split it in two new functions:
- xenParsePCI(): it's a new function that keeps the old name. It's
responsible for the whole per-PCI logic from the old xenParsePCI();
- xenParsePCIList(): it's basically the old xenParsePCI(), but now it
just iterates over the list of PCIs, calling xenParsePCI() per each PCI.

This patch is basically preparing the ground for the future when
typesafe virConf acessors will be used.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-06-11 15:13:45 +02:00
Fabiano Fidêncio
9c89500ec0 vmx: convert to typesafe virConf accessors
Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-06-11 15:10:57 +02:00
Fabiano Fidêncio
7c2b32a691 xen_vm: convert to typesafe virConf accessors
Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-06-11 14:56:49 +02:00
Fabiano Fidêncio
5d358df82a xen_xm: Split the per-disk logic from xenParseXMDisk()
xenParseXMDisk() does a lot of stuff and, in order to make things
cleaner, let's split it in two new functions:
- xenParseXMDisk(): it's a new function that keeps the old name. It's
responsible for the whole per-disk logic from the old xenParseXMDisk();
- xenParseXMDiskList(): it's basically the old xenParseXMDisk(), but
now it just iterates over the list of disks, calling xenParseXMDisk()
per each disk.

This patch is basically preparing the ground for the future when
typesafe virConf acessors will be used.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-06-11 10:17:15 +02:00
Roman Bogorodskiy
057a78ea31 bhyve: tests: Add missing data files
Add missing data files for bhyve cpu topology tests that should have been
added in b66fda0a74.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2018-06-08 21:53:36 +04:00
Marc Hartmayer
fef4d132c4 qemu: Fix segmentation fault on reconnect
On start up of libvirtd the worker pool of the QEMU driver must be
initialized before trying to reconnect to all the running QEMU
instances. Otherwise segmentation faults can occur if there are QEMU
monitor events emitted.

 #0  __GI___pthread_mutex_lock
 #1  0x000003fffdba9e62 in virMutexLock
 #2  0x000003fffdbab2dc in virThreadPoolSendJob
 #3  0x000003ffd8343b70 in qemuProcessHandleSerialChanged
 #4  0x000003ffd836a776 in qemuMonitorEmitSerialChange
 #5  0x000003ffd8378e52 in qemuMonitorJSONHandleSerialChange
 #6  0x000003ffd8378930 in qemuMonitorJSONIOProcessEvent
 #7  0x000003ffd837edee in qemuMonitorJSONIOProcessLine
 #8  0x000003ffd837ef86 in qemuMonitorJSONIOProcess
 #9  0x000003ffd836757a in qemuMonitorIOProcess
 #10 0x000003ffd836863e in qemuMonitorIO
 #11 0x000003fffdb4033a in virEventPollDispatchHandles
 #12 0x000003fffdb4055e in virEventPollRunOnce
 #13 0x000003fffdb3e782 in virEventRunDefaultImpl
 #14 0x000003fffdc89400 in virNetDaemonRun
 #15 0x000000010002a816 in main

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-06-08 13:29:18 +02:00
Martin Kletzander
6142758a57 util: Remove cbm_mask from virResctrlInfoPerType
It was used just temporarily to do a calculation, no need to keep that around.
Also use virBitmap in the code instead of reimplementing two of its existing
functions.  And move the counting part next to where the value is read.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
f1d7625e13 Move virCacheKernel enum implemetation from conf/ to util/
It will be used in that file later on, plus it makes sense for all the
implementations to be in same place.  Also comment each one of them nicely and
add a comment explaining why they all need to end with the same _LAST value.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
c95b9557b5 util: Initialize virResctrlInfo struct right away
There is no need to have virResctrlGetInfo() when it must be called after
virResctrlInfoNew() anyway, otherwise it's just an unusable object.  When we
wrap the logic inside the New() function we'll save some calls later as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
089c81b0e1 util: Reorder parts of virresctrl
Move description of the purpose of the file before any definition.

One empty line between related enum definitions.

All typedefs before all structs.  This is exception from the usual, but not the
only one, we already have something similar for some other structs.  This way we
can move contents between structs and reorder some parts nicely without moving
all definitions of one type before another one just so it's defined.

Define all classes in one place.

Have one initialization function for all classes in the file.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
657ddeff23 util: Use virFileFlock() in virresctrl
That way we get rid of the last preprocessor conditional so the code compiles on
all platforms.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
3593d36c33 util: Avoid needless preprocessor conditionals in virresctrl
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
5a0a5f7fb5 util: Introduce virFileFlock
We already have virFileLock(), but we are now using flock() in the code as
well (due to requirements for mutual exclusion between libvirt and other
programs using flock() as well), so let's have a function for that as well so we
don't need to have stubs for unsupported platforms in other files.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
f41bbfe0e5 util: Fix typo in error message %ud -> %u
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
c5159d66de util: Rename resctrl to alloc if it is virResctrlAllocPtr
Just to stay consistent.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
7a439dcb23 docs: Add TSEG support info into news.xml
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
d60b730b48 qemu: Add support for setting the TSEG size
The default is stable per machine type so there should be no need to keep that.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
3ea32b635d qemu: Add capability flag for setting the extended tseg size
For getting the reply I queried the newest and oldest QEMU using
test/qemucapsprobe.  From the differences I only extracted the reply to the new
QMP command and discarded the rest.  For all the versions below the one which
added support for the new option I used the output from the oldest QEMU release
and for those that support it I used the output from the newest one.

In order to make doubly sure the reply is where it is supposed to be (the
replies files are very forgiving) I added the property to all the replies files,
reran the tests again and fixed the order in replies files so that all the
versions are reporting the new capability.  Then removed that one property.

After that I used test/qemucapsfixreplies to fix the reply IDs.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
1bd5a08d38 conf, schema, docs: Add support for TSEG size setting
TSEG (Top of Memory Segment) is one of many regions that SMM (System Management
Mode) can occupy.  This one, however is special, because a) most of the SMM code
lives in TSEG nowadays and b) QEMU just (well, some time ago) added support for
so called 'extended' TSEG.  The difference to the TSEG implemented in real q35's
MCH (Memory Controller Hub) is that it can offer one extra size to the guest OS
apart from the standard TSEG's 1, 2, and 8 MiB and that size can be selected in
1 MiB increments.  Maximum may vary based on QEMU and is way too big, so we
don't need to check for the maximum here.  Similarly to the memory size we'll
leave it to the hypervisor to try satisfying that and giving us an error message
in case it is not possible.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
3f2499d7d7 qemu: Relax check for SMM feature
One of the things that this is improving is the fact that instead of error
message (that was wrong) you get when starting a domain with SMM and i440fx we
allow the setting to go through.  SMM option exists and makes sense on i440fx as
well (basically whenever that _SMM_OPT capability is set).

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Martin Kletzander
343894b74b qemu: Move checks for SMM from command-line creation into validation phase
We are still hoping all of such checks will be moved there and this is one small
step in that direction.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 10:28:46 +02:00
Peter Krempa
e546785dce tests: qemuxml2argv: Make tests based on DO_TEST_CAPS_LATEST stable
To avoid problems with test cases specifying an alias machine type which
would change once capabilities for a newer version are added strip all
alias machine types for the DO_TEST_CAPS_LATEST based tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-06-08 09:28:58 +02:00
Peter Krempa
e1e8d0a9b7 util: storage: remove 'allow_probe' from virStorageFileGetMetadata
All callers pass 'false' now so it's no longer needed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:38 +02:00
Peter Krempa
e0f8839b88 tests: storage: Drop duplicate tests with TEST_CHAIN
Now that all test cases with TEST_CHAIN were testing the same thing
twice drop one of them. Note that some of the cases were duplicate even
before dropping the image format probing tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:38 +02:00
Peter Krempa
655b95a01d tests: storage: Drop format probing from tests
Storage drivers now don't allow it so there's no need to test it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:38 +02:00
Peter Krempa
67d7d41615 tests: storage: Absorb ALLOW_PROBE flag into the TEST_CHAIN macro
The second set of arguments for TEST_CHAIN always specifies the
'ALLOW_PROBE' flag. Make it part of the macro.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:38 +02:00
Peter Krempa
300515b414 tests: virstoragetest: Add complementary test case for QED format
We have a test case for QED disk image with autodetection but not with
the format explicitly specified.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:38 +02:00
Peter Krempa
abccb2fdeb security: aa-helper: Remove the -p parameter
As the aa-helper binary is supposed to be used only with libvirt, we can
fully remove it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:37 +02:00
Peter Krempa
10bc2127c3 security: Remove VIR_SECURITY_MANAGER_ALLOW_DISK_PROBE
Nothing is setting that flag now so it can be removed. Note that
removing 'mgr' from 'load_profile' in the apparmor driver would create a
lot of churn.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:37 +02:00
Peter Krempa
69d0d15632 qemu: driver: Remove impossible code path in qemuDomainSnapshotCreateInactiveExternal
Previous patch naively removed all code relevant to disk format
checking. The semantics now dictate that the format check when creating
external snapshots is now impossible as we always fill in the format for
disks in domain definition in the post-parse callback.

Remove the impossible code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:37 +02:00
Peter Krempa
c95f50cb02 qemu: conf: Remove 'allow_disk_format_probing' config option
The option is insecure and it has been long enough for users to migrate
their disk files to use explicit format. Drop the option and related
code.

The config parser still parses it and rejects statup if it's still
present in the config in enabled state.

The augeas lens is also kept so that users can disable it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:37 +02:00
Peter Krempa
18d94e17f8 tests: Drop tests enabling allowDiskFormatProbing
Format probing will be dropped so remove the tests which will become
obsolete.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-08 09:26:37 +02:00
Daniel Nicoletti
13311be4a3 Add Virtlyst web application to apps.html
Signed-off-by: Daniel Nicoletti <dantti12@gmail.com>
2018-06-07 17:20:32 -04:00
Brijesh Singh
c04d452ef6 nwfilter: fix build error when pcap-config is not present
The compilation fails with the following error when pcap-config
is not present on the host:

nwfilter/nwfilter_learnipaddr.c:824:1: error: conflicting types for 'virNWFilterLearnIPAddress'
 virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,

 In file included from nwfilter/nwfilter_learnipaddr.c:57:0:
 nwfilter/nwfilter_learnipaddr.h:38:5: note: previous declaration of 'virNWFilterLearnIPAddress' was here
  int virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-06-07 23:00:16 +02:00