From 5766ff9893f67dc7340d9344ff6eec44704be147 Mon Sep 17 00:00:00 2001 From: Yichen Wang Date: Thu, 25 Feb 2016 16:20:49 -0800 Subject: [PATCH] Enhancements to support mixed read/write tests 1. Enhancements to support mixed read/write tests; 2. Add a name field for each storage test cases; 3. Support to run customized storage tests by supplying 'extra_opts'; 4. Fixed the get status API error when staging resources; Change-Id: Iecd4001268757ed24fedbc17813f0c0fb8110c68 --- .../kloudbuster/static/kb_test/kb_vm_agent.py | 6 ++-- kb_server/kb_server/controllers/api_kb.py | 7 ++-- kloudbuster/cfg.scale.yaml | 34 ++++++++++++++++--- kloudbuster/kb_runner_storage.py | 1 + 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/kb_dib/elements/kloudbuster/static/kb_test/kb_vm_agent.py b/kb_dib/elements/kloudbuster/static/kb_test/kb_vm_agent.py index d0d3e92..d0023b8 100644 --- a/kb_dib/elements/kloudbuster/static/kb_test/kb_vm_agent.py +++ b/kb_dib/elements/kloudbuster/static/kb_test/kb_vm_agent.py @@ -127,8 +127,8 @@ class KB_Instance(object): # Run fio @staticmethod - def run_fio(dest_path, name, mode, block_size, iodepth, - runtime, rate_iops=None, rate=None, status_interval=None): + def run_fio(dest_path, name, description, mode, block_size, iodepth, runtime, + rate_iops=None, rate=None, rwmixread=None, status_interval=None, extra_opts=None): fixed_opt = '--thread --ioengine=libaio --output-format=json+ --direct=1 ' fixed_opt += '--filename=/mnt/volume/kb_storage_test.bin ' required_opt = '--name=%s --rw=%s --bs=%s --iodepth=%s --runtime=%s ' %\ @@ -136,7 +136,9 @@ class KB_Instance(object): optional_opt = '' optional_opt += '--rate_iops=%s ' % rate_iops if rate_iops else '' optional_opt += '--rate=%s ' % rate if rate else '' + optional_opt += '--rwmixread=%s ' % rwmixread if rwmixread else '' optional_opt += '--status-interval=%s ' % status_interval if status_interval else '' + optional_opt += extra_opts if extra_opts else '' cmd = '%s %s %s %s' % (dest_path, fixed_opt, required_opt, optional_opt) return cmd diff --git a/kb_server/kb_server/controllers/api_kb.py b/kb_server/kb_server/controllers/api_kb.py index 3161d73..fc60614 100644 --- a/kb_server/kb_server/controllers/api_kb.py +++ b/kb_server/kb_server/controllers/api_kb.py @@ -97,14 +97,11 @@ class KBController(object): kloudbuster = kb_session.kloudbuster status_dict = {'status': status} if status == "STAGING": - if hasattr(kloudbuster, 'kloud'): - status_dict['server_vm_count'] = kloudbuster.kloud.vm_up_count - else: - status_dict['server_vm_count'] = 0 + status_dict['server_vm_count'] =\ + getattr(getattr(kloudbuster, 'kloud', None), 'vm_up_count', 0) status_dict['client_vm_count'] = kloudbuster.testing_kloud.vm_up_count return json.dumps(status_dict) - @expose(generic=True) @check_session_id def log(self, *args, **kwargs): diff --git a/kloudbuster/cfg.scale.yaml b/kloudbuster/cfg.scale.yaml index e68ff1a..6d2e766 100644 --- a/kloudbuster/cfg.scale.yaml +++ b/kloudbuster/cfg.scale.yaml @@ -212,9 +212,11 @@ client: # (4) Sequential write # # Accepted testing parameters for each scenario: + # description: (Required) + # A string describing the test case # mode: (Required) # Self-explained with the name, must be one of the below: - # ['randread', 'randwrite', 'read', 'write'] + # ['randread', 'randwrite', 'randrw', 'read', 'write', 'rw'] # runtime: (Required) # Test duration in seconds # block_size: (Required, default=4k) @@ -225,27 +227,49 @@ client: # Cap the bandwidth to this number of IOPS # rate: (Optional, default=unlimited) # Cap the bandwidth to this number of bytes/sec, normal postfix rules apply + # rwmixread: (Required when mode is 'randrw' or 'rw') + # Percentage of a mixed workload that should be reads + # extra_opts: (Optional, default=None) + # Extra options that will be added to the FIO client storage_tool_configs: - - mode: 'randread' + - description: 'Random Read Test Case' + mode: 'randread' runtime: 30 block_size: '4k' iodepth: 4 rate_iops: 100 - - mode: 'randwrite' + - description: 'Random Write Test Case' + mode: 'randwrite' runtime: 30 block_size: '4k' iodepth: 4 rate_iops: 100 - - mode: 'read' + - description: 'Random Read/Write Test Case' + mode: 'randrw' + runtime: 30 + block_size: '4k' + iodepth: 4 + rate_iops: 100 + rwmixread: 70 + - description: 'Sequential Read Test Case' + mode: 'read' runtime: 30 block_size: '64k' iodepth: 64 rate: '60M' - - mode: 'write' + - description: 'Sequential Write Test Case' + mode: 'write' runtime: 30 block_size: '64k' iodepth: 64 rate: '60M' + - description: 'Sequential Read/Write Test Case' + mode: 'rw' + runtime: 30 + block_size: '64k' + iodepth: 64 + rate: '60M' + rwmixread: 70 # Volumes size in GB for each VM # Will effect only in storage testing mode diff --git a/kloudbuster/kb_runner_storage.py b/kloudbuster/kb_runner_storage.py index 3a83cae..6340de9 100644 --- a/kloudbuster/kb_runner_storage.py +++ b/kloudbuster/kb_runner_storage.py @@ -91,6 +91,7 @@ class KBRunner_Storage(KBRunner): # Call the method in corresponding tools to consolidate results LOG.kbdebug(self.result.values()) tc_result = perf_tool.consolidate_results(self.result.values()) + tc_result['description'] = cur_config['description'] tc_result['mode'] = cur_config['mode'] tc_result['block_size'] = cur_config['block_size'] tc_result['iodepth'] = cur_config['iodepth']