'Creates a volume from a snapshot.'

@pure_driver_debug_trace
def create_volume_from_snapshot(self, volume, snapshot):

    vol_name = self._get_vol_name(volume)
    if (snapshot['group_snapshot'] or snapshot['cgsnapshot']):
        snap_name = self._get_pgroup_snap_name_from_snapshot(snapshot)
    else:
        snap_name = self._get_snap_name(snapshot)
    if (not snap_name):
        msg = (_('Unable    to    determine    snapshot    name    in    Purity    for    snapshot    %(id)s.') % {'id': snapshot['id']})
        raise exception.PureDriverException(reason=msg)
    current_array = self._get_current_array()
    current_array.copy_volume(snap_name, vol_name)
    self._extend_if_needed(current_array, vol_name, snapshot['volume_size'], volume['size'])
    self._add_to_group_if_needed(volume, vol_name)
    self._enable_replication_if_needed(current_array, volume)
