Ejemplo n.º 1
0
 def test_ini(self):
     """
     Test that we use a valid ini format (no spaces, allows None)
     """
     j = Job(collections.OrderedDict((("bs", "8k"), ("iodepth", 2), ("stonewall", None))))
     j.name = "my-job"
     self.assertEqual("[my-job]\nbs=8k\niodepth=2\nstonewall", j.to_ini().strip())
Ejemplo n.º 2
0
    def test_version_args(self):
        engine = FIOEngine(Job())
        self.assertEqual(["fio", "-v"], engine._get_check_version_args())

        engine = FIOEngine(Job({"a": "b"}))
        self.assertEqual(["fio", "-v"], engine._get_check_version_args())

        engine = FIOEngine(Job(), "/usr/local/bin/fio")
        self.assertEqual(["/usr/local/bin/fio", "-v"],
                         engine._get_check_version_args())
Ejemplo n.º 3
0
    def test_invocation_args(self):
        cnf_path = "/does/not/exist"
        engine = FIOEngine(Job())
        self.assertEqual(["fio", "--minimal", "--warnings-fatal", cnf_path],
                         engine._get_execute_fio_args(cnf_path))

        engine = FIOEngine(Job(), "/usr/local/bin/fio")
        self.assertEqual(
            ["/usr/local/bin/fio", "--minimal", "--warnings-fatal", cnf_path],
            engine._get_execute_fio_args(cnf_path))
Ejemplo n.º 4
0
 def test_ini(self):
     """
     Test that we use a valid ini format (no spaces, allows None)
     """
     j = Job(
         collections.OrderedDict(
             (("bs", "8k"), ("iodepth", 2), ("stonewall", None))))
     j.name = "my-job"
     self.assertEqual("[my-job]\nbs=8k\niodepth=2\nstonewall",
                      j.to_ini().strip())
Ejemplo n.º 5
0
 def test_bs(self):
     """
     Test that we report the correct block size
     """
     #TODO: What if we declare two vars?
     j1 = Job({"bs": "8k"})
     self.assertEqual("8k", j1.block_size)
     j2 = Job({"blocksize": "16k"})
     self.assertEqual("16k", j2.block_size)
     j3 = Job()
     self.assertEqual("4k", j3.block_size)
Ejemplo n.º 6
0
    def test_ini(self):
        """
        Check that the composite config aggregates jobs, and in the correct order
        """
        j1 = Job({"engine": "libaio"}, "global")
        j2 = Job({"iodepth": 4})

        c = FIOConfig()
        c.add_job(j1)
        c.add_job(j2)

        self.assertEqual("[global]\nengine=libaio\n\n\n[anonymous]\niodepth=4",
                         c.to_ini().strip())
Ejemplo n.º 7
0
    def test_addition(self):
        """
        Test that when adding jobs, we
          - Create an anonymous job
          - Prioritize the right operand
        """
        j0 = Job({"bs": "4k", "iodepth": "4"}, "global")
        j1 = Job({"bs": "8k", "rw": "read"}, "job")

        j2 = j0 + j1

        self.assertEqual("anonymous", j2.name)
        self.assertEqual("read", j2.mode)
        self.assertEqual("8k", j2.block_size)
        self.assertEqual("4", j2.io_depth)
Ejemplo n.º 8
0
def start_benchmark(cloud, api_client, benchmark_volumes, extra_assets,
                    fio_bin, block_sizes, depths, modes, size, ramp, duration):
    # Create references in the API
    logger.debug("Creating API assets")
    assets = create_api_assets(cloud, api_client, benchmark_volumes,
                               extra_assets)

    for asset in assets:
        logger.info("Found asset: %s", asset)

    # Prepare jobs
    base_job = BASE_LINUX_JOB + Job(
        {
            "filename": ":".join(vol.device for vol in benchmark_volumes),
            "ramp_time": ramp,
            "runtime": duration,
        })

    # Warm up the disk
    logger.debug("Running warm-up job")
    warm_volume(base_job, fio_bin)

    # Run benchmarks
    run_benchmarks(api_client, assets, base_job, fio_bin, block_sizes, depths,
                   modes)
Ejemplo n.º 9
0
def run_benchmarks(api_client, assets, base_job, fio_bin, block_sizes, depths,
                   modes):
    for i, (bs, depth,
            mode) in enumerate(itertools.product(block_sizes, depths, modes)):
        logger.info("Launching job. Block Size:%s, I/O Depth:%s, I/O Mode:%s",
                    bs, depth, mode)

        job = base_job + BASE_BENCH_JOB + Job({
            "bs": bs,
            "iodepth": depth,
            "rw": mode,
            "stonewall": None,
        })

        configuration = api_client.configurations.get_or_create(
            **{
                "mode": job.mode,
                "block_size": block_size_in_kb(job.block_size),
                "io_depth": job.io_depth
            })

        engine = FIOEngine(job, fio_bin)
        report = engine.run_test()
        assert len(report) == 1, "Invalid report: {0}".format(report)
        job_report = SingleJobReport(job, report[0])
        report_benchmark(api_client, assets, configuration, job_report)
Ejemplo n.º 10
0
    def test_fail_execution(self):
        class TestEngine(FIOEngine):
            def _get_execute_fio_args(self, config_file):
                return ["false"]

        engine = TestEngine(Job())
        self.assertRaises(FIOCallError, engine.execute_fio, "/does/not/exist")
Ejemplo n.º 11
0
    def test_check_version(self):
        class TestEngine(FIOEngine):
            def _get_check_version_args(self):
                return ["echo", "fio-2.0.15"]

        engine = TestEngine(Job())
        engine.check_version()
Ejemplo n.º 12
0
    def test_execute(self):
        class TestEngine(FIOEngine):
            def _get_execute_fio_args(self, config_file):
                return ["echo", "Hello world"]

        engine = TestEngine(Job())

        output = engine.execute_fio("/does/not/exist")
        self.assertEqual(output, "Hello world")
Ejemplo n.º 13
0
    def test_mode(self):
        """
        Test that the correct mode is reported for jobs
        """
        j1 = Job({"rw": "read"})
        self.assertTrue(j1.is_read)
        self.assertFalse(j1.is_write)

        j2 = Job({"readwrite": "randwrite"})
        self.assertFalse(j2.is_read)
        self.assertTrue(j2.is_write)

        j3 = Job({"readwrite": "rw"})
        self.assertTrue(j3.is_read)
        self.assertTrue(j3.is_write)

        j4 = Job({"readwrite": "randwrite"})
        self.assertFalse(j4.is_read)
        self.assertTrue(j4.is_write)
Ejemplo n.º 14
0
#coding:utf-8
from cloudbench.fio.config.job import Job

BASE_LINUX_JOB = Job({
    "clocksource": "cpu",
    "randrepeat": "0",
    "group_reporting": None,
    "direct": "1",
    "ioengine": "libaio",
})

BASE_FILL_JOB = Job({
    "scramble_buffers": "1",
    "iodepth": "4",
    "rw": "write",
    "bs": "2M",
    "refill_buffers": None,
    "time_based": None,
})

BASE_BENCH_JOB = Job({
    "ioscheduler": "deadline",
    "cpumask": "1",
    "time_based": None,
})