rpc: Check and message setsockopt()

Check status when attempting to set SO_REUSEADDR flag on outgoing connection
On failure, VIR_WARN(), but continue to connect. This code path is on the
sender side where the setting is just a hint and would only take effect if
the sender is overflowed with TCP connections.  Inability to set doesn't mean
failure to establish a connection.
tools: Check return status on virBufferTrim()
util: Check for negative indent in virBufferAdd

Since virBufferGetIndent() will check and fail on buf->error, I
removed that check from virBufferAdd() and used the -1 return as the
way to exit.
Convert virDomainObj, qemuAgent, qemuMonitor, lxcMonitor to virObjectLockable

The  virDomainObj, qemuAgent, qemuMonitor, lxcMonitor classes
all require a mutex, so can be switched to use virObjectLockable

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Convert all rpc classes over to virObjectLockable
Add a port allocator class

Introduce a virPortAllocator for managing TCP port allocations.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Convert QEMU driver over to use virPortAllocator APIs

Replace the current QEMU driver code for managing port
reservations with the new virPortAllocator APIs.
Convert libxl driver over to use virPortAllocator APIs

Replace the current libxl driver code for managing port
reservations with the new virPortAllocator APIs.
qemu: fix QEMU_CAPS_NO_ACPI detection

In commit c4bbaaf8, caps->arch was checked uninitialized, rendering the
whole check useless.

This patch moves the conditional setting of QEMU_CAPS_NO_ACPI to
qemuCapsInitQMP, and removes the no longer needed exception for S390.

It also clears the flag for all non-x86 archs instead of just S390 in
qemuCapsInitHelp.
conf: fix class_id bitmap leak in virNetworkObj

Commit '07d1b6b' added class_id bitmap to virNetworkObj but never freed
it.
conf: fix leak in virDomainVcpuPinAdd

Fix the leak of vcpupin on failure to allocate cpumask and the leak of
cpumask if we fail to expand vcpupin_list.
locking: Resolve resource leaks on non error path

Both 'dir' and 'path' were not free'd on successful return
libxl: Use consistent style for function definitions

Commit dfa1e1dd added functions whose definitions do not conform
to the style used in the libxl driver.  Change these functions to
be consistent throughout the driver.
libxl: Use consistent parameter naming scheme

Use consistent parameter names throughout the libxl timeout and fd
event functions.
libxl: Don't free domain death event

Callers should not free death events provided by libxl_evdisable_FOO().
libxl: Check for libxl_ctx_alloc failure
libxl: Fix cleanup on domain start error

If building the libxl domain config fails, cleanup before returning
failure.
Fix typo in variable name

that broke the build like:

  CC     libvirt_conf_la-domain_conf.lo
  conf/domain_conf.c: In function 'virDomainVcpuPinAdd':
  conf/domain_conf.c:11920:29: error: 'vpcupin' undeclared (first use in this function)
  conf/domain_conf.c:11920:29: note: each undeclared identifier is reported only once for each function it appears in
  make[3]: *** [libvirt_conf_la-domain_conf.lo] Error 1
call virstateCleanup to do the cleanup before libvirtd exits
include util.h in cgroup.h

required by VIR_ENUM_DECL.