summaryrefslogtreecommitdiffstats
path: root/tests/distaf/tests_d
diff options
context:
space:
mode:
Diffstat (limited to 'tests/distaf/tests_d')
-rw-r--r--tests/distaf/tests_d/__init__.py0
-rw-r--r--tests/distaf/tests_d/ctdb_gluster/__init__.py0
-rw-r--r--tests/distaf/tests_d/ctdb_gluster/test_ctdb_gluster_setup.py51
-rw-r--r--tests/distaf/tests_d/distaf_gluster_config.yml190
-rw-r--r--tests/distaf/tests_d/examples/__init__.py0
-rw-r--r--tests/distaf/tests_d/examples/test_basic_gluster_tests.py64
-rw-r--r--tests/distaf/tests_d/examples/test_docstring.py130
-rw-r--r--tests/distaf/tests_d/examples/test_passfail.py97
-rw-r--r--tests/distaf/tests_d/nfs_ganesha/__init__.py0
-rw-r--r--tests/distaf/tests_d/nfs_ganesha/test_nfs_ganesha_setup.py63
-rw-r--r--tests/distaf/tests_d/sanity/__init__.py0
-rw-r--r--tests/distaf/tests_d/sanity/io_config.yml14
-rw-r--r--tests/distaf/tests_d/sanity/test_dd_writes.py139
13 files changed, 0 insertions, 748 deletions
diff --git a/tests/distaf/tests_d/__init__.py b/tests/distaf/tests_d/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/tests/distaf/tests_d/__init__.py
+++ /dev/null
diff --git a/tests/distaf/tests_d/ctdb_gluster/__init__.py b/tests/distaf/tests_d/ctdb_gluster/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/tests/distaf/tests_d/ctdb_gluster/__init__.py
+++ /dev/null
diff --git a/tests/distaf/tests_d/ctdb_gluster/test_ctdb_gluster_setup.py b/tests/distaf/tests_d/ctdb_gluster/test_ctdb_gluster_setup.py
deleted file mode 100644
index 90a86489c40..00000000000
--- a/tests/distaf/tests_d/ctdb_gluster/test_ctdb_gluster_setup.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-# This file is part of DiSTAF
-# Copyright (C) 2015-2016 Red Hat, Inc. <http://www.redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-from distaf.util import tc, testcase
-from distaflibs.gluster.gluster_base_class import GlusterBaseClass
-from distaflibs.gluster.ctdb_libs import ctdb_gluster_setup
-
-
-@testcase("test_ctdb_gluster_setup")
-class TestCtdbGlusterSetup(GlusterBaseClass):
- """
- Test case to setup CTDB on gluster setup
- """
- def __init__(self, config_data):
- """
- Initialise the class with the config values
- """
- tc.logger.info("Starting testcase for CTDB gluster setup")
- GlusterBaseClass.__init__(self, config_data)
-
- def setup(self):
- """
- The function to setup the CTDB setup
- """
- ret = ctdb_gluster_setup()
- return ret
-
- def run(self):
- return True
-
- def cleanup(self):
- """
- The function to cleanup the test setup
- """
- return True
diff --git a/tests/distaf/tests_d/distaf_gluster_config.yml b/tests/distaf/tests_d/distaf_gluster_config.yml
deleted file mode 100644
index 9d48f66250a..00000000000
--- a/tests/distaf/tests_d/distaf_gluster_config.yml
+++ /dev/null
@@ -1,190 +0,0 @@
-log_file: /var/log/tests/distaf_test_run.log
-log_level: DEBUG
-remote_user: root
-
-servers:
- - &server1
- host: server-vm1
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server2
- host: server-vm2
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server3
- host: server-vm3
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server4
- host: server-vm4
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server5
- host: server-vm5
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server6
- host: server-vm2
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server7
- host: server-vm7
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server8
- host: server-vm8
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server9
- host: server-vm9
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server10
- host: server-vm10
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server11
- host: server-vm11
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
- - &server12
- host: server-vm12
- devices: ["/dev/vdb", "/dev/vdc", "/dev/vdd", "/dev/vde"]
- brick_root: "/bricks"
-
-clients:
- - &client1
- host: client-vm1
- - &client2
- host: client-vm2
-
-gluster:
- cluster_config:
- smb:
- enable: False
- user: 'root'
- passwd: 'foobar'
- ctdb_servers: []
- ctdb_vips:
- - vip: vip1
- routing_prefix: '23'
- interface: 'eth0'
- - vip: vip2
- routing_prefix: '22'
- interface: 'eth0'
- ctdb_metavol_brick_path: ''
-
- nfs_ganesha:
- enable: False
- num_of_nfs_ganesha_nodes: 4
- vips: []
-
- volume_types:
- distribute: &distribute
- type: distribute
- dist_count: 4
- transport: tcp
- replicate: &replicate
- type: replicate
- replica_count: 3
- transport: tcp
- dist_rep: &dist_rep
- type: dist_rep
- dist_count: 2
- replica_count: 2
- transport: tcp
- disperse: &disperse
- type: disperse
- disperse_count: 4
- redundancy_count: 2
- transport: tcp
- dist_disperse: &dist_disperse
- type: dist_disperse
- dist_count: 2
- disperse_count: 4
- redundancy_count: 2
- transport: tcp
-
- slave_volumes:
- - &slave_vol1
- voltype: *dist_rep
- servers: [ *server5, *server6, *server7, *server8 ]
- peers: []
- quota:
- enable: False
- limit_usage:
- path: "/"
- size: 100GB
- percent:
- limit_objects:
- path: "/"
- number:
- percent:
- alert_time:
- soft_timeout:
- hard_timeout:
- inode_quota:
- enable: False
- bitrot:
- enable: False
- scrub_throttle:
- scrub_frequency:
-
- volumes:
- - &vol1
- name: hosdu
- voltype: *dist_disperse
- servers: [ *server1, *server2, *server3, *server4 ]
- peers: [ *server9, *server10, *server11, *server12 ]
- tier:
- create_tier: False
- type: *dist_rep
- quota:
- enable: False
- limit_usage:
- path: "/"
- size: 100GB
- percent:
- limit_objects:
- path: "/"
- number:
- percent:
- alert_time: 0
- soft_timeout: 0
- hard_timeout: 0
- inode_quota:
- enable: False
- bitrot:
- enable: False
- scrub_throttle: 'aggressive'
- scrub_frequency: 'hourly'
- geo_rep:
- create_geo_rep_session: False
- slave_volumes: [ *slave_vol1 ]
- user: 'root'
- group: 'geogroup'
- sync_mode: 'rsync'
- options:
- performance.readdir-ahead: on
- snapshot:
- use_snapshot: True
- snap_jobname: 'snap_job'
- snap_schedule: 2
-
- mounts:
- - &mount1
- protocol: 'glusterfs'
- server: ''
- volname:
- client: *client1
- mountpoint: ''
- options: ''
- - &mount2
- protocol: 'nfs'
- server: ''
- volname: ''
- client: *client2
- mountpoint: ''
- options: ''
-
-global_mode: True
diff --git a/tests/distaf/tests_d/examples/__init__.py b/tests/distaf/tests_d/examples/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/tests/distaf/tests_d/examples/__init__.py
+++ /dev/null
diff --git a/tests/distaf/tests_d/examples/test_basic_gluster_tests.py b/tests/distaf/tests_d/examples/test_basic_gluster_tests.py
deleted file mode 100644
index d981c0b8ab5..00000000000
--- a/tests/distaf/tests_d/examples/test_basic_gluster_tests.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# This file is part of DiSTAF
-# Copyright (C) 2015-2016 Red Hat, Inc. <http://www.redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-from distaf.util import tc, testcase
-from distaflibs.gluster.gluster_base_class import GlusterBaseClass
-from distaflibs.gluster.mount_ops import mount_volume, umount_volume
-
-
-@testcase("gluster_basic_test")
-class gluster_basic_test(GlusterBaseClass):
- """
- runs_on_volumes: ALL
- runs_on_protocol: [ glusterfs, nfs ]
- reuse_setup: False
- """
- def run(self):
- _rc = True
- client = self.clients[0]
- tc.run(self.mnode, "gluster volume status %s" % self.volname)
- ret, _, _ = mount_volume(self.volname, self.mount_proto,
- self.mountpoint, mclient=client)
- if ret != 0:
- tc.logger.error("Unable to mount the volume %s in %s"
- "Please check the logs" % (self.volname, client))
- return False
- ret, _, _ = tc.run(client, "cp -r /etc %s" % self.mountpoint)
- if ret != 0:
- tc.logger.error("cp failed in %s. Please check the logs" % client)
- _rc = False
- tc.run(client, "rm -rf %s/etc" % self.mountpoint)
- umount_volume(client, self.mountpoint)
- return _rc
-
-
-@testcase("dummy_testcase")
-class dummy_testcase(GlusterBaseClass):
- """
- runs_on_volumes: ALL
- runs_on_protocol: [ glusterfs, nfs ]
- reuse_setup: False
- """
- def run(self):
- _rc = True
- ret, _, _ = tc.run(self.mnode, "gluster volume status %s" % self.volname)
- if ret != 0:
- tc.logger.error("Unable to thet the status of %s", self.volname)
- _rc = False
-
- return _rc
diff --git a/tests/distaf/tests_d/examples/test_docstring.py b/tests/distaf/tests_d/examples/test_docstring.py
deleted file mode 100644
index a939da8da9e..00000000000
--- a/tests/distaf/tests_d/examples/test_docstring.py
+++ /dev/null
@@ -1,130 +0,0 @@
-# This file is part of DiSTAF
-# Copyright (C) 2015-2016 Red Hat, Inc. <http://www.redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-from distaf.util import tc, testcase
-from distaflibs.gluster.gluster_base_class import GlusterBaseClass
-
-
-# An example with both doc and config in docstring
-@testcase("doc_and_config_test")
-class DocAndConfig(GlusterBaseClass):
- """ Testing docstring configuration options
- This is an example of a basic distaf test with mixed comment and config
- Any necessary description doc string text goes here and can include any
- plain text normally found in a docstring.
- Distaf specific config yaml can be included using the yaml standard
- document triple-dash separator below.
- ---
- runs_on_volumes: [ distributed ]
- runs_on_protocol: [ glusterfs ]
- reuse_setup: False
- tags:
- - tag1
- - tag2
- - tag3
- """
- def run(self):
- tc.logger.info("Running with doc and config in docstring")
- config = self.config_data
- tc.logger.debug("Tag 2 is %s" % config["tags"][1])
- tag2 = config["tags"][1]
- if tag2 == "tag2":
- return True
-
- return False
-
- def setup(self):
- return True
-
- def cleanup(self):
- return True
-
- def teardown(self):
- return True
-
-
-# An example with only config in docstring
-@testcase("config_only_test")
-class ConfigOnly(GlusterBaseClass):
- """
- runs_on_volumes: [ distributed ]
- runs_on_protocol: [ glusterfs, cifs ]
- reuse_setup: False
- tags:
- - tag1
- - tag2
- - tag3
- """
- def run(self):
- tc.logger.info("Running with only config in docstring")
- config = self.config_data
- tc.logger.debug("Tag 2 is %s" % config["tags"][1])
- tag2 = config["tags"][1]
- if tag2 == "tag2":
- return True
-
- return False
-
- def setup(self):
- return True
-
- def cleanup(self):
- return True
-
- def teardown(self):
- return True
-
-
-# An example with only doc in docstring
-@testcase("doc_only_test")
-class DocOnly(GlusterBaseClass):
- """ Testing docstring configuration options
- This is an example of a basic distaf test with mixed comment and config
- Any necessary description doc string text goes here and can include any
- plain text normally found in a docstring.
- """
- def run(self):
- tc.logger.info("Running with only doc in docstring")
- return True
-
- def setup(self):
- return True
-
- def cleanup(self):
- return True
-
- def teardown(self):
- return True
-
-
-# An example without a docstring
-@testcase("no_docstring_test")
-class NoDocstring(GlusterBaseClass):
- def run(self):
- tc.logger.info("Running with no docstring")
-
- return True
-
- def setup(self):
- return True
-
- def cleanup(self):
- return True
-
- def teardown(self):
- return True
diff --git a/tests/distaf/tests_d/examples/test_passfail.py b/tests/distaf/tests_d/examples/test_passfail.py
deleted file mode 100644
index 78396349fc4..00000000000
--- a/tests/distaf/tests_d/examples/test_passfail.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# This file is part of DiSTAF
-# Copyright (C) 2015-2016 Red Hat, Inc. <http://www.redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-from distaf.util import tc, testcase
-from distaflibs.gluster.gluster_base_class import GlusterBaseClass
-
-
-@testcase("this_should_pass")
-class GoingToPass(GlusterBaseClass):
- """ Testing connectivity and framework pass
- This is an example of a basic distaf test with mixed comment and config
- Any necessary description doc string text goes here and can include any
- plain text normally found in a docstring.
- Distaf specific config yaml can be included using the yaml standard
- document triple-dash separator below.
- ---
- runs_on_volumes: [ distributed ]
- runs_on_protocol: [ glusterfs ]
- reuse_setup: False
- tags:
- - tag1
- - tag2
- - tag3
- """
- def setup(self):
- return True
-
- def run(self):
- config = self.config_data
- tc.logger.info("Testing connection and command exec")
- tc.logger.debug("Tag 1 is %s" % config["tags"][0])
- ret, _, _ = tc.run(self.servers[0], "hostname")
- if ret != 0:
- tc.logger.error("hostname command failed")
- return False
- else:
- return True
-
- def setup(self):
- return True
-
- def cleanup(self):
- return True
-
- def teardown(self):
- return True
-
-
-@testcase("this_should_fail")
-class GoingToFail(GlusterBaseClass):
- """ Testing connectivity and fail
- ---
- runs_on_volumes: [ distributed ]
- runs_on_protocol: [ glusterfs, cifs ]
- reuse_setup: False
- tags:
- - tag1
- - tag2
- - tag3
- """
- def setup(self):
- return True
-
- def run(self):
- config = self.config_data
- tc.logger.info("Testing fail output")
- tc.logger.debug("Tag 1 is %s" % config["tags"][0])
- ret, _, _ = tc.run(self.servers[0], "false")
- if ret != 0:
- tc.logger.error("false command failed")
- return False
- else:
- return True
-
- def setup(self):
- return True
-
- def cleanup(self):
- return True
-
- def teardown(self):
- return True
diff --git a/tests/distaf/tests_d/nfs_ganesha/__init__.py b/tests/distaf/tests_d/nfs_ganesha/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/tests/distaf/tests_d/nfs_ganesha/__init__.py
+++ /dev/null
diff --git a/tests/distaf/tests_d/nfs_ganesha/test_nfs_ganesha_setup.py b/tests/distaf/tests_d/nfs_ganesha/test_nfs_ganesha_setup.py
deleted file mode 100644
index b95d3c9af90..00000000000
--- a/tests/distaf/tests_d/nfs_ganesha/test_nfs_ganesha_setup.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-# This file is part of DiSTAF
-# Copyright (C) 2015-2016 Red Hat, Inc. <http://www.redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-
-from distaf.util import tc, testcase
-from distaflibs.gluster.class_setup_nfs_ganesha_vol import SetupNfsGaneshaVol
-
-
-class TestSetupNfsGaneshaVol(SetupNfsGaneshaVol):
- """
- Test case to setup NFS-Ganesha
- """
- def __init__(self, config_data, nfs_options="vers=3"):
- """
- Initialise the class with the config values
- Kwargs:
- nfs_options (str): This argument takes the nfs options,
- say vers=3 or vers=4.
- Default value is vers=3
- """
- tc.logger.info("Testcase to setup NFS-Ganesha volume %s"
- % nfs_options)
- SetupNfsGaneshaVol.__init__(self, config_data, nfs_options)
-
- def run(self):
- return True
-
-
-@testcase("test_setup_nfs_ganesha_vol_v3")
-class TestSetupNfsGaneshaVolV3(TestSetupNfsGaneshaVol):
- """
- Test case to setup NFS-Ganesha and
- export volume with vers=3
- """
- def ___init__(self, config_data):
- TestSetupNfsGaneshaVol.__init__(self, config_data,
- nfs_options="vers=3")
-
-
-@testcase("test_setup_nfs_ganesha_vol_v4")
-class TestSetupNfsGaneshaVolV4(TestSetupNfsGaneshaVol):
- """
- Test case to setup NFS-Ganesha and
- export volume with vers=3
- """
- def ___init__(self, config_data):
- TestSetupNfsGaneshaVol.__init__(self, config_data,
- nfs_options="vers=4")
diff --git a/tests/distaf/tests_d/sanity/__init__.py b/tests/distaf/tests_d/sanity/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/tests/distaf/tests_d/sanity/__init__.py
+++ /dev/null
diff --git a/tests/distaf/tests_d/sanity/io_config.yml b/tests/distaf/tests_d/sanity/io_config.yml
deleted file mode 100644
index 577c43eda09..00000000000
--- a/tests/distaf/tests_d/sanity/io_config.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-gluster:
- tests:
- io:
- dd_writes:
- num_of_files: 1
- num_of_process_per_file: 1
- input_file: /dev/urandom
- block_size: random
- count: 1
- # oflag: append,direct,nonblock
- # conv: fsync
-
-
-
diff --git a/tests/distaf/tests_d/sanity/test_dd_writes.py b/tests/distaf/tests_d/sanity/test_dd_writes.py
deleted file mode 100644
index 3cff3ef8d82..00000000000
--- a/tests/distaf/tests_d/sanity/test_dd_writes.py
+++ /dev/null
@@ -1,139 +0,0 @@
-from distaf.util import tc, testcase, globl_configs
-from distaflibs.gluster.gluster_base_class import GlusterBaseClass
-from distaflibs.gluster.mount_ops import mount_volume, umount_volume
-import os
-import random
-import yaml
-
-@testcase("test_dd_writes")
-class TestDdWrites(GlusterBaseClass):
- """
- runs_on_volumes: [ distribute, replicate, dist_rep ]
- runs_on_protocol: [ glusterfs, nfs ]
- reuse_setup: True
- """
- def __init__(self, globl_configs):
- GlusterBaseClass.__init__(self, globl_configs)
- self.filename = "dd_testfile"
- io_config_file = os.path.join(os.path.dirname
- (os.path.realpath(__file__)),
- "io_config.yml")
- dd_writes_config = yaml.load(open(io_config_file))
- # Num of dd's to start per client/per file
- self.num_of_dd_writes_process = (dd_writes_config['gluster']['tests']
- ['io']['dd_writes']
- ['num_of_process_per_file'])
-
- # Num of files to create
- self.num_of_files = (dd_writes_config['gluster']['tests']
- ['io']['dd_writes']['num_of_files'])
-
- # Input file for dd command
- self.dd_input_file = (dd_writes_config['gluster']['tests']
- ['io']['dd_writes']['input_file'])
-
- # Block size
- self.block_size = (dd_writes_config['gluster']['tests']
- ['io']['dd_writes']['block_size'])
- if "random" in self.block_size:
- self.block_size = ["1k", "10k", "256k", "512k" ,"1M",
- "10M", "100M", "256M", "512M", "1G"]
-
- # dd count
- self.dd_count = (dd_writes_config['gluster']['tests']
- ['io']['dd_writes']['count'])
-
- # dd CONV
- if (dd_writes_config['gluster']['tests']['io']
- ['dd_writes']).has_key('conv'):
- self.dd_conv = (dd_writes_config['gluster']['tests']
- ['io']['dd_writes']['conv'])
- else:
- self.dd_conv = None
-
- # dd OFLAG
- if (dd_writes_config['gluster']['tests']['io']
- ['dd_writes']).has_key('oflag'):
- self.dd_oflag = (dd_writes_config['gluster']['tests']
- ['io']['dd_writes']['oflag'])
- else:
- self.dd_oflag = None
-
-
- def setup(self):
- ret = GlusterBaseClass.setup(self)
- if not ret:
- return False
-
- if self.mounts:
- for mount_obj in self.mounts:
- ret = mount_obj.mount()
- if not ret:
- tc.logger.error("Mounting Volume %s failed on %s:%s" %
- (mount_obj.volname,
- mount_obj.client_system,
- mount_obj.mountpoint))
- return False
- return True
-
-
- def run(self):
- rc = True
- dd_cmd = "dd if=%s count=%s " % (self.dd_input_file, self.dd_count)
- if self.dd_conv is not None:
- dd_cmd += "conv=%s " % self.dd_conv
-
- if self.dd_oflag is not None:
- dd_cmd += "oflag=%s " % self.dd_oflag
-
- all_mounts_cmd_runs = []
- for mount_obj in self.mounts:
- all_cmd_runs = []
- for i in range(1, (self.num_of_files + 1)):
- cmd_runs = []
- for j in range(1, (self.num_of_dd_writes_process + 1)):
- cmd = dd_cmd + ("of=%s bs=%s" %
- (os.path.join(mount_obj.mountpoint,
- self.filename + "_" + str(i)),
- random.choice(self.block_size)))
- tc.logger.info("Executing Command: %s", cmd)
- ret = tc.run_async(mount_obj.client_system, cmd)
- cmd_runs.append(ret)
- all_cmd_runs.append(cmd_runs)
- all_mounts_cmd_runs.append(all_cmd_runs)
-
- for all_cmd_runs in all_mounts_cmd_runs:
- for cmd_runs in all_cmd_runs:
- for each_cmd_run in cmd_runs:
- each_cmd_run.wait()
-
- rc = True
- for i, all_cmd_runs in enumerate(all_mounts_cmd_runs):
- for j, cmd_runs in enumerate(all_cmd_runs):
- for k, each_cmd_run in enumerate(cmd_runs):
- ret, _, _ = each_cmd_run.value()
- if ret != 0:
- tc.logger.error("DD Writes failed on: %s/%s/%s:%d" %
- (self.mounts[i].client_system,
- self.mounts[i].mountpoint,
- (self.filename + "_" + str(j)), k))
- rc = False
- if not rc:
- tc.logger.error("DD Write failed on atleast one file")
- return False
- else:
- tc.logger.info("DD Write successfully passed on all the files")
- return True
-
- def teardown(self):
- for mount_obj in self.mounts:
- cleanup_mount_cmd = "rm -rf %s/*" % mount_obj.mountpoint
- ret, out, err = tc.run(mount_obj.client_system,
- cleanup_mount_cmd)
- for mount_obj in self.mounts:
- mount_obj.unmount()
- ret = GlusterBaseClass.teardown(self)
- if not ret:
- return False
- return True
-