'Sanitize image_utils\' qemu_img_info.
This code expects to deal only with relative filenames.'

def _qemu_img_info_base(self, path, volume_name, basedir, run_as_root=False):

    run_as_root = (run_as_root or self._execute_as_root)
    info = image_utils.qemu_img_info(path, run_as_root=run_as_root)
    if info.image:
        info.image = os.path.basename(info.image)
    if info.backing_file:
        if self._VALID_IMAGE_EXTENSIONS:
            valid_ext = ('(\\.(%s))?' % '|'.join(self._VALID_IMAGE_EXTENSIONS))
        else:
            valid_ext = ''
        backing_file_template = ('(%(basedir)s/[0-9a-f]+/)?%(volname)s(.(tmp-snap-)?[0-9a-f-]+)?%(valid_ext)s$' % {'basedir': basedir, 'volname': volume_name, 'valid_ext': valid_ext})
        if (not re.match(backing_file_template, info.backing_file, re.IGNORECASE)):
            msg = (_('File    %(path)s    has    invalid    backing    file    %(bfile)s,    aborting.') % {'path': path, 'bfile': info.backing_file})
            raise exception.RemoteFSException(msg)
        info.backing_file = os.path.basename(info.backing_file)
    return info
