Reduce duplication/hardcoding related to platform flags

Signed-off-by: John Else <john.else@citrix.com>
CP-4147: Change the USB emulation platform flag semantics

Instead of having a single flag, "nousb", which turns off all USB
emulation, we now have two flags:

  - "usb", which controls USB emulation
  - "usb_tablet", which controls USB emulation, as long as USB emulation
    is turned on

xapi defaults to both keys being true, whereas xenopsd defaults to both
keys being false.

Signed-off-by: John Else <john.else@citrix.com>
Refactor out the platformdata checks

Signed-off-by: John Else <john.else@citrix.com>
CP-4145: Only allow parallel port devices to be passed through to qemu

Signed-off-by: John Else <john.else@citrix.com>
Move a function to test_common

Signed-off-by: John Else <john.else@citrix.com>
Add unit tests for the platformdata checks

Signed-off-by: John Else <john.else@citrix.com>
Merge pull request #1174 from johnelse/ea-1253-clearwater

CLEARWATER: EA-1253: Changes for control of USB/parallel port emulation
Whitespace: reindent part of db_gc.ml

$ camlp4o -printer o -no_comments ocaml/xapi/db_gc md5sum
5a1a9071cb9ef592bca5795af33e3ea2  -
$ git checkout HEAD^
$ camlp4o -printer o -no_comments ocaml/xapi/db_gc.ml | md5sum
5a1a9071cb9ef592bca5795af33e3ea2  -

Signed-off-by: John Else <john.else@citrix.com>
CA-103748: Swap heartbeat and delay in heartbeat thread

If a pool.hello takes over five minutes (which it can do if a lot of
slaves in a large pool are rebooted at once) the master's GC thread will
have declared the slave dead again by the time the pool.hello returns.

The heartbeat thread will signal to the master that the slave is in fact
still alive but only after waiting for the heartbeat delay (which by
default is 30 seconds long).

This means that there is a 30 second window where the startup sequence
is continuing but the slave is seen as dead on the master, and if the
slave tries to plug its PBDs in this window it will receive a
HOST_OFFLINE exception (i.e. the master is telling the slave that it
thinks the slave is offline).

This change means that the first heartbeat is sent *before* the delay
period, closing this window to the time taken to make a few database
calls.

Signed-off-by: John Else <john.else@citrix.com>
Merge pull request #1183 from johnelse/ca-103748-clearwater

CA-103748: Swap heartbeat and delay in heartbeat thread
CA-100561: Fix bash completion with grep color

Signed-off-by: Harrie Pieters <harrie.pieters@citrix.com>
Merge pull request #1186 from HPieters/CA-100561Clearwater

CA-100561: Fix bash completion with grep color