Add ability to register callback for virCommand dry run

To allow for fault injection of the virCommand dry run,
add the ability to register a callback. The callback will
be passed the argv, env and stdin buffer and is expected
to return the exit status and optionally fill stdout and
stderr buffers.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
build: Fix build with old automake

Ancient automake (such as from RHEL5) does not provide abs_srcdir and
abs_builddir variables which are used by a recent commit of mine
(e562e82).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
build: Fix make distcheck

I forgot to delete the underscore in object_locking_SOURCES when
changing the name in one of previous cleanups.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
qemuhotplugtest: Fix mem-leaking testcases

While running qemuhotplugtest, it was found that valgrind pointed out
the following memory leak:

==7906== 5 bytes in 1 blocks are definitely lost in loss record 7 of 121
==7906==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==7906==    by 0x3E782A754D: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6)
==7906==    by 0x4CDAE03: virDomainDeviceInfoParseXML.isra.32 (domain_conf.c:3685)
==7906==    by 0x4CE3BB9: virDomainNetDefParseXML (domain_conf.c:6707)
==7906==    by 0x4CFBA08: virDomainDefParseXML (domain_conf.c:12235)
==7906==    by 0x4CFBC1E: virDomainDefParseNode (domain_conf.c:13039)
==7906==    by 0x4CFBD95: virDomainDefParse (domain_conf.c:12981)
==7906==    by 0x41FEB4: testQemuHotplug (qemuhotplugtest.c:66)
==7906==    by 0x420F41: virtTestRun (testutils.c:201)
==7906==    by 0x41F287: mymain (qemuhotplugtest.c:422)
==7906==    by 0x4216BD: virtTestMain (testutils.c:784)
==7906==    by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
...and 10 more.

Problem is, since 20745748 we do both, parse <alias/> elements from
XML files and call qemuAssignDeviceAliases(). While generating runtime
info for domain at runtime is just fine in the test, we can parse just
inactive XML and remove all <alias/>-es from the XML files.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
build: Make sure src/util/virprobe.h is distributed

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
conf: consistent comments about disk enum usage

Before refactoring this struct, I found it helpful to track which
'int' fields really contain an enum value.

* src/conf/domain_conf.h (_virDomainDiskDef): Add comments.

Signed-off-by: Eric Blake <eblake@redhat.com>
domiftune: Reword bandwidth clearing paragraph

s/of value/value of/

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
nwfilter: Fix double free of pointer

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

Commit 49b59a15 fixed one problem but masks another one related to pointer
freeing.

Avoid putting of the virNWFilterSnoopReq once the thread has been started.
It belongs to the thread and the thread will call virNWFilterSnoopReqPut() on it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
virNetClientSetTLSSession: Restore original signal mask

Currently, we use pthread_sigmask(SIG_BLOCK, ...) prior to calling
poll(). This is okay, as we don't want poll() to be interrupted.
However, then - immediately as we fall out from the poll() - we try to
restore the original sigmask - again using SIG_BLOCK. But as the man
page says, SIG_BLOCK adds signals to the signal mask:

SIG_BLOCK
      The set of blocked signals is the union of the current set and the set argument.

Therefore, when restoring the original mask, we need to completely
overwrite the one we set earlier and hence we should be using:

SIG_SETMASK
      The set of blocked signals is set to the argument set.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
libxl: move libxlDomainEventQueue to libxl_domain

Move libxlDomainEventQueue from libxl_driver to libxl_domain for
use by other libxl modules.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: move libxlDomainManagedSavePath to libxl_domain

Move libxlDomainManagedSavePath from libxl_driver to libxl_domain
for use by other libxl modules.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: move libxlSaveImageOpen to libxl_domain

Move libxlSaveImageOpen from libxl_driver to libxl_domain for
use by other libxl modules.  For consistency, rename to
libxlDomainSaveImageOpen.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: move libxlVmCleanup{,Job} to libxl_domain

Move libxlVmCleanup and libxlVmCleanupJob from libxl_driver to
libxl_domain for use by other libxl modules.  For consistency,
rename to libxlDomainCleanup and libxlDomainCleanupJob.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: move libxlDomEventsRegister to libxl_domain

Move libxlDomEventsRegister from libxl_driver to libxl_domain for
use by other libxl modules.  For consistency, rename to
libxlDomainEventsRegister.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: move libxlDomainAutoCoreDump to libxl_domain

Move libxlDomainAutoCoreDump from libxl_driver to libxl_domain
for use by other libxl modules.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: move libxlDoNodeGetInfo to libxl_conf

Move libxlDoNodeGetInfo from libxl_driver to libxl_conf
for use by other libxl modules.  For consistency, rename to
libxlDriverNodeGetInfo.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: move libxlDomainSetVcpuAffinities to libxl_domain

Move libxlDomainSetVcpuAffinities from libxl_driver to libxl_domain
for use by other libxl modules.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: move libxlFreeMem to libxl_domain

Move libxlFreeMem from libxl_driver to libxl_domain for
use by other libxl modules.  For consistency, rename to
libxlDomainFreeMem.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: move libxlVmStart to libxl_domain

Move libxlVmStart from libxl_driver to libxl_domain for
use by other libxl modules.  For consistency, rename to
libxlDomainStart.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
libxl: include a pointer to the driver in libxlDomainObjPrivate

Include a pointer to the libxl driver in libxlDomainObjPrivate
object so it can be used in the domain event handler and
shutdown thread.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>