Comment 1 for bug 1550525

Revision history for this message
Andrea Rosa (andrea-rosa-m) wrote :

With the Nova API version 2.24 we have introduced the ability to abort an ongoing live-migration of an instance.
The new API is a DELETE on the server-migrations object

DELETE /servers/{id}/migrations{id}
Nothing needs to be passed in the body.

The call to complete successfully requires that the virtualization driver supports the cancellation of the live-migration.
At the moment the feature is implemented just for the libvirt driver, if the driver doesn't support the cancellation the results of the API call will be an error.
The call is enabled just for Admin user.

To perform a cancellation of a migration, the migration must be in the running state and the migration-type equals to 'live-migration'.
If the cancellation call succeeded then the libvirt driver performs a rollback of the live migration and the state of the Migration object is set to 'cancelled'.

If the request is accepted the http response code is `202 Accepted`

The expected error returned are:

`400 Bad Request`
 - the instance state is invalid for cancellation, i.e. the task state is not 'migrating' or the migration is not in a running
state and the type is 'live-migration'

`403 Forbidden`
- Policy violation if the caller is not granted access to 'os_compute_api:servers:migrations:delete' in policy.json

`404 Not found`
- the server doesn't exist
- the migration doesn't exist

`409 Conflict`
- if the instance is not in the valid state for calling the abort of live migration.