'Creates a clone of the specified volume.'

@retry_wrapper
def create_cloned_volume(self, vol, src_vref, truncate_name=False):

    self.authenticate_user()
    name = self._get_resource_name(vol, MAX_DEFAULT_NAME_LENGTH, truncate_name)
    srcname = self._get_coprhd_volume_name(src_vref)
    try:
        if src_vref.group_id:
            raise coprhd_utils.CoprHdError(coprhd_utils.CoprHdError.SOS_FAILURE_ERR, _("Clone    can't    be    taken    individually    on    a    volume    that    is    part    of    a    Consistency    Group"))
    except KeyError as e:
        pass
    except AttributeError:
        pass
    try:
        (storageres_type, storageres_typename) = self.volume_obj.get_storageAttributes(srcname, None, None)
        resource_id = self.volume_obj.storage_resource_query(storageres_type, srcname, None, None, self.configuration.coprhd_project, self.configuration.coprhd_tenant)
        self.volume_obj.clone(name, resource_id, sync=True)
        full_project_name = ('%s/%s' % (self.configuration.coprhd_tenant, self.configuration.coprhd_project))
        detachable = self.volume_obj.is_volume_detachable(full_project_name, name)
        LOG.debug('Is    volume    detachable    :    %s', detachable)
        if detachable:
            self.volume_obj.volume_clone_detach('', full_project_name, name, True)
    except IndexError:
        LOG.exception('Volume    clone    detach    returned    empty    task    list')
    except coprhd_utils.CoprHdError as e:
        coprhd_err_msg = (_('Volume    %(name)s:    clone    failed\n%(err)s') % {'name': name, 'err': six.text_type(e.msg)})
        log_err_msg = ('Volume    :    {%s}    clone    failed' % name)
        self._raise_or_log_exception(e.err_code, coprhd_err_msg, log_err_msg)
    src_vol_size = 0
    dest_vol_size = 0
    try:
        src_vol_size = src_vref.size
    except AttributeError:
        src_vol_size = src_vref.volume_size
    try:
        dest_vol_size = vol.size
    except AttributeError:
        dest_vol_size = vol.volume_size
    if (dest_vol_size > src_vol_size):
        size_in_bytes = coprhd_utils.to_bytes(('%sG' % dest_vol_size))
        try:
            self.volume_obj.expand(('%s/%s' % (self.configuration.coprhd_tenant, self.configuration.coprhd_project)), name, size_in_bytes, True)
        except coprhd_utils.CoprHdError as e:
            coprhd_err_msg = (_('Volume    %(volume_name)s:    expand    failed\n%(err)s') % {'volume_name': name, 'err': six.text_type(e.msg)})
            log_err_msg = ('Volume    :    %s    expand    failed' % name)
            self._raise_or_log_exception(e.err_code, coprhd_err_msg, log_err_msg)
