From 98e6d9c86064e2375fc618d320ebdf74a09d67b6 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Tue, 15 Sep 2015 12:50:49 +0200 Subject: [PATCH] suite: add config.suite_verify_ceph_hash when no gitbuilder The suite_verify_ceph_hash configuration option is added to disable the gitbuilder package verifications. If True, teuthology-suite verifies that a package matching the ceph branch exists in the gitbuilder. If False, no verification is done and teuthology-suite assumes the packages are either not necessary to run the task or they are created on demand. Signed-off-by: Loic Dachary --- docs/siteconfig.rst | 7 +++++++ teuthology/config.py | 1 + teuthology/suite.py | 25 ++++++++++++++++--------- teuthology/test/test_suite.py | 25 +++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 9 deletions(-) diff --git a/docs/siteconfig.rst b/docs/siteconfig.rst index 2c2b175bde..58c2071051 100644 --- a/docs/siteconfig.rst +++ b/docs/siteconfig.rst @@ -119,6 +119,13 @@ Here is a sample configuration with many of the options set and documented:: # etc. baseurl_template: http://{host}/{proj}-{pkg_type}-{dist}-{arch}-{flavor}/{uri} + # If True, teuthology-suite verifies that a package matching the + # desired ceph branch exists in the gitbuilder. If False, no + # verification is done and teuthology-suite assumes the packages + # are either not necessary to run the task or they are created on + # demand. + suite_verify_ceph_hash: True + # The OpenStack backend configuration, a dictionary interpreted as follows # openstack: diff --git a/teuthology/config.py b/teuthology/config.py index 2a76f266b6..a9365a6099 100644 --- a/teuthology/config.py +++ b/teuthology/config.py @@ -150,6 +150,7 @@ class TeuthologyConfig(YamlConfig): 'koji_task_url': 'https://kojipkgs.fedoraproject.org/work/', 'baseurl_template': 'http://{host}/{proj}-{pkg_type}-{dist}-{arch}-{flavor}/{uri}', 'teuthology_path': None, + 'suite_verify_ceph_hash': True, 'openstack': { 'clone': 'git clone http://github.com/ceph/teuthology', 'user-data': 'teuthology/openstack/openstack-{os_type}-{os_version}-user-data.txt', diff --git a/teuthology/suite.py b/teuthology/suite.py index 4b9b4b3d49..806be43d57 100644 --- a/teuthology/suite.py +++ b/teuthology/suite.py @@ -200,20 +200,27 @@ def create_initial_config(suite, suite_branch, ceph_branch, teuthology_branch, kernel_dict = dict() # Get the ceph hash - ceph_hash = get_hash('ceph', ceph_branch, kernel_flavor, machine_type, - distro) + if config.suite_verify_ceph_hash: + ceph_hash = get_hash('ceph', ceph_branch, kernel_flavor, machine_type, + distro) + else: + ceph_hash = git_ls_remote('ceph', ceph_branch) + if not ceph_hash: exc = BranchNotFoundError(ceph_branch, 'ceph.git') schedule_fail(message=str(exc), name=name) log.info("ceph sha1: {hash}".format(hash=ceph_hash)) - # Get the ceph package version - ceph_version = package_version_for_hash(ceph_hash, kernel_flavor, - distro, machine_type) - if not ceph_version: - schedule_fail("Packages for ceph hash '{ver}' not found".format( - ver=ceph_hash), name) - log.info("ceph version: {ver}".format(ver=ceph_version)) + if config.suite_verify_ceph_hash: + # Get the ceph package version + ceph_version = package_version_for_hash(ceph_hash, kernel_flavor, + distro, machine_type) + if not ceph_version: + schedule_fail("Packages for ceph hash '{ver}' not found".format( + ver=ceph_hash), name) + log.info("ceph version: {ver}".format(ver=ceph_version)) + else: + log.info('skipping ceph package verification') if teuthology_branch and teuthology_branch != 'master': if not git_branch_exists('teuthology', teuthology_branch): diff --git a/teuthology/test/test_suite.py b/teuthology/test/test_suite.py index 87405ee579..d6e9a253fc 100644 --- a/teuthology/test/test_suite.py +++ b/teuthology/test/test_suite.py @@ -782,9 +782,34 @@ class TestSuiteMain(object): fetch_repos=DEFAULT, teuthology_schedule=DEFAULT, sleep=DEFAULT, + get_arch=lambda x: 'x86_64', + git_ls_remote=lambda *args: '1234', + get_hash=DEFAULT, + package_version_for_hash=lambda *args: 'fake-9.5', ) as m: + config.suite_verify_ceph_hash = False main(['--suite', suite_name, '--suite-dir', 'teuthology/test', '--throttle', throttle, '--machine-type', machine_type]) m['sleep'].assert_called_with(int(throttle)) + m['get_hash'].assert_not_called() + + with patch.multiple( + suite, + fetch_repos=DEFAULT, + teuthology_schedule=DEFAULT, + sleep=DEFAULT, + get_arch=lambda x: 'x86_64', + git_ls_remote=lambda *args: '1234', + get_hash=DEFAULT, + package_version_for_hash=lambda *args: 'fake-9.5', + ) as m: + config.suite_verify_ceph_hash = True + m['get_hash'].return_value = '12345' + main(['--suite', suite_name, + '--suite-dir', 'teuthology/test', + '--throttle', throttle, + '--machine-type', machine_type]) + m['sleep'].assert_called_with(int(throttle)) + m['get_hash'].assert_called() -- 2.39.5