CA-147820: don't run hotplug add if params is missing

This patch checks the return value of "xenstore-read" when it reads
"backend/vbd/domid/devid/params" while processing an "add" event. This
ensures that we won't write garbage to XenStore, which otherwise
confuses everyone.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
CA-119317: Move backend-kind to VDI.other_config

This way the SM driver can set this and special case where necessary for
certain SR types.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CA-119317: Consider VDI.sm_config:backend-kind

Allow a way of an SM driver to configure the VBD backend to be used for this
VDI. This is done by setting the backend-kind key in the sm_config field.

This value will be used but will still be overridden if a value appears in
other-config (user-configurable).

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Whitespace: Fix formatting in Xapi_vbd module.

The following produces the same before and after the commit.

    $ camlp4o -printer o -no_comments ocaml/xapi/xapi_vbd.ml | md5sum
    4d75d489ebdf8bb7b186baaba12a35bb  -

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
CA-133780: Set VBD backend-kind on VBD creation

Getting this informaton from the VDI record in the Xenopsd metadata translation
layer caused CD-eject to hang because ejection is done by setting the VDI ref
for the VBD to NULL.

Instead, the SM can still set the backend-kind sm-config key which will be
placed in other-config of the VBD at creation. It can still be overwritten by
the user.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Use default VBD backend for empty CD drives

Now that the VDI is queried for a VBD backend at VBD creation, we need to
handle the case when the VBD is created with VDI ref NULL. This will be the
case for creating an empty CD drive, for example, on VM.import.

Since the model is to not add anything to the other_config field for default
behaviour then now we widen the exception handling such that _any_ failure to
find a specified backend kind results in the default.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
Merge pull request #2029 from johnelse/blktap3-trunk

Port blktap3 xapi changes to trunk
CA-141064: Don't mandate host-uuid for a standalone pool

This patch obviates from specifying the host-uuid explicitly for a
standalone pool

Signed-off-by: Ravi Pandey <ravi.pandey@citrix.com>
Merge pull request #2037 from ravippandey/CA-141064_trunk

CA-141064: Don't mandate host-uuid for a standalone pool
Merge pull request #1969 from tmakatos/CA-147820

CA-147820: don't run hotplug add if params is missing
Deduplicate some code

Signed-off-by: John Else <john.else@citrix.com>
CA-151670: Don't double count HA-protected VMs when restarting them

When attempting to restart HA-protected VMs after an HA failure, they
should be not treated as new VMs to add to the HA plan, since HA will
already be taking them into account.

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