def _get_snap_dev(filename, backing_store):
    if (filename is None):
        msg = _('filename cannot be None')
        raise exception.NovaException(msg)
    LOG.debug(('XML: %s' % xml))
    LOG.debug(('active disk object: %s' % active_disk_object))
    filename_to_merge = filename
    matched_name = None
    b = backing_store
    index = None
    current_filename = active_disk_object.source_name.split('/')[1]
    if (current_filename == filename_to_merge):
        return (my_dev + '[0]')
    while (b is not None):
        source_filename = b.source_name.split('/')[1]
        if (source_filename == filename_to_merge):
            LOG.debug(('found match: %s' % b.source_name))
            matched_name = b.source_name
            index = b.index
            break
        b = b.backing_store
    if (matched_name is None):
        msg = (_('no match found for %s') % filename_to_merge)
        raise exception.NovaException(msg)
    LOG.debug(('index of match (%s) is %s' % (b.source_name, index)))
    my_snap_dev = ('%s[%s]' % (my_dev, index))
    return my_snap_dev
def _get_snap_dev(filename, backing_store):
    if (filename is None):
        msg = _('filename cannot be None')
        raise exception.NovaException(msg)
    LOG.debug(('XML: %s' % xml))
    LOG.debug(('active disk object: %s' % active_disk_object))
    filename_to_merge = filename
    matched_name = None
    b = backing_store
    index = None
    current_filename = active_disk_object.source_name.split('/')[1]
    if (current_filename == filename_to_merge):
        return (my_dev + '[0]')
    while (b is not None):
        source_filename = b.source_name.split('/')[1]
        if (source_filename == filename_to_merge):
            LOG.debug(('found match: %s' % b.source_name))
            matched_name = b.source_name
            index = b.index
            break
        b = b.backing_store
    if (matched_name is None):
        msg = (_('no match found for %s') % filename_to_merge)
        raise exception.NovaException(msg)
    LOG.debug(('index of match (%s) is %s' % (b.source_name, index)))
    my_snap_dev = ('%s[%s]' % (my_dev, index))
    return my_snap_dev