Teuthology docker 目标 hack (5/5)

loic

teuthology 容器 hack 得到了改进 以运行 teuthology-suite。例如

./virtualenv/bin/teuthology-suite \ --distro ubuntu \ --suite-dir $HOME/software/ceph/ceph-qa-suite \ --config-file docker-integration/teuthology.yaml \ --machine-type container \ --owner loic@dachary.org \ --filter 'rados:basic/{clusters/fixed-2.yaml fs/btrfs.yaml \ msgr-failures/few.yaml tasks/rados_cls_all.yaml}' \ --suite rados/basic --ceph ANY \ $(pwd)/docker-integration/ubuntu.yaml

安排 rados 套件中的单个作业,结果可以收集在 teuthology-worker 存档目录中

$ tail -5 /tmp/a/loic-2015-06-06_16:06:57-rados:\ basic-ANY---basic-container/22/teuthology.log 06:57-rados:basic-ANY---basic-container/22/teuthology.log tasks/rados_cls_all.yaml}', duration: 1017.5819008350372, \ flavor: basic, owner: loic@dachary.org, success: true} 2015-06-06T16:24:38.634 WARNING:teuthology.report:No result_server \ in config; not reporting results 2015-06-06T16:24:38.634 INFO:teuthology.run:pass

tox 集成测试

docker-delegate tox 环境可用于设置 teuthology 集群以运行集成测试 ,例如 lock –list –all
使用 tox -e docker-delegate 创建一个容器,设置一个集群,然后在容器中再次运行 tox 以利用它,使用 tox -e docker-integration

$ tox -e docker-delegate GLOB sdist-make: /home/loic/software/ceph/teuthology/setup.py docker-delegate runtests: PYTHONHASHSEED='1772658356' ... docker run --rm --privileged --name teuthology-ubuntu-14.04 \ --hostname teuthology-ubuntu-14.04 \ -v /tmp:/tmp -v /packages \ -v /var/run/docker.sock:/run/docker.sock \ -v /usr/bin/docker:/bin/docker \ -v /home/loic:/home/loic \ -w /home/loic/software/ceph/teuthology \ --user 1000 teuthology-ubuntu-14.04 \ env HOME=/home/loic tox -e docker-integration ... GLOB sdist-make: /home/loic/software/ceph/teuthology/setup.py docker-integration recreate: /home/loic/software/ceph/teuthology/.tox/docker-integration ... docker-integration/test.py::TestLock::test_list PASSED

=========================== 1 passed in 0.12 seconds =========================== ___________________________________ summary ____________________________________ docker-integration: commands succeeded congratulations :) ___________________________________ summary ____________________________________ docker-delegate: commands succeeded congratulations :)

基于容器的 teuthology-suite

用于 tox 集成测试的容器可以重新用于手动运行作业。

docker run \ --privileged \ --rm --name teuthology-ubuntu-14.04 \ -v /srv/hosts \ -v /tmp:/tmp/tmp \ -v /home/tmp:/packages \ -v /var/run/docker.sock:/run/docker.sock \ -v $(which docker):/bin/docker \ -v $HOME:$HOME -w $(pwd) \ --user $(id -u) -t -i \ teuthology-ubuntu-14.04 bash

/home/tmp 目录必须首先使用 make-debs.sh 填充

$ make-debs.sh /home/tmp

进入容器后,使用以下命令创建 teuthology 集群

loic@85fdacf1c0e3:~/software/ceph/teuthology$ docker-integration/setup.sh docker-integration/setup.sh Current branch master is up to date. New python executable in ./virtualenv/bin/python ... loic@85fdacf1c0e3:~/software/ceph/teuthology$ ps PID TTY TIME CMD 1 ? 00:00:01 bash 215 ? 00:00:04 pecan 221 ? 00:00:00 beanstalkd 12126 ? 00:00:00 teuthology-worker

beanstalkd 总线由 teuthology-schedule 用于与 teuthology-worker 通信,后者将从 paddlespecan 守护程序)锁定机器。锁定机器后,它调用 teuthology 运行作业并将结果存储在存档目录中进行法医分析(例如上面的 /tmp/a)。