Teuthology docker 目标 hack (3/4)

loic

The teuthology 容器 hack is 改进 so each Ceph 命令是通过 docker exec -i 运行的,它可以 从 stdin 读取,自 docker 1.4 发布以来(2014年12月)。它可以运行以下任务

machine_type: container os_type: ubuntu os_version: "14.04" suite_path: /home/loic/software/ceph/ceph-qa-suite roles

    • mon.a
    • osd.0
    • osd.1
    • client.0 overrides: install: ceph: branch: master ceph: wait-for-scrub: false tasks
  • install
  • ceph

在一分钟之内,当第二次重复时,并且安装的大部分内容 可以重用

{duration: 50.01510691642761, flavor: basic, owner: loic@dachary.org, success: true}

docker exec -i 命令的运行方式是

self.p = subprocess.Popen(self.args, stdin=self.stdin_r, stdout=stdout, stderr=stderr, close_fds=True,)

stdin 在创建命令时设置,作为一个 os.pipe,以便可以立即写入它,即使在实际运行命令之前(如果线程已经忙于完成之前的命令,则可能在稍后进行)。 stdoutstderr 在命令运行后立即被消耗并复制到调用者提供的参数

while ( self.file_copy(self.p.stdout, self.stdout) or self.file_copy(self.p.stderr, self.stderr) )

所有其他文件描述符都已关闭(使用 close_fds=True),否则子进程将挂起,直到所有文件描述符都关闭。