CA-86869: Don't list snapshots when listing custom templates.

print-custom-templates is used by xe-backup-metadata so that it can then
backup metadata of all custom templates. xapi explicitly blocks exporting
the metadata of snapshots, so there's no reason for
print-custom-templates to include snapshots.

Signed-off-by: John Else <john.else@citrix.com>
CP-3657: Update alert priorities

* Reversed the meaning of mail-min-priority config key, and renamed it
mail-max-priority.

* Removed priority checking from Xapi_vmpp.

* Updated priority checking in mail-alarm.

* Updated comments to reflect XenCenter usage.
Dynamically compute python site-packages directory

This allow to compile and use even if you have newer version of python

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
CA-91927: Reduce the frequency of VM.allowed_operations updates.

When xapi receives a VM update from xenopsd, allowed_operations should
only be updated if a VM field which could affect the allowed_operations
was changed.

Signed-off-by: John Else <john.else@citrix.com>
Whitespace: Xapi_vdi.check_operation_error

$ camlp4o -printer o -no_comments ocaml/xapi/xapi_vdi| md5sum
089dfa0d238d159793ae1bd7e172d0d5  -
$ git checkout HEAD^
$ camlp4o -printer o -no_comments ocaml/xapi/xapi_vdi.ml | md5sum
089dfa0d238d159793ae1bd7e172d0d5  -

Signed-off-by: John Else <john.else@citrix.com>
CA-90263: Pass through a list of SR, PBD and VBD records to Xapi_vdi.check_operation_error

Signed-off-by: John Else <john.else@citrix.com>
CA-90263: Improve efficiency of Xapi_vdi.check_operation_error.

This changeset removes most of the database calls from this function,
assuming it is passed lists of SR, PBD and VBD records.

Signed-off-by: John Else <john.else@citrix.com>
CA-90263: Cache the return values of Helpers.is_tools_sr

Signed-off-by: John Else <john.else@citrix.com>
Whitespace: Cancel_tasks.update_all_allowed_operations.

$ camlp4o -printer o -no_comments ocaml/xapi/cancel_tasks.ml | md5sum
c2950b0075ab9d737e34ce8728258560  -
$ git checkout HEAD^
$ camlp4o -printer o -no_comments ocaml/xapi/cancel_tasks.ml | md5sum
c2950b0075ab9d737e34ce8728258560  -

Signed-off-by: John Else <john.else@citrix.com>
Rebased-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-90263: Improve efficiency of Cancel_tasks.update_all_allowed_operations.

Instead of calling Xapi_vdi.update_allowed_operations, call
Xapi_vdi.update_allowed_operations_internal and pass in cached lists of
SR, PBD and VBD records.

Signed-off-by: John Else <john.else@citrix.com>
Add timing stats to Cancel_tasks.update_all_allowed_operations

Signed-off-by: John Else <john.else@citrix.com>
Rebased-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Add timing stats to Db_gc.single_pass

Signed-off-by: John Else <john.else@citrix.com>
CA-90263: Don't get the SR UUID for each VDI when resynchronising VDI activations.

Signed-off-by: John Else <john.else@citrix.com>
CA-91927: Xapi_xenops event thread should update VM.allowed_operations on master instead of localhost.

Signed-off-by: John Else <john.else@citrix.com>
CA-90263: Remove the need to ever get an SR record as part of Xapi_vdi.check_operation_error

Signed-off-by: John Else <john.else@citrix.com>
CA-91931: Prevent spurious exceptions being raised by Event.from

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-91927: Reduce the number of times a guest agent updated causes an allowed-operations update

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-91930: Remove union of subscriptions between event.from invocations.

This fixes an issue whereby when parallel event.from calls were being
processed, each call would get the union of events meant for each. This
causes particular problems when XenCenter is connected as it registers
for _all_ events. Therefore any other calls made to event.from will
receive _all_ events whenever the GUI is connected. Additionally, as
there is no way to generate a token for 'now', this means that the
initial call to event.from will dump the _entire_ database, including
all the messages, requiring reading these from the disk.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-91930: Add some warning comments to make sure we don't regress this fix.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Merge pull request #864 from mietek/cp-3657