'Creates a clone of the specified volume.'

def create_cloned_volume(self, volume, src_vref):

    model_update = {}
    scvolume = None
    src_volume_name = src_vref.get('id')
    src_provider_id = src_vref.get('provider_id')
    volume_name = volume.get('id')
    LOG.debug('Creating    cloned    volume    %(clone)s    from    volume    %(vol)s', {'clone': volume_name, 'vol': src_volume_name})
    with self._client.open_connection() as api:
        try:
            srcvol = api.find_volume(src_volume_name, src_provider_id)
            if (srcvol is not None):
                specs = self._get_volume_extra_specs(volume)
                scvolume = api.create_cloned_volume(volume_name, srcvol, specs.get('storagetype:storageprofile'), specs.get('storagetype:replayprofiles'), specs.get('storagetype:volumeqos'), specs.get('storagetype:groupqos'), specs.get('storagetype:datareductionprofile'))
                if (scvolume and (volume['size'] > src_vref['size'])):
                    LOG.debug('Resize    the    volume    to    %s.', volume['size'])
                    scvolume = api.expand_volume(scvolume, volume['size'])
                if (scvolume is None):
                    raise exception.VolumeBackendAPIException(message=(_('Unable    to    create    volume    %(name)s    from    %(vol)s.') % {'name': volume_name, 'vol': src_volume_name}))
                self._add_volume_to_group(api, scvolume, volume)
                model_update = self._create_replications(api, volume, scvolume)
                model_update['provider_id'] = scvolume['instanceId']
        except Exception:
            self._cleanup_failed_create_volume(api, volume_name)
            with excutils.save_and_reraise_exception():
                LOG.error('Failed    to    create    volume    %s', volume_name)
    if (scvolume is not None):
        LOG.debug('Volume    %(vol)s    cloned    from    %(src)s', {'vol': volume_name, 'src': src_volume_name})
    else:
        msg = (_('Failed    to    create    volume    %s') % volume_name)
        raise exception.VolumeBackendAPIException(data=msg)
    return model_update
