smapiv2: Use the xcp-idl service API rather than a hand-rolled webserver

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
'xe sr-create' now allows device-config parameter values to be uploaded from files.

We can now say:

  xe sr-create type=libvirt name-label=ceph device-config:xml-filename=ceph-sr.xml

and the local file 'ceph-sr.xml' will be uploaded as the value for the device-config
key 'xml'.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
On PBD.plug, refresh global SR metrics by invoking SR.update

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Don't assume that VDI.location is globally-unique

The pair of (SR.uuid, VDI.location) is globally unique.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Make the tools SR compatible with both 'iso' and 'ffs' drivers

Signed-off-by: David Scott <dave.scott@eu.citrix.com>

Conflicts:
	ocaml/xapi/dbsync_master.ml
sr-scan: If a disk image's filename is a valid UUID, use that value as the VDI's UUID.

Signed-off-by: Euan Harris <euan.harris@citrix.com>
Examine the vdi's primary key (typically the filename) and use it as a uuid, if it's already a uuid.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
SR: Only consider a filename to be a UUID if it is the correct length

Uuid.is_uuid only checks that the string passed to it _starts_ with a
valid UUID, so Uuid.is_uuid "82cf569a-344d-9c62-95bc-ac693202e25a_foo_bar"
returns True.   Uuidm's behaviour is the same...

Check that the file's base name is the right length, in addition to parsing
correctly.

Signed-off-by: Euan Harris <euan.harris@citrix.com>
SMAPIv2: avoid calling ourselves via the Unix domain socket

Instead we should be able to call internal functions directly.

The snag is that the storage_{mux,impl,migrate} end up with a
circular dependency if one tries to call storage_mux (the local
entrypoint) from storage_migrate (one of the places making loopback
calls). The boundaries between these modules need to be rethought.
In the meantime, work around the problem by stashing a local
'Rpc.call -> Rpc.response' function in a reference in a new module
storage_server.

To make a local SMAPI call one can use the module

  Storage_local_client

Signed-off-by: David Scott <dave.scott@eu.citrix.com>

Conflicts:
	ocaml/xapi/storage_migrate.ml
Constants in OCaml should not be all caps  #NOTPYTHON

Signed-off-by: Euan Harris <euan.harris@citrix.com>
Update storage_impl_test to use xcp-idl/xcp_service

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Merge pull request #1554 from djs55/upstream/smapiv2

SMAPIv2 bugfixes