From 7da45d65be36d36b880cc55c5036e96c24b53f00 Mon Sep 17 00:00:00 2001 From: Qiaowei Ren Date: Thu, 1 Mar 2018 14:38:11 +0800 Subject: remove ceph code This patch removes initial ceph code, due to license issue. Change-Id: I092d44f601cdf34aed92300fe13214925563081c Signed-off-by: Qiaowei Ren --- src/ceph/qa/tasks/util/__init__.py | 26 --------- src/ceph/qa/tasks/util/rados.py | 87 ------------------------------- src/ceph/qa/tasks/util/rgw.py | 81 ---------------------------- src/ceph/qa/tasks/util/test/__init__.py | 0 src/ceph/qa/tasks/util/test/test_rados.py | 40 -------------- 5 files changed, 234 deletions(-) delete mode 100644 src/ceph/qa/tasks/util/__init__.py delete mode 100644 src/ceph/qa/tasks/util/rados.py delete mode 100644 src/ceph/qa/tasks/util/rgw.py delete mode 100644 src/ceph/qa/tasks/util/test/__init__.py delete mode 100644 src/ceph/qa/tasks/util/test/test_rados.py (limited to 'src/ceph/qa/tasks/util') diff --git a/src/ceph/qa/tasks/util/__init__.py b/src/ceph/qa/tasks/util/__init__.py deleted file mode 100644 index 5b8575e..0000000 --- a/src/ceph/qa/tasks/util/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -from teuthology import misc - -def get_remote(ctx, cluster, service_type, service_id): - """ - Get the Remote for the host where a particular role runs. - - :param cluster: name of the cluster the service is part of - :param service_type: e.g. 'mds', 'osd', 'client' - :param service_id: The third part of a role, e.g. '0' for - the role 'ceph.client.0' - :return: a Remote instance for the host where the - requested role is placed - """ - def _is_instance(role): - role_tuple = misc.split_role(role) - return role_tuple == (cluster, service_type, str(service_id)) - try: - (remote,) = ctx.cluster.only(_is_instance).remotes.keys() - except ValueError: - raise KeyError("Service {0}.{1}.{2} not found".format(cluster, - service_type, - service_id)) - return remote - -def get_remote_for_role(ctx, role): - return get_remote(ctx, *misc.split_role(role)) diff --git a/src/ceph/qa/tasks/util/rados.py b/src/ceph/qa/tasks/util/rados.py deleted file mode 100644 index a83f9e1..0000000 --- a/src/ceph/qa/tasks/util/rados.py +++ /dev/null @@ -1,87 +0,0 @@ -import logging - -from teuthology import misc as teuthology - -log = logging.getLogger(__name__) - -def rados(ctx, remote, cmd, wait=True, check_status=False): - testdir = teuthology.get_testdir(ctx) - log.info("rados %s" % ' '.join(cmd)) - pre = [ - 'adjust-ulimits', - 'ceph-coverage', - '{tdir}/archive/coverage'.format(tdir=testdir), - 'rados', - ]; - pre.extend(cmd) - proc = remote.run( - args=pre, - check_status=check_status, - wait=wait, - ) - if wait: - return proc.exitstatus - else: - return proc - -def create_ec_pool(remote, name, profile_name, pgnum, profile={}, cluster_name="ceph", application=None): - remote.run(args=['sudo', 'ceph'] + - cmd_erasure_code_profile(profile_name, profile) + ['--cluster', cluster_name]) - remote.run(args=[ - 'sudo', 'ceph', 'osd', 'pool', 'create', name, - str(pgnum), str(pgnum), 'erasure', profile_name, '--cluster', cluster_name - ]) - if application: - remote.run(args=[ - 'sudo', 'ceph', 'osd', 'pool', 'application', 'enable', name, application, '--cluster', cluster_name - ], check_status=False) # may fail as EINVAL when run in jewel upgrade test - -def create_replicated_pool(remote, name, pgnum, cluster_name="ceph", application=None): - remote.run(args=[ - 'sudo', 'ceph', 'osd', 'pool', 'create', name, str(pgnum), str(pgnum), '--cluster', cluster_name - ]) - if application: - remote.run(args=[ - 'sudo', 'ceph', 'osd', 'pool', 'application', 'enable', name, application, '--cluster', cluster_name - ], check_status=False) - -def create_cache_pool(remote, base_name, cache_name, pgnum, size, cluster_name="ceph"): - remote.run(args=[ - 'sudo', 'ceph', 'osd', 'pool', 'create', cache_name, str(pgnum), '--cluster', cluster_name - ]) - remote.run(args=[ - 'sudo', 'ceph', 'osd', 'tier', 'add-cache', base_name, cache_name, - str(size), '--cluster', cluster_name - ]) - -def cmd_erasure_code_profile(profile_name, profile): - """ - Return the shell command to run to create the erasure code profile - described by the profile parameter. - - :param profile_name: a string matching [A-Za-z0-9-_.]+ - :param profile: a map whose semantic depends on the erasure code plugin - :returns: a shell command as an array suitable for Remote.run - - If profile is {}, it is replaced with - - { 'k': '2', 'm': '1', 'crush-failure-domain': 'osd'} - - for backward compatibility. In previous versions of teuthology, - these values were hardcoded as function arguments and some yaml - files were designed with these implicit values. The teuthology - code should not know anything about the erasure code profile - content or semantic. The valid values and parameters are outside - its scope. - """ - - if profile == {}: - profile = { - 'k': '2', - 'm': '1', - 'crush-failure-domain': 'osd' - } - return [ - 'osd', 'erasure-code-profile', 'set', - profile_name - ] + [ str(key) + '=' + str(value) for key, value in profile.iteritems() ] diff --git a/src/ceph/qa/tasks/util/rgw.py b/src/ceph/qa/tasks/util/rgw.py deleted file mode 100644 index ab76b50..0000000 --- a/src/ceph/qa/tasks/util/rgw.py +++ /dev/null @@ -1,81 +0,0 @@ -from cStringIO import StringIO -import logging -import json -import requests - -from requests.packages.urllib3 import PoolManager -from requests.packages.urllib3.util import Retry -from urlparse import urlparse - -from teuthology.orchestra.connection import split_user -from teuthology import misc as teuthology - -log = logging.getLogger(__name__) - -def rgwadmin(ctx, client, cmd, stdin=StringIO(), check_status=False, - format='json', decode=True, log_level=logging.DEBUG): - log.info('rgwadmin: {client} : {cmd}'.format(client=client,cmd=cmd)) - testdir = teuthology.get_testdir(ctx) - cluster_name, daemon_type, client_id = teuthology.split_role(client) - client_with_id = daemon_type + '.' + client_id - pre = [ - 'adjust-ulimits', - 'ceph-coverage'.format(tdir=testdir), - '{tdir}/archive/coverage'.format(tdir=testdir), - 'radosgw-admin'.format(tdir=testdir), - '--log-to-stderr', - '--format', format, - '-n', client_with_id, - '--cluster', cluster_name, - ] - pre.extend(cmd) - log.log(log_level, 'rgwadmin: cmd=%s' % pre) - (remote,) = ctx.cluster.only(client).remotes.iterkeys() - proc = remote.run( - args=pre, - check_status=check_status, - stdout=StringIO(), - stderr=StringIO(), - stdin=stdin, - ) - r = proc.exitstatus - out = proc.stdout.getvalue() - if not decode: - return (r, out) - j = None - if not r and out != '': - try: - j = json.loads(out) - log.log(log_level, ' json result: %s' % j) - except ValueError: - j = out - log.log(log_level, ' raw result: %s' % j) - return (r, j) - -def get_user_summary(out, user): - """Extract the summary for a given user""" - user_summary = None - for summary in out['summary']: - if summary.get('user') == user: - user_summary = summary - - if not user_summary: - raise AssertionError('No summary info found for user: %s' % user) - - return user_summary - -def get_user_successful_ops(out, user): - summary = out['summary'] - if len(summary) == 0: - return 0 - return get_user_summary(out, user)['total']['successful_ops'] - -def wait_for_radosgw(url): - """ poll the given url until it starts accepting connections - - add_daemon() doesn't wait until radosgw finishes startup, so this is used - to avoid racing with later tasks that expect radosgw to be up and listening - """ - # use a connection pool with retry/backoff to poll until it starts listening - http = PoolManager(retries=Retry(connect=8, backoff_factor=1)) - http.request('GET', url) diff --git a/src/ceph/qa/tasks/util/test/__init__.py b/src/ceph/qa/tasks/util/test/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/ceph/qa/tasks/util/test/test_rados.py b/src/ceph/qa/tasks/util/test/test_rados.py deleted file mode 100644 index ee1cfa6..0000000 --- a/src/ceph/qa/tasks/util/test/test_rados.py +++ /dev/null @@ -1,40 +0,0 @@ -# -# The MIT License -# -# Copyright (C) 2014 Cloudwatt -# -# Author: Loic Dachary -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, -# copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following -# conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -from .. import rados - -class TestRados(object): - - def test_cmd_erasure_code_profile(self): - name = 'NAME' - cmd = rados.cmd_erasure_code_profile(name, {}) - assert 'k=2' in cmd - assert name in cmd - cmd = rados.cmd_erasure_code_profile(name, { 'k': '88' }) - assert 'k=88' in cmd - assert name in cmd -- cgit 1.2.3-korg