]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
6 years agoqemu: Refactor variables for extracting flags in qemuDomainBlockCopyCommon
Peter Krempa [Tue, 21 May 2019 11:51:27 +0000 (13:51 +0200)] 
qemu: Refactor variables for extracting flags in qemuDomainBlockCopyCommon

Add separate booleans for extracting VIR_DOMAIN_BLOCK_COPY_REUSE_EXT and
VIR_DOMAIN_BLOCK_COPY_SHALLOW from '@flags' and also change 'reuse' into
'existing'.

qemuMonitorDriveMirror requires the unmodified state of the flags to
pass to qemu and also we use the value a few times internally. Extract
it separately now.

The 'reuse' flag did not indicate reusing of the file as much as the
fact that the storage is existing and thus should not be created, so
modify the name to reflect this.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Don't emit traditional disk events for jobs without disk
Peter Krempa [Tue, 23 Apr 2019 08:47:01 +0000 (10:47 +0200)] 
qemu: blockjob: Don't emit traditional disk events for jobs without disk

With -blockdev it will be possible that a block job loses the disk that
was used to start it to a guest-initiated hot-unplug. Don't emit the
block job events in that case as we can't report the top level source or
disk target for an unplugged (and potentially replugged with different
source) disk.

Eventually when we add machinery for tracking jobs globally for a VM the
event will be reinstated via the domain job event.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Don't reset state when entering sync blockjob
Peter Krempa [Mon, 27 May 2019 13:20:21 +0000 (15:20 +0200)] 
qemu: blockjob: Don't reset state when entering sync blockjob

job->newstate is now used internally all the time so there's no need to
clear it as it already has correct value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: add 'bochs' video display type
Jonathon Jongsma [Fri, 12 Jul 2019 20:12:16 +0000 (15:12 -0500)] 
qemu: add 'bochs' video display type

Update schema and configuration to allow specifying new video type of
'bochs'. Add implementation and tests for qemu.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Add bochs-display capability
Jonathon Jongsma [Fri, 12 Jul 2019 20:12:15 +0000 (15:12 -0500)] 
qemu: Add bochs-display capability

Check whether qemu supports the bochs-display device and set a
capability. Update tests.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agostorage: Add iscsi-direct pool list type flag
Han Han [Thu, 11 Jul 2019 07:23:05 +0000 (15:23 +0800)] 
storage: Add iscsi-direct pool list type flag

Add pool list type flag VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT,
which was forgotten when introducing iscsi-direct pool at f0bf1be3.

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

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agovirsh.pod: Add zfs and vstorage pool types
Han Han [Thu, 11 Jul 2019 07:23:07 +0000 (15:23 +0800)] 
virsh.pod: Add zfs and vstorage pool types

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agostorage: Add missing pool type flags in comment
Han Han [Thu, 11 Jul 2019 07:23:06 +0000 (15:23 +0800)] 
storage: Add missing pool type flags in comment

Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agomaint: RNG comment fix
Eric Blake [Fri, 12 Jul 2019 21:25:00 +0000 (16:25 -0500)] 
maint: RNG comment fix

Typo'd at file creation in commit 0c97dc41.

Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agosnapshot: Factor out redefine cycle validation
Eric Blake [Sat, 6 Jul 2019 02:07:43 +0000 (21:07 -0500)] 
snapshot: Factor out redefine cycle validation

The code to check whether a redefined snapshot/checkpoint XML is
attempting to create a cycle in the list of moments is lengthy, and
common between the two types of list. Therefore, it belongs in the
shared base file.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: skip systemd activation test if FDs 3/4/5 are open
Daniel P. Berrangé [Fri, 12 Jul 2019 16:55:13 +0000 (17:55 +0100)] 
tests: skip systemd activation test if FDs 3/4/5 are open

With systemd activation the passed in file descriptors are required to
be numbered from STDERR_FILENO + 1 onwards. The unit tests thus require
FDs 3, 4 and 5 to be available.

This may not be the case in all environments in which the tests run. For
example on RHEL7 it was seen that a library constructor (gcrypt probably)
opens /dev/urandom and leaves the file handle open. This means FD 3 is
not available and the activation tests fail.

The best way to deal with this would be to create a standalone helper
program for the tests, but that's much more work than just skipping the
tests if we notice we have the problem.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: remove unused typedef for auto shutdown function callback
Daniel P. Berrangé [Mon, 1 Jul 2019 14:16:48 +0000 (15:16 +0100)] 
rpc: remove unused typedef for auto shutdown function callback

The use of the virNetServerAutoShutdownFunc typedef was removed in

  commit 79b8a56995e6d9ce47e0b44512f7be440df9ff7d
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed Oct 31 19:03:55 2012 +0000

    Replace polling for active VMs with signalling by drivers

This unused typedef was then copied into the virNetDaemon object
when that was split off from virNetServer, resulting in a typedef
virNetDaemonAutoShutdownFunc that has never been needed.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: remove unused helper for getting UNIX socket path
Daniel P. Berrangé [Tue, 25 Jun 2019 17:36:36 +0000 (18:36 +0100)] 
util: remove unused helper for getting UNIX socket path

The new systemd activation APIs mean there is no longer a need to get
the UNIX socket path associated with a plain FD.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: move code for getting listen FDs into systemd module
Daniel P. Berrangé [Tue, 25 Jun 2019 17:35:11 +0000 (18:35 +0100)] 
util: move code for getting listen FDs into systemd module

The virGetListenFDs method no longer needs to be called directly, so it
can be a static function internal to the systemd code.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agologging: convert log daemon to use systemd activation APIs
Daniel P. Berrangé [Tue, 25 Jun 2019 17:29:43 +0000 (18:29 +0100)] 
logging: convert log daemon to use systemd activation APIs

Using the new system activation APIs allows for simpler code setting up
the network services.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agolocking: convert lock daemon to use systemd activation APIs
Daniel P. Berrangé [Tue, 25 Jun 2019 17:29:43 +0000 (18:29 +0100)] 
locking: convert lock daemon to use systemd activation APIs

Using the new system activation APIs allows for simpler code setting up
the network services.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: remove code spawning with systemd activation env vars
Daniel P. Berrangé [Tue, 25 Jun 2019 17:09:31 +0000 (18:09 +0100)] 
util: remove code spawning with systemd activation env vars

The only use of this code was removed by:

  commit be78814ae07f092d9c4e71fd82dd1947aba2f029
  Author: Michal Privoznik <mprivozn@redhat.com>
  Date:   Thu Apr 2 14:41:17 2015 +0200

    virNetSocketNewConnectUNIX: Use flocks when spawning a daemon

less than a year after it was first introduced in

  commit 1b807f92dbb617db5b9d551777d3026d8ff0903f
  Author: Martin Kletzander <mkletzan@redhat.com>
  Date:   Wed Jul 16 08:00:19 2014 +0200

    rpc: pass listen FD to the daemon being started

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoremote: update config files to note usage wrt systemd socket activation
Daniel P. Berrangé [Mon, 24 Jun 2019 11:00:37 +0000 (12:00 +0100)] 
remote: update config files to note usage wrt systemd socket activation

Certain libvirtd.conf settings are not honoured when using systemd
socket activation.

Certain systemd unit file settings must match those defined in
libvirtd.conf for systemd socket activation to work with systemd
version < 227, otherwise libvirtd cannot determine which inherited
FD to use for which service.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoremote: make system libvirtd exit when idle via timeout
Daniel P. Berrangé [Tue, 30 Apr 2019 15:44:15 +0000 (16:44 +0100)] 
remote: make system libvirtd exit when idle via timeout

Since we have socket activation available now, we can let the system
libvirtd exit when it is idle. This allows it to still do autostart
when the host boots up, but when nothing was started it will quickly
exit again until some mgmt app connects to the socket.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoremote: add systemd socket units for UNIX/TCP sockets
Daniel P. Berrangé [Tue, 30 Apr 2019 15:41:10 +0000 (16:41 +0100)] 
remote: add systemd socket units for UNIX/TCP sockets

We don't do socket activation of libvirtd, since we need to
unconditionally start libvirtd in order to perform autostart. This
doesn't mean we can't have systemd socket units. Some use cases will
not need libvirt's autostart & are thus free to use activation.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: remove unused API for creating services from FDs
Daniel P. Berrangé [Mon, 24 Jun 2019 10:52:40 +0000 (11:52 +0100)] 
rpc: remove unused API for creating services from FDs

The virNetServerServiceNewFDOrUNIX method cannot be correctly used when
dealing with systemd activation of a service which can receive more than
one socket FD as there is not guaranteed ordering of FDs.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoremote: fix handling of systemd activation wrt socket ordering
Daniel P. Berrangé [Tue, 25 Jun 2019 16:27:04 +0000 (17:27 +0100)] 
remote: fix handling of systemd activation wrt socket ordering

The current libvirtd code for systemd socket activation assumes socket
FDs are passed in the order unix-rw, unix-ro, unix-admin.  There is in
fact no ordering guarantee made by systemd. Applications are expected
to check the address or name associated with each FD to figure out its
identity.

This rewrites libvirtd to make use of the new systemd activation APIs
to make it robust wrt socket ordering changes.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoremote: simplify libvirtd code for deciding if SASL auth is needed
Daniel P. Berrangé [Tue, 25 Jun 2019 16:32:29 +0000 (17:32 +0100)] 
remote: simplify libvirtd code for deciding if SASL auth is needed

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: add API for checking whether an auth scheme is in use on a server
Daniel P. Berrangé [Tue, 25 Jun 2019 16:04:47 +0000 (17:04 +0100)] 
rpc: add API for checking whether an auth scheme is in use on a server

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: add helper APIs for adding services with systemd activation
Daniel P. Berrangé [Tue, 25 Jun 2019 15:33:36 +0000 (16:33 +0100)] 
rpc: add helper APIs for adding services with systemd activation

Currently code has to first create the service and then separately
register it with the server. If the socket associated with a particular
service is not passed from systemd we want to skip creating the service
altogether. This means we can't put the systemd activation logic into
the constructors for virNetServerService.

This patch thus creates some helper methods against virNetServer which
combine systemd activation, service creation and service registration
into one single operation. This operation is automatically a no-op if
systemd activation is present and no sockets were passed in.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: avoid unlinking sockets passed in from systemd
Daniel P. Berrangé [Tue, 25 Jun 2019 19:17:27 +0000 (20:17 +0100)] 
rpc: avoid unlinking sockets passed in from systemd

Currently the socket code will unlink any UNIX socket path which is
associated with a server socket. This is not fine grained enough, as we
need to avoid unlinking server sockets we were passed by systemd.

To deal with this we must explicitly track whether each socket needs to
be unlinked when closed, separately of the client vs server state.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: allow creating RPC service from an array of FDs
Daniel P. Berrangé [Tue, 25 Jun 2019 14:54:48 +0000 (15:54 +0100)] 
rpc: allow creating RPC service from an array of FDs

The virNetServerServiceNewFD API only accepts a single FD, but it is
easily changed to allow for an array of FDs to be passed in.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: refactor RPC service constructors to share more code
Daniel P. Berrangé [Mon, 24 Jun 2019 10:48:38 +0000 (11:48 +0100)] 
rpc: refactor RPC service constructors to share more code

Introduce a virNetServerServiceNewSocket API that allows the various
constructors to share more code.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: add APIs for facilitating use of systemd activation FDs
Daniel P. Berrangé [Tue, 25 Jun 2019 12:03:56 +0000 (13:03 +0100)] 
util: add APIs for facilitating use of systemd activation FDs

When receiving multiple FDs from systemd during service activation it is
neccessary to identify which purpose each FD is used for. While this
could be inferred by looking for the specific IP ports or UNIX socket
paths, this requires the systemd config to always match what is expected
by the code. Using systemd FD names we can remove this restriction and
simply identify FDs based on an arbitrary name.

The FD names are passed by systemd in the LISTEN_FDNAMES env variable
which is populated with the socket unit file names, unless overriden
by using the FileDescriptorName setting.

This is supported since the system 227 release and unfortunately RHEL7
lacks this version. Thus the code has some back compat support whereby
we look at the TCP ports or the UNIX socket paths to identify what
socket maps to which name. This back compat code is written such that
is it easly deleted when we are able to mandate newer systemd.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: ensure all sockets bind to same port when service is NULL
Daniel P. Berrangé [Wed, 26 Jun 2019 11:22:29 +0000 (12:22 +0100)] 
rpc: ensure all sockets bind to same port when service is NULL

When the service passed to getaddrinfo is NULL the kernel will choose a
free port to bind to. In a dual stack though we will get separate
sockets for IPv4 and IPv6 and we need them to bind to the same port
number. Thus once the kerel has auto-selected a port for the first
socket, we must disable auto-select for subsequent IP sockets and force
reuse of the first port.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agostorage: rbd: do not attempt to dereference a non-pointer
Ján Tomko [Fri, 12 Jul 2019 15:47:11 +0000 (17:47 +0200)] 
storage: rbd: do not attempt to dereference a non-pointer

My commit 9b7c4048fa0559fd81d57b7f7d13b1dccd6a99b2 was too blind
and my librbd was not new enough to actually compile this part.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agodocs: RBD pool only supports raw volumes
Ján Tomko [Fri, 12 Jul 2019 14:23:54 +0000 (16:23 +0200)] 
docs: RBD pool only supports raw volumes

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoRevert "conf: Remove volOptions for VIR_STORAGE_POOL_RBD"
Ján Tomko [Fri, 12 Jul 2019 14:13:17 +0000 (16:13 +0200)] 
Revert "conf: Remove volOptions for VIR_STORAGE_POOL_RBD"

This reverts commit 035db37394ad11a39d47f8bd2b6a8a2734283cbf

Even though we only allow using RBD with raw volumes,
removing the options and the default format causes our
parser not to fill out the volume format and the backend code
rejects creating a non-raw volume.

Re-introduce the volume options to fix volume creation while
erroring out on requests to use non-raw formats.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agostorage: rbd: actually index the array when iterating over it
Ján Tomko [Fri, 12 Jul 2019 14:11:16 +0000 (16:11 +0200)] 
storage: rbd: actually index the array when iterating over it

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

Fixes: 3aa190f2a43a632b542a6ba751a6c3ab4d51f1dd
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agostorage: rbd: use VIR_REALLOC in the loop
Ján Tomko [Fri, 12 Jul 2019 14:09:32 +0000 (16:09 +0200)] 
storage: rbd: use VIR_REALLOC in the loop

If there are more than 16 images, the memory allocated in images
might be leaked on subsequent execution(s).

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: minor refactor of video device string handling
Jonathon Jongsma [Thu, 11 Jul 2019 21:05:32 +0000 (16:05 -0500)] 
qemu: minor refactor of video device string handling

In preparation for adding the bochs display device, refactor the logic
so that each branch handles a single device type and checks its
parameters within that branch. In this case VGA and VMVGA are still
grouped into the same branch since they share device-specific parameter
names.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agovirnetworkobj: Drop needless cleanup label in virNetworkObjDeletePort
Michal Privoznik [Tue, 9 Jul 2019 14:57:44 +0000 (16:57 +0200)] 
virnetworkobj: Drop needless cleanup label in virNetworkObjDeletePort

The cleanup label in virNetworkObjDeletePort() function serves no
purpose. Drop it and thus simplify the function a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agovirnetworkobj: Drop needless cleanup label in virNetworkObjAddPort
Michal Privoznik [Tue, 9 Jul 2019 14:51:43 +0000 (16:51 +0200)] 
virnetworkobj: Drop needless cleanup label in virNetworkObjAddPort

The cleanup label in virNetworkObjAddPort() function serves no
purpose. Drop it and thus simplify the function a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agovirnetworkobj: Free retval of virNetworkObjGetPortStatusDir()
Michal Privoznik [Tue, 9 Jul 2019 14:46:31 +0000 (16:46 +0200)] 
virnetworkobj: Free retval of virNetworkObjGetPortStatusDir()

The virNetworkObjGetPortStatusDir() function allocates a memory
to construct a path. None of the callers free it leading to a
memleak.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agologging: ensure virtlogd rollover takes priority over logrotate
Daniel P. Berrangé [Fri, 5 Jul 2019 09:32:53 +0000 (10:32 +0100)] 
logging: ensure virtlogd rollover takes priority over logrotate

The virtlogd config is set to rollover logs every 2 MB.

Normally a logrotate config file is also installed to handle cases where
virtlogd is disabled. This is set to rollover weekly with no size
constraint.

As a result logrotate can interfere with virtlogd's, rolling over files
that virtlogd has already taken care of.

This changes logrotate configs to rollover based on a max size
constraint of 2 MB + 1 byte. When virtlogd is running the log files will
never get this large, making logrotate a no-op.

If the user changes the size in virtlogd's config to something larger,
they are responsible for also changing the logrotate config suitably.

The LXC/libxl drivers don't use virtlogd, but there logrotate config is
altered to match the QEMU driver config, for the sake of consistency.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: always pass "-T -e none" args to ssh
Daniel P. Berrangé [Tue, 9 Jul 2019 17:02:38 +0000 (18:02 +0100)] 
rpc: always pass "-T -e none" args to ssh

Way back in the past, the "no_tty=1" option was added for the remote
driver to disable local password prompting by disabling use of the local
tty:

  commit b32f42984994a397441a1c48f1a002e906624c51
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Fri Sep 21 20:17:09 2007 +0000

    Added a no_tty param to remote URIs to stop SSH prompting for password

This was done by adding "-T -o BatchMode=yes -e none" args to ssh. This
achieved the desired results but is none the less semantically flawed
because it is mixing up config parameters for the local tty vs the
remote tty.

The "-T" arg stops allocation of a TTY on the remote host. This is good
for all libvirt SSH tunnels as we never require a TTY for our usage
model, so we should have just passed this unconditionally.

The "-e none" option disables the escape character for sessions with a
TTY. If we pass "-T" this is not required, but it also not harmful to
add it, so we should just pass it unconditionally too.

Only the "-o BatchMode=yes" option is related to disabling local
password prompts and thus needs control via the no_tty URI param.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: stop formatting json='1' in status XML
Ján Tomko [Fri, 14 Jun 2019 19:14:48 +0000 (21:14 +0200)] 
qemu: stop formatting json='1' in status XML

For quite some time now it is impossible to connect to a domain
using a HMP monitor, so there is no point in formatting it in the status
XML.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agonodedev: add missing include for virFileMakePathWithMode
Daniel P. Berrangé [Thu, 11 Jul 2019 13:19:03 +0000 (14:19 +0100)] 
nodedev: add missing include for virFileMakePathWithMode

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: add API for resolving socket service names
Daniel P. Berrangé [Mon, 24 Jun 2019 10:26:28 +0000 (11:26 +0100)] 
util: add API for resolving socket service names

The getservent() APIs are not re-entrant safe so cannot be used in any
threaded program. Add a wrapper around getaddrinfo() for resolving the
service names to a port number.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agorpc: add helper API for getting UNIX path from socket object
Daniel P. Berrangé [Mon, 24 Jun 2019 10:48:12 +0000 (11:48 +0100)] 
rpc: add helper API for getting UNIX path from socket object

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: add helper API for getting UNIX path from socket address
Daniel P. Berrangé [Mon, 24 Jun 2019 10:25:48 +0000 (11:25 +0100)] 
util: add helper API for getting UNIX path from socket address

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agolocking,logging: put a strong dep from admin socket to main socket
Daniel P. Berrangé [Wed, 26 Jun 2019 16:17:51 +0000 (17:17 +0100)] 
locking,logging: put a strong dep from admin socket to main socket

It doesn't make sense to have the admin socket active if the main
socket is not running, so bind their lifecycle together.

This ensures that if primary socket is stopped, the corresponding
admin socket is also stopped.

In the reverse, starting the admin socket will also automatically
start the primary socket.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agogitlab: Perform some builds on Debian 10
Andrea Bolognani [Thu, 11 Jul 2019 10:34:50 +0000 (12:34 +0200)] 
gitlab: Perform some builds on Debian 10

The split is mostly arbitrary, but we purposefully moved
the mips64el builds off sid since currently that container
is failing to build and is thus unavailable.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoci: Update image list
Andrea Bolognani [Thu, 11 Jul 2019 10:32:07 +0000 (12:32 +0200)] 
ci: Update image list

We really need to change this so that it fetches the image
list dynamically from Quay, but for the time being at least
make sure the static list is accurate.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoci: Use default image tag "latest"
Andrea Bolognani [Thu, 11 Jul 2019 10:30:04 +0000 (12:30 +0200)] 
ci: Use default image tag "latest"

Up until now, our images have been tagged as "master" instead
of the default "latest" due to the way the build process
worked, but we're using the default now.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agobhyve: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
bhyve: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/bhyve/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/bhyve/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovz: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
vz: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/vz/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/vz/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agolxc: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
lxc: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/lxc/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/lxc/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agolibxl: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
libxl: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/libxl/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/libxl/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agolibxl: remove obsolete check for xend during driver startup
Daniel P. Berrangé [Wed, 10 Jul 2019 10:43:04 +0000 (11:43 +0100)] 
libxl: remove obsolete check for xend during driver startup

No supported build targets for libvirt still ship xend, so there is no
need for the libxl driver to check for it anymore.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonwfilter: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
nwfilter: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/nwfilter/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/nwfilter/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agointerface: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
interface: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/interface/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/interface/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonodedev: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
nodedev: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/nodedev/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/nodedev/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agostorage: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
storage: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/storage/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/storage/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonetwork: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
network: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/network/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/network/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agosecrets: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
secrets: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/secrets/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/secrets/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: acquire a pidfile in the driver root directory
Daniel P. Berrangé [Thu, 23 May 2019 10:34:08 +0000 (11:34 +0100)] 
qemu: acquire a pidfile in the driver root directory

When we allow multiple instances of the driver for the same user
account, using a separate root directory, we need to ensure mutual
exclusion. Use a pidfile to guarantee this.

In privileged libvirtd this ends up locking

   /var/run/libvirt/qemu/driver.pid

In unprivileged libvirtd this ends up locking

  /run/user/$UID/libvirt/qemu/run/driver.pid

NB, the latter can vary depending on $XDG_RUNTIME_DIR

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agosnapshot: Add VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE flag
Eric Blake [Sat, 6 Jul 2019 03:05:37 +0000 (22:05 -0500)] 
snapshot: Add VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE flag

We've been doing a terrible job of performing XML validation in our
various API that parse XML with a corresponding schema (we started
with domains back in commit dd69a14f, v1.2.12, but didn't catch all
domain-related APIs, didn't document the use of the flag, and didn't
cover other XML). New APIs (like checkpoints) should do the validation
unconditionally, but it doesn't hurt to continue retrofitting existing
APIs to at least allow the option.

While there are many APIs that could be improved, this patch focuses
on wiring up a new snapshot XML creation flag through all the
hypervisors that support snapshots, as well as exposing it in 'virsh
snapshot-create'.  For 'virsh snapshot-create-as', we blindly set the
flag without a command-line option, since the XML we create from the
command line should generally always comply (note that validation
might cause failures where it used to succeed, such as if we tighten
the RNG to reject a name of '../\n'); but blindly passing the flag
means we also have to add in fallback code to disable validation if
the server is too old to understand the flag.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agosnapshot: Add internal option to validate XML against schema
Eric Blake [Sat, 6 Jul 2019 03:02:03 +0000 (22:02 -0500)] 
snapshot: Add internal option to validate XML against schema

Similar to VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; the next patch will
put it to use with a counterpart public API flag.

No need to change qemudomainsnapshotxml2xmltest to use the flag, since
the testsuite already has a separate virschematest that does the same.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agomaint: Drop dead code in check-driverimpls.pl
Eric Blake [Tue, 9 Jul 2019 14:02:35 +0000 (09:02 -0500)] 
maint: Drop dead code in check-driverimpls.pl

We no longer need to special-case xenUnified, since 1dac5fbbbb0
dropped support for that naming scheme.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agovz: fix typo that lost the '#' in '#define'
Daniel P. Berrangé [Wed, 10 Jul 2019 14:35:29 +0000 (15:35 +0100)] 
vz: fix typo that lost the '#' in '#define'

Previous commit:

  commit faceedaf7170903065807e2c37dd0d1bd06a6ef5
  Author: Jonathon Jongsma <jjongsma@redhat.com>
  Date:   Tue Jun 18 11:13:12 2019 -0500

    src/vz: use #pragma once in headers

accidentally chomped the "#" in a "#define" when re-indenting

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: assume modern CPU_ALLOC macros always exist
Daniel P. Berrangé [Tue, 9 Jul 2019 11:30:50 +0000 (12:30 +0100)] 
util: assume modern CPU_ALLOC macros always exist

Support for the modern CPU_ALLOC macros was added 10 years ago in

  commit a73cd93b2428adbbc62bb919b6cf5ffd27728040
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Mon Nov 16 16:08:29 2009 +0000

    Alternate CPU affinity impl to cope with NR_CPUS > 1024

This is long enough that we can assume it always exists and drop the
back compat code.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agodocs: introduce a "knowledge base" for task oriented guides
Daniel P. Berrangé [Mon, 8 Jul 2019 12:58:56 +0000 (13:58 +0100)] 
docs: introduce a "knowledge base" for task oriented guides

The previously added AMD SEV doc was not linked from anywhere on the
website. Address this by introducing a new "Knowledge base" section
that can hold task oriented guide to various features. Moving the SEV,
disk locking and secure usage guides under this section.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agomaint: Typo fix for whether
Eric Blake [Tue, 9 Jul 2019 13:53:31 +0000 (08:53 -0500)] 
maint: Typo fix for whether

Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agobhyve: Fix build
Eric Blake [Tue, 9 Jul 2019 15:36:31 +0000 (10:36 -0500)] 
bhyve: Fix build

Continuous integration caught that although 'make syntax-check' was
sufficient to let me be aware that I had to change bhyve to use
s/virDomainShutdownEnsureACL/virDomainShutdownFlagsEnsureACL/, it was
not sufficient to note which ACL functions require 2 vs. 3 arguments
for flag validation.

Fixes: eded8aad
Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agolibxl_driver: Drop needless variable
Michal Privoznik [Tue, 28 May 2019 16:02:23 +0000 (18:02 +0200)] 
libxl_driver: Drop needless variable

The @oldDef variable in libxlAddDom0() is not used really. Drop
it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotest: Add various vir*Flags API
Eric Blake [Mon, 8 Jul 2019 21:56:21 +0000 (16:56 -0500)] 
test: Add various vir*Flags API

Even though we don't accept any flags, it is unfriendly to callers
that use the modern API to have to fall back to the flag-free API.

Note that virDomainBlockStats does not trivially forward to
virDomainBlockStatsFlags, so that one is omitted for now.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agophyp: Add various vir*Flags API
Eric Blake [Mon, 8 Jul 2019 21:56:21 +0000 (16:56 -0500)] 
phyp: Add various vir*Flags API

Even though we don't accept any flags, it is unfriendly to callers
that use the modern API to have to fall back to the flag-free API.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agoesx: Add various vir*Flags API
Eric Blake [Mon, 8 Jul 2019 21:56:21 +0000 (16:56 -0500)] 
esx: Add various vir*Flags API

Even though we don't accept any flags, it is unfriendly to callers
that use the modern API to have to fall back to the flag-free API.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agobhyve: Add various vir*Flags API
Eric Blake [Mon, 8 Jul 2019 21:56:21 +0000 (16:56 -0500)] 
bhyve: Add various vir*Flags API

Even though we don't accept any flags, it is unfriendly to callers
that use the modern API to have to fall back to the flag-free API.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: Add getuid() to virnetdevbandwidthmock
Andrea Bolognani [Mon, 8 Jul 2019 15:25:56 +0000 (17:25 +0200)] 
tests: Add getuid() to virnetdevbandwidthmock

When only geteuid() is mocked, the test crashes on Debian 10.

  Fatal: failed to reset uid: No such file or directory

  Program received signal SIGABRT, Aborted.
  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
  (gdb) t a a bt

  Thread 1 (Thread 0x7ffff3b3e080 (LWP 12003)):
  #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  #1  0x00007ffff7798535 in __GI_abort () at abort.c:79
  #2  0x00007ffff485ca20 in _gcry_logv (level=level@entry=40, fmt=fmt@entry=0x7ffff4929126 "failed to reset uid: %s\n", arg_ptr=arg_ptr@entry=0x7fffffffe4a0) at ../../src/misc.c:142
  #3  0x00007ffff485cd61 in _gcry_log_fatal (fmt=fmt@entry=0x7ffff4929126 "failed to reset uid: %s\n") at ../../src/misc.c:218
  #4  0x00007ffff48639d1 in lock_pool_pages (n=<optimized out>, p=<optimized out>) at ../../src/secmem.c:340
  #5  _gcry_secmem_init_internal (n=<optimized out>) at ../../src/secmem.c:563
  #6  0x00007ffff4863d78 in _gcry_secmem_init (n=4096) at ../../src/secmem.c:581
  #7  0x00007ffff485e4e6 in _gcry_vcontrol (cmd=<optimized out>, arg_ptr=arg_ptr@entry=0x7fffffffe5e0) at ../../src/global.c:506
  #8  0x00007ffff485a789 in gcry_control (cmd=cmd@entry=GCRYCTL_INIT_SECMEM) at ../../src/visibility.c:79
  #9  0x00007ffff71af10f in ssh_crypto_init () at ./src/libgcrypt.c:621
  #10 0x00007ffff7193796 in _ssh_init (constructor=constructor@entry=1) at ./src/init.c:79
  #11 0x00007ffff71834de in libssh_constructor () at ./src/init.c:116
  #12 0x00007ffff7fe437a in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe778, env=env@entry=0x7fffffffe788) at dl-init.c:72
  #13 0x00007ffff7fe4476 in call_init (env=0x7fffffffe788, argv=0x7fffffffe778, argc=1, l=<optimized out>) at dl-init.c:30
  #14 _dl_init (main_map=0x7ffff7ffe190, argc=1, argv=0x7fffffffe778, env=0x7fffffffe788) at dl-init.c:119
  #15 0x00007ffff7fd60ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
  #16 0x0000000000000001 in ?? ()
  #17 0x00007fffffffea26 in ?? ()
  #18 0x0000000000000000 in ?? ()

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agovirsh: support block device storage type in virshParseSnapshotDiskspec
Liu Dayu [Mon, 8 Jul 2019 09:46:34 +0000 (17:46 +0800)] 
virsh: support block device storage type in virshParseSnapshotDiskspec

virsh snapshot-create-as supports 'file' storage type in --diskspec by default.
But it doesn't support 'block' storage type in the virshParseSnapshotDiskspec().
So if a snapshot on a block device (e.g. LV) was created, the type of
current running storage source in dumpxml is inconsistent with the actual
backend storage source. It will check file-system type mismatch failed
and return an error message of 'Migration without shared storage is unsafe'
when VM performs a live migration after this snapshot.

Considering virsh has to be able to work remotely that recognizing a block device
by prefix /dev/ or by stat() may be not suitable, so adding a "stype" field
for the --diskspec string which will be either "file" or "block".
e.g. --diskspec vda,snapshot=external,driver=qcow2,stype=block,file=/dev/xxx.

Signed-off-by: Liu Dayu <liu.dayu@zte.com.cn>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agopo: Drop src/xenconfig/xen_sxpr.c from POTFILES
Peter Krempa [Tue, 9 Jul 2019 09:32:19 +0000 (11:32 +0200)] 
po: Drop src/xenconfig/xen_sxpr.c from POTFILES

Commit 2f1c909991291b40 forgot this change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agonews: Mention drop of xen sxpr support
Peter Krempa [Wed, 3 Jul 2019 12:34:08 +0000 (14:34 +0200)] 
news: Mention drop of xen sxpr support

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Drop virsexpr module
Peter Krempa [Wed, 3 Jul 2019 08:02:33 +0000 (10:02 +0200)] 
util: Drop virsexpr module

There are no users any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoxen: drop xen_sxpr.(c|h)
Peter Krempa [Wed, 3 Jul 2019 07:59:06 +0000 (09:59 +0200)] 
xen: drop xen_sxpr.(c|h)

The files are now completely unused. Remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoxen: Move xenParseSxprChar to xen_common
Peter Krempa [Wed, 3 Jul 2019 07:44:51 +0000 (09:44 +0200)] 
xen: Move xenParseSxprChar to xen_common

It's the only place where it's used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoxen: Move xenParseSxprVifRate to xen_common
Peter Krempa [Wed, 3 Jul 2019 07:44:51 +0000 (09:44 +0200)] 
xen: Move xenParseSxprVifRate to xen_common

It's the only place where it's used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoxen: Move xenParseSxprSound to xen_common
Peter Krempa [Wed, 3 Jul 2019 07:30:11 +0000 (09:30 +0200)] 
xen: Move xenParseSxprSound to xen_common

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoxenconfig: Remove pointless label in xenParseSxprSound
Peter Krempa [Wed, 3 Jul 2019 06:41:38 +0000 (08:41 +0200)] 
xenconfig: Remove pointless label in xenParseSxprSound

The 'error' label just returned -1. Inline it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoxenconfig: Drop unused sexpr parsing infrastructure
Peter Krempa [Wed, 3 Jul 2019 07:22:15 +0000 (09:22 +0200)] 
xenconfig: Drop unused sexpr parsing infrastructure

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Drop sexpr2xmltest
Peter Krempa [Wed, 3 Jul 2019 06:36:09 +0000 (08:36 +0200)] 
tests: Drop sexpr2xmltest

Now that we no longer support sexpr conversion to the internal config we
can drop the test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agolibxl: Drop support for parsing sxpr format in libxlConnectDomainXMLFromNative
Peter Krempa [Wed, 3 Jul 2019 06:16:47 +0000 (08:16 +0200)] 
libxl: Drop support for parsing sxpr format in libxlConnectDomainXMLFromNative

We've dropped old xend support over a year ago. At this point we can
also drop support for parsing very old configs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoxen: Move xenFormatSxprChr to xen_common
Peter Krempa [Wed, 3 Jul 2019 07:15:37 +0000 (09:15 +0200)] 
xen: Move xenFormatSxprChr to xen_common

That's the only file using the helper function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoxenconfig: Move guts of xenFormatSxprSound into xenFormatSound
Peter Krempa [Wed, 3 Jul 2019 07:04:01 +0000 (09:04 +0200)] 
xenconfig: Move guts of xenFormatSxprSound into xenFormatSound

Use new coding style to merge the only use of xenFormatSxprSound into
the caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoxenconfig: Drop sxpr formatter
Peter Krempa [Wed, 3 Jul 2019 06:50:00 +0000 (08:50 +0200)] 
xenconfig: Drop sxpr formatter

It's no longer used. Remove the dead code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Remove xml2sexprtest
Peter Krempa [Wed, 3 Jul 2019 06:25:15 +0000 (08:25 +0200)] 
tests: Remove xml2sexprtest

The test was the only place calling 'xenFormatSxpr'. Drop it as there
are no other users of that code since we've dropped xend support in
commit 1dac5fbbbb06a03.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agosnapshot: Fix virDomainUndefineFlags docs regarding snapshots
Eric Blake [Sat, 6 Jul 2019 03:55:40 +0000 (22:55 -0500)] 
snapshot: Fix virDomainUndefineFlags docs regarding snapshots

The docs talked about an active snapshot when they meant an active
domain; they also claimed the flag was a no-op for hypervisors with no
snapshot metadata even though the flag is currently rejected as
unrecognized for hypervisors with no snapshot support at all.  A later
patch may teach more drivers to ignore the flag as a no-op, but that
shouldn't conflict with the wording chosen here (since a new client
talking to an old server still runs into the same issue, even if a
newer server becomes more tolerant).

Reported-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agosnapshot: Rename qemu domain snapshot test files
Eric Blake [Fri, 5 Jul 2019 18:24:40 +0000 (13:24 -0500)] 
snapshot: Rename qemu domain snapshot test files

Make it obvious that the domainsnapshotxml2xml test is only run when
compiling in support for qemu.

Suggested-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agolibvirt: remove link to outdated mailing list post
Daniel P. Berrangé [Fri, 5 Jul 2019 13:37:12 +0000 (14:37 +0100)] 
libvirt: remove link to outdated mailing list post

The virConnectGetType() method has an unfortunate signature, returning a
static string that must not be freed by the caller. The remote driver,
however, gets this string dynamically over an RPC call, which raised a
design discussion on the mailing list. Eventually the problem was
resolved by having the remote driver cache the returned string
internally and free it when the connection was closed.

The link to the mailing list is thus talking about a problem that does
not actually exist in the final implementation, and at best serves to
confuse the reader into thinking there might be a memory leak.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: Validate disk against domain def on coldplug
Michal Privoznik [Wed, 26 Jun 2019 13:35:11 +0000 (15:35 +0200)] 
qemu: Validate disk against domain def on coldplug

https://bugzilla.redhat.com/show_bug.cgi?id=1692296#c7

This is a counterpart for ddc72f99027 and implements the same
check for coldplug.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agorpc: ensure thread safe initialization of SASL library
Daniel P. Berrangé [Mon, 8 Jul 2019 10:32:38 +0000 (11:32 +0100)] 
rpc: ensure thread safe initialization of SASL library

Neither the sasl_client_init or sasl_server_init methods are even
remotely threadsafe. They do a bunch of one-time initialization and
merely use a simple integer counter to avoid repeated work, not even
using atomic increment/reads on the counter. This can easily race in a
threaded program. Protect the calls using a virOnce initializer function
which is guaranteed threadsafe at least from libvirt's POV.

If the application using libvirt also uses another library that makes
use of SASL then the race still exists. It is impossible to fix that
fully except in SASL code itself.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agom4: Fix check for yajl.pc
Andrea Bolognani [Mon, 8 Jul 2019 07:55:30 +0000 (09:55 +0200)] 
m4: Fix check for yajl.pc

Commit 44b8df4cb4b3 introduced a check for yajl.pc that is
extremely similar to the one we already had in place for
readline.pc - so similar, in fact, that it's still looking
for readline.pc instead of yajl.pc :)

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agosnapshot: Refactor test to utilize virDomainMoment more
Eric Blake [Wed, 12 Jun 2019 15:48:15 +0000 (10:48 -0500)] 
snapshot: Refactor test to utilize virDomainMoment more

Similar to commit a487890d for qemu, a little bit of refactoring in
the snapshot delete code will make it easier to reuse functionality
for checkpoints.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
6 years agodocs: minor updates to to new API doc
Jonathon Jongsma [Fri, 5 Jul 2019 19:28:29 +0000 (14:28 -0500)] 
docs: minor updates to to new API doc

Fix a filename and add a couple missing words.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Message-Id: <20190705192829.1223-1-jjongsma@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>