bhyve: domain events support

Support events for these functions:

 - domainDefineXML
 - domainUndefine
 - domainCreate{WithFlags,XML}
 - domainDestroy
qemu: snapshot: Use typecasted switch in qemuDomainSnapshotPrepare()

Convert the switch to a typecasted value so that the compiler tracks
additions for us.
qemu: snapshot: Forbid partial internal snapshots

qemu's savevm command does a snapshot of all non readonly disks of a VM.
Libvirt though allowed disabling snapshot for certain disk of a VM.
qemu: snapshot: Forbid empty snapshots

If neither disks nor memory are selected for snapshot we'd record
metadata in case of external snapshot and do a disk snapshot in case of
external disk snapshot. Forbid this as it doesn't make much sense.
qemu: snapshot: Fix return value of external checkpoint with no disks

When doing an external checkpoint of a VM with no disk selected we'd
return failure but not set error code. This was a result of ret not
being set to 0 during walking of the disk array.

Rework early failure checking and set the error code to success before
iterating the array of disks so that we return success if no disks are
snapshotted.

Fixes the following symptom (or without --diskspec for diskless VMs)

 $ virsh snapshot-create-as snapshot-test  --memspec /tmp/asdf --diskspec hda,snapshot=no
 error: An error occurred, but the cause is unknown
tests: avoid dlsym mocking on mingw

I got a build failure when cross-compiling to mingw with the
mingw64-dbus package installed:

  CC       virmockdbus_la-virmockdbus.lo
../../tests/virmockdbus.c:29:6: error: 'dbus_connection_set_change_sigpipe' redeclared without dllimport attribute: previous dllimport ignored [-Werror=attributes]
 VIR_MOCK_STUB_VOID_ARGS(dbus_connection_set_change_sigpipe,
      ^
../../tests/virmockdbus.c:33:18: error: 'dbus_bus_get' redeclared without dllimport attribute: previous dllimport ignored [-Werror=attributes]
 VIR_MOCK_STUB_RET_ARGS(dbus_bus_get,
...

Well duh - mingw lacks dlopen and friends, even if it can support
dbus.  A similar failure occured in virsystemdtest.c; but in that
file, we know that systemd is a Linux-only concept.

* tests/virmockdbus.c: Cripple on mingw.
* tests/virsystemdtest.c: Cripple on non-Linux.

Signed-off-by: Eric Blake <eblake@redhat.com>
virdbus: Remove redundant error macro

This is the only callsite.

We drop use of localerror.name here, because it's not actually useful
to us: rather than the parameter name which received an invalid value
(which was assumed), it's actually the the dbus errno equivalent.
Just use the error string.

Acked-by: Eric Blake <eblake@redhat.com>
virdbus: Show method name in error message

If you trigger bug 1033369, we get the error message:

  error from service: Invalid argument

Which is a bit too generic to pinpoint what is actually failing. This
changes it to:

  error from service: CreateMachine: Invalid argument

Acked-by: Eric Blake <eblake@redhat.com>
bhyve: fix virObjectUnlock() usage

In a number of places in the bhyve driver, virObjectUnlock()
is called with an arg without check if the arg is non-NULL, which
could result in passing NULL value and a warning like:

virObjectUnlock:340 : Object 0x0 ((unknown)) is not a virObjectLockable instance

* src/bhyve/bhyve_driver.c (bhyveDomainGetInfo)
(bhyveDomainGetState, bhyveDomainGetAutostart)
(bhyveDomainSetAutostart, bhyveDomainIsActive)
(bhyveDomainIsPersistent, bhyveDomainGetXMLDesc)
(bhyveDomainUndefine, bhyveDomainLookupByUUID)
(bhyveDomainLookupByName, bhyveDomainLookupByID)
(bhyveDomainCreateWithFlags, bhyveDomainOpenConsole):
Check if arg is not NULL before calling virObjectUnlock on it.
qemuSetupCgroupForVcpu: s/virProcessInfoSetAffinity/virProcessSetAffinity/

In the f56c773bf we've made the substitution but forgot to fix one
comment which is still referring to the old name. This may be
potentially misleading.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>