Teuthology docker targets hack (3/5)

The teuthology container hack is improved so each Ceph command is run via docker exec -i which can read from stdin as of docker 1.4 released in December 2014.
It can run the following job

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:

under one minute, when repeated a second time and the bulk of the installation can be reused.

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


The docker exec -i commands a run with

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

The stdin is set when the command is created, as an os.pipe, so that it can be written to immediately, even before the command is actually run (which may happen at a later time if the thread is already busy finished a previous command). The stdout and stderr are consumed immediately after the command is run and copied over to the arguments provided by the caller:

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

All other file descriptors are closed (with close_fds=True), otherwise the child process will hang until they are all closed.

This entry was posted in ceph, docker. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>