'Create a clone of the specified volume.'

def create_cloned_volume(self, volume, src_vref):

    LOG.debug('Entering    create_cloned_volume...')
    LOG.debug('volume:    %s', volume.__dict__)
    LOG.debug('src_vref:    %s', src_vref.__dict__)
    LOG.debug('volume_metadata:    %s', volume['volume_metadata'])
    src_lun_naa = self._get_lun_naa_from_volume_metadata(src_vref)
    src_lun = self.api_executor.get_lun_info(LUNNAA=src_lun_naa)
    lun_index = src_lun.find('LUNIndex').text
    LOG.debug('LUNIndex:    %s', lun_index)
    create_snapshot_name = self._create_snapshot_name(lun_index)
    self.api_executor.create_snapshot_api(lun_index, create_snapshot_name)
    created_snapshot = self.api_executor.get_snapshot_info(lun_index=lun_index, snapshot_name=create_snapshot_name)
    snapshot_id = created_snapshot.find('snapshot_id').text
    LOG.debug('snapshot_id:    %s', snapshot_id)
    while True:
        cloned_lun_name = self._gen_random_name()
        cloned_lun = self.api_executor.get_lun_info(LUNName=cloned_lun_name)
        if (cloned_lun is None):
            break
    self.api_executor.clone_snapshot(snapshot_id, cloned_lun_name)
    max_wait_sec = 600
    try_times = 0
    lun_naa = ''
    while True:
        created_lun = self.api_executor.get_lun_info(LUNName=cloned_lun_name)
        if (created_lun.find('LUNNAA') is not None):
            lun_naa = created_lun.find('LUNNAA').text
        try_times = (try_times + 3)
        eventlet.sleep(self.TIME_INTERVAL)
        if ((try_times > max_wait_sec) or (lun_naa is not None)):
            break
    LOG.debug('LUNNAA:    %s', lun_naa)
    if (volume['size'] > src_vref['size']):
        self._extend_lun(volume, lun_naa)
    _metadata = self._get_volume_metadata(volume)
    _metadata['LUNNAA'] = lun_naa
    _metadata['LunName'] = cloned_lun_name
    return {'metadata': _metadata}
