'Generic way to revert volume to a snapshot.
the framework will use the generic way to implement the revert
to snapshot feature:
1. create a temporary volume from snapshot
2. mount two volumes to host
3. copy data from temporary volume to original volume
4. detach and destroy temporary volume'

def _revert_to_snapshot_generic(self, ctxt, volume, snapshot):

    temp_vol = None
    try:
        v_options = {'display_name': ('[revert]    temporary    volume    created    from    snapshot    %s' % snapshot.id)}
        ctxt = (context.get_internal_tenant_context() or ctxt)
        temp_vol = self.driver._create_temp_volume_from_snapshot(ctxt, volume, snapshot, volume_options=v_options)
        self._copy_volume_data(ctxt, temp_vol, volume)
        self.driver.delete_volume(temp_vol)
        temp_vol.destroy()
    except Exception:
        with excutils.save_and_reraise_exception():
            LOG.exception('Failed    to    use    snapshot    %(snapshot)s    to    create    a    temporary    volume    and    copy    data    to    volume        %(volume)s.', {'snapshot': snapshot.id, 'volume': volume.id})
            if (temp_vol and (temp_vol.status == 'available')):
                self.driver.delete_volume(temp_vol)
                temp_vol.destroy()
