'Migrate the volume to the specified host (called on source host).'

def migrate_volume(self, ctxt, volume, host, force_host_copy=False, new_type_id=None):

    try:
        utils.require_driver_initialized(self.driver)
    except exception.DriverNotInitialized:
        with excutils.save_and_reraise_exception():
            volume.migration_status = 'error'
            volume.save()
    model_update = None
    moved = False
    status_update = None
    if (volume.status in ('retyping', 'maintenance')):
        status_update = {'status': volume.previous_status}
    volume.migration_status = 'migrating'
    volume.save()
    if ((not force_host_copy) and (new_type_id is None)):
        try:
            LOG.debug('Issue    driver.migrate_volume.', resource=volume)
            (moved, model_update) = self.driver.migrate_volume(ctxt, volume, host)
            if moved:
                updates = {'host': host['host'], 'cluster_name': host.get('cluster_name'), 'migration_status': 'success', 'previous_status': volume.status}
                if status_update:
                    updates.update(status_update)
                if model_update:
                    updates.update(model_update)
                volume.update(updates)
                volume.save()
        except Exception:
            with excutils.save_and_reraise_exception():
                updates = {'migration_status': 'error'}
                if status_update:
                    updates.update(status_update)
                volume.update(updates)
                volume.save()
    if (not moved):
        try:
            self._migrate_volume_generic(ctxt, volume, host, new_type_id)
        except Exception:
            with excutils.save_and_reraise_exception():
                updates = {'migration_status': 'error'}
                if status_update:
                    updates.update(status_update)
                volume.update(updates)
                volume.save()
    LOG.info('Migrate    volume    completed    successfully.', resource=volume)
