'Creates a volume from snapshot.'

def create_volume_from_snapshot(self, volume, snapshot):

    LOG.debug('VeritasNFSDriver    create_volume_from_snapshot    called    volume_id    =    %(volume)s    and    snapshot_id    =    %(snapshot)s', {'volume': volume.id, 'snapshot': snapshot.id})
    snap_name = snapshot.name
    vol_size = volume.size
    snap_size = snapshot.volume_size
    self._do_clone_volume(snapshot, snap_name, volume)
    volume.provider_location = snapshot.provider_location
    if (vol_size != snap_size):
        try:
            self.extend_volume(volume, vol_size)
        except exception.ExtendVolumeError as ex:
            with excutils.save_and_reraise_exception():
                LOG.error('Failed    to    extend    Volume:    %s', ex.msg)
                path = self.local_path(volume)
                self._delete_file(path)
    return {'provider_location': volume.provider_location}
