From: rakesh Date: Mon, 25 Feb 2019 08:03:37 +0000 (+0530) Subject: added longrunning task and its suit X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b372e0c16a95bb8432e661183c49388260fda355;p=ceph.git added longrunning task and its suit --- diff --git a/qa/suites/rgw/longrunning/% b/qa/suites/rgw/longrunning/% new file mode 100644 index 00000000000..e69de29bb2d diff --git a/qa/suites/rgw/longrunning/clusters/4-node-bluestore.yaml b/qa/suites/rgw/longrunning/clusters/4-node-bluestore.yaml new file mode 100644 index 00000000000..80e5cb8c26c --- /dev/null +++ b/qa/suites/rgw/longrunning/clusters/4-node-bluestore.yaml @@ -0,0 +1,33 @@ +overrides: + ceph_ansible: + vars: + ceph_stable: true + ceph_origin: distro + ceph_stable_rh_storage: true + ceph_repository: rhcs + ceph_stable_release: luminous + osd_scenario: collocated + journal_size: 1024 + osd_auto_discovery: false + osd_objectstore: bluestore + ceph_test: true + ceph_conf_overrides: + global: + osd_default_pool_size: 3 + osd_pool_default_pg_num: 8 + osd_pool_default_pgp_num: 8 + osd crush chooseleaf type: 0 +roles: +- - mgr.x +- - mon.a + - osd.0 + - osd.1 + - osd.2 +- - osd.3 + - osd.4 + - osd.5 +- - osd.6 + - osd.7 + - osd.8 +- - rgw.0 + - client.0 diff --git a/qa/suites/rgw/longrunning/clusters/4-node.yaml b/qa/suites/rgw/longrunning/clusters/4-node.yaml new file mode 100644 index 00000000000..feacd7fe08a --- /dev/null +++ b/qa/suites/rgw/longrunning/clusters/4-node.yaml @@ -0,0 +1,32 @@ +overrides: + ceph_ansible: + vars: + ceph_stable: true + ceph_origin: distro + ceph_stable_rh_storage: true + ceph_repository: rhcs + ceph_stable_release: luminous + osd_scenario: collocated + journal_size: 1024 + osd_auto_discovery: false + ceph_test: true + ceph_conf_overrides: + global: + osd_default_pool_size: 3 + osd_pool_default_pg_num: 8 + osd_pool_default_pgp_num: 8 + osd crush chooseleaf type: 0 +roles: +- - mgr.x +- - mon.a + - osd.0 + - osd.1 + - osd.2 +- - osd.3 + - osd.4 + - osd.5 +- - osd.6 + - osd.7 + - osd.8 +- - rgw.0 + - client.0 diff --git a/qa/suites/rgw/longrunning/tasks/Mbuckets_with_Nobjects.yaml b/qa/suites/rgw/longrunning/tasks/Mbuckets_with_Nobjects.yaml new file mode 100644 index 00000000000..cf1b2e4e095 --- /dev/null +++ b/qa/suites/rgw/longrunning/tasks/Mbuckets_with_Nobjects.yaml @@ -0,0 +1,24 @@ +# tests s3 objects upload, download and deleting of buckets and objects +# non-multipart upload +tasks: + - ssh-keys: null + - ceph-ansible: null + - rgw-longrunning: + test: Mbuckets_with_Nobjects + script: test_Mbuckets_with_Nobjects.py + config: + user_count: 2 + bucket_count: 2 + size_ranges: [50, 100, 250 ,500, 1000] + local_file_delete: true + test_ops: + create_bucket: true + create_object: true + download_object: true + delete_bucket_object: true + sharding: + enable: false + max_shards: 0 + compression: + enable: false + type: zlib \ No newline at end of file diff --git a/qa/suites/rgw/longrunning/tasks/Mbuckets_with_Nobjects_multipart.yaml b/qa/suites/rgw/longrunning/tasks/Mbuckets_with_Nobjects_multipart.yaml new file mode 100644 index 00000000000..86890909ce7 --- /dev/null +++ b/qa/suites/rgw/longrunning/tasks/Mbuckets_with_Nobjects_multipart.yaml @@ -0,0 +1,25 @@ +# tests s3 objects upload, download and deleting of buckets and objects +# multipart upload +tasks: + - ssh-keys: null + - ceph-ansible: null + - rgw-longrunning: + test: Mbuckets_with_Nobjects_multipart + script: test_Mbuckets_with_Nobjects.py + config: + user_count: 2 + bucket_count: 2 + size_ranges: [50, 100, 250, 500, 1000] + local_file_delete: true + test_ops: + create_bucket: true + create_object: true + download_object: true + delete_bucket_object: true + upload_type: multipart + sharding: + enable: false + max_shards: 0 + compression: + enable: false + type: zlib \ No newline at end of file diff --git a/qa/suites/rgw/longrunning/tasks/Mbuckets_with_Nobjects_sharding.yaml b/qa/suites/rgw/longrunning/tasks/Mbuckets_with_Nobjects_sharding.yaml new file mode 100644 index 00000000000..7090f513967 --- /dev/null +++ b/qa/suites/rgw/longrunning/tasks/Mbuckets_with_Nobjects_sharding.yaml @@ -0,0 +1,24 @@ +# tests s3 objects upload, download and deleting of buckets and objects with sharding enabled +# non-multipart upload +tasks: + - ssh-keys: null + - ceph-ansible: null + - rgw-longrunning: + test: Mbuckets_with_Nobjects + script: test_Mbuckets_with_Nobjects.py + config: + user_count: 2 + bucket_count: 2 + size_ranges: [50, 100, 250, 500, 1000] + local_file_delete: true + test_ops: + create_bucket: true + create_object: true + download_object: true + delete_bucket_object: true + sharding: + enable: true + max_shards: 32 + compression: + enable: false + type: zlib \ No newline at end of file diff --git a/qa/suites/rgw/longrunning/tasks/versioning_ops.yaml b/qa/suites/rgw/longrunning/tasks/versioning_ops.yaml new file mode 100644 index 00000000000..0e86ead91d7 --- /dev/null +++ b/qa/suites/rgw/longrunning/tasks/versioning_ops.yaml @@ -0,0 +1,19 @@ +# tests version enable, download, suspend_version, and upload after objects after suspending +tasks: + - ssh-keys: null + - ceph-ansible: null + - rgw-longrunning: + test: versioning_ops + script: test_versioning_with_objects.py + config: + user_count: 2 + bucket_count: 2 + version_count: 4 + size_ranges: [50, 100, 250, 500, 1000] + local_file_delete: true + test_ops: + enable_version: true + suspend_version: true + copy_to_version: false + delete_object_versions: false + upload_after_suspend: true \ No newline at end of file diff --git a/qa/tasks/rgw_longrunning.py b/qa/tasks/rgw_longrunning.py new file mode 100644 index 00000000000..0e164f1e1d9 --- /dev/null +++ b/qa/tasks/rgw_longrunning.py @@ -0,0 +1,184 @@ +import yaml +import contextlib +import logging +from teuthology import misc as teuthology +from teuthology.orchestra import run + +log = logging.getLogger(__name__) +import os +import pwd +import cStringIO +import time + +log = logging.getLogger(__name__) + +DIR = {"v2": {"script": "rgw/v2/tests/s3_swift/", + "config": "rgw/v2/tests/s3_swift/configs"}} + +MEM_UNITS_CONV = {'MiB': 1024 ** 0, + 'GiB': 1024 ** 1, + 'TiB': 1024 ** 2, + 'PiB': 1024 ** 3} + + +def get_cluster_size_info(clients): + out = cStringIO.StringIO() + clients[0].run(args=['sudo', 'ceph', 'df'], stdout=out) + var = out.readlines() + cluster_size = dict(zip(var[1].split(), var[2].split())) + return cluster_size + + +def do_auto_calculate_io(clients, config): + # re weight osds + """ + # this code may be come of use in future, so just keep in comment. + + out = cStringIO.StringIO() + clients[0].run(args=['sudo', 'ceph', 'osd', 'df'], stdout=out) + var = out.readlines() + + osd_weights = {i.split()[0]:i.split()[1] for i in var[1:len(var)-2]} + + for id, weight in osd_weights.items(): + clients[0].run(args=[run.Raw( + 'sudo ceph osd reweight %s %s' % (id, weight))]) + """ + # get the cluster size + + cluster_size = get_cluster_size_info(clients) + available = cluster_size['AVAIL'] + size, mem_unit = int(float(available[:-3])), available[-3:] + log.info('size: %s, mem_unit: %s' %(size, mem_unit)) + available = size * MEM_UNITS_CONV.get(mem_unit) # convert size to mbs + replication = 3 # assuming the replication size is 3 + log.info('available size: %s' % available) + available = int(float(available) / replication) + log.info('available size with replication(%s): %s' % (replication, available)) + filling_percent = config.get('filling_percent', 60) # default filling percent is 60 + log.info('filling percent: %s' % filling_percent) + usable_size = int((float(filling_percent) / float(100)) * available) + log.info('usable_size: %s' % usable_size) + test_config = config.get('config') + user_count = test_config.get('user_count') + bucket_count = test_config.get('bucket_count') + size_ranges = test_config.get('size_ranges') + version_count = test_config.get('version_count') + each_user_usable_size = int(float(usable_size) / float(user_count)) + log.info('each_user_usable_size: %s' % each_user_usable_size) + each_bucket_usable_size = int(float(each_user_usable_size) / float(bucket_count)) + log.info("each user's bucket usable size: %s" % each_bucket_usable_size) + if version_count is not None: + log.info('got version count') + assert version_count != 0, "version count cannot be zero" + log.info('version_count: %s' % version_count) + each_bucket_usable_size = int(float(each_bucket_usable_size) / float(version_count)) + log.info("each user's bucket size with versioning: %s" % each_bucket_usable_size) + part_size = int(float(each_bucket_usable_size) / float(len(size_ranges))) + log.info('each part size: %s' % part_size) + temp = [] + for sz in size_ranges: + objects = int(float(part_size) / float(sz)) + log.info('size: %s objects: %s' % (sz, objects)) + for i in range(objects): + temp.append(sz) + mapped_sizes = {indx: sz for indx, sz in enumerate(temp)} + log.info('total objects: %s ' % len(mapped_sizes)) + estimated_filling_size = sum(mapped_sizes.values()) + log.info('estimated_filling_size: %s' % estimated_filling_size) + clients[0].run(args=['sudo', 'ceph', 'osd', 'crush', 'tunables', 'optimal']) + time.sleep(60) + return mapped_sizes + + +@contextlib.contextmanager +def task(ctx, config): + """ + pre-validation still pending + """ + + log.info('starting rgw-longrunning') + log.info('config %s' % config) + if config is None: + config = {} + assert isinstance(config, dict), \ + "task set-repo only supports a dictionary for configuration" + config_file_name = config['test'] + ".yaml" + log.info('test_version: %s' % config.get('test_version', 'v2')) + log.info('test: %s' % config['test']) + branch = config.get('branch', 'master') + log.info('script: %s' % config.get('script', config['test'] + ".py")) + test_root_dir = 'rgw-tests' + test_base_path = os.path.join(test_root_dir, 'ceph-qe-scripts') + script = os.path.join(test_base_path, + DIR[config.get('test_version', 'v2')]['script'], + config.get('script', config['test'] + ".py")) + config_file = os.path.join(test_base_path, + DIR[config.get('test_version', 'v2')]['config'], + config_file_name) + log.info('script: %s' % script) + log.info('config_file: %s' % config_file) + soot = ['venv', 'rgw-tests', 'io_info.yaml', '*.json', 'Download.*', 'Download', '*.mpFile', 'x*', 'key.*', 'Mp.*', + '*.key.*'] + cleanup = lambda x: clients[0].run(args=[run.Raw('sudo rm -rf %s' % x)]) + remotes = ctx.cluster.only(teuthology.is_type('client')) + clients = [ + remote for remote, + roles_for_host in remotes.remotes.iteritems()] + map(cleanup, soot) + clients[0].run(args=['mkdir', test_root_dir]) + log.info('cloning the repo to %s' % clients[0].hostname) + clients[0].run( + args=[ + 'cd', + '%s' % test_root_dir, + run.Raw(';'), + 'git', + 'clone', + 'http://gitlab.cee.redhat.com/ceph/ceph-qe-scripts.git', + '-b', + '%s' % branch + ]) + mapped_sizes = do_auto_calculate_io(clients, config) + test_config = {'config': config.get('config')} + test_config['config']['objects_count'] = len(mapped_sizes) + test_config['config']['mapped_sizes'] = mapped_sizes + log.info('config: %s' % test_config) + log.info('creating configuration from data: %s' % test_config) + local_file = os.path.join('/tmp/', + config_file_name + "_" + str(os.getpid()) + pwd.getpwuid(os.getuid()).pw_name) + with open(local_file, 'w') as outfile: + outfile.write(yaml.dump(test_config, default_flow_style=False)) + log.info('local_file: %s' % local_file) + log.info('copying temp yaml to the client node') + clients[0].put_file(local_file, config_file) + clients[0].run(args=['ls', '-lt', os.path.join(test_base_path, + DIR[config.get('test_version', 'v2')]['config'])]) + clients[0].run(args=['cat', config_file]) + # os.remove(local_file) + clients[0].run(args=['virtualenv', 'venv']) + clients[0].run( + args=[ + 'source', + 'venv/bin/activate', + run.Raw(';'), + run.Raw('pip install boto boto3 names PyYaml ConfigParser'), + run.Raw(';'), + 'deactivate']) + time.sleep(60) + log.info('trying to restart rgw service after sleep 60 secs') + clients[0].run(args=[run.Raw('sudo systemctl restart ceph-radosgw.target')]) + log.info('starting the tests after sleep of 60 secs') + time.sleep(60) + clients[0].run( + args=[run.Raw( + 'sudo venv/bin/python2.7 %s -c %s ' % (script, config_file))]) + try: + yield + finally: + log.info('Test completed') + log.info('Cluster size after test completion') + cluster_size = get_cluster_size_info(clients) + log.info('available: %s' % cluster_size['AVAIL']) + log.info("Deleting leftovers") + map(cleanup, soot)