]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
added code to the object size by calulucating the cluster size and changed th clean...
authorrakesh <rakesh@dhcp35-53.lab.eng.blr.redhat.com>
Sat, 17 Jun 2017 18:07:13 +0000 (23:37 +0530)
committerVasu Kulkarni <vasu@redhat.com>
Tue, 5 Sep 2017 19:45:12 +0000 (12:45 -0700)
qa/tasks/rgw_system_test.py

index b67061fd513c134abe4b5d077e10557a336888ff..5c65a0a9b9d50b766e56d568c292f2e3186db76d 100644 (file)
@@ -6,7 +6,7 @@ from teuthology.orchestra import run
 log = logging.getLogger(__name__)
 import os
 import pwd
-
+import cStringIO
 
 class Test(object):
 
@@ -254,6 +254,59 @@ def task(ctx, config):
     config['port_number'] = '8080'
     test_config = config['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
+
+    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()))
+
+    available_cluster_size = int(cluster_size['AVAIL'][:-1]) * 1024  # size in MBs
+
+    log.info('cluster available size from parsing: %s' % available_cluster_size)
+
+    available_cluster_size = available_cluster_size / 3  # assuming the replication size is 3, i.e the default value
+
+    log.info('calculated available size: %s' % available_cluster_size)
+
+    usable_size = int(
+        (float(60) / float(100)) * available_cluster_size)  # 60 % of cluster size is being used for automation tests
+
+    osize = usable_size / \
+            (int(test_config['user_count']) *
+             int(test_config['bucket_count']) *
+             int(test_config['objects_count']))
+
+    if osize < 10:
+        log.error('test does not support small size objects less than 10 MB ')
+        exit(1)
+
+    test_config['min_file_size'] = osize - 5
+    test_config['max_file_size'] = osize
+
+    log.info('calucated object max size: %s' % test_config['max_file_size'])
+    log.info('calucated object min size: %s' % test_config['min_file_size'])
+
+    clients[0].run(args=['sudo', 'ceph', 'osd', 'crush', 'tunables', 'optimal'])
+
     # basic Upload
 
     data = None
@@ -510,5 +563,9 @@ def task(ctx, config):
 
         log.info("Deleting repos")
 
-        clients[0].run(args=[run.Raw(
-            'sudo rm -rf venv rgw-tests *.json Download.* Download *.mpFile  x* key.*  Mp.* *.key.*')])
+        cleanup = lambda x: clients[0].run(args=[run.Raw('sudo rm -rf %s' % x)])
+
+        soot = ['venv', 'rgw-tests', '*.json', 'Download.*', 'Download', '*.mpFile', 'x*', 'key.*', 'Mp.*',
+                '*.key.*']
+
+        map(cleanup, soot)
\ No newline at end of file