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>
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.
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>
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>
Merge pull request #865 from robhoes/master
Avoid cleaning too much

main build system write some file to main output directory.
Here OUTPUT_SDK_DIR point to the main directory so every files is
wiped out. OUTPUT_SDK_DIR is used only for tmp subdirectory so
clean only this directory
Create directory before copying files

There are cases where the site-packages directory is not created so install
will fail. Make sure directory exists before installing.
Fail if install fails

Error from install was ignored, catch it and exit with an error
This make sure that build fails if some files are not built
Do not try to install not present files

This is required as not install script fails if source file
is not present.
Merge pull request #858 from johnelse/ca-87758