VDI.detach: on failure to 'losetup -d', retry forever

These failures appear inevitable because other services on the system
(possibly the kernel?) take a passing interest in the device and cause
the 'losetup -d' to fail occasionally.

The VDI.detach API must not fail, so we retry forever. It should succeed
eventually because this is our loop device, no-one else should take
a permanent interest in it.

Fixes #4

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Start adding vhd support from libvhd and vhdd

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Wire up tapdisk VDI attach, activate, deactivate, detach

When we 'attach' a VDI we create a symlink from the SR/VDI name
to the block device. We can then lookup a Tapctl.tapdev from
this block device. The symlink is stored in a non-persistent
directory so will be cleared on reboot.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Build dependency rename: libvhd -> vhdlib.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Throw a VDI_SIZE Backend_error if the requested VDI has a bad size.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Move utility functions to Common; add 'type format = Vhd | Raw'

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Handle both 'raw' and 'vhd' format files.

The config file specifies a default format, which will be applied
for new disks when the SR is attached unless an override is provided
in the device_config.

When a disk is created we first check to see whether an override
has been specified (sm-config:type=(vhd|raw)) and if not, we fall
back to the default set at SR attach time.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Include the current VERSION in the binary so it can be reported at runtime.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Implement VDI.{snapshot,clone}

For the moment we use 'rename' even though this makes life
difficult over NFS.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
For every vhd 'base image' b, create a file b.readme

The file has two purposes:
  1. it records the names of files which reference this one
  2. it describes in english what the file is for, and why
     it shouldn't be carelessly manually deleted

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Remove unused vhd nodes on VDI.destroy

We update the parent metadata with the new list of children
and recursively delete all parent vhds which are nolonger
reachable.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Expose the capabilities VDI_SNAPSHOT and VDI_CLONE

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
When renaming a vhd, make sure we rewrite the parent metadata

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

Add vhd support