Update to the Xen-4.2 interface (deactived by #ifdefs)

We now have:
 * configurable xenstore and console backend domids
 * incrementable VM generation counts

This is all disabled by #ifdef XENGUEST_4_2 for now.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
If Xenctrl.domain_set_mmap_limit fails, log and continue

For an undiagnosed reason, this fails on xen-4.2

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
CA-89978: Fix restoration of database from temporary restore file.

- Delete the temporary restore file after using it to populate the
  database - if we don't do this then xapi will use the restore file
  again the next time it starts up.

- Perform the initial database flush to the global list of database
  connections in all cases; don't flush to the restore database file
  if it's being used.

Signed-off-by: John Else <john.else@citrix.com>
CA-89978: Log the location(s) from which we're attempting to read the db.

Signed-off-by: John Else <john.else@citrix.com>
CP-3638: Remove now redundant code from various source files in rrdd and xapi.

Signed-off-by: Rok Strniša <rok.strnisa@citrix.com>
CA-87758: When handling an HTTP request, perform any logins/logouts on the master.

Previously we always attempted all logins and logouts via an RPC call
to localhost - the logouts would fail silently on a slave, causing a
session leak.

Signed-off-by: John Else <john.else@citrix.com>
CA-90580: Pass VIF QoS settings to xenopsd.

Previously we were just passing rate = None, independent of the QoS
settings in xapi.

Signed-off-by: John Else <john.else@citrix.com>
CA-84305: Allow SR.destroy if an SR contains only unmanaged VDIs.

This was originally fixed as CA-79059, but the fix was lost when the
SR.allowed_operations code was moved to xapi_sr_operations.ml.

Signed-off-by: John Else <john.else@citrix.com>
Remove duplicated SR allowed_operations code.

As of the last commit, the removed code is identical to that in
xapi_sr_operations.ml.

Signed-off-by: John Else <john.else@citrix.com>
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>
Whitespace: Xapi.resynchronise_ha_state

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

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.
CA-88864: Make sure that dom0 is marked as running when resynchronising HA state.

Signed-off-by: John Else <john.else@citrix.com>
Revert the rebalance-interval changes to networkd of f03a30793ccdbf0b6071a5bfe5d8de06aa2984df

The policies for which values are set in the network layer should be in xapi. Networkd should
just do do what xapi says.

After this change, the default rebalance-intervals are unchanged: for balance-slb bonds is 30min,
while for LACP bonds, the value is unset and the default from the ovs is used (10s). However, the
change makes it possible for the user to override the rebalance-interval using the other-config key,
even in the LACP case (for whatever reason).

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-77465 fix: xe pool-certificate-install now works with a filepath.
Also fixed the same bug in pool-crl-install.

Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
[new] New ocaml lib 'rrd-client' in order to move rrd2csv and RRDD plugins out of the xen-api repository
[fix] Fixing rrd-client compilation (a var was forgotten while merging)
[build] Adding RPM packaging information for the rrd-client library
Install xapi-rrd-devel package into PACKAGES.main as well.

RRD plugin framework should be installed by default for post-Tampa releases.

Signed-off-by: Rok Strniša <rok.strnisa@citrix.com>
CA-74343: Fix HA on VLANs

The recent change to not automatically plug VLANs on host boot (for
scalability reasons), led the HA code to believe that VMs on VLANs
were not agile, even if they were.

It turns out that the agility check for networking is too strict.
Currently, xapi only considers a VM agile if all its networks
1. have PIFs on all enabled hosts, AND
2. have all those PIFs attached/plugged.

This is too strict, because a PIF can always be plugged, unless it is
a bond slave, and xapi automatically plugs a PIF when it is needed by a
VM.

Therefore, the agility check was changed to require that a VM's networks
1. have PIFs on all enabled hosts, AND
2. none of those PIFs are bond slaves.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>