xenopsd: Support driver domains for PV guests

The case of HVM guests with emulated QEMU networks devices is not yet
handled.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Allow setting the VIF backend for a network

If, on a network, other_config:backend_vm is set to the UUID of a VM, this VM is
used for the VIF backends (netback) of any VIFs on the network.

This is useful for internal networks (only), since the key is set on a network
rather than on a PIF.

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

$ camlp4o -printer o -no_comments ocaml/xapi/xapi_vm.ml | md5sum
46e5866dd5fcb2d8ebac427aa1889aad  -
$ git checkout HEAD^
$ camlp4o -printer o -no_comments ocaml/xapi/xapi_vm.ml | md5sum
46e5866dd5fcb2d8ebac427aa1889aad  -

Signed-off-by: John Else <john.else@citrix.com>
CA-99726: Don't make VM.provisions wait in line

VM.provision will run after a template has been copied or cloned, so we
don't need it to wait in line behind other VM.copy or VM.checkpoint
tasks.

Signed-off-by: John Else <john.else@citrix.com>
CP-2190 for PR-1221: SR alerts for hosts can be configured on the SR now.

To reduce the effort of configuration, whereas previously it was
necessary to configure throughput alerts for an SR on each host
individually, now it is possible to set up a per-host SR throughput
alert for each host connected to an SR by writing to the SR's
other-config:perfmon key.
CI-44: Add an extra field "originator" to session object.

This is a key string used for distinguishing different API users sharing the same login name.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: Add the originator param to XAPI session creation

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: update internal uses of login_with_password with the originator param

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: update external components and tests with the new originator param

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: Add max_sessions_per_originator config

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: update session create/destory rbac audit functions

Based on some previous patches from Thomas Sanders.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: it seems making better sense to expire tasks before sessions

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: add max_sessions_per_user_name config variable

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CI-44: expire sessions based on username/originator specific quota

Based on some previous patches by Thomas Sanders.

The current algorithm is implemented as follows:

  * For sessions with their own auth_user_name (other than "root"/""), they will use their independent session quota (Xapi_globs.max_sessions_per_user_name) grouped by their auth_user_name. This can happen in following cases:
    - The session creator uses an external authentication method where the username is not the default
    - The session creator is logged in as local super user (hence no username/password authentication required) but still chooses to pass an independent username argument in purpose (e.g. vmpr, sm)

  * Sessions without independent auth_user_name (e.g. without RBAC, most external API users will have to share the same super user login) can still distiguish themselves using the new "originator" param during session creation. For sessions created with the optional "originator" argument, they will use their independent session quota (Xapi_globs.max_sessions_per_originator) grouped by their originator key.

  * All the rest sessions are in the common session pool, as before, sharing the default session quota (Xapi_globs.max_sessions). Among them, internal sessions will have higher prioirty than the external ones.

Signed-off-by: Zheng Li <zheng.li@eu.citrix.com>
CP-4325: Split License_check.check_expiry up into two functions.

Signed-off-by: John Else <john.else@citrix.com>
CP-4325: Implement pool.get_license_state

Signed-off-by: John Else <john.else@citrix.com>
CP-4325: Add pool.license_state getter to CLI

Signed-off-by: John Else <john.else@citrix.com>
Add Test_common.make_pool

Signed-off-by: John Else <john.else@citrix.com>
Add high-level unit testing framework

Signed-off-by: John Else <john.else@citrix.com>
CP-4325: Add tests for pool-wide license logic

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