From f74c38be2fb48f7e863e15e62d85ba91a417f957 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sat, 19 Dec 2015 17:42:27 +0100 Subject: [PATCH] openstack: install ceph-workbench Signed-off-by: Loic Dachary Conflicts: teuthology/openstack/__init__.py --- scripts/openstack.py | 9 +++++ teuthology/openstack/__init__.py | 10 ++++++ teuthology/openstack/openstack-user-data.txt | 2 +- teuthology/openstack/setup-openstack.sh | 36 +++++++++++++++++++ teuthology/openstack/test/test_openstack.py | 5 +++ teuthology/openstack/test/user-data-test1.txt | 2 +- 6 files changed, 62 insertions(+), 2 deletions(-) diff --git a/scripts/openstack.py b/scripts/openstack.py index 6d0d3592b..68e91adbf 100644 --- a/scripts/openstack.py +++ b/scripts/openstack.py @@ -217,6 +217,15 @@ def get_openstack_parser(): help="use this teuthology branch instead of master", default=os.getenv('TEUTH_BRANCH', 'master'), ) + parser.add_argument( + '--ceph-workbench-git-url', + help="git clone url for ceph-workbench", + ) + parser.add_argument( + '--ceph-workbench-branch', + help="use this ceph-workbench branch instead of master", + default='master', + ) parser.add_argument( '--upload', action='store_true', default=False, diff --git a/teuthology/openstack/__init__.py b/teuthology/openstack/__init__.py index 616497b76..c3dffb496 100644 --- a/teuthology/openstack/__init__.py +++ b/teuthology/openstack/__init__.py @@ -728,6 +728,8 @@ class TeuthologyOpenStack(OpenStack): '--suite-branch', '--ceph-repo', '--ceph', + '--ceph-workbench-branch', + '--ceph-workbench-git-url', '--archive-upload', '--archive-upload-url', '--key-name', @@ -933,16 +935,24 @@ ssh access : ssh {identity}{username}@{ip} # logs in /usr/share/nginx/ clone = ("git clone -b {branch} {url}".format( branch=self.args.teuthology_branch, url=self.args.teuthology_git_url)) + ceph_workbench = '' + if self.args.ceph_workbench_git_url: + ceph_workbench += (" --ceph-workbench-branch " + + self.args.ceph_workbench_branch) + ceph_workbench += (" --ceph-workbench-git-url " + + self.args.ceph_workbench_git_url) log.debug("OPENRC = " + openrc + " " + "TEUTHOLOGY_USERNAME = " + self.username + " " + "CLONE_OPENSTACK = " + clone + " " + "UPLOAD = " + upload + " " + + "CEPH_WORKBENCH = " + ceph_workbench + " " + "NWORKERS = " + str(self.args.simultaneous_jobs)) content = (template. replace('OPENRC', openrc). replace('TEUTHOLOGY_USERNAME', self.username). replace('CLONE_OPENSTACK', clone). replace('UPLOAD', upload). + replace('CEPH_WORKBENCH', ceph_workbench). replace('NWORKERS', str(self.args.simultaneous_jobs))) open(path, 'w').write(content) log.debug("get_user_data: " + content + " written to " + path) diff --git a/teuthology/openstack/openstack-user-data.txt b/teuthology/openstack/openstack-user-data.txt index 1317c6489..f537e86b9 100644 --- a/teuthology/openstack/openstack-user-data.txt +++ b/teuthology/openstack/openstack-user-data.txt @@ -12,6 +12,6 @@ packages: runcmd: - su - -c '(set -x ; CLONE_OPENSTACK && cd teuthology && ./bootstrap install)' TEUTHOLOGY_USERNAME >> /tmp/init.out 2>&1 - echo 'export OPENRC' | tee /home/TEUTHOLOGY_USERNAME/openrc.sh - - su - -c '(set -x ; source openrc.sh ; cd teuthology ; source virtualenv/bin/activate ; openstack keypair delete teuthology || true ; teuthology/openstack/setup-openstack.sh --nworkers NWORKERS UPLOAD --setup-all)' TEUTHOLOGY_USERNAME >> /tmp/init.out 2>&1 + - su - -c '(set -x ; source openrc.sh ; cd teuthology ; source virtualenv/bin/activate ; openstack keypair delete teuthology || true ; teuthology/openstack/setup-openstack.sh --nworkers NWORKERS UPLOAD CEPH_WORKBENCH --setup-all)' TEUTHOLOGY_USERNAME >> /tmp/init.out 2>&1 - /etc/init.d/teuthology restart final_message: "teuthology is up and running after $UPTIME seconds" diff --git a/teuthology/openstack/setup-openstack.sh b/teuthology/openstack/setup-openstack.sh index 9089a9edc..3be3cc65d 100755 --- a/teuthology/openstack/setup-openstack.sh +++ b/teuthology/openstack/setup-openstack.sh @@ -287,6 +287,23 @@ function remove_crontab() { crontab -r } +function setup_ceph_workbench() { + local url=$1 + local branch=$2 + + ( + cd $HOME + source teuthology/virtualenv/bin/activate + if test "$url" ; then + git clone -b $branch $url + cd ceph-workbench + python setup.py install + else + pip install ceph-workbench + fi + ) +} + function get_or_create_keypair() { local keypair=$1 @@ -452,8 +469,11 @@ function main() { local flavor_select local keypair=teuthology local archive_upload + local ceph_workbench_git_url + local ceph_workbench_branch local do_setup_keypair=false + local do_ceph_workbench=false local do_create_config=false local do_setup_dnsmasq=false local do_install_packages=false @@ -490,6 +510,14 @@ function main() { shift archive_upload=$1 ;; + --ceph-workbench-git-url) + shift + ceph_workbench_git_url=$1 + ;; + --ceph-workbench-branch) + shift + ceph_workbench_branch=$1 + ;; --install) do_install_packages=true ;; @@ -499,6 +527,9 @@ function main() { --setup-keypair) do_setup_keypair=true ;; + --setup-ceph-workbench) + do_ceph_workbench=true + ;; --setup-dnsmasq) do_setup_dnsmasq=true ;; @@ -513,6 +544,7 @@ function main() { ;; --setup-all) do_install_packages=true + do_ceph_workbench=true do_create_config=true do_setup_keypair=true do_setup_dnsmasq=true @@ -568,6 +600,10 @@ function main() { setup_crontab || return 1 fi + if $do_ceph_workbench ; then + setup_ceph_workbench $ceph_workbench_git_url $ceph_workbench_branch || return 1 + fi + if $do_setup_keypair ; then get_or_create_keypair $keypair || return 1 fi diff --git a/teuthology/openstack/test/test_openstack.py b/teuthology/openstack/test/test_openstack.py index 1cf0b9df8..c1d021434 100644 --- a/teuthology/openstack/test/test_openstack.py +++ b/teuthology/openstack/test/test_openstack.py @@ -1639,6 +1639,8 @@ openstack keypair delete {key_name} || true argv = (self.options + ['--teuthology-git-url', 'TEUTHOLOGY_URL', '--teuthology-branch', 'TEUTHOLOGY_BRANCH', + '--ceph-workbench-git-url', 'CEPH_WORKBENCH_URL', + '--ceph-workbench-branch', 'CEPH_WORKBENCH_BRANCH', '--upload', '--archive-upload', archive_upload] + teuthology_argv) @@ -1659,6 +1661,9 @@ openstack keypair delete {key_name} || true assert "nworkers=" + str(args.simultaneous_jobs) in l assert "username=" + teuthology.username in l assert "upload=--archive-upload user@archive:/tmp" in l + assert ("ceph_workbench=" + " --ceph-workbench-branch CEPH_WORKBENCH_BRANCH" + " --ceph-workbench-git-url CEPH_WORKBENCH_URL") in l assert "clone=git clone -b TEUTHOLOGY_BRANCH TEUTHOLOGY_URL" in l assert os.environ['OS_AUTH_URL'] in l assert " ".join(teuthology_argv) in l diff --git a/teuthology/openstack/test/user-data-test1.txt b/teuthology/openstack/test/user-data-test1.txt index 9889aa9f3..4e3e466c2 100644 --- a/teuthology/openstack/test/user-data-test1.txt +++ b/teuthology/openstack/test/user-data-test1.txt @@ -2,4 +2,4 @@ system_info: default_user: name: ubuntu -final_message: "teuthology is up and running after $UPTIME seconds, substituded variables nworkers=NWORKERS openrc=OPENRC username=TEUTHOLOGY_USERNAME upload=UPLOAD clone=CLONE_OPENSTACK" +final_message: "teuthology is up and running after $UPTIME seconds, substituded variables nworkers=NWORKERS openrc=OPENRC username=TEUTHOLOGY_USERNAME upload=UPLOAD ceph_workbench=CEPH_WORKBENCH clone=CLONE_OPENSTACK" -- 2.47.3