CA-100511: Don't fail SXM when guests are shutdown during migration

If, during the VDI copy to the remote, the guest is shutdown then, when it
comes to moving the domain, Xenops will complain that the domain doesn't exist.
We had already desinged to handle this case but the exception catch needed to
be broadened to match the new "extra" TypedTable used for the VM metadata.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
VDI.copy: add extra arguments for deltas, and copying "into"

VDI.copy now takes arguments:
 vdi: the disk to copy
 base: if present, we will copy differences from here only
 SR: if no "into" VDI is provided, a fresh VDI will be created
     in this SR
 into: if present, the existing disk we will write the blocks into

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
CA-120529: Wait for receiver in X-host VDI.copy

The sender was completing the VDI.copy operation after it had sent the last of
the data. This meant that any subsequent operations on the new VDI could fail
with VDI_IN_USE because the datapath on the receiver had yet to be destroyed.

Now we forward the task to the receiving host and wait for it to set it as
complete.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
 CA-120529: Propagate VDI.copy receiver failures

If the receiver fails but the sender has already sent all its data then it
would have deemed the copy a success. This is dangerous since we can end up
with VDI corruption on the receiver and the impression that the copy was
successful.

Now we re-raise any errors encountered on the receiver back on the sender side
in the case of cross-host VDI.copy.

Signed-off-by: Si Beaumont <simon.beaumont@citrix.com>
VDI.copy: add implementation for 'base' and 'into' arguments

If 'base' is provided then we will perform a delta-copy.
If 'into' is provided then we will copy into this existing VDI,
  otherwise we will create a fresh VDI in the SR given by 'sr'

However:
* if 'into' is read-only then we will fail with VDI_READONLY
* if 'into' is too small then we will fail with VDI_TOO_SMALL
* if 'base' is provided but the destination VDI (either 'into'
  or the fresh one we created in 'sr') does not support spareness
  then we fail with VDI_NOT_SPARSE

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
quicktest: add a test for new VDI.copy functionality

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
CA-127975: Run sparse_dd with new subtask during cross-host VDI.copy

Previously sparse_dd (and the receiving import_raw_vdi operation)
re-used the VDI.copy task, marking it complete once the import had
finished.

This caused problems with cross-host VM.copy, as the VM.copy operation
would also watch the VDI.copy task for completion. The VM.copy would
attempt to extract the new VDI reference from the task result straight
away, but import_raw_vdi did not add this to the task result on
completion, leading to the VM.copy failing with Xml.Error.

Adding the new VDI ref to the VDI.copy task result did not fix the
problem, as in this case the VM.copy operation would immediately destroy
the VDI.copy task as soon as it was marked completed. The VDI.copy
operation would then fail, as its task no longer existed, and it would
clean up by destroying the new VDI. Meanwhile the VM.copy operation would
complete without an exception being raised.

The approach taken here is to create a new task for the import_raw_vdi
operation. VDI.copy watches for this task to be completed, and VM.copy
in turn watches for the VDI.copy operation to be completed. This way
there is no race between VDI.copy and VM.copy, and the new VDI ref is
automatically added to the VDI.copy task's result on completion.

Signed-off-by: John Else <john.else@citrix.com>
Replacing clearwater_release with tampa_release