mount.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:kostka 作者: pixers 项目源码 文件源码
def mount_lowerdirs(self):
        # First, build a dependency graph in order to avoid duplicate entries
        dependencies = {}

        def dependency_path(dep):
            container = self.__class__(dep['imageName'])
            path = dep.get('path', os.readlink(os.path.join(container.path, 'overlay.fs')))
            return os.path.join(dep['imageName'], path)

        pending_deps = set(map(dependency_path, self.dependencies))
        while len(pending_deps) > 0:
            path = pending_deps.pop()
            name = path.split('/')[-2]
            if name not in dependencies:
                dependencies[path] = set(map(dependency_path, self.__class__(name).dependencies))
                pending_deps |= dependencies[path]

        # Then sort it topologically. The list is reversed, because overlayfs
        # will check the mounts in order they are given, so the base fs has to
        # be the last one.
        dependencies = reversed(list(toposort_flatten(dependencies)))
        return ':'.join(os.path.join(self.metadata_dir, dep) for dep in dependencies)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号