Commit Graph

30218 Commits

Author SHA1 Message Date
Jiri Denemark
073d5041c7 spec: Explicitly require matching libvirt-libs
All drivers now link directly to libvirt.so rather than getting the
symbols from the daemon. Let's explicitly mention this dependency in the
spec file instead of relying on transitive dependency from
libvirt-daemon.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2018-07-11 13:37:48 +02:00
Marcos Paulo de Souza
80dacadf8e phyp_driver: Set remoteOnly member of virConnectDriver
Phyp driver can't function without a server being informed, so this flag
makes libvirt to check for a valid server before calling connectOpen.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-11 13:16:59 +02:00
Marcos Paulo de Souza
1c270a84e7 hyperv_driver: Set remoteOnly member of virConnectDriver
HyperV driver can't function without a server being informed, so this flag
makes libvirt to check for a valid server before calling connectOpen.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-11 13:16:22 +02:00
Marcos Paulo de Souza
bda9b38917 esx_driver: Set remoteOnly member of virConnectDriver
ESX driver can't function without a server being informed, so this flag
makes libvirt to check for a valid server before calling connectOpen.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-11 13:13:34 +02:00
Marcos Paulo de Souza
4916297b46 libvirt.c: Return error when remoteOnly is set but server is empty
Some drivers require a server in order to work, so this flag removes the
burden of esach driver to check for an server by doing it in
virConnectOpenInternal.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
2018-07-11 12:55:26 +02:00
Marcos Paulo de Souza
9a4c75590f driver.h: Add remoteOnly member to virConnectDriver struct
This new flag will be set when a driver needs a remote URL in order to
work, as ESX, HyperV and Phyp.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
2018-07-11 12:55:26 +02:00
Shichangkuo
a94bb4ebdf storagePoolDefineXML: prefer using newDef to save config file
When re-defining an active storage pool, due to a bug the config
file on disk is not changed. This is because we are passing old
definition instead of new one to virStoragePoolObjSaveDef.
This issue was introduced by bfcd8fc9,

Signed-off-by: Changkuo Shi <shi.changkuo@h3c.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-11 11:22:26 +02:00
Peter Krempa
fac0dacd54 qemu: monitor: Make qemuMonitorAddObject more robust against programming errors
Document and check that @props contains a pointer to a json object and
check that both necessary fields are present. Also mark @props as
NONNULL.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 17:32:58 +02:00
Peter Krempa
62ef8227e2 qemu: hotplug: Do not try to add secret object for TLS if it does not exist
The check whether the object holding secret for decryption of the TLS
environment was wrong and would always attempt to add the object. This
lead to a crash due to recent refactors.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 17:32:58 +02:00
Michal Privoznik
ab435a4be4 qemu: Fetch pr-helper process info on reconnect
If qemu-pr-helper process died while libvirtd was not running no
event is emitted. Therefore, when reconnecting to the monitor we
must check the qemu-pr-helper process status and act accordingly.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-10 14:56:22 +02:00
Michal Privoznik
5f085862e8 qemu_monitor: Introduce qemuMonitorJSONGetPRManagerInfo
This function fetches status of all pr-managers. So far, qemu
reports only a single attribute "connected" but that fits our
needs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-10 14:56:22 +02:00
Michal Privoznik
6fbda83330 qemu: Wire up PR_MANAGER_STATUS_CHANGED event
This event is emitted on the monitor if one of pr-managers lost
connection to its pr-helper process. What libvirt needs to do is
restart the pr-helper process iff it corresponds to managed
pr-manager.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-10 14:56:22 +02:00
Michal Privoznik
0da435118c virStoragePRDefFormat: Suppress path formatting for migratable XML
If there are managed reservations for a disk source, the path to
the pr-helper socket is generated automatically by libvirt when
needed and points somewhere under priv->libDir. Therefore it is
very unlikely that the path will work even on migration
destination (the libDir is derived from domain short name and its
ID).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-10 14:56:22 +02:00
Michal Privoznik
900403a3b2 qemuDomainValidateStorageSource: Relax PR validation
Rather than rejecting the user provided path and alias for the
managed PR reservation we will ignore the provided path. The
reason is that migration XML does contain path even for managed
reservations.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-10 14:56:22 +02:00
Michal Privoznik
dd1d58cabc qemuProcessStartPRDaemonHook: Try to set NS iff domain was started with one
Users have possibility to disable qemu namespace feature (e.g.
because they are running on *BSD which lacks Linux NS support).
If that's the case we should not try to move qemu-pr-helper into
the same namespace as qemu is in.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-10 14:56:22 +02:00
Peter Krempa
bb4f3543bb qemu: command: Format rerror/werror with -device instead of -drive
Use the new proper location for the read/write error policy selection.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:37:51 +02:00
Peter Krempa
a087a8e60a qemu: capabilities: Add capability for werror/rerror for 'usb-device' frontend
Support for specifying it with the -device frontend was added recently.
Add a capability for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:37:51 +02:00
Peter Krempa
3cb1497dfc tests: qemuxml2argv: Add CAPS_LATEST version for the disk error policy test
Add output arguments generated with the latest qemu capabilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:37:51 +02:00
Peter Krempa
98ee8bcf6d tests: qemuxml2argv: Unify all tests for disk error policy
Add multiple drives with the various configurations rather than having
multiple tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:37:51 +02:00
Peter Krempa
1cb98a1fb3 qemu: block: Add support for RBD authentication for blockdev
To allow using -blockdev with RBD we need to support the recently added
RBD authentication.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:37:51 +02:00
Peter Krempa
8b4a31efc0 tests: qemucaps: Add test data for upcoming qemu 3.0.0
Based on qemu commit ab3257c281c1a1a91da1090ac9e38ddd8f860c63

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:37:51 +02:00
Peter Krempa
e1e04a0263 tests: remove qemuqapischema.json
We now take the schema from the qemucapabilitiestest data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:37:50 +02:00
Peter Krempa
92a18bb567 tests: qemu: Use qmp schema data from the qemucapabilities test
Add helpers that allow using the latest schema from the replies from an
actual qemu which are recorded for the purpose of the qemucapabilities
test instead of an unsynced copy stored in qemuqapischema.json.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:37:50 +02:00
Peter Krempa
ad8da38e0a qemu: command: Rename qemuBuildDriveDevStr to qemuBuildDiskDeviceStr
It builds the string for '-device' from a virDomainDiskDef.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:32:54 +02:00
Peter Krempa
192cf8ce00 qemu: command: Refactor floppy controller command formatting
Aggregate the code for the two separate formats used according to the
machine type and add some supporting code so that the function is
actually readable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:32:54 +02:00
Peter Krempa
6236b61443 qemu: command: Don't generate disk drive alias manually for floppies
qemuBulildFloppyCommandLineOptions built its own version of the -drive
alias. Replace it by qemuAliasDiskDriveFromDisk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:32:54 +02:00
Peter Krempa
35582d1125 qemu: command: Split out formatting of disk source commandline
Further split qemuBuildDiskCommandLine to separate formatting of the
source part.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:32:54 +02:00
Peter Krempa
48c643f47c qemu: hotplug: Add warning regarding SD hotplug
SD card hotplug should not be implemented until they can be used via
-blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:32:54 +02:00
Peter Krempa
aa624c3bfb qemu: command: Rename and export qemuDiskBusNeedsDeviceArg
Change the semantics to exactly opposite and rename it to
qemuDiskBusNeedsDriveArg. This will be necessary as some devices can't
be used with -blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:32:54 +02:00
Peter Krempa
d60c17b3d7 tests: Remove disk from 'serial-unix-chardev' test
We are testing character devices so the disk is not necessary. Minimize
the configuration. This will prevent changes when switching to blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:32:53 +02:00
Peter Krempa
d7eeafaa4c qemu: domain: Reject copy_on_read for read-only disks
The sectors read from the backing image need to be written to the top
level image. If a disk is marked read-only the image can't be written.

QEMU handled that by disabling copy_on_read and reporting a warning:

-drive file=/var/lib/libvirt/images/c,format=qcow2,if=none,
    id=drive-scsi0-0-1,readonly=on,copy-on-read=on:
    warning: disabling copy-on-read on read-only drive

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:32:53 +02:00
Peter Krempa
9ac3ea5cf8 qemu: domain: Remove code assuming disk format probing
After commit c95f50cb02 we always set a disk format in the
post parse callback so the code that mandates use of explicit format for
shareable disks no longer makes sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-07-10 13:32:53 +02:00
Erik Skultety
767f9e1449 qemu: validate: Enforce compile time switch type checking for videos
There wasn't an explicit type case to the video type enum in
qemuDomainDeviceDefValidateVideo, _TYPE_GOP was also missing from the
switch.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-07-09 18:59:24 +02:00
Erik Skultety
75aa179ad6 conf: Introduce virDomainDefPostParseVideo helper
Move the video post parse bits into a separate helper as the logic is
going to be extended in the future.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-07-09 18:59:16 +02:00
Erik Skultety
f317b1e5c5 conf: Introduce virDomainVideoDefClear helper
Future patches rely on the ability to reset the contents of the
virDomainVideoDef structure rather than re-allocating it.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-07-09 18:59:02 +02:00
Erik Skultety
3e90bd67a2 qemu: address: Handle all the video devices within a single loop
Since 133fb140 moved the validation of a video device into a separate
function, the code handling PCI slot assignment for video devices has
been the same for both the primary device and the secondary devices.
Let's merge these and thus handle all the devices within the existing
'for' loop.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-07-09 18:59:02 +02:00
Erik Skultety
ff767f083f qemu: command: Fix building of the SDL display command line
QEMU uses a shorthand '-sdl' which maps to '-display sdl'. However, if
there are any options to be passed to SDL, the full command version must
be used. Everything seemingly worked for us until commit 5038b30043
introduced OpenGL support for SDL and added ',gl=on/off' option which as
mentioned above could have never worked with the shorthand version of
the command. Indeed starting a domain with an SDL display and OpenGL
enabled, QEMU produces a rather cryptic error:

-sdl: Could not open 'gl=on': No such file or directory

This patch provides fixes to both the SDL cmdline generation and the
test suite.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-07-09 17:45:19 +02:00
Erik Skultety
8ec7c8ce76 conf: Replace error label with cleanup in virDomainGraphicsDefParseVNCXML
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-07-09 17:45:19 +02:00
Erik Skultety
9f26814afd qemu: command: Add virReportEnumRangeError to BuildHostdevCommandline
Adding the 'default' case to our enum-typecasted switches is the current
safety trend, so add it here for mdevs too.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-07-09 17:45:19 +02:00
Erik Skultety
afc107c20f qemu: command: Move graphics iteration to its own function
It should be the command line helper who takes care of the iteration
rather than the caller.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-07-09 17:45:19 +02:00
Erik Skultety
57e78a9ebb conf: Remove a redundant model/address-type check in mdev post parse
It's pointless to check the same thing multiple times.
Fix the indentation along the way too.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-07-09 17:45:19 +02:00
Han Han
e11515ef8d virsh: sata support for virsh attach-disk --address
Adding sata bus address support to the optional address parameter of virsh
attach-disk. The address is used as controller.bus.unit. e.g.
sata:0.0.0

Signed-off-by: Han Han <hhan@redhat.com>
2018-07-09 17:19:20 +02:00
Han Han
31cd4dd8e7 virsh: usb support for virsh attach-disk --address
Adding usb bus address support to the optional address parameter
of virsh attach-disk. The address is used as bus:port. e.g. usb:1:1.

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-09 17:13:16 +02:00
Boris Fiuczynski
78eb8895eb qemu: Fix typo in qemu_command.c
Rename qemuBulildFloppyCommandLineOptions into
qemuBuildFloppyCommandLineOptions.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2018-07-09 16:36:18 +02:00
Peter Krempa
902f4bce09 qemu: monitor: Use 'target' instead of 'arch' in reply of 'query-cpus-fast'
qemu changed the output field name for the architecture from 'arch' to
'target'. Note the change and fix the code so that the arch-specific
extraction works.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-09 16:18:53 +02:00
Peter Krempa
1e65d35b04 qemu: monitor: Remove qemuMonitorJSONExtractCPUArchInfo wrapper
The wraper is quite pointless and also the 'arch' field may depend on
whether query-cpus-fast is used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-09 16:18:53 +02:00
Michal Privoznik
3087b27cff domain_nwfilter: Return early if net has no name in virDomainConfNWFilterTeardownImpl
This function is called from various clean up paths (e.g.
from qemuBuildInterfaceCommandLine). However, depending on the
stage the interface creation process failed at, net->ifname might
still be not filled in when control jumps to cleanup label. If
that is the case return early (avoiding useless error message
produced in virNWFilterBindingLookupByPortDev) as there is no
NWFilter to tear down anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-07-09 16:01:50 +02:00
Michal Privoznik
87d80b50c6 qemuBuildSCSIiSCSIHostdevDrvStr: Don't leak @netsource and @srcprops
After 6b770f9a3b both @netsource and @srcprops are leaked
because of early return introduced in the commit.

==1812== 644 bytes in 4 blocks are definitely lost in loss record 835 of 885
==1812==    at 0x4C2F12F: realloc (vg_replace_malloc.c:785)
==1812==    by 0x8846393: xmlSaveUriRealloc (in /usr/lib64/libxml2.so.2.9.8)
==1812==    by 0x8846B1C: xmlSaveUri (in /usr/lib64/libxml2.so.2.9.8)
==1812==    by 0x5DDA619: virURIFormat (viruri.c:256)
==1812==    by 0x56E941B: qemuBuildNetworkDriveURI (qemu_command.c:781)
==1812==    by 0x56E979A: qemuBuildNetworkDriveStr (qemu_command.c:859)
==1812==    by 0x56F3A0B: qemuBuildSCSIiSCSIHostdevDrvStr (qemu_command.c:4664)
==1812==    by 0x56F3D1F: qemuBuildSCSIHostdevDrvStr (qemu_command.c:4732)
==1812==    by 0x56F57F7: qemuBuildHostdevCommandLine (qemu_command.c:5337)
==1812==    by 0x570303A: qemuBuildCommandLine (qemu_command.c:10376)
==1812==    by 0x57604EE: qemuProcessCreatePretendCmd (qemu_process.c:6649)
==1812==    by 0x11352A: testCompareXMLToArgv (qemuxml2argvtest.c:566)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-07-09 13:07:30 +02:00
Andrea Bolognani
94d1f273ba AUTHORS: Avoid duplicated entries
Instead of simply dumping the list of authors as obtained
from git, we can be a bit smarter and filter out maintainers
so that their names don't appear twice.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-07-09 10:04:51 +02:00
Andrea Bolognani
fdb389d781 mailmap: Consolidate current and past maintainers
We can't do this in general, but for maintainers we have
the data in AUTHORS.in to use as a source of truth.

This gets rid of several duplicated lines in the generated
AUTHORS file.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-07-09 10:04:49 +02:00