]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoqemu_firmware: Introduce @want variable to qemuFirmwareMatchDomain()
Michal Privoznik [Tue, 7 Jan 2020 09:10:02 +0000 (10:10 +0100)]
qemu_firmware: Introduce @want variable to qemuFirmwareMatchDomain()

This simplifies condition when matching FW interface by having a
single line condition instead of multiline one. Also, it prepares
the code for future expansion.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu_firmware: Pass virDomainDef into qemuFirmwareFillDomain()
Michal Privoznik [Fri, 13 Dec 2019 14:41:16 +0000 (15:41 +0100)]
qemu_firmware: Pass virDomainDef into qemuFirmwareFillDomain()

This function needs domain definition really, we don't need to
pass the whole domain object. This saves couple of dereferences
and characters esp. in more checks to come.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agocmdDomIfAddr: Move domain lookup down a few lines
Michal Privoznik [Fri, 3 Jan 2020 15:50:02 +0000 (16:50 +0100)]
cmdDomIfAddr: Move domain lookup down a few lines

The 'domifaddr' command accepts several arguments. Let's validate
them first and look up domain to work with only after to save
some RPC cycles should validation fail.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirsh: Fix virshDomainInterfaceSourceCompleter
Michal Privoznik [Thu, 5 Dec 2019 15:00:22 +0000 (16:00 +0100)]
virsh: Fix virshDomainInterfaceSourceCompleter

Introduced in v5.10.0-449-gcf44ec5577 it used
virshCommaStringListComplete() to generate list of options. But
this is not correct because the '--source' argument of the
'domifaddr' doesn't accept a string list (for instance
"arp,agent,lease") rather than a single string. Therefore, the
completer must return these strings separately and thus must
refrain from using virshCommaStringListComplete().

At the same time, now that we have strings we need declared as
an enum we can use TypeToString() instead of copying strings.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirsh: Use VIR_ENUM_* instead of open coding string -> enum conversion
Michal Privoznik [Thu, 5 Dec 2019 14:59:47 +0000 (15:59 +0100)]
virsh: Use VIR_ENUM_* instead of open coding string -> enum conversion

There are more occurrences, but I'm converting --source argument
of domifaddr command only, because I will need it in next commit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agopo/Makefile.am: use SOURCE_DATE_EPOCH to set POT creation date
Pavel Hrdina [Mon, 6 Jan 2020 14:23:06 +0000 (15:23 +0100)]
po/Makefile.am: use SOURCE_DATE_EPOCH to set POT creation date

When building RPMs for libvirt the PO files are part of libvirt-libs
package.  Now that we generate libvirt.pot during build time the POT
creation date is also generated at that time.

The issue here is that when building libvirt-libs for x86_64 and i686
the generated libvirt.pot file will have different POT creation date
which affects installed PO files as well which leads to conflict when
installing both x86_64 and i686 packages.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotravis: add build for Debian 9
Daniel P. Berrangé [Fri, 3 Jan 2020 17:14:08 +0000 (17:14 +0000)]
travis: add build for Debian 9

Debian 9 ships the oldest versions of some of our dependent
packages so can highlight bugs not seen elsewhere. CentOS 7,
despite being quite old, has rebased some packages to much
newer versions.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: introduce compile time API version checking
Daniel P. Berrangé [Fri, 3 Jan 2020 17:54:12 +0000 (17:54 +0000)]
util: introduce compile time API version checking

GLib header files annotate every API with a version number.

It is possible to define some constants before including
glib.h which will result in useful compile time warnings.

Setting GLIB_VERSION_MIN_REQUIRED will result in a warning
if libvirt uses an API that was deprecated in the declared
version, or before. Such API usage should be rewritten to
use the documented new replacement API.

Setting GLIB_VERSION_MAX_ALLOWED will result in a warning
if libvirt uses an API that was not introduced until a
version of GLib that's newer than our minimum declared
version. This avoids accidentally using functionality
that is not available on some supported platforms.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: remove use of g_date_time_new_from_iso8601 function
Daniel P. Berrangé [Mon, 6 Jan 2020 14:20:09 +0000 (14:20 +0000)]
src: remove use of g_date_time_new_from_iso8601 function

The g_date_time_new_from_iso8601() function was introduced as
a replacement for strptime in

  commit 810613a60efe3924c536b3663246900bc08910a5
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Mon Dec 23 15:37:26 2019 +0000

    src: replace strptime()/timegm()/mktime() with GDateTime APIs set

Unfortunately g_date_time_new_from_iso8601 isn't available until
glib 2.56, and backporting it requires alot of code copying and
poking at private glib structs.

This reverts domain_conf.c back to its original parsing logic prior
to 810613a60efe3924c536b3663246900bc08910a5, but using g_date_time_new()
instead of gmtime(). The other files are then adapted to follow a
similar approach.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: add compat impl of g_canonicalize_filename
Daniel P. Berrangé [Mon, 6 Jan 2020 11:54:20 +0000 (11:54 +0000)]
util: add compat impl of g_canonicalize_filename

g_canonicalize_filename was not introduced until glib 2.58
so we need a temporary backport of its impl.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: fix indent depth for glib compat impls
Daniel P. Berrangé [Mon, 6 Jan 2020 16:00:59 +0000 (16:00 +0000)]
util: fix indent depth for glib compat impls

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: keep glib compat methods in alphabetical order
Daniel P. Berrangé [Mon, 6 Jan 2020 15:56:10 +0000 (15:56 +0000)]
util: keep glib compat methods in alphabetical order

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: always replace g_fsync usage with our wrapper
Daniel P. Berrangé [Mon, 6 Jan 2020 11:42:17 +0000 (11:42 +0000)]
util: always replace g_fsync usage with our wrapper

g_fsync was introduced in 2.63 which is newer than our minimum
glib version. A future commit will introduce compile time
checking of API versions to prevent accidental usage of APIs
from glib newer than our min declared.

To avoid triggering this warning, however, we need to ensure
that we always use our wrapper function via glibcompat.c,
which will disable the API version warnings.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosecurity: improve security driver error message
Sebastian Mitterle [Tue, 7 Jan 2020 14:15:19 +0000 (14:15 +0000)]
security: improve security driver error message

Currently, when security driver is not available users are informed that
it wasn't found which can be confusing.
1. Update error message
2. Add comment to domain doc

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by Sebastian Mitterle <smitterl@redhat.com>

5 years agoselinux: Use fd_path instead of /dev/tap* to get context
Dominick Grift [Tue, 7 Jan 2020 14:22:30 +0000 (15:22 +0100)]
selinux: Use fd_path instead of /dev/tap* to get context

/dev/tap* is an invalid path but it works with lax policy.
Make it work with more accurate policy as well

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dominick Grift <dac.override@gmail.com>
5 years agoqemu: backup: roll-back checkpoint metadata if the checkpoint wasn't taken
Peter Krempa [Mon, 6 Jan 2020 14:32:54 +0000 (15:32 +0100)]
qemu: backup: roll-back checkpoint metadata if the checkpoint wasn't taken

We insert the checkpoint metadata into the list of checkpoints prior to
actually creating the on-disk bits. If the 'transaction' or any other
steps done between inserting the checkpoint and creating the on-disk
data fail we'd end up with an unusable checkpoint that would vanish
after libvirtd restart.

Prevent this by rolling back the metadata if we didn't actually take and
record the checkpoint.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: checkpoint: Extract and export rollback of checkpoint metadata storing
Peter Krempa [Mon, 6 Jan 2020 14:03:56 +0000 (15:03 +0100)]
qemu: checkpoint: Extract and export rollback of checkpoint metadata storing

If we are certain that the checkpoint creation failed we remove the
metadata from the list. To allow reusing this in the backup code add a
new helper and export it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoman: virsh: Mention how to disable snapshot of disk in snapshot-create-as
Peter Krempa [Tue, 7 Jan 2020 08:24:59 +0000 (09:24 +0100)]
man: virsh: Mention how to disable snapshot of disk in snapshot-create-as

Document that --diskspec DISK,snapshot=no disables snapshot for the
given disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agocpu_map/x86: Add support for BFLOAT16 data type
Jiri Denemark [Fri, 13 Dec 2019 16:08:44 +0000 (17:08 +0100)]
cpu_map/x86: Add support for BFLOAT16 data type

Introduced in QEMU by commit v4.1.0-266-g80db491da4.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovircgroupv2devices: Avoid double close on map FD
Michal Privoznik [Mon, 6 Jan 2020 14:06:20 +0000 (15:06 +0100)]
vircgroupv2devices: Avoid double close on map FD

When allowing/denying a device in devices CGroupV2 we have to
write a BPF program for it. The program we put there is merely
static and all it does it looks up a device in a hash table (also
known as map in BPF terminology). A map is referenced via an FD
which can be acquired via virBPFCreateMap() and like any other FD
it should be closed when no longer needed. However, we close it
twice: the first time in virCgroupV2DevicesAttachProg() which
closes it unconditionally, and the second time in either
virCgroupV2DevicesCreateProg() or
virCgroupV2DevicesPrepareProg(). Remove the second close.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agovircgroupv2devices: Unexport virCgroupV2DevicesAttachProg()
Michal Privoznik [Mon, 6 Jan 2020 14:05:05 +0000 (15:05 +0100)]
vircgroupv2devices: Unexport virCgroupV2DevicesAttachProg()

This function is not called outside of the source file where it's
defined. There's no need to export it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
5 years agoci: Fetch list of available container images dynamically
Andrea Bolognani [Wed, 11 Dec 2019 17:40:31 +0000 (18:40 +0100)]
ci: Fetch list of available container images dynamically

Any static list of images is destined to become outdated eventually,
so let's start generating it dynamically instead.

Unfortunately there doesn't seem to be a straightforward way to get
Podman/Docker to list all repositories under quay.io/libvirt, so we
have to resort to searching and filtering manually; and since the
two tools behave slightly differently in that regard, it's more
sane to have the logic in a separate shell script than it would be
to keep it inline in the Makefile with all the annoying escaping
doing so would entail.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoIntroduce command 'virsh domstats --memory' for reporting memory BW
Wang Huaqiang [Thu, 2 Jan 2020 10:45:05 +0000 (18:45 +0800)]
Introduce command 'virsh domstats --memory' for reporting memory BW

Introduce an option '--memory' for showing memory related
information. The memory bandwidth infomatio is listed as:

Domain: 'libvirt-vm'
 memory.bandwidth.monitor.count=4
 memory.bandwidth.monitor.0.name=vcpus_0-4
 memory.bandwidth.monitor.0.vcpus=0-4
 memory.bandwidth.monitor.0.node.count=2
 memory.bandwidth.monitor.0.node.0.id=0
 memory.bandwidth.monitor.0.node.0.bytes.total=10208067584
 memory.bandwidth.monitor.0.node.0.bytes.local=4807114752
 memory.bandwidth.monitor.0.node.1.id=1
 memory.bandwidth.monitor.0.node.1.bytes.total=8693735424
 memory.bandwidth.monitor.0.node.1.bytes.local=5850161152
 memory.bandwidth.monitor.1.name=vcpus_7
 memory.bandwidth.monitor.1.vcpus=7
 memory.bandwidth.monitor.1.node.count=2
 memory.bandwidth.monitor.1.node.0.id=0
 memory.bandwidth.monitor.1.node.0.bytes.total=853811200
 memory.bandwidth.monitor.1.node.0.bytes.local=290701312
 memory.bandwidth.monitor.1.node.1.id=1
 memory.bandwidth.monitor.1.node.1.bytes.total=406044672
 memory.bandwidth.monitor.1.node.1.bytes.local=229425152

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
5 years agoutil, resctrl: using 64bit interface instead of 32bit for counters
Wang Huaqiang [Thu, 2 Jan 2020 10:45:04 +0000 (18:45 +0800)]
util, resctrl: using 64bit interface instead of 32bit for counters

The underlying resctrl monitoring is actually using 64 bit counters,
not the 32bit one. Correct this by using 64bit data type for reading
hardware value.

To keep the interface consistent, the result of CPU last level cache
that occupied by vcpu processors of specific restrl monitor group is
still reported with a truncated 32bit data type. because, in silicon
world, CPU cache size will never exceed 4GB.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
5 years agoutil: time: Fix comment for virTimeFieldsNow
Peter Krempa [Fri, 15 Nov 2019 11:11:27 +0000 (12:11 +0100)]
util: time: Fix comment for virTimeFieldsNow

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
5 years agoschemas: backup: Remove pointless <choice> for 'name' of backup disk
Peter Krempa [Fri, 20 Dec 2019 10:27:37 +0000 (11:27 +0100)]
schemas: backup: Remove pointless <choice> for 'name' of backup disk

One of the first versions thought of using disk path as the second
option but this was dropped as being a legacy interface. Remove the
leftover pointless <choice> wrapper for the disk name as there's just
one option now.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: process: Terminate backup job on VM destroy
Peter Krempa [Fri, 20 Dec 2019 10:20:24 +0000 (11:20 +0100)]
qemu: process: Terminate backup job on VM destroy

Commit d75f865fb989b3e6330c78c28e1c3bf7fa28e6a5 caused a job-deadlock if
a VM is running the backup job and being destroyed as it removed the
cleanup of the async job type and there was nothing to clean up the
backup job.

Add an explicit cleanup of the backup job when destroying a VM.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: backup: Properly propagate async job type when cancelling the job
Peter Krempa [Fri, 20 Dec 2019 10:15:47 +0000 (11:15 +0100)]
qemu: backup: Properly propagate async job type when cancelling the job

When cancelling the blockjobs as part of failed backup job startup
recover we didn't pass in the correct async job type. Luckily the block
job handler and cancellation code paths use no block job at all
currently so those were correct.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: blockjob: Remove infrastructure for remembering to delete image
Peter Krempa [Fri, 20 Dec 2019 10:02:35 +0000 (11:02 +0100)]
qemu: blockjob: Remove infrastructure for remembering to delete image

Now that we delete the images elsewhere it's not required. Additionally
it's safe to do as we never released an upstream version which required
this being in place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: backup: Move deletion of backup images to job termination
Peter Krempa [Fri, 20 Dec 2019 10:00:57 +0000 (11:00 +0100)]
qemu: backup: Move deletion of backup images to job termination

While qemu is running both locations are identical in semantics, but the
move will allow us to fix the scenario when the VM is destroyed or
crashes where we'd leak the images.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: backup: Configure backup store image with backing file
Peter Krempa [Fri, 20 Dec 2019 08:33:40 +0000 (09:33 +0100)]
qemu: backup: Configure backup store image with backing file

In contrast to snapshots the backup job does not complain when the
backup job's store file has backing pre-configured. It's actually
required so that the NBD server exposes all the data properly.

Remove our fake termination and use the existing disk source as backing.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Reset the node-name allocator in qemuDomainObjPrivateDataClear
Peter Krempa [Fri, 20 Dec 2019 08:32:08 +0000 (09:32 +0100)]
qemu: Reset the node-name allocator in qemuDomainObjPrivateDataClear

qemuDomainObjPrivateDataClear clears state which become invalid after VM
stopped running and the node name allocator belongs there.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: block: Use proper asyncJob when waiting for completion of blockdev-create
Peter Krempa [Fri, 20 Dec 2019 08:30:28 +0000 (09:30 +0100)]
qemu: block: Use proper asyncJob when waiting for completion of blockdev-create

The waiting loop used QEMU_ASYNC_JOB_NONE rather than 'asyncJob' passed
from the caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobootstrap: annotate with info about desired replacement
Daniel P. Berrangé [Tue, 24 Dec 2019 11:48:37 +0000 (11:48 +0000)]
bootstrap: annotate with info about desired replacement

Add a comment against each gnulib module suggesting strategy
for replacement.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobootstrap: remove now unused gnulib modules
Daniel P. Berrangé [Fri, 20 Dec 2019 16:25:51 +0000 (16:25 +0000)]
bootstrap: remove now unused gnulib modules

* canonicalize-lgpl: replaced by realpath()/g_canonicalize_filename()
* clock-gettime: replaced by g_get_(real|monotonic)_time
* dirname-lgpl: replaced by g_path_get_dirname()
* fclose: we aren't affected by any portability problems it fixes
* fdatasync: every platform we call fdatasync on has it present
* fsync: replaced by g_fsync()
* fnmatch: replaced by g_pattern_match()
* getcwd-lgpl: replaced by g_get_current_dir()
* gethostname: replaced by g_get_hostname()
* gettimeofday: replaced by g_get_(real|monotonic)_time
* setenv: replaced by g_setenv()
* strptime: replaced by GDateTime
* timegm: replaced by GDateTime
* unsetenv: replaced by g_unsetenv()

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: replace strptime()/timegm()/mktime() with GDateTime APIs set
Daniel P. Berrangé [Mon, 23 Dec 2019 15:37:26 +0000 (15:37 +0000)]
src: replace strptime()/timegm()/mktime() with GDateTime APIs set

All places where we use strptime/timegm()/mktime() are handling
conversion of dates in a format compatible with ISO 8601, so we
can use the GDateTime APIs to simplify code.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: replace WSAStartup with g_networking_init()
Daniel P. Berrangé [Mon, 23 Dec 2019 15:37:14 +0000 (15:37 +0000)]
src: replace WSAStartup with g_networking_init()

g_networking_init() does the same as our custom code.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: replace gethostname() with g_get_hostname()
Daniel P. Berrangé [Mon, 23 Dec 2019 14:55:45 +0000 (14:55 +0000)]
util: replace gethostname() with g_get_hostname()

Note the glib function returns a const string because it
caches the hostname using a one time thread initializer
function.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: use realpath/g_canonicalize_filename
Daniel P. Berrangé [Mon, 23 Dec 2019 14:21:54 +0000 (14:21 +0000)]
util: use realpath/g_canonicalize_filename

The canonicalize_file_name(path) is equivalent to calling
realpath(path, NULL). Passing NULL for the second arg of
realpath is not standardized behaviour, however, Linux,
FreeBSD > 6.4 and macOS > 10.5 all support this critical
extension.

This leaves Windows which doesn't provide realpath at all.
The g_canonicalize_filename() function doesn't expand
symlinks, so is not strictly equivalent to realpath()
but is close enough for our Windows portability needs
right now.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: replace getcwd() with g_get_current_dir()
Daniel P. Berrangé [Fri, 20 Dec 2019 16:51:16 +0000 (16:51 +0000)]
src: replace getcwd() with g_get_current_dir()

commandhelper.c is not converted since this is a standalone
program only run on UNIX, so can rely on getcwd().

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: remove unused imports of dirname.h
Daniel P. Berrangé [Mon, 23 Dec 2019 15:37:45 +0000 (15:37 +0000)]
src: remove unused imports of dirname.h

A few places were importing dirname.h without actually using it.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: replace mdir_name() with g_path_get_dirname()
Daniel P. Berrangé [Fri, 20 Dec 2019 16:48:02 +0000 (16:48 +0000)]
src: replace mdir_name() with g_path_get_dirname()

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: replace IS_ABSOLUTE_FILE_NAME with g_path_is_absolute
Daniel P. Berrangé [Mon, 23 Dec 2019 15:54:41 +0000 (15:54 +0000)]
util: replace IS_ABSOLUTE_FILE_NAME with g_path_is_absolute

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: replace last_component() with g_path_get_basename()
Daniel P. Berrangé [Mon, 23 Dec 2019 15:47:21 +0000 (15:47 +0000)]
src: replace last_component() with g_path_get_basename()

The last_component() method is a GNULIB custom function
that returns a pointer to the base name in the path.
This is similar to g_path_get_basename() but without the
malloc. The extra malloc is no trouble for libvirt's
needs so we can use g_path_get_basename().

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: replace clock_gettime()/gettimeofday() with g_get_real_time()
Daniel P. Berrangé [Fri, 20 Dec 2019 16:19:30 +0000 (16:19 +0000)]
src: replace clock_gettime()/gettimeofday() with g_get_real_time()

g_get_real_time() returns the time since epoch in microseconds.
It uses gettimeofday() internally while libvirt used clock_gettime
because it is declared async signal safe. In practice gettimeofday
is also async signal safe *provided* the timezone parameter is
NULL. This is indeed the case in g_get_real_time().

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: switch from fnmatch to g_pattern_match_simple
Daniel P. Berrangé [Fri, 20 Dec 2019 16:02:49 +0000 (16:02 +0000)]
src: switch from fnmatch to g_pattern_match_simple

The g_pattern_match function_simple is an acceptably close
approximation of fnmatch for libvirt's needs.

In contrast to fnmatch(), the '/' character can be matched
by the wildcards, there are no '[...]' character ranges and
'*' and '?' can not be escaped to include them literally in
a pattern.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: use g_lstat() instead of lstat()
Daniel P. Berrangé [Tue, 24 Dec 2019 15:19:17 +0000 (15:19 +0000)]
src: use g_lstat() instead of lstat()

The GLib g_lstat() function provides a portable impl for
Win32.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: introduce virFileDataSync
Daniel P. Berrangé [Tue, 24 Dec 2019 15:14:13 +0000 (15:14 +0000)]
util: introduce virFileDataSync

A wrapper that calls g_fsync on Win32/macOS and fdatasync
elsewhere. g_fsync is a stronger flush than we need but it
satisfies the caller's requirements & matches the approach
gnulib takes.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: use g_fsync for portability
Daniel P. Berrangé [Fri, 20 Dec 2019 15:57:24 +0000 (15:57 +0000)]
src: use g_fsync for portability

The g_fsync() API provides the same Windows portability
as GNULIB does for fsync().

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: add compat wrapper for g_fsync
Daniel P. Berrangé [Mon, 23 Dec 2019 10:10:20 +0000 (10:10 +0000)]
util: add compat wrapper for g_fsync

g_fsync isn't available until 2.63 so we need a compat
wrapper temporarily.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: switch to use g_setenv/g_unsetenv
Daniel P. Berrangé [Wed, 18 Dec 2019 17:16:19 +0000 (17:16 +0000)]
src: switch to use g_setenv/g_unsetenv

Eliminate direct use of normal setenv/unsetenv calls in
favour of GLib's wrapper. This eliminates two gnulib
modules

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agosrc: always pull in glib/gstdio.h header
Daniel P. Berrangé [Tue, 24 Dec 2019 15:25:40 +0000 (15:25 +0000)]
src: always pull in glib/gstdio.h header

The gstdio.h header defines some low level wrappers for
things like fsync, stat, lstat, etc.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoutil: add note about event file descriptors on Windows
Daniel P. Berrangé [Wed, 18 Dec 2019 16:46:07 +0000 (16:46 +0000)]
util: add note about event file descriptors on Windows

When using GNULIB with Winsock, libvirt will never see the normal HANDLE
objects, instead GNULIB guarantees that libvirt gets a C runtime file
descriptor. The GNULIB poll impl also expects to get C runtime file
descriptors rather than HANDLE objects. Document this behaviour so that
it is clear to applications providing event loop implementations if they
need Windows portability.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotravis: add macOS Xcode 11.3 testing
Daniel P. Berrangé [Mon, 23 Dec 2019 14:20:46 +0000 (14:20 +0000)]
travis: add macOS Xcode 11.3 testing

Ideally we would test macOS 10.15 as the newest release, however, that
is not available in Travis yet. We can at least test newer XCode
versions though to get toolchain validation.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: expand macOS platform support coverage
Daniel P. Berrangé [Mon, 23 Dec 2019 14:15:40 +0000 (14:15 +0000)]
docs: expand macOS platform support coverage

We initially claimed to only support the most recent macOS
release, which is currently 10.15. Our Travis CI, however,
is validating 10.14.4 / XCode 10.3.

For almost all of our other platforms, we support multiple
releases to some degree. This change brings macOS in line
with other long life distros, covering the most recent &
most recent but one for a 2 year overlap. With this docs
change our CI is now actually testing our minimum version.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agobuild: set min version for CLang to 3.4 / XCode CLang to 5.1
Daniel P. Berrangé [Mon, 23 Dec 2019 14:06:46 +0000 (14:06 +0000)]
build: set min version for CLang to 3.4 / XCode CLang to 5.1

We have a strong check for GCC >= 4.8, but don't validate any
version number for CLang historically.

This defines the min CLang to be 3.4 which is what is available
for RHEL-7. macOS uses a different versioning scheme for CLang,
based off XCode versions. There is a mapping recorded at

  https://en.wikipedia.org/wiki/Xcode#Toolchain_versions

Here we see upstream CLang 3.4 corresponds to XCode 5.1

XCode 5.1 is available for macOS 10.8.4 or later which
trivially satisfies our platform support matrix requirements.

All these versions match what QEMU declares for its min GCC
and CLang checks.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agovirsh: Add a completer for `domifaddr` --source parameter.
Julio Faracco [Thu, 2 Jan 2020 15:07:06 +0000 (12:07 -0300)]
virsh: Add a completer for `domifaddr` --source parameter.

The command `domifaddr` can use three different sources to grab IP
address of a Virtual Machine: lease, agent and arp. This parameter does
not have a completer function to return source options.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agotravis: fix homebrew install of python3
Daniel P. Berrangé [Thu, 2 Jan 2020 13:40:48 +0000 (13:40 +0000)]
travis: fix homebrew install of python3

The Python3 package has started failing to install from
HomeBrew with the following:

  Error: The `brew link` step did not complete successfully
  The formula built, but is not symlinked into /usr/local
  Could not symlink Frameworks/Python.framework/Headers
  Target /usr/local/Frameworks/Python.framework/Headers
  is a symlink belonging to python@2. You can unlink it:

    brew unlink python@2

  To force the link and overwrite all conflicting files:

    brew link --overwrite python

The result is that libvirt fails to find python3:

  checking for python3... no
  configure: error: 'python3' binary is required to build libvirt

It is unclear what changed in Travis/HomeBrew to break our
previously working setup, but running the suggested command
fixes it well enough for libvirt's CI needs.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agomaint: update to latest gnulib
Ján Tomko [Thu, 2 Jan 2020 08:51:05 +0000 (09:51 +0100)]
maint: update to latest gnulib

Update to:

    commit 7d069378921bfa0d7c7198ea177aac0a2440016f
    Author:     Pádraig Brady <P@draigBrady.com>
    CommitDate: 2020-01-01 22:00:28 +0000

       md5, sha1, sha256, sha512: support --with-openssl=auto-gpl-compat

Signed-off-by: Ján Tomko <jtomko@redhat.com>
5 years agoschemas: Allow additional qemu cmd line arguments/env variables and qemuCaps to be...
Michal Privoznik [Fri, 20 Dec 2019 09:24:07 +0000 (10:24 +0100)]
schemas: Allow additional qemu cmd line arguments/env variables and qemuCaps to be interleaved

While command line arguments are sort of positional (because you
have to have two entries, one for "-arg" the other for "value"),
it doesn't really matter whether env variables come before or
after command line arguments.

And it matters even less when playing with qemu capabilities.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoqemu: hide details of fake reboot
Nikolay Shirokovskiy [Thu, 19 Dec 2019 08:02:06 +0000 (11:02 +0300)]
qemu: hide details of fake reboot

If we use fake reboot then domain goes thru running->shutdown->running
state changes with shutdown state only for short period of time.  At
least this is implementation details leaking into API. And also there is
one real case when this is not convinient. I'm doing a backup with the
help of temporary block snapshot (with the help of qemu's API which is
used in the newly created libvirt's backup API). If guest is shutdowned
I want to continue to backup so I don't kill the process and domain is
in shutdown state. Later when backup is finished I want to destroy qemu
process. So I check if it is in shutdowned state and destroy it if it
is. Now if instead of shutdown domain got fake reboot then I can destroy
process in the middle of fake reboot process.

After shutdown event we also get stop event and now as domain state is
running it will be transitioned to paused state and back to running
later. Though this is not critical for the described case I guess it is
better not to leak these details to user too. So let's leave domain in
running state on stop event if fake reboot is in process.

Reconnection code handles this patch without modification. It detects
that qemu is not running due to shutdown and then calls qemuProcessShutdownOrReboot
which reboots as fake reboot flag is set.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoStorage: Use errno parameter in virReportSystemError
Yi Li [Mon, 23 Dec 2019 01:15:40 +0000 (09:15 +0800)]
Storage: Use errno parameter in virReportSystemError

Use errno parameter in virReportSystemError.
Remove hold function return values if don't need.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Yi Li <yili@winhong.com>
5 years agostorage: Fix volStorageBackendRBDRefreshVolInfo function return errors
Yi Li [Mon, 23 Dec 2019 01:15:39 +0000 (09:15 +0800)]
storage: Fix volStorageBackendRBDRefreshVolInfo function return errors

Fix the return value status comparison checking for call to
volStorageBackendRBDRefreshVolInfo introduced by commit id f46d137e.

we only should fail when the return is < 0. -ENOENT, -ETIMEDOUT will
ignore according commit id f46d137e.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Yi Li <yili@winhong.com>
5 years agoStorage: Use rc hold intermediate function return values.
Yi Li [Mon, 23 Dec 2019 01:15:38 +0000 (09:15 +0800)]
Storage: Use rc hold intermediate function return values.

most libvirt code uses 'int rc' to hold intermediate
function return values. consistent with the rest of libvirt.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Yi Li <yili@winhong.com>
5 years agoqemu: store the emulator name in the capabilities XML
Daniel P. Berrangé [Tue, 10 Dec 2019 10:23:14 +0000 (10:23 +0000)]
qemu: store the emulator name in the capabilities XML

We don't need this for any functional purpose, but when debugging hosts
it is useful to know what binary a given capabilities XML document is
associated with.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: add qemu caps constructor which takes binary name
Daniel P. Berrangé [Fri, 20 Dec 2019 12:28:57 +0000 (12:28 +0000)]
qemu: add qemu caps constructor which takes binary name

Simplify repeated code patterns by providing a new constructor taking
the QEMU binary name.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: add explicit flag to skip qemu caps invalidation
Daniel P. Berrangé [Fri, 20 Dec 2019 11:56:38 +0000 (11:56 +0000)]
qemu: add explicit flag to skip qemu caps invalidation

Currently if the binary path is NULL in the qemu capabilities object,
cache invalidation is skipped. A future patch will ensure that the
binary path is always non-NULL, so a way to explicitly skip invalidation
is required.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: ensure outputfile is deleted if rst2html/rst2man fail
Daniel P. Berrangé [Wed, 11 Dec 2019 18:03:53 +0000 (18:03 +0000)]
docs: ensure outputfile is deleted if rst2html/rst2man fail

This avoids leaving a zero length or partially generated output
file on errors.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs/auth.html.in: fixed typos
Andrew Miloradovsky [Thu, 19 Dec 2019 15:01:28 +0000 (18:01 +0300)]
docs/auth.html.in: fixed typos

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Andrew Miloradovsky <andrew@interpretmath.pw>
5 years agostorage: Fix daemon crash on lookup storagepool by targetpath
Yi Li [Sat, 21 Dec 2019 00:33:33 +0000 (08:33 +0800)]
storage: Fix daemon crash on lookup storagepool by targetpath

Causing a crash when storagePoolLookupByTargetPath beacuse of
Some types of storage pool have no target elements.
Use STREQ_NULLABLE instead of STREQ
Avoids segfaults when using NULL arguments.

Core was generated by `/usr/sbin/libvirtd'.
Program terminated with signal 11, Segmentation fault.
(gdb) bt
0  0x0000ffff9e951388 in strcmp () from /lib64/libc.so.6
1  0x0000ffff92103e9c in storagePoolLookupByTargetPathCallback (
    obj=0xffff7009aab0, opaque=0xffff801058b0) at storage/storage_driver.c:1649
2  0x0000ffff9f2c52a4 in virStoragePoolObjListSearchCb (
    payload=0xffff801058b0, name=<optimized out>, opaque=<optimized out>)
    at conf/virstorageobj.c:476
3  0x0000ffff9f1f2f7c in virHashSearch (ctable=0xffff800f4f60,
    iter=iter@entry=0xffff9f2c5278 <virStoragePoolObjListSearchCb>,
    data=data@entry=0xffff95af7488, name=name@entry=0x0) at util/virhash.c:696
4  0x0000ffff9f2c64f0 in virStoragePoolObjListSearch (pools=0xffff800f2ce0,
    searcher=searcher@entry=0xffff92103e68 <storagePoolLookupByTargetPathCallback>,
     opaque=<optimized out>) at conf/virstorageobj.c:505
5  0x0000ffff92101f54 in storagePoolLookupByTargetPath (conn=0xffff5c0009f0,
path=0xffff7009a850 "/vms/images") at storage/storage_driver.c:1672

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Yi Li <yili@winhong.com>
5 years agoqemu_process.c: remove 'cleanup' label from qemuProcessCreatePretendCmd()
Daniel Henrique Barboza [Fri, 20 Dec 2019 21:16:32 +0000 (18:16 -0300)]
qemu_process.c: remove 'cleanup' label from qemuProcessCreatePretendCmd()

The 'cleanup' flag is doing no cleaup in this function. We can
remove it and return NULL on error or qemuBuildCommandLine().

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu_process.c: remove cleanup labels after g_auto*() changes
Daniel Henrique Barboza [Fri, 20 Dec 2019 21:16:31 +0000 (18:16 -0300)]
qemu_process.c: remove cleanup labels after g_auto*() changes

The g_auto*() changes made by the previous patches made a lot
of 'cleanup' labels obsolete. Let's remove them.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu_process.c: use g_autoptr()
Daniel Henrique Barboza [Fri, 20 Dec 2019 21:16:30 +0000 (18:16 -0300)]
qemu_process.c: use g_autoptr()

Change all feasible pointers to use g_autoptr().

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu_domain.h: add G_DEFINE_AUTOPTR_CLEANUP_FUNC for qemuDomainLogContext
Daniel Henrique Barboza [Fri, 20 Dec 2019 21:16:29 +0000 (18:16 -0300)]
qemu_domain.h: add G_DEFINE_AUTOPTR_CLEANUP_FUNC for qemuDomainLogContext

This will allow us to g_autoptr qemuDomainLogContext pointers
in the following patch.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu_process.c: use g_autofree
Daniel Henrique Barboza [Fri, 20 Dec 2019 21:16:28 +0000 (18:16 -0300)]
qemu_process.c: use g_autofree

Change all feasible strings and scalar pointers to use g_autofree.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agovbox: Get rid of "no_memory" labels
Fabiano Fidêncio [Fri, 20 Dec 2019 12:43:15 +0000 (13:43 +0100)]
vbox: Get rid of "no_memory" labels

As pointed out by Ján Tomko, "no_memory seems suspicious in the times of
abort()".

As libvirt decided to take the path to not report OOM and simply abort
when it happens, let's get rid of the no_memory labels and simplify the
code around them.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
5 years agoutil: Get rid of "no_memory" labels
Fabiano Fidêncio [Fri, 20 Dec 2019 12:43:14 +0000 (13:43 +0100)]
util: Get rid of "no_memory" labels

As pointed out by Ján Tomko, "no_memory seems suspicious in the times of
abort()".

As libvirt decided to take the path to not report OOM and simply abort
when it happens, let's get rid of the no_memory labels and simplify the
code around them.

Mind that virfirewall.c was not touched and still contains no_memory
labels. The reason those are left behind, at least for now, is because
the conversion seems to be slightly more complicated than the rest, as
some other places are relying on firewall->err being set to ENOMEM.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
5 years agorpc: Get rid of "no_memory" labels
Fabiano Fidêncio [Fri, 20 Dec 2019 12:43:13 +0000 (13:43 +0100)]
rpc: Get rid of "no_memory" labels

As pointed out by Ján Tomko, "no_memory seems suspicious in the times of
abort()".

As libvirt decided to take the path to not report OOM and simply abort
when it happens, let's get rid of the no_memory labels and simplify the
code around them.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
5 years agoopenvz: Get rid of "no_memory" labels
Fabiano Fidêncio [Fri, 20 Dec 2019 12:43:12 +0000 (13:43 +0100)]
openvz: Get rid of "no_memory" labels

As pointed out by Ján Tomko, "no_memory seems suspicious in the times of
abort()".

As libvirt decided to take the path to not report OOM and simply abort
when it happens, let's get rid of the no_memory labels and simplify the
code around them.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
5 years agoconf: Get rid of "no_memory" labels
Fabiano Fidêncio [Fri, 20 Dec 2019 12:43:11 +0000 (13:43 +0100)]
conf: Get rid of "no_memory" labels

As pointed out by Ján Tomko, "no_memory seems suspicious in the times of
abort()".

As libvirt decided to take the path to not report OOM and simply abort
when it happens, let's get rid of the no_memory labels and simplify the
code around them.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
5 years agonews: document phyp removal
Cole Robinson [Fri, 20 Dec 2019 18:03:22 +0000 (13:03 -0500)]
news: document phyp removal

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoRemove phyp driver
Cole Robinson [Wed, 18 Dec 2019 15:23:34 +0000 (10:23 -0500)]
Remove phyp driver

The phyp driver was added in 2009 and does not appear to have had any
real feature change since 2011. There's virtually no evidence online
of users actually using it. IMO it's time to kill it.

This was discussed a bit in April 2016:
https://www.redhat.com/archives/libvir-list/2016-April/msg01060.html

Final discussion is here:
https://www.redhat.com/archives/libvir-list/2019-December/msg01162.html

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agodocs: rewrite polkit docs generator in Python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
docs: rewrite polkit docs generator in Python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the genaclperms.pl tool in Python.

This was a straight conversion, manually going line-by-line to
change the syntax from Perl to Python. Thus the overall structure
of the file and approach is the same.

Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: rewrite hvsupport.html page generator in python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
docs: rewrite hvsupport.html page generator in python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the hvsupport.pl tool in Python.

This was a straight conversion, manually going line-by-line to
change the syntax from Perl to Python. Thus the overall structure
of the file and approach is the same.

The new impl generates byte-for-byte identical output to the
old impl.

Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: rewrite file access checker in Python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
tests: rewrite file access checker in Python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the check-file-access.pl tool in Python.

This was a straight conversion, manually going line-by-line to
change the syntax from Perl to Python. Thus the overall structure
of the file and approach is the same.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: rewrite qemu capability grouper in Python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
tests: rewrite qemu capability grouper in Python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the group-qemu-caps.pl tool in Python.

This was a straight conversion, manually going line-by-line to
change the syntax from Perl to Python. Thus the overall structure
of the file and approach is the same.

Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoesx: set vmfs fs type for vmfs-based datastores
Pino Toscano [Fri, 15 Nov 2019 11:51:51 +0000 (12:51 +0100)]
esx: set vmfs fs type for vmfs-based datastores

This way they are correctly represented:
  <source>
    <format type='vmfs'/>
  </source>
... instead of 'auto'.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agostorage: add vmfs filesystem type
Pino Toscano [Fri, 15 Nov 2019 11:45:19 +0000 (12:45 +0100)]
storage: add vmfs filesystem type

It will be used to represent the type of a filesystem pool in ESXi.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoesx: split virtualswitchToNetwork helper
Pino Toscano [Thu, 14 Nov 2019 10:19:13 +0000 (11:19 +0100)]
esx: split virtualswitchToNetwork helper

Move the creation of a virNetworkPtr object from the
esxVI_HostVirtualSwitch object of a virtual switch out of
esxNetworkLookupByName in an own helper. This way it can be used also
in other functions.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoesx: split targetToStoragePool helper
Pino Toscano [Tue, 12 Nov 2019 17:16:48 +0000 (18:16 +0100)]
esx: split targetToStoragePool helper

Move the creation of a virStoragePtr object from the
esxVI_HostInternetScsiHbaStaticTarget object of a target out of
esxStoragePoolLookupByName in an own helper. This way it can be used
also in other functions.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoesx: split datastorePoolType helper
Pino Toscano [Tue, 12 Nov 2019 13:39:32 +0000 (14:39 +0100)]
esx: split datastorePoolType helper

Move the detection of the type of a vmfs pool out of
esxLookupVMFSStoragePoolType in an own helper. This way it can be used
also in other functions.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoesx: split datastoreToStoragePoolPtr helper
Pino Toscano [Mon, 11 Nov 2019 15:34:34 +0000 (16:34 +0100)]
esx: split datastoreToStoragePoolPtr helper

Move the creation of a virStoragePtr object from the esxVI_ObjectContent
object of a datastore out of esxStoragePoolLookupByName in an own
helper. This way it can be used also in other functions.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoadmin: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:41:33 +0000 (10:41 +0100)]
admin: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoadmin: Use g_autofree in getSocketPath()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:40:37 +0000 (10:40 +0100)]
admin: Use g_autofree in getSocketPath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agointerface: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:39:32 +0000 (10:39 +0100)]
interface: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:38:37 +0000 (10:38 +0100)]
locking: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Use g_autofree in virLockDaemonExecRestartStatePath()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:37:20 +0000 (10:37 +0100)]
locking: Use g_autofree in virLockDaemonExecRestartStatePath()

Together with the change, let's also simplify the function and get rid
of the goto.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Use g_autofree in virLockDaemonUnixSocketPaths()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:35:57 +0000 (10:35 +0100)]
locking: Use g_autofree in virLockDaemonUnixSocketPaths()

Together with the change, let's also simplify the function and get rid
of the goto.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Use g_autofree in virLockManagerLockDaemonPath()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:34:16 +0000 (10:34 +0100)]
locking: Use g_autofree in virLockManagerLockDaemonPath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agologging: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:29:28 +0000 (10:29 +0100)]
logging: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>