aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingLu5 <lvjing5@huawei.com>2017-08-02 07:16:27 +0000
committerJingLu5 <lvjing5@huawei.com>2017-08-03 04:03:24 +0000
commitcee68c826b54f005de93a1cba39f2399a65d002b (patch)
treeb88557550f20c6dc0900cc12f2836882d6ed9cb1
parente78324bf2672a694f460e953373f18729c476e8d (diff)
New storage test case: Bonnie++
JIRA: YARDSTICK-770 Bonnie++ is a disk and file system benchmarking tool for measuring I/O performance. With Bonnie++ you can quickly and easily produce a meaningful value to represent your current file system performance. This work is add new storage test case using Bonnie++. Change-Id: I752fee156707cda730962c68d17fda4d4e9cd472 Signed-off-by: JingLu5 <lvjing5@huawei.com>
-rw-r--r--docs/testing/user/userguide/opnfv_yardstick_tc079.rst109
-rwxr-xr-xinstall.sh1
-rw-r--r--samples/bonnie++.yaml55
-rw-r--r--tests/unit/benchmark/scenarios/storage/test_bonnie.py74
-rwxr-xr-xtools/ubuntu-server-cloudimg-modify.sh1
-rw-r--r--yardstick/benchmark/scenarios/storage/bonnie.py97
6 files changed, 337 insertions, 0 deletions
diff --git a/docs/testing/user/userguide/opnfv_yardstick_tc079.rst b/docs/testing/user/userguide/opnfv_yardstick_tc079.rst
new file mode 100644
index 000000000..2c1091770
--- /dev/null
+++ b/docs/testing/user/userguide/opnfv_yardstick_tc079.rst
@@ -0,0 +1,109 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International
+.. License.
+.. http://creativecommons.org/licenses/by/4.0
+.. (c) OPNFV, Huawei Technologies Co.,Ltd and others.
+
+*************************************
+Yardstick Test Case Description TC079
+*************************************
+
+.. _bonnie++: http://www.coker.com.au/bonnie++/
+
++-----------------------------------------------------------------------------+
+|Storage Performance |
+| |
++--------------+--------------------------------------------------------------+
+|test case id | OPNFV_YARDSTICK_TC079_Bonnie++ |
+| | |
++--------------+--------------------------------------------------------------+
+|metric | Sequential Input/Output and Sequential/Random Create speed |
+| | and CPU useage. |
+| | |
++--------------+--------------------------------------------------------------+
+|test purpose | The purpose of TC078 is to evaluate the IaaS storage |
+| | performance with regards to Sequential Input/Output and |
+| | Sequential/Random Create speed and CPU useage statistics. |
+| | |
++--------------+--------------------------------------------------------------+
+|test tool | Bonnie++ |
+| | |
+| | Bonnie++ is a disk and file system benchmarking tool for |
+| | measuring I/O performance. With Bonnie++ you can quickly and |
+| | easily produce a meaningful value to represent your current |
+| | file system performance. |
+| | |
+| | Bonnie++ is not always part of a Linux distribution, hence |
+| | it needs to be installed in the test image. |
+| | |
++--------------+--------------------------------------------------------------+
+|test | This test case uses Bonnie++ to perform the tests below: |
+|description | * Create files in sequential order |
+| | * Stat files in sequential order |
+| | * Delete files in sequential order |
+| | * Create files in random order |
+| | * Stat files in random order |
+| | * Delete files in random order |
+| | |
++--------------+--------------------------------------------------------------+
+|configuration | file: bonnie++.yaml (in the 'samples' directory) |
+| | |
+| | file_size is set to 1024; ram_size is set to 512; |
+| | test_dir is set to '/tmp'; concurrency is set to 1. |
+| | |
+| | SLA is not available in this test case. |
+| | |
++--------------+--------------------------------------------------------------+
+|applicability | Test can be configured with different: |
+| | |
+| | * file_size - size fo the test file in MB. File size should |
+| | be double RAM for good results; |
+| | * ram_size - specify RAM size in MB to use, this is used to |
+| | reduce testing time; |
+| | * test_dir - this directory is where bonnie++ will create |
+| | the benchmark operations; |
+| | * test_user - the user who should perform the test. This is |
+| | not required if you are not running as root; |
+| | * concurrency - number of thread to perform test; |
+| | |
++--------------+--------------------------------------------------------------+
+|usability | This test case is used for executing Bonnie++ benchmark in |
+| | VMs. |
+| | |
++--------------+--------------------------------------------------------------+
+|references | bonnie++_ |
+| | |
+| | ETSI-NFV-TST001 |
+| | |
++--------------+--------------------------------------------------------------+
+|pre-test | The Bonnie++ distribution includes a 'bon_csv2html' Perl |
+|conditions | script, which takes the comma-separated values reported by |
+| | Bonnie++ and generates an HTML page displaying them. |
+| | To use this feature, bonnie++ is required to be install with |
+| | yardstick (e.g. in yardstick docker). |
+| | |
++--------------+--------------------------------------------------------------+
+|test sequence | description and expected result |
+| | |
++--------------+--------------------------------------------------------------+
+|step 1 | A host VM with fio installed is booted. |
+| | |
++--------------+--------------------------------------------------------------+
+|step 2 | Yardstick is connected with the host VM by using ssh. |
+| | |
++--------------+--------------------------------------------------------------+
+|step 3 | Bonnie++ benchmark is invoked. Simulated IO operations are |
+| | started. Logs are produced and stored. |
+| | |
+| | Result: Logs are stored. |
+| | |
++--------------+--------------------------------------------------------------+
+|step 4 | An HTML report is generated using bonnie++ benchmark results |
+| | and stored under /tmp/bonnie.html. |
+| | |
++--------------+--------------------------------------------------------------+
+|step 5 | The host VM is deleted. |
+| | |
++--------------+--------------------------------------------------------------+
+|test verdict | None. Bonnie++ html report is generated. |
+| | |
++--------------+--------------------------------------------------------------+
diff --git a/install.sh b/install.sh
index 8a5050a61..58d070ecc 100755
--- a/install.sh
+++ b/install.sh
@@ -51,6 +51,7 @@ echo "vm.mmap_min_addr = 0" > /etc/sysctl.d/mmap_min_addr.conf
# install tools
apt-get update && apt-get install -y \
qemu-user-static/xenial \
+ bonnie++ \
wget \
expect \
curl \
diff --git a/samples/bonnie++.yaml b/samples/bonnie++.yaml
new file mode 100644
index 000000000..5c85eb20e
--- /dev/null
+++ b/samples/bonnie++.yaml
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+---
+# Sample benchmark task config file
+# measure storage and file system performance using bonnie++
+
+schema: "yardstick:task:0.1"
+
+{% set provider = provider or none %}
+{% set physical_network = physical_network or 'physnet1' %}
+{% set segmentation_id = segmentation_id or none %}
+
+scenarios:
+-
+ type: Bonnie++
+ options:
+ file_size: 1024
+ ram_size: 512
+ test_dir: /tmp
+ #test_user: root
+ concurrency: 1
+
+ host: bonnie.demo
+
+ runner:
+ type: Iteration
+ iterations: 1
+
+context:
+ name: demo
+ image: yardstick-image
+ flavor: yardstick-flavor
+ user: ubuntu
+
+ servers:
+ bonnie:
+ floating_ip: true
+
+ networks:
+ test:
+ cidr: '10.0.1.0/24'
+ {% if provider == "vlan" %}
+ provider: {{provider}}
+ physical_network: {{physical_network}}
+ {% if segmentation_id %}
+ segmentation_id: {{segmentation_id}}
+ {% endif %}
+ {% endif %}
+
diff --git a/tests/unit/benchmark/scenarios/storage/test_bonnie.py b/tests/unit/benchmark/scenarios/storage/test_bonnie.py
new file mode 100644
index 000000000..b3524e9a7
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/storage/test_bonnie.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# Unittest for yardstick.benchmark.scenarios.storage.bonnie.Bonnie
+
+from __future__ import absolute_import
+
+import unittest
+
+import mock
+
+from yardstick.common import utils
+from yardstick.benchmark.scenarios.storage import bonnie
+
+
+class BonnieTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.ctx = {
+ 'host': {
+ 'ip': '172.16.0.137',
+ 'user': 'root',
+ 'key_filename': "mykey.key"
+ }
+ }
+
+ self.result = {}
+
+ @mock.patch('yardstick.benchmark.scenarios.storage.bonnie.ssh')
+ def test_bonnie_successful_setup(self, mock_ssh):
+
+ options = {
+ "file_size": "1024",
+ "ram_size": "512",
+ "test_dir": "/tmp",
+ "concurrency": "1",
+ "test_user": "root"
+ }
+ args = {"options": options}
+ b = bonnie.Bonnie(args, self.ctx)
+ mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
+
+ b.setup()
+ self.assertIsNotNone(b.client)
+ self.assertTrue(b.setup_done, True)
+
+ @mock.patch('yardstick.benchmark.scenarios.storage.bonnie.ssh')
+ def test_bonnie_unsuccessful_script_error(self, mock_ssh):
+ options = {
+ "file_size": "1024",
+ "ram_size": "512",
+ "test_dir": "/tmp",
+ "concurrency": "1",
+ "test_user": "root"
+ }
+ args = {"options": options}
+ b = bonnie.Bonnie(args, self.ctx)
+
+ mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR')
+ self.assertRaises(RuntimeError, b.run, self.result)
+
+def main():
+ unittest.main()
+
+if __name__ == '__main__':
+ main()
diff --git a/tools/ubuntu-server-cloudimg-modify.sh b/tools/ubuntu-server-cloudimg-modify.sh
index 66c740eb6..47e7357c9 100755
--- a/tools/ubuntu-server-cloudimg-modify.sh
+++ b/tools/ubuntu-server-cloudimg-modify.sh
@@ -48,6 +48,7 @@ EOF
apt-get update
apt-get install -y \
bc \
+ bonnie++ \
fio \
git \
gcc \
diff --git a/yardstick/benchmark/scenarios/storage/bonnie.py b/yardstick/benchmark/scenarios/storage/bonnie.py
new file mode 100644
index 000000000..a4a60ba9b
--- /dev/null
+++ b/yardstick/benchmark/scenarios/storage/bonnie.py
@@ -0,0 +1,97 @@
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+from __future__ import absolute_import
+from __future__ import print_function
+
+import logging
+import subprocess
+
+import yardstick.ssh as ssh
+from yardstick.benchmark.scenarios import base
+
+LOG = logging.getLogger(__name__)
+
+
+class Bonnie(base.Scenario):
+ """Execute bonnie benchmark in a host
+
+ Parameters
+ file_size - size fo the test file in MB. File size should be double RAM for good results.
+ type: int
+ unit: MB
+ default: 2048
+ ram_size - specify RAM size in MB to use, this is used to reduce testing time.
+ type: int
+ unit: MB
+ default: na
+ test_dir - this directory is where bonnie++ will create the benchmark operations.
+ type: string
+ unit: na
+ default: "/tmp"
+ test_user - the user who should perform the test. This is not required if you are not running
+ as root.
+ type: string
+ unit: na
+ default: na
+ concurrency - number of thread to perform test
+ type: int
+ unit: na
+ default: 1
+ """
+ __scenario_type__ = "Bonnie++"
+
+ def __init__(self, scenario_cfg, context_cfg):
+ self.scenario_cfg = scenario_cfg
+ self.context_cfg = context_cfg
+ self.setup_done = False
+
+ def setup(self):
+ """scenario setup"""
+ host = self.context_cfg["host"]
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "root"})
+ self.client.wait(timeout=600)
+
+ self.setup_done = True
+
+ def run(self, result): # pragma: no cover
+ """execute the benchmark"""
+ if not self.setup_done:
+ self.setup()
+
+ cmd_args = ""
+
+ options = self.scenario_cfg["options"]
+ file_size = options.get("file_size", 2048)
+ test_dir = options.get("test_dir", "/tmp")
+
+ if "ram_size" in options:
+ cmd_args += " -r %s" % options["ram_size"]
+
+ if "test_user" in options:
+ cmd_args += " -u %s" % options["test_user"]
+
+ if "concurrency" in options:
+ cmd_args += " -c %s" % options["concurrency"]
+
+ cmd = "bonnie++ -d %s -s %s %s" % (test_dir, file_size, cmd_args)
+
+ LOG.debug("Executing command: %s", cmd)
+ status, stdout, stderr = self.client.execute(cmd)
+ if status:
+ raise RuntimeError(stderr)
+
+ raw_data = stdout.split('\n')[-2]
+ result.update({"raw_data": raw_data})
+
+ LOG.debug("Generating Bonnie++ HTML report...")
+ with open("/tmp/bonnie.html", "w") as bon_file:
+ p = subprocess.Popen(["bon_csv2html"], stdout=bon_file, stdin=subprocess.PIPE)
+ p.communicate(raw_data)
+ LOG.info('Bonnie++ benchmark completed, please find benchmark report at /tmp/bonnie.html')