'Creates a volume from a snapshot.'

def create_volume_from_snapshot(self, volume, snapshot):

    LOG.debug('create    vol    from    snap:    from    %(snap)s    make    %(vol)s', {'snap': snapshot['id'], 'vol': volume['id']})
    (d_res_name, sname, sprop) = self._resource_and_snap_data_from_snapshot(snapshot)
    new_res = self.is_clean_volume_name(volume['id'], DM_VN_PREFIX)
    r_props = self.empty_dict
    new_vol_nr = 0
    v_props = [(new_vol_nr, self._priv_hash_from_volume(volume))]
    res = self.call_or_reconnect(self.odm.restore_snapshot, new_res, d_res_name, sname, r_props, v_props)
    self._check_result(res, ignore=[dm_exc.DM_ENOENT])
    self._push_drbd_options(d_res_name)
    okay = self._call_policy_plugin(self.plugin_resource, self.policy_resource, dict(resource=new_res, volnr=str(new_vol_nr)))
    if (not okay):
        message = (_('DRBDmanage    timeout    waiting    for    new    volume    after    snapshot    restore;    resource    "%(res)s",    volume    "%(vol)s"') % {'res': new_res, 'vol': volume['id']})
        raise exception.VolumeBackendAPIException(data=message)
    if (('size' in volume) and (volume['size'] > snapshot['volume_size'])):
        LOG.debug("resize    volume    '%(dst_vol)s'    from    %(src_size)d    to    %(dst_size)d", {'dst_vol': volume['id'], 'src_size': snapshot['volume_size'], 'dst_size': volume['size']})
        self.extend_volume(volume, volume['size'])
