Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix / work around gitbuilder problems #364

Merged
merged 3 commits into from Nov 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions teuthology/config.py
Expand Up @@ -113,6 +113,7 @@ class TeuthologyConfig(YamlConfig):
'lock_server': 'http://paddles.front.sepia.ceph.com/',
'max_job_time': 259200, # 3 days
'results_server': 'http://paddles.front.sepia.ceph.com/',
'results_sending_email': 'teuthology',
'src_base_path': os.path.expanduser('~/src'),
'verify_host_keys': True,
'watchdog_interval': 120,
Expand Down
54 changes: 35 additions & 19 deletions teuthology/suite.py
Expand Up @@ -63,7 +63,10 @@ def main(args):

job_config = create_initial_config(suite, suite_branch, ceph_branch,
teuthology_branch, kernel_branch,
kernel_flavor, distro, machine_type)
kernel_flavor, distro, machine_type,
name)
if dry_run:
log.debug("Base job config:\n%s" % job_config)

if suite_dir:
suite_repo_path = suite_dir
Expand Down Expand Up @@ -146,7 +149,8 @@ def fetch_repos(branch, test_name):


def create_initial_config(suite, suite_branch, ceph_branch, teuthology_branch,
kernel_branch, kernel_flavor, distro, machine_type):
kernel_branch, kernel_flavor, distro, machine_type,
name=None):
"""
Put together the config file used as the basis for each job in the run.
Grabs hashes for the latest ceph, kernel and teuthology versions in the
Expand All @@ -163,35 +167,36 @@ def create_initial_config(suite, suite_branch, ceph_branch, teuthology_branch,
kernel_hash = None
else:
kernel_hash = get_hash('kernel', kernel_branch, kernel_flavor,
machine_type)
machine_type, distro)
if not kernel_hash:
schedule_fail(message="Kernel branch '{branch}' not found".format(
branch=kernel_branch))
branch=kernel_branch), name=name)
if kernel_hash:
log.info("kernel sha1: {hash}".format(hash=kernel_hash))
kernel_dict = dict(kernel=dict(kdb=True, sha1=kernel_hash))
else:
kernel_dict = dict()

# Get the ceph hash
ceph_hash = get_hash('ceph', ceph_branch, kernel_flavor, machine_type)
ceph_hash = get_hash('ceph', ceph_branch, kernel_flavor, machine_type,
distro)
if not ceph_hash:
exc = BranchNotFoundError(ceph_branch, 'ceph.git')
schedule_fail(message=str(exc))
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 version '{ver}' not found".format(
ver=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 teuthology_branch:
if not get_branch_info('teuthology', teuthology_branch):
exc = BranchNotFoundError(teuthology_branch, 'teuthology.git')
raise schedule_fail(message=str(exc))
raise schedule_fail(message=str(exc), name=name)
else:
# Decide what branch of teuthology to use
if get_branch_info('teuthology', ceph_branch):
Expand Down Expand Up @@ -343,24 +348,34 @@ def get_distro_defaults(distro, machine_type):
Given a distro (e.g. 'ubuntu') and machine type, return:
(arch, release, pkg_type)

This is mainly used to default to:
This is used to default to:
('x86_64', 'precise', 'deb') when passed 'ubuntu' and 'plana'
And ('armv7l', 'saucy', 'deb') when passed 'ubuntu' and 'saya'
And ('x86_64', 'centos6', 'rpm') when passed anything non-ubuntu
('armv7l', 'saucy', 'deb') when passed 'ubuntu' and 'saya'
('x86_64', 'wheezy', 'deb') when passed 'debian'
('x86_64', 'fedora20', 'rpm') when passed 'fedora'
('x86_64', 'centos6', 'rpm') when passed 'centos'
And ('x86_64', 'rhel7_0', 'rpm') when passed anything else
"""
arch = 'x86_64'
if distro == 'ubuntu':
pkg_type = 'deb'
if machine_type == 'saya':
arch = 'armv7l'
release = 'saucy'
pkg_type = 'deb'
arch = 'armv7l'
else:
arch = 'x86_64'
release = 'precise'
pkg_type = 'deb'
else:
arch = 'x86_64'
elif distro == 'debian':
release = 'wheezy'
pkg_type = 'deb'
elif distro == 'centos':
release = 'centos6'
pkg_type = 'rpm'
elif distro == 'fedora':
release = 'fedora20'
pkg_type = 'rpm'
else:
release = 'rhel7_0'
pkg_type = 'rpm'
log.debug(
"Defaults for machine_type %s: arch=%s, release=%s, pkg_type=%s)",
machine_type, arch, release, pkg_type)
Expand Down Expand Up @@ -388,7 +403,7 @@ def get_gitbuilder_url(project, distro, pkg_type, arch, kernel_flavor):


def package_version_for_hash(hash, kernel_flavor='basic',
distro='ubuntu', machine_type='plana'):
distro='rhel', machine_type='plana'):
"""
Does what it says on the tin. Uses gitbuilder repos.

Expand All @@ -398,6 +413,7 @@ def package_version_for_hash(hash, kernel_flavor='basic',
base_url = get_gitbuilder_url('ceph', release, pkg_type, arch,
kernel_flavor)
url = os.path.join(base_url, 'sha1', hash, 'version')
log.debug("Looking for packages at {url}".format(url=url))
resp = requests.get(url)
if resp.ok:
return resp.text.strip()
Expand Down