Introduce a more convenient virCgroupNewDetectMachine

Instead of requiring drivers to use a combination of calls
to virCgroupNewDetect and virCgroupIsValidMachine, combine
the two into virCgroupNewDetectMachine

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Make virCgroupIsValidMachine static

The virCgroupIsValidMachine does not need to be called from
outside the cgroups file now, so make it static.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Fix detection of 'emulator' cgroup

When a VM has an 'emulator' child cgroup present, we must
strip off that suffix when detecting the cgroup for a
machine

Rename the virCgroupIsValidMachineGroup method to
virCgroupValidateMachineGroup to make a bit clearer
that this isn't simply a boolean check, it will make
changes to the object.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Add 'controllers' arg to virCgroupNewDetect

When detecting cgroups we must honour any controllers
whitelist the driver may have.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Skip detecting placement if controller is disabled

If the app has provided a whitelist of controllers to be used,
we skip detecting its mount point. We still, however, fill in
the placement info which later confuses the machine name
validation code. Skip detecting placement if the controller
mount point is not set

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Fix virsh snapshot-list error reporting

Noticed that the expected "not supported" error is dropped when
invoking 'virsh snapshot-list dom' on a Xen installation running
the libxl driver

 virsh snapshot-list test
 error: Invalid snapshot: virDomainSnapshotFree

The error is overwritten by a call to virDomainSnapshotFree
in cleanup code within cmdSnapshotList.  Prevent overwritting
the real error by not calling virDomainSnapshotFree with a NULL
virDomainSnapshotPtr.
conf:Fix a copy paste error

Signed-off-by: Alex Jia <ajia@redhat.com>
formatdomain.html.in: Correctly use <code/> in #elementQoS

Interestingly, we had <code>floor<code> ... </code>outbound</code> which
results in much larger block of text to be written in code style that
intended.
formatdomain.html.in: Document implementation limitation of QoS

The outbound/@peak is ignored (since QoS was introduced). This is due to
kernel limitation of know allowing ingress filters to have peak just
average rate. However, we should document this limitation to not confuse
users.
Set the number of elements 0 in virNetwork*Clear

Decrementing it when it was already 0 causes an invalid free
in virNetworkDefUpdateDNSHost if virNetworkDNSHostDefParseXML
fails and virNetworkDNSHostDefClear gets called twice.

virNetworkForwardDefClear left the number untouched even if it
freed all the elements.
Don't check validity of missing attributes in DNS SRV XML

This fixes a crash if one of them is missing.

https://bugzilla.redhat.com/show_bug.cgi?id=988718
Remove double space in error messages
Remove redundant free in virNetworkDNSHostDefParseXML

ip has to be NULL at this point.
Resolve Coverity complaint in storagevolxml2argvtest

Ignore NULL pool in testSetVolumeType to silence Coverity,
even though we only call it with NULL pool when vol is also NULL.

(13) Event var_deref_model:	Passing null pointer "inputpool" to
function "testSetVolumeType(virStorageVolDefPtr, virStoragePoolDefPtr)",
which dereferences it. [details]
Also see events: [assign_zero]

95    testSetVolumeType(inputvol, inputpool);
Separate out StateAutoStart from StateInitialize

Separation allows for dependent drivers to be make a connection during
the AutoStart phase of state initialization.
virStateDriver - Separate AutoStart from Initialize

Adjust these drivers to handle their Autostart functionality after each
of the drivers has gone through their Initialization functions