Migration for detached volumes with no snaps.
Implementation of volume migration for detached volumes with no snapshots. Migration is initiated by an admin API. The scheduler confirms that the specified destination host can accept the volume. The source driver is given the opportunity to migrate the volume on their own. Otherwise, a new volume is created on the destination, both volumes are attached, the data is copied over, the volumes are detached, the source is deleted, and the destination is renamed. In the database, the destination volume's attributes are copied to the source so that the volume-id remains unchanged, and the destination volume row is deleted. DocImpact Implements: bp volume-migration Change-Id: Ib6fcf27051f45e60aa3ba5f599e88c1421db753e
This commit is contained in:
@@ -140,6 +140,21 @@ class VolumeAdminController(AdminController):
|
||||
self.volume_api.detach(context, volume)
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
@wsgi.action('os-migrate_volume')
|
||||
def _migrate_volume(self, req, id, body):
|
||||
"""Migrate a volume to the specified host."""
|
||||
context = req.environ['cinder.context']
|
||||
self.authorize(context, 'migrate_volume')
|
||||
try:
|
||||
volume = self._get(context, id)
|
||||
except exception.NotFound:
|
||||
raise exc.HTTPNotFound()
|
||||
params = body['os-migrate_volume']
|
||||
host = params['host']
|
||||
force_host_copy = params.get('force_host_copy', False)
|
||||
self.volume_api.migrate_volume(context, volume, host, force_host_copy)
|
||||
return webob.Response(status_int=202)
|
||||
|
||||
|
||||
class SnapshotAdminController(AdminController):
|
||||
"""AdminController for Snapshots."""
|
||||
|
||||
Reference in New Issue
Block a user