Commit Graph

25053 Commits

Author SHA1 Message Date
Laine Stump
39de732aa7 network: replace virSaveLastError() with virErrorPreserveLast()
virErrorPreserveLast()/virErrorRestore() (added in commit 8333e7455
back in 2017), do a better better job of saving and restoring the last
libvirt error than virSaveLastError()/virErrorRestore() (they're
simpler, and they also save/restore the system errno).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-16 11:58:46 -04:00
Laine Stump
dac697e8d7 network: fix crash during cleanup from failure to allocate port
During networkPortCreateXML, if networkAllocatePort() failed,
networkReleasePort() would be called, which would (in the case of
network pools of macvtap passthrough devices) attempt to find the
allocated device by comparing port->plug.direct.linkdev to each device
in the pool. Since port->plug.direct.linkdev was still NULL, the
attempted strcmp would result in a SEGV.

Calling networkReleasePort() during error cleanup is something that
should only be done if networkAllocatePort() has already succeeded. It
turns out there is one other possible error exit from
networkPortCreateXML() that happens after networkAllocatePort() has
succeeded, so the code to call networkReleasePort() was just moved
down to there.

Resolves: https://bugzilla.redhat.com/1741390

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-16 11:58:30 -04:00
Laine Stump
8d6eaf5e09 access: fix incorrect addition to virAccessPermNetwork
Commit e69444e17 (first appeared in libvirt-5.5.0) added the new value
"VIR_ACCESS_PERM_NETWORK_SEARCH_PORTS" to the virAccessPerNetwork
enum, and also the string "search_ports" to the VIR_ENUM_IMPL() macro
for that enum. Unfortunately, the enum value was added in the middle
of the list, while the string was added to the end of the
VIR_ENUM_IMPL().

This patch corrects that error by moving the new value to the end of
the enum definition, so that the order matches that of the string
list.

Resolves: https://bugzilla.redhat.com/1741428

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-16 11:56:56 -04:00
Peter Krempa
4b58fdf280 qemu: driver: allow remote destinations for block copy
Now that we support blockdev for qemuDomainBlockCopy we can allow
copying to remote destinations as well.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:11 +02:00
Peter Krempa
ce7229a3b0 qemu: Add blockdev support for the block copy job
Implement job handling for the block copy job (drive/blockdev-mirror)
when using -blockdev. In contrast to the previously implemented
blockjobs the block copy job introduces new images to the running qemu
instance, thus requires a bit more handling.

When copying to new images the code now makes use of blockdev-create to
format the images explicitly rather than depending on automagic qemu
behaviour.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:10 +02:00
Peter Krempa
545edb2502 qemu: Introduce code for blockdev-create
QEMU finally exposes an interface which allows us to instruct it to
format or create arbitrary images. This is required for blockdev
integration of block copy and snapshots as we need to pre-format images
prior to use with blockdev-add.

This path introduces job handling and also helpers for formatting and
attaching a whole image described by a virStorageSource.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:10 +02:00
Peter Krempa
7b8db52f5b qemu: blockjob: Copy non-detected chain fully in qemuBlockJobRewriteConfigDiskSource
Rather than copying just the top level image, let's copy the full user
provided backing chain.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:10 +02:00
Peter Krempa
4807051b02 conf: domain: Parse backingStore with VIR_DOMAIN_DEF_PARSE_DISK_SOURCE
The only code path which calls the parser with the
VIR_DOMAIN_DEF_PARSE_DISK_SOURCE is from qemuDomainBlockCopy. Since that
code path can properly handle backing chains for the disk and it's
desired to pass the parsed chains to the block copy code remove the
condition which prevents parsing the <backingStore> element.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:10 +02:00
Peter Krempa
41ac166c6c qemu: domain: Add 'break' after formatting commit job status XML
In commit 3f93884a4d where the job handling of commit jobs with
blockdev was added I've forgot to add a 'break' in the switch fomatting
the status XML. Thankfully this would not be a problem as the cases
where this fell through didn't have any code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:10 +02:00
Peter Krempa
016584c52c qemu: blockjob: Remove qemuBlockJobDiskRegisterMirror
The utility of the function is extremely limited as for block copy
we need to register the mirror chain earlier than when it's set with the
disk. This means that it would be open-coded in that case.

Avoid any weird usage and just open-code the only current usage, remove
the function, and reword the docs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:10 +02:00
Peter Krempa
49ea62e51d qemu: fix broken handling of shallow flag in qemuDomainBlockCopyCommon
Commit 16ca234b56 refactored how the 'shallow' and 'reuse' flags
are accessed but neglected to fix the clearing of 'shallow' in case when
the disk has no backing chain. This means that we'd request a shallow
copy even without backing chain and also a few checks would work wrong.

Fix it by using the extracted variable everywhere.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:10 +02:00
Peter Krempa
32bd092b49 qemu: Fix logic in qemuDomainBlockCopyCommonValidateUserMirrorBackingStore
Allow reusing original backing chain when doing a shallow copy without
reuse of external image. The existing logic didn't allow it but it will
be possible. Also add a note to explain that logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:10 +02:00
Peter Krempa
734352d434 qemu: domain: Allow formatting top source only in qemuDomainObjPrivateXMLFormatBlockjobFormatChain
Rename qemuDomainObjPrivateXMLFormatBlockjobFormatChain to
qemuDomainObjPrivateXMLFormatBlockjobFormatSource and add a 'chain'
parameter which allows controlling whether the backing chain is
formatted.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:26:10 +02:00
Peter Krempa
60b862cf9d qemu: Don't report some ignored errors in qemuDomainGetStatsOneBlockFallback
The function ignores all errors from qemuStorageLimitsRefresh by calling
virResetLastError. This still logs them. Since qemuStorageLimitsRefresh
allows suppressing some, do so.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:17:41 +02:00
Peter Krempa
ea26e22f94 qemu: Allow suppressing errors from qemuStorageLimitsRefresh
qemuStorageLimitsRefresh uses qemuDomainStorageOpenStat internally and
there are callers which don't care about the error. Propagate the
skipInaccessible flag so that we can log less errors.

Callers currently don't care about the return value change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:17:41 +02:00
Peter Krempa
3d7ea4165b qemu: driver: Improve error suppression in qemuDomainStorageUpdatePhysical
None of the callers of qemuDomainStorageUpdatePhysical care about
errors.

Use the new flag for qemuDomainStorageOpenStat which suppresses some
errors and move the reset of the rest of the uncommon errors into this
function. Document what is happening in a comment for the function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:17:41 +02:00
Peter Krempa
b074363136 util: storagefile: Don't report errors from virStorageSourceUpdatePhysicalSize
virStorageSourceUpdatePhysicalSize is called only from
qemuDomainStorageUpdatePhysical and all callers of it reset the libvirt
error if -1 is returned.

Don't bother setting the error in the first place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:17:41 +02:00
Peter Krempa
ba6c12df2c qemu: Allow skipping some errors in qemuDomainStorageOpenStat
Some callers of this function actually don't care about errors and reset
it. The message is still logged which might irritate users in this case.

Add a boolean flag which will do few checks whether it actually makes
sense to even try opening the storage file. For local files we check
whether it exists and for remote files we at first see whether we even
have a storage driver backend for it in the first place before trying to
open it.

Other problems will still report errors but these are the most common
scenarios which can happen here.

This patch changes the return value of the function so that the caller
is able to differentiate the possibilities.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:17:40 +02:00
Peter Krempa
68639829c6 util: Export virStorageFileSupportsBackingChainTraversal
The function will be reused in the qemu snapshot code. The argument is
turned into const similarly to the other virStorageFileSupports*
functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-16 13:17:40 +02:00
Peter Krempa
96f0a17ead util: storage: Fix parsing of 'exportname' from legacy NBD strings
If the nbd export name contains a colon, our parser would not parse it
properly as we split the string by colons. Modify the code to look up
the exportname and copy any trailing characters as the export name is
supposed to be at the end of the string.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2019-08-16 13:16:40 +02:00
hexin
e9c6158838 virpci:fix Secondary Bus Reset bug
The parent bridge configuration of the current device
should be read and reset, instead of reading the current
device configuration.

Signed-off-by: He Xin <hexin15@baidu.com>
Signed-off-by: Liu Qi <liuqi16@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-16 10:47:26 +02:00
Michal Privoznik
3b7c5ab983 remote_daemon_dispatch.c: typecast ARRAY_CARDINALITY() in remoteDispatchProbeURI()
Since users can enable/disable drivers at compile time, it may
happen that @drivers array is in fact empty (in both its
occurrences within the function). This means that
ARRAY_CARDINALITY() returns 0UL which makes gcc unhappy because
of loop condition:

  i < ARRAY_CARDINALITY(drivers)

GCC complains that @i is unsigned and comparing an unsigned value
against 0 is always false. However, changing the type of @i to
ssize_t is not enough, because compiler still sees the unsigned
zero. The solution is to typecast the ARRAY_CARDINALITY().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2019-08-16 08:56:02 +02:00
Andrea Bolognani
49520e9e7d test_driver: Fix permissions for test_driver.c
Introduced in commit 4a6ee53581.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
(cherry picked from commit df1b5cf02e)

Reintroduced-by: fb275b7673
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-08-15 21:32:46 +02:00
Peter Krempa
e776194ad2 util: storage: Allow checking whether virStorageFileCreate is supported
Add virStorageFileSupportsCreate which allows silent check whether
virStorageFileCreate is implemented.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-14 18:25:08 +02:00
Peter Krempa
d30e0d3abc util: storage: Refactor logic for using virStorageFileGetBackendForSupportCheck
Modify the return value so that callers don't have to repeat logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-08-14 18:25:08 +02:00
Ilias Stamatis
77521d27da test_driver: implement virDomainSetLifecycleAction
Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-08-14 18:10:09 +02:00
Ilias Stamatis
423ca282f4 test_driver: Introduce testDomainActionSetState helper
This helper extracts common lifecycle action code from both
testDomainShutdownFlags and testDomainReboot.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-08-14 18:10:09 +02:00
Ján Tomko
e95f9459d3 util: default to read-only in virPCIDeviceConfigOpen
All the callers left require virPCIDeviceConfigOpen to be fatal
and only use read-only access to the config file.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-14 16:28:34 +02:00
Ján Tomko
17317a4bc6 util: introduce virPCIDeviceConfigOpenTry
For callers that only need read-only access and don't want
an error reported.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-14 16:28:34 +02:00
Ján Tomko
801ebb5edb util: introduce readonly attribute to virPCIDeviceConfigOpenInternal
Allow wrappers to open PCI config as read-only.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-14 16:28:34 +02:00
Ján Tomko
fabb743050 util: Introduce virPCIDeviceConfigOpenWrite
Only a handful of function need write access to the PCI config
space. Create a wrapper function for those so that we can
open it read only by default.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-14 16:28:34 +02:00
Ján Tomko
fc16c69987 util: introduce virPCIDeviceConfigOpenInternal
A thin wrapper to allow creating new functions.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-14 16:28:33 +02:00
Ján Tomko
257f96eb1e rpc: make virNetDaemonCallInhibit a no-op with no logind
As a side effect, this also silences the possible:
  internal error: Unable to get DBus system bus connection:
  Failed to connect to socket /run/dbus/system_bus_socket:
  No such file or directory
error, since we check upfront whether dbus is available.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-14 16:22:13 +02:00
Ján Tomko
dd16434a2a util: cache the result of whether logind is available
Similar to how we cache the availability of machined.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-14 16:22:13 +02:00
Ján Tomko
81177ff4de util: introduce virSystemdHasLogind
Split it out from virSystemdPMSupportTarget.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-14 16:22:12 +02:00
Ján Tomko
ff9aa7a862 util: be quiet when pm-is-supported is unavailable
Look up the binary name upfront to avoid the error:
Cannot find 'pm-is-supported' in path: No such file or directory

In that case, we just assume nodesuspend is not available.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-08-14 11:27:38 +02:00
Ján Tomko
ab895d5dc3 util: do not repeat the pm-is-supported string
Use a 'binary' variable to hold it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-08-14 11:27:38 +02:00
Ján Tomko
7f5b43b09e util: use VIR_AUTOPTR virNodeSuspendSupportsTargetPMUtils
Get rid of the ret variable as well as the cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-08-14 11:27:38 +02:00
Jiri Denemark
4514abbd41 qemu: Allow migration with disk cache on
When QEMU supports flushing caches at the end of migration, we can
safely allow migration even if disk/driver/@cache is not none nor
directsync.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Acked-By: Peter Krempa <pkrempa@redhat.com>
2019-08-14 09:36:43 +02:00
Jiri Denemark
598ec0db68 qemu: Check for drop-cache capability
QEMU 4.0.0 and newer automatically drops caches at the end of migration.
Let's check for this capability so that we can allow migration when disk
cache is turned on.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Acked-By: Peter Krempa <pkrempa@redhat.com>
2019-08-14 09:36:43 +02:00
Jiri Denemark
4748f8df29 qemu: Clarify error message in qemuMigrationSrcIsSafe
The original message was logically incorrect: cache != none or cache !=
directsync is always true. But even replacing "or" with "and" doesn't
make it more readable for humans.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Acked-By: Peter Krempa <pkrempa@redhat.com>
2019-08-14 09:36:43 +02:00
Jiri Denemark
69b1ecde25 qemu: Fix crash on incoming migration
In the first stage of incoming migration (qemuMigrationDstPrepareAny) we
call qemuMigrationEatCookie when there's no vm object created yet and
thus we don't have any private data to pass.

Broken by me in commit v5.6.0-109-gbf15b145ec.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-08-14 09:28:22 +02:00
Jiri Denemark
8a62a1592a Revert "configure: Remove --enable-test-coverage"
This reverts commit f38d553e2d.

Gnulib's make coverage (or init-coverage, build-coverage, gen-coverage)
is not a 1-1 replacement for the original configure option. Our old
--enable-test-coverage seems to be close to gnulib's make build-coverage
except gnulib runs lcov in that phase and the build actually fails for
me even before lcov is run. And since we want to be able to just build
libvirt without running lcov, I suggest reverting to our own
implementation.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Acked-By: Eric Blake <eblake@redhat.com>
2019-08-14 09:28:06 +02:00
Laine Stump
a60ee91400 util: allow tap-based guest interfaces to have MAC address prefix 0xFE
Back in July 2010, commit 6ea90b84 (meant to resolve
https://bugzilla.redhat.com/571991 ) added code to set the MAC address
of any tap device to the associated guest interface's MAC, but with
the first byte replaced with 0xFE. This was done in order to assure
that

1) the tap MAC and guest interface MAC were different (otherwise L2
   forwarding through the tap would not work, and the kernel would
   repeatedly issue a warning stating as much).

2) any bridge device that had one of these taps attached would *not*
   take on the MAC of the tap (leading to network instability as
   guests started and stopped)

A couple years later, https://bugzilla.redhat.com/798467 was filed,
complaining that a user could configure a tap-based guest interface to
have a MAC address that itself had a first byte of 0xFE, silently
(other than the kernel warning messages) resulting in a non-working
configuration. This was fixed by commit 5d571045, which logged an
error and failed the guest start / interface attach if the MAC's first
byte was 0xFE.

Although this restriction only reduces the potential pool of MAC
addresses from 2^46 (last two bits of byte 1 must be set to 10) by
2^32 (still 4 orders of magnitude larger than the entire IPv4 address
space), it also means that management software that autogenerates MAC
addresses must have special code to avoid an 0xFE prefix. Now after 7
years, someone has noticed this restriction and requested that we
remove it.

So instead of failing when 0xFE is found as the first byte, this patch
removes the restriction by just replacing the first byte in the tap
device MAC with 0xFA if the first byte in the guest interface is
0xFE. 0xFA is the next-highest value that still has 10 as the lowest
two bits, and still

2) meets the requirement of "tap MAC must be different from guest
   interface MAC", and

3) is high enough that there should never be an issue of the attached
   bridge device taking on the MAC of the tap.

The result is that *any* MAC can be chosen by management software
(although it would still not work correctly if a multicast MAC (lowest
bit of first byte set to 1) was chosen), but that's a different
issue).

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com
2019-08-12 14:22:05 -04:00
Wim ten Have
cb12c59dac qemu: support for kvm-hint-dedicated performance hint
QEMU version 2.12.1 introduced a performance feature under commit
be7773268d98 ("target-i386: add KVM_HINTS_DEDICATED performance hint")

This patch adds a new KVM feature 'hint-dedicated' to set this performance
hint for KVM guests. The feature is off by default.

To enable this hint and have libvirt add "-cpu host,kvm-hint-dedicated=on"
to the QEMU command line, the following XML code needs to be added to the
guest's domain description in conjunction with CPU mode='host-passthrough'.

  <features>
    <kvm>
      <hint-dedicated state='on'/>
    </kvm>
  </features>
  ...
  <cpu mode='host-passthrough ... />

Signed-off-by: Wim ten Have <wim.ten.have@oracle.com>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-12 15:13:04 +02:00
Ilias Stamatis
8daefcf60e test_driver: implement virDomainSetBlockIoTune
Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-08-12 11:46:08 +02:00
Ilias Stamatis
824260cb5e test_driver: implement testDomainGetBlockIoTune
Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-08-12 11:42:12 +02:00
Daniel P. Berrangé
e4c05240bf build: bump min libxml2 to 2.9.1
The various distros have the following libxml2 vesions:

        CentOS 7: 2.9.1
  Debian Stretch: 2.9.4
   FreeBSD Ports: 2.9.9
Ubuntu 16.04 LTS: 2.9.3

Based on this sampling, we can reasonably bump libxml2 min
version to 2.9.1

The 'query_raw' struct field was added in version 2.6.28,
so can be assumed to exist.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-08-09 17:21:42 +01:00
Maxiwell S. Garcia
38d2e03368 qemu: check if numa cell's cpu range match with cpu topology count
QEMU shows a warning message if partial NUMA mapping is set. This patch
adds a warning message in libvirt when editing the XML. It must be an
error in future, when QEMU remove this ability.

Signed-off-by: Maxiwell S. Garcia <maxiwell@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-08-09 15:43:09 +02:00
Daniel P. Berrangé
b18c273a24 remote: enable connecting to the per-driver daemons
Historically URIs handled by the remote driver will always connect to
the libvirtd UNIX socket. There will now be one daemon per driver, and
each of these has its own UNIX sockets to connect to.

It will still be possible to run the traditional monolithic libvirtd
though, which will have the original UNIX socket path.

In addition there is a virproxyd daemon that doesn't run any drivers,
but provides proxying for clients accessing libvirt over IP sockets, or
tunnelling to the legacy libvirtd UNIX socket path.

Finally when running inside a daemon, the remote driver must not reject
connections unconditionally. For example, the QEMU driver needs to be
able to connect to the network driver. The remote driver must thus be
willing to handle connections even when inside the daemon, provided no
local driver is registered.

This refactoring enables the remote driver to be able to connect to the
per-driver daemons. The URI parameter "mode" accepts the values "auto",
"direct" and "legacy" to control which daemons are connected to.

The client side libvirt.conf config file also supports a "remote_mode"
setting which is used if the URI parameter is not set.

If neither the config file or URI parameter set a mode, then "auto"
is used, whereby the client looks to see which sockets actually exist
right now.

The remote driver will only ever spawn the per-driver daemons, or
the legacy libvirtd. It won't ever try to spawn virtproxyd, as
that is only there for IP based connectivity, or for access from
legacy remote clients.

If connecting to a remote host over any kind of ssh tunnel, for now we
must assume only the legacy socket exists. A future patch will introduce
a netcat replacement that is tailored for libvirt to make remote
tunnelling easier.

The configure arg '--with-remote-default-mode=legacy|direct' allows
packagers to set a default at build time. If not given, it will default
to legacy mode.

Eventually the default will switch to direct mode. Distros can choose
to do the switch earlier if desired. The main blocker is testing and
suitable SELinux/AppArmor policies.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-08-09 14:06:31 +01:00