Don't call VM.stat every time we receive a xapi event on a VM.

VM.stat is expensive as it does lots of xenstore reads - just check that
the VM exists in xenopsd's database instead.

Signed-off-by: John Else <john.else@citrix.com>
Dump xenopsd updates every time we push an update.

Signed-off-by: John Else <john.else@citrix.com>
Sort events properly.

Signed-off-by: John Else <john.else@citrix.com>
Oliver/HFX-908:CA-87377: Snapshot updates state in inject_barrier

Xapi then receives updates including barrier information from the
updates.get API call. Xapi processes the barriers first, as these
have threads waiting on them.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>

Conflicts:

	ocaml/xapi/xapi_fist.ml
CA-87377: Add barriers info to xn diagnostics

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-105160: Make sure event_wait is cancellable

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-105159: Wait for ack of shutdown request for HVM guests with PV drivers

The code paths only handled fully-PV guests and HVM guests without PV drivers.
In the case of PV drivers we did not wait for the shutdown request to be
acknowledged. This did not enable early exit if the request was not
acknowledged.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CA-105155: Make sure we timeout as requested

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Oliver/HFX-908:Make VM.shutdown timeout configurable.

The default remains at 1200.0

Configure by creating/editing a file /etc/xensource/xapi_globs.conf
and put in the line:

domain_shutdown_total_timeout = 30.0

for example.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>

Conflicts:

	ocaml/xapi/xapi_vm.ml
Make it such that you can do a hard_shutdown even if a clean_shutdown is in progress

Same for reboot

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Oliver/HFX-908:CA-105793: Don't ignore the shutdown_delay parameter.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>

Conflicts:

	ocaml/xapi/xapi_vm.ml
Oliver/HFX-908:SCTX-1334: Add exception handlers

In response to code review with djs55

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>

Conflicts:

	ocaml/xapi/message_forwarding.ml
Raise the correct error if a xenops task is cancelled

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Oliver/HFX-908:SCTX-1334: Ensure that a force shutdown cancels any clean_shutdown.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>

Conflicts:

	ocaml/xapi/message_forwarding.ml
Merge pull request #1384 from akshayramani/Oliver/HFX-908

Oliver/HFX-908: TAMPA commits for Hotfix Oliver