Eliminate a few DB calls from Nm.bring_pif_up

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
CA-74937: Reset master (remote DB) connection for any dom0 IP address change

This prevents the master connection from getting "stuck" when:
1. A slave has two NICs, with management on eth0.
2. An IP address is put on eth1, and management is moved to it.
3. The IP address of eth0 is removed.

After step 1, the slave has a master connection with as local (socket)
address the IP of eth0. After step 2, the master connection is reset, but
it may still get the same local address (eth0's IP), since there are now
two routes to the master, and it is up to dom0's kernel to pick one.
After step 3, however, this routes breaks, but the master connection was
not reset. This patch causes the connection to be reset in this case as well.

In the "stuck" state, DB calls may still arrive at the master (and other slave
operations may still work), but the master would send replies to the old IP,
which would never arrive. I believe the slave would eventually realise this
and reset the connection, but only after a very long timeout. I think that
the situation is different when the master goes offline, because the MAC layer
would cause the TCP connection to break immediately, after which the slave
automatically resets the master connection, and keeps trying until the master
is back.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
Reinstate some code that went missing during the Great Xenopsd Merge

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Rename Mirror.active -> Mirror.list, and move the type definitions into the submodule

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Remove content_id from the receive_start call

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Change receive_finalize/receive_cancel to use vdi rather than content_id

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Persist the storage migration state to disk

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Use receive_finalize rather than DP.destroy

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Implement Mirror.list

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Add mirror tests to sm-test binary

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Several changes:

* Make localhost storage migrate work (deadlock problem with DP.destroy)
* Make intra-pool migrate work (don't use importexport for intra-pool)
* Report back error state of mirroring from Mirror.list

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Ensure that storage migrate works even if the vm is rebooted during the process

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Implement VIF mapping in import.ml.

Merged-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>

Conflicts:

	ocaml/xapi/xapi_vm_migrate.ml
Pass the VIF map to xenops.

Merged-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>

Conflicts:

	ocaml/xapi/xapi_vm_migrate.ml
Implements the VIF mapping in xenops.

Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>
Implements VIF mapping in get_internal_state.

Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>
CA-77015: Ignore storage errors in Xenops.VM.destroy, as we used to do.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-77015: Ignore storage errors in Xenops.VM.destroy, as we used to do.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Permit shutdown,reboot,start while migrate_send in current_operations

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
CA-77015: As well as catching the exception, make sure the task isn't marked as failed

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>