summaryrefslogtreecommitdiffstats
path: root/tests/functional/quota
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/quota')
-rw-r--r--tests/functional/quota/list_path_values.py4
-rwxr-xr-xtests/functional/quota/test_alert_time_out.py30
-rw-r--r--tests/functional/quota/test_deem_statfs.py116
-rw-r--r--tests/functional/quota/test_deem_statfs_quotad.py23
-rw-r--r--tests/functional/quota/test_limit_usage_deep_dir.py23
-rw-r--r--tests/functional/quota/test_multi_value_limit.py22
-rw-r--r--tests/functional/quota/test_negative_quota.py4
-rw-r--r--tests/functional/quota/test_non_existent_dir.py6
-rw-r--r--tests/functional/quota/test_quota_add_brick.py4
-rw-r--r--tests/functional/quota/test_quota_file_larger_than_limit.py23
-rwxr-xr-xtests/functional/quota/test_quota_limit_dir_breadth.py25
-rw-r--r--tests/functional/quota/test_quota_no_dir.py4
-rwxr-xr-xtests/functional/quota/test_quota_rebalance.py204
-rw-r--r--tests/functional/quota/test_quota_rebalance_heal.py198
-rwxr-xr-xtests/functional/quota/test_quota_renamed_dir.py23
-rw-r--r--tests/functional/quota/test_quota_single_brick_volume.py35
-rw-r--r--tests/functional/quota/test_quota_symlink_limit.py23
-rw-r--r--tests/functional/quota/test_quota_unique_soft_limit.py23
-rw-r--r--tests/functional/quota/test_quota_volume_subdir_limits.py22
19 files changed, 648 insertions, 164 deletions
diff --git a/tests/functional/quota/list_path_values.py b/tests/functional/quota/list_path_values.py
index 292370473..08ccf242c 100644
--- a/tests/functional/quota/list_path_values.py
+++ b/tests/functional/quota/list_path_values.py
@@ -41,7 +41,7 @@ class QuotaListPathValues(GlusterBaseClass):
"""
# calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Setup Volume and Mount Volume
g.log.info("Starting to Setup and Mount Volume %s",
@@ -66,7 +66,7 @@ class QuotaListPathValues(GlusterBaseClass):
g.log.info("Successful in Unmount Volume and Cleanup Volume")
# calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ cls.get_super_method(cls, 'tearDownClass')()
def test_quota_list_path_values(self):
"""
diff --git a/tests/functional/quota/test_alert_time_out.py b/tests/functional/quota/test_alert_time_out.py
index 5619105f0..626a04d2b 100755
--- a/tests/functional/quota/test_alert_time_out.py
+++ b/tests/functional/quota/test_alert_time_out.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2020 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
@@ -16,7 +16,6 @@
import time
import random
-import string
from glusto.core import Glusto as g
from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
from glustolibs.gluster.lib_utils import (search_pattern_in_file,
@@ -45,7 +44,7 @@ class QuotaTimeOut(GlusterBaseClass):
which is used in tests
"""
# Calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Setup Volume and Mount Volume
g.log.info("Starting to Setup and Mount Volume %s",
@@ -56,20 +55,17 @@ class QuotaTimeOut(GlusterBaseClass):
% cls.volname)
g.log.info("Successful in Setup and Mount Volume %s", cls.volname)
- @classmethod
- def tearDownClass(cls):
- """
- Clean up the volume and umount volume from client
- """
- # Stopping the volume
+ def tearDown(self):
+
+ # Unmount and cleanup original volume
g.log.info("Starting to Unmount Volume and Cleanup Volume")
- ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts)
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
if not ret:
- raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")
- g.log.info("Successful in Unmount Volume and Cleanup Volume")
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
- # Calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
def test_alert_time_out(self):
"""
@@ -163,7 +159,7 @@ class QuotaTimeOut(GlusterBaseClass):
# Get the brick log file path for a random node
bricks = get_all_bricks(self.mnode, self.volname)
selected_node, brick_path = random.choice(bricks[0:6]).split(':')
- brickpath = string.replace(brick_path, '/', '-')
+ brickpath = str.replace(brick_path, '/', '-')
brickpathfinal = brickpath[1:]
brick_log = "/var/log/glusterfs/bricks/%s.log" % brickpathfinal
@@ -282,9 +278,9 @@ class QuotaTimeOut(GlusterBaseClass):
g.log.info("Files creation stopped on mountpoint once exceeded "
"hard limit")
- # Inserting sleep of 2 seconds so the alert message gets enough time
+ # Inserting sleep of 6 seconds so the alert message gets enough time
# to be logged
- time.sleep(2)
+ time.sleep(6)
# Append unique string to the brick log
g.log.info("Appending string 'appended_string_6' to the log:")
diff --git a/tests/functional/quota/test_deem_statfs.py b/tests/functional/quota/test_deem_statfs.py
new file mode 100644
index 000000000..92cc44e74
--- /dev/null
+++ b/tests/functional/quota/test_deem_statfs.py
@@ -0,0 +1,116 @@
+# Copyright (C) 2015-2020 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 glusto.core import Glusto as g
+from glustolibs.gluster.gluster_base_class import (GlusterBaseClass,
+ runs_on)
+from glustolibs.gluster.lib_utils import get_size_of_mountpoint
+from glustolibs.gluster.quota_ops import (quota_enable,
+ quota_limit_usage,
+ quota_remove)
+from glustolibs.gluster.exceptions import ExecutionError
+
+
+@runs_on([['distributed-replicated', 'replicated', 'dispersed', 'distributed',
+ 'distributed-dispersed'],
+ ['glusterfs', 'nfs']])
+class QuotaStatvfs(GlusterBaseClass):
+
+ @classmethod
+ def setUpClass(cls):
+ """
+ setup volume, mount volume and initialize necessary variables
+ which is used in tests
+ """
+
+ # calling GlusterBaseClass setUpClass
+ cls.get_super_method(cls, 'setUpClass')()
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup and Mount Volume %s",
+ cls.volname)
+ ret = cls.setup_volume_and_mount_volume(mounts=cls.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume and Mount_Volume %s"
+ % cls.volname)
+ g.log.info("Successful in Setup and Mount Volume %s", cls.volname)
+
+ def tearDown(self):
+
+ # Unmount and cleanup original volume
+ g.log.info("Starting to Unmount Volume and Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
+
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
+
+ def test_quota_statvfs(self):
+ """
+ Test statvfs calls return appropriate avaialable size with quota.
+
+ * Enable Quota
+ * Save the result from statvfs call
+ * Set Quota limit of 1 GB on the root of the volume
+ * Validate statvfs call honors quota
+ * Remove quota limit from the Volume
+ * Validate statvfs call reports old value of avialable space
+ """
+ # Enable Quota
+ g.log.info("Enabling quota on the volume %s", self.volname)
+ ret, _, _ = quota_enable(self.mnode, self.volname)
+ self.assertEqual(ret, 0, ("Failed to enable quota on the volume %s",
+ self.volname))
+ g.log.info("Successfully enabled quota on the volume %s", self.volname)
+
+ mount_dir = self.mounts[0].mountpoint
+ client = self.mounts[0].client_system
+
+ # Save the result from statvfs call
+ orig_avail_space = int(get_size_of_mountpoint(client, mount_dir))
+
+ # Set Quota limit of 1 GB on the root of the volume
+ g.log.info("Set Quota Limit on the path '/'")
+ ret, _, _ = quota_limit_usage(self.mnode, self.volname,
+ path='/', limit="1GB")
+ self.assertEqual(ret, 0, ("Failed to set quota limit on path '/'"))
+ g.log.info("Successfully set the Quota limit on '/'")
+
+ # Validate statvfs call honors quota
+ avail_space_after_limit = int(get_size_of_mountpoint(client,
+ mount_dir))
+ g.log.info("space %s", avail_space_after_limit)
+ self.assertEqual(avail_space_after_limit * 1024, 1073741824,
+ "avialable space reported by statvfs does not honor \
+ quota limit on '/'")
+ g.log.info("successfully validated statvfs honor quota limit on '/'")
+
+ # Remove Quota limit from the Volume
+ g.log.info("Remove Quota Limit set on path '/'")
+ ret, _, _ = quota_remove(self.mnode, self.volname, path='/')
+ self.assertEqual(ret, 0, ("Failed to remove quota limit on path '/' "))
+ g.log.info("Successfully removed the Quota limit on path '/'")
+
+ # Validate statvfs call reports old value of avialable space
+ avail_space_after_remove = int(get_size_of_mountpoint(client,
+ mount_dir))
+ g.log.info("space %s", avail_space_after_remove)
+ self.assertEqual(avail_space_after_remove, orig_avail_space,
+ "avialable space reported by statvfs not restored \
+ after quota limit is removed on '/'")
+ g.log.info("successfully validated statvfs shows original value")
diff --git a/tests/functional/quota/test_deem_statfs_quotad.py b/tests/functional/quota/test_deem_statfs_quotad.py
index cf294894b..06e87f7e8 100644
--- a/tests/functional/quota/test_deem_statfs_quotad.py
+++ b/tests/functional/quota/test_deem_statfs_quotad.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2020 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
@@ -33,27 +33,24 @@ class QuotaDeemStatfsAndQuotad(GlusterBaseClass):
"""
setup volume and initialize necessary variables
"""
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
g.log.info("Starting to Setup Volume")
ret = cls.setup_volume()
if not ret:
raise ExecutionError("Failed to Setup_Volume")
g.log.info("Successful in Setup Volume")
- @classmethod
- def tearDownClass(cls):
- """
- Clean up the volume
- """
- # stopping the volume and clean up the volume
+ def tearDown(self):
+
+ # Unmount and cleanup original volume
g.log.info("Starting to Cleanup Volume")
- ret = cls.cleanup_volume()
+ ret = self.cleanup_volume()
if not ret:
- raise ExecutionError("Failed to Cleanup Volume")
- g.log.info("Successful in Cleanup Volume")
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
- # calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
def test_quota_deem_statfs_quotad(self):
"""
diff --git a/tests/functional/quota/test_limit_usage_deep_dir.py b/tests/functional/quota/test_limit_usage_deep_dir.py
index 974249c79..b024f575d 100644
--- a/tests/functional/quota/test_limit_usage_deep_dir.py
+++ b/tests/functional/quota/test_limit_usage_deep_dir.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2020 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
@@ -15,6 +15,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import random
+
from glusto.core import Glusto as g
from glustolibs.gluster.gluster_base_class import (GlusterBaseClass,
runs_on)
@@ -31,24 +32,21 @@ from glustolibs.gluster.glusterdir import (mkdir,
rmdir)
-@runs_on([['distributed-replicated', 'replicated', 'distributed',
- 'dispersed', 'distributed-dispersed'],
+@runs_on([['distributed-replicated', 'replicated', 'distributed'],
['glusterfs', 'nfs']])
class LimitUsageDeepDir(GlusterBaseClass):
@classmethod
def setUpClass(cls):
# Calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Upload io scripts for running IO on mounts
g.log.info("Upload io scripts to clients %s for running IO on mounts",
cls.clients)
- script_local_path = ("/usr/share/glustolibs/io/scripts/"
- "file_dir_ops.py")
cls.script_upload_path = ("/usr/share/glustolibs/io/scripts/"
"file_dir_ops.py")
- ret = upload_scripts(cls.clients, [script_local_path])
+ ret = upload_scripts(cls.clients, cls.script_upload_path)
if not ret:
raise ExecutionError("Failed to upload IO scripts to clients %s"
% cls.clients)
@@ -57,7 +55,7 @@ class LimitUsageDeepDir(GlusterBaseClass):
def setUp(self):
# Calling GlusterBaseClass setUp
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
self.all_mounts_procs = []
@@ -80,7 +78,7 @@ class LimitUsageDeepDir(GlusterBaseClass):
g.log.info("Successful in umounting the volume and Cleanup")
# Calling GlusterBaseClass teardown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
def test_limit_usage_deep_dir(self):
# pylint: disable=too-many-statements
@@ -180,9 +178,10 @@ class LimitUsageDeepDir(GlusterBaseClass):
# Data creation
# Creates one file of rand[0] size in each dir
rand = random.sample([1, 10, 512], 1)
- cmd = ("python %s create_files --fixed-file-size %sk %s/%s"
- % (self.script_upload_path, rand[0],
- mount_object.mountpoint, dir_list[0]))
+ cmd = ("/usr/bin/env python %s create_files "
+ "--fixed-file-size %sk %s/%s" % (
+ self.script_upload_path,
+ rand[0], mount_object.mountpoint, dir_list[0]))
ret, _, _ = g.run(mount_object.client_system, cmd)
self.assertFalse(ret, "Failed to create files")
diff --git a/tests/functional/quota/test_multi_value_limit.py b/tests/functional/quota/test_multi_value_limit.py
index 3991c614b..76187bb64 100644
--- a/tests/functional/quota/test_multi_value_limit.py
+++ b/tests/functional/quota/test_multi_value_limit.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2020 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
@@ -39,7 +39,7 @@ class QuotaMultiValueLimits(GlusterBaseClass):
"""
# calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Setup Volume and Mount Volume
g.log.info("Starting to Setup and Mount Volume %s",
@@ -50,21 +50,17 @@ class QuotaMultiValueLimits(GlusterBaseClass):
% cls.volname)
g.log.info("Successful in Setup and Mount Volume %s", cls.volname)
- @classmethod
- def tearDownClass(cls):
- """
- Clean up the volume and umount volume from client
- """
+ def tearDown(self):
- # stopping the volume
+ # Unmount and cleanup original volume
g.log.info("Starting to Unmount Volume and Cleanup Volume")
- ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts)
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
if not ret:
- raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")
- g.log.info("Successful in Unmount Volume and Cleanup Volume")
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
- # calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
def test_quota_multi_value_limits(self):
# pylint: disable=too-many-statements
diff --git a/tests/functional/quota/test_negative_quota.py b/tests/functional/quota/test_negative_quota.py
index d420dd153..aab912e70 100644
--- a/tests/functional/quota/test_negative_quota.py
+++ b/tests/functional/quota/test_negative_quota.py
@@ -34,7 +34,7 @@ class TestNegativeQuota(GlusterBaseClass):
def setUp(self):
""" creates the volume and mount it"""
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
g.log.info("Creating the vol %s and mount it", self.volname)
ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
if not ret:
@@ -49,7 +49,7 @@ class TestNegativeQuota(GlusterBaseClass):
if not ret:
raise ExecutionError("Failed to delete the "
"volume" % (self.volname))
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
def test_negative_quota_enable(self):
""" This testcase will enable quota by giving negative inputs or
diff --git a/tests/functional/quota/test_non_existent_dir.py b/tests/functional/quota/test_non_existent_dir.py
index 380576ac1..34a11cd70 100644
--- a/tests/functional/quota/test_non_existent_dir.py
+++ b/tests/functional/quota/test_non_existent_dir.py
@@ -28,12 +28,12 @@ from glustolibs.gluster.exceptions import ExecutionError
class QuotaNonExistentDir(GlusterBaseClass):
@classmethod
def setUpClass(cls):
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
g.log.info("Starting %s ", cls.__name__)
def setUp(self):
# SettingUp volume and Mounting the volume
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
# Setting up the volume
ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
@@ -78,4 +78,4 @@ class QuotaNonExistentDir(GlusterBaseClass):
g.log.info("Successful in umounting the volume and Cleanup")
# Calling GlusterBaseClass tearDown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
diff --git a/tests/functional/quota/test_quota_add_brick.py b/tests/functional/quota/test_quota_add_brick.py
index 1078ceff1..7a08d7d65 100644
--- a/tests/functional/quota/test_quota_add_brick.py
+++ b/tests/functional/quota/test_quota_add_brick.py
@@ -34,7 +34,7 @@ class QuotaAddBrick(GlusterBaseClass):
def setUp(self):
# Calling GlusterBaseClass setUp
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
self.all_mounts_procs = []
@@ -57,7 +57,7 @@ class QuotaAddBrick(GlusterBaseClass):
g.log.info("Successful in umounting the volume and Cleanup")
# Calling GlusterBaseClass teardown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
def test_quota_add_brick(self):
"""
diff --git a/tests/functional/quota/test_quota_file_larger_than_limit.py b/tests/functional/quota/test_quota_file_larger_than_limit.py
index d354f7155..ed777fbf5 100644
--- a/tests/functional/quota/test_quota_file_larger_than_limit.py
+++ b/tests/functional/quota/test_quota_file_larger_than_limit.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2017-2020 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
@@ -39,7 +39,7 @@ class QuotaFileLargerThanLimit(GlusterBaseClass):
which is used in tests
"""
# calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Setup Volume and Mount Volume
g.log.info("Starting to Setup and Mount Volume %s",
@@ -50,20 +50,17 @@ class QuotaFileLargerThanLimit(GlusterBaseClass):
% cls.volname)
g.log.info("Successful in Setup and Mount Volume %s", cls.volname)
- @classmethod
- def tearDownClass(cls):
- """
- Clean up the volume and umount volume from client
- """
- # stopping the volume
+ def tearDown(self):
+
+ # Unmount and cleanup original volume
g.log.info("Starting to Unmount Volume and Cleanup Volume")
- ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts)
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
if not ret:
- raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")
- g.log.info("Successful in Unmount Volume and Cleanup Volume")
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
- # calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
def test_quota_file_larger_than_limit(self):
# pylint: disable=too-many-statements
diff --git a/tests/functional/quota/test_quota_limit_dir_breadth.py b/tests/functional/quota/test_quota_limit_dir_breadth.py
index e9c79cc00..acaa82790 100755
--- a/tests/functional/quota/test_quota_limit_dir_breadth.py
+++ b/tests/functional/quota/test_quota_limit_dir_breadth.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2020 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
@@ -15,6 +15,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from glusto.core import Glusto as g
+
from glustolibs.gluster.gluster_base_class import (GlusterBaseClass,
runs_on)
from glustolibs.gluster.quota_ops import (quota_enable, quota_limit_usage)
@@ -32,16 +33,14 @@ class QuotaLimitDirBreadth(GlusterBaseClass):
@classmethod
def setUpClass(cls):
# Calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Upload io scripts for running IO on mounts
g.log.info("Upload io scripts to clients %s for running IO on mounts",
cls.clients)
- script_local_path = ("/usr/share/glustolibs/io/scripts/"
- "file_dir_ops.py")
cls.script_upload_path = ("/usr/share/glustolibs/io/scripts/"
"file_dir_ops.py")
- ret = upload_scripts(cls.clients, [script_local_path])
+ ret = upload_scripts(cls.clients, cls.script_upload_path)
if not ret:
raise ExecutionError("Failed to upload IO scripts to clients %s"
% cls.clients)
@@ -50,7 +49,7 @@ class QuotaLimitDirBreadth(GlusterBaseClass):
def setUp(self):
# Calling GlusterBaseClass setUp
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
self.all_mounts_procs = []
@@ -73,7 +72,7 @@ class QuotaLimitDirBreadth(GlusterBaseClass):
g.log.info("Successful in umounting the volume and Cleanup")
# Calling GlusterBaseClass teardown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
def test_quota_limit_dir_breadth(self):
"""
@@ -101,8 +100,8 @@ class QuotaLimitDirBreadth(GlusterBaseClass):
g.log.info("Creating Directories on %s:%s",
client, mount_dir)
- cmd = ('python %s create_deep_dir -d 0 -l 10 %s'
- % (self.script_upload_path, mount_dir))
+ cmd = "/usr/bin/env python %s create_deep_dir -d 0 -l 10 %s" % (
+ self.script_upload_path, mount_dir)
proc = g.run_async(client, cmd, user=mount_obj.user)
self.all_mounts_procs.append(proc)
@@ -150,10 +149,10 @@ class QuotaLimitDirBreadth(GlusterBaseClass):
g.log.info("Creating Files on %s:%s", client, mount_dir)
for i in range(1, 11):
dir_name = "/user" + str(i)
- cmd = ("python %s create_files -f 10 --fixed-file-size 1M "
- "%s/%s"
- % (self.script_upload_path, mount_dir,
- dir_name))
+ cmd = ("/usr/bin/env python %s create_files -f 10 "
+ "--fixed-file-size 1M %s/%s" % (
+ self.script_upload_path,
+ mount_dir, dir_name))
ret, _, _ = g.run(client, cmd)
self.assertFalse(ret, "Failed to create files in %s"
diff --git a/tests/functional/quota/test_quota_no_dir.py b/tests/functional/quota/test_quota_no_dir.py
index 8bc381cc3..2e6a6af86 100644
--- a/tests/functional/quota/test_quota_no_dir.py
+++ b/tests/functional/quota/test_quota_no_dir.py
@@ -34,7 +34,7 @@ from glustolibs.gluster.volume_libs import (
class QuotaNoDir(GlusterBaseClass):
def setUp(self):
# SettingUp volume and Mounting the volume
- GlusterBaseClass.setUp.im_func(self)
+ self.get_super_method(self, 'setUp')()
g.log.info("Creating volume %s", (self.volname))
# Setting up the volume
@@ -146,4 +146,4 @@ class QuotaNoDir(GlusterBaseClass):
g.log.info("Successful in umounting the volume and Cleanup")
# Calling GlusterBaseClass tearDown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
diff --git a/tests/functional/quota/test_quota_rebalance.py b/tests/functional/quota/test_quota_rebalance.py
new file mode 100755
index 000000000..8f71ef9c9
--- /dev/null
+++ b/tests/functional/quota/test_quota_rebalance.py
@@ -0,0 +1,204 @@
+# Copyright (C) 2020 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 time import sleep
+from glusto.core import Glusto as g
+from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.quota_ops import (
+ quota_enable,
+ quota_set_hard_timeout,
+ quota_set_soft_timeout,
+ quota_limit_usage)
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.misc.misc_libs import upload_scripts
+from glustolibs.io.utils import (
+ wait_for_io_to_complete,
+ validate_io_procs)
+from glustolibs.gluster.brick_ops import add_brick
+from glustolibs.gluster.lib_utils import form_bricks_list
+from glustolibs.gluster.rebalance_ops import (
+ rebalance_start,
+ get_rebalance_status,
+ wait_for_rebalance_to_complete)
+
+
+@runs_on([['replicated', 'distributed-replicated', 'dispersed',
+ 'distributed', 'distributed-dispersed', 'arbiter',
+ 'distributed-arbiter'],
+ ['glusterfs', 'nfs']])
+class TestQuotaRebalance(GlusterBaseClass):
+ """
+ Test if the quota limits are honored while a rebalance
+ is in progress.
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ # Calling GlusterBaseClass setUpClass
+ cls.get_super_method(cls, "setUpClass")()
+
+ # Upload io scripts for running IO on mounts
+ g.log.info(
+ "Upload io scripts to clients %s for running IO on mounts",
+ cls.clients)
+ cls.script_upload_path = (
+ "/usr/share/glustolibs/io/scripts/file_dir_ops.py")
+ ret = upload_scripts(cls.clients, [cls.script_upload_path])
+ if not ret:
+ raise ExecutionError(
+ "Failed to upload IO scripts to clients %s" % cls.clients)
+ g.log.info(
+ "Successfully uploaded IO scripts to clients %s", cls.clients)
+
+ def setUp(self):
+ # Calling GlusterBaseClass setUp
+ self.get_super_method(self, "setUp")()
+ self.all_mounts_procs = []
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup Volume and Mount Volume")
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume and Mount_Volume")
+ g.log.info("Successful in Setup Volume and Mount Volume")
+
+ def tearDown(self):
+ """
+ Cleanup and umount volume
+ """
+ # Cleanup and umount volume
+ g.log.info("Starting to Unmount Volume and Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
+
+ # Calling GlusterBaseClass teardown
+ self.get_super_method(self, "tearDown")()
+
+ def test_quota_rebalance(self):
+ """
+ * Enable quota on the volume
+ * set hard and soft time out to zero.
+ * Create some files and directories from mount point
+ so that the limits are reached.
+ * Perform add-brick operation on the volume.
+ * Start rebalance on the volume.
+ * While rebalance is in progress, create some more files
+ and directories from the mount point until limit is hit
+ """
+
+ # pylint: disable=too-many-statements
+ # Enable Quota on volume
+ ret, _, _ = quota_enable(self.mnode, self.volname)
+ self.assertEqual(
+ ret, 0, ("Failed to enable quota on the volume %s", self.volname))
+ g.log.info("Successfully enabled quota on the volume %s", self.volname)
+
+ # Set the Quota timeouts to 0 for strict accounting
+ ret, _, _ = quota_set_hard_timeout(self.mnode, self.volname, 0)
+ self.assertEqual(
+ ret, 0, ("Failed to set hard-timeout to 0 for %s", self.volname))
+ ret, _, _ = quota_set_soft_timeout(self.mnode, self.volname, 0)
+ self.assertEqual(
+ ret, 0, ("Failed to set soft-timeout to 0 for %s", self.volname))
+ g.log.info(
+ "Quota soft and hard timeout has been set to 0 for %s",
+ self.volname)
+
+ # Set limit of 100 MB on root dir of the volume
+ ret, _, _ = quota_limit_usage(self.mnode, self.volname, "/", "100MB")
+ self.assertEqual(ret, 0, "Failed to set Quota for dir '/'")
+ g.log.info("Successfully set quota limit for dir '/'")
+
+ # Do some IO until hard limit is reached
+ cmd = (
+ "/usr/bin/env python %s create_files "
+ "-f 100 --fixed-file-size 1M --base-file-name file %s"
+ % (self.script_upload_path,
+ self.mounts[0].mountpoint))
+ proc = g.run_async(
+ self.mounts[0].client_system, cmd, user=self.mounts[0].user)
+ self.all_mounts_procs.append(proc)
+
+ # Wait for IO to complete and validate IO
+ self.assertTrue(
+ wait_for_io_to_complete(self.all_mounts_procs, self.mounts[0]),
+ "IO failed on some of the clients")
+ g.log.info("IO is successful on all mounts")
+
+ # Add bricks to the volume
+ if "replica_count" in self.volume["voltype"]:
+ new_bricks_count = self.volume["voltype"]["replica_count"]
+ elif "disperse_count" in self.volume["voltype"]:
+ new_bricks_count = self.volume["voltype"]["disperse_count"]
+ else:
+ new_bricks_count = 3
+ bricks_list = form_bricks_list(
+ self.mnode,
+ self.volname,
+ new_bricks_count,
+ self.servers,
+ self.all_servers_info)
+ g.log.info("new brick list: %s", bricks_list)
+ ret, _, _ = add_brick(self.mnode, self.volname, bricks_list, False)
+ self.assertEqual(ret, 0, "Failed to add the bricks to the volume")
+ g.log.info("Successfully added bricks to volume")
+
+ # Perform rebalance start operation
+ ret, _, _ = rebalance_start(self.mnode, self.volname)
+ self.assertEqual(ret, 0, "Rebalance Start Failed")
+
+ # Wait for at least one file to be lookedup/scanned on the nodes
+ status_info = get_rebalance_status(self.mnode, self.volname)
+ count = 0
+ while count < 20:
+ lookups_start_count = 0
+ for node in range(len(status_info['node'])):
+ status_info = get_rebalance_status(self.mnode, self.volname)
+ lookups_file_count = status_info['node'][node]['lookups']
+ if int(lookups_file_count) > 0:
+ lookups_start_count += 1
+ sleep(2)
+ if lookups_start_count == len(self.servers):
+ g.log.info("Volume %s: At least one file is lookedup/scanned "
+ "on all nodes", self.volname)
+ break
+ count += 1
+
+ # Perform some more IO and check if hard limit is honoured
+ self.all_mounts_procs = []
+ cmd = (
+ "/usr/bin/env python %s create_files "
+ "-f 100 --fixed-file-size 1M --base-file-name newfile %s"
+ % (self.script_upload_path,
+ self.mounts[0].mountpoint))
+ proc = g.run_async(
+ self.mounts[0].client_system, cmd, user=self.mounts[0].user)
+ self.all_mounts_procs.append(proc)
+
+ # Wait for IO to complete and validate IO
+ # This should fail as the quotas were already reached
+ self.assertFalse(
+ validate_io_procs(self.all_mounts_procs, self.mounts[0]),
+ "Unexpected: IO passed on the client even after quota is reached")
+ g.log.info("Expected: IO failed as quota is reached")
+
+ # Wait for rebalance to finish
+ ret = wait_for_rebalance_to_complete(
+ self.mnode, self.volname, timeout=180)
+ self.assertTrue(ret, "Unexpected: Rebalance did not complete")
+ g.log.info("Rebalance completed as expected")
diff --git a/tests/functional/quota/test_quota_rebalance_heal.py b/tests/functional/quota/test_quota_rebalance_heal.py
new file mode 100644
index 000000000..e6feb123d
--- /dev/null
+++ b/tests/functional/quota/test_quota_rebalance_heal.py
@@ -0,0 +1,198 @@
+# Copyright (C) 2015-2020 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 time import sleep
+
+from glusto.core import Glusto as g
+
+from glustolibs.gluster.gluster_base_class import (GlusterBaseClass,
+ runs_on)
+from glustolibs.gluster.quota_ops import (quota_enable,
+ quota_set_hard_timeout,
+ quota_set_soft_timeout,
+ quota_limit_usage)
+from glustolibs.gluster.exceptions import ExecutionError
+from glustolibs.misc.misc_libs import upload_scripts
+from glustolibs.io.utils import validate_io_procs
+from glustolibs.gluster.brick_ops import add_brick
+from glustolibs.gluster.brick_libs import (get_all_bricks,
+ bring_bricks_offline,
+ bring_bricks_online)
+from glustolibs.gluster.lib_utils import form_bricks_list
+from glustolibs.gluster.rebalance_ops import rebalance_start
+
+
+@runs_on([['distributed-replicated'],
+ ['glusterfs', 'nfs']])
+class TestQuotaRebalanceHeal(GlusterBaseClass):
+ """
+ Test if the quota limits are honored while a rebalance and
+ heal is in progress.
+ """
+ @classmethod
+ def setUpClass(cls):
+ # Calling GlusterBaseClass setUpClass
+ cls.get_super_method(cls, 'setUpClass')()
+
+ # Upload io scripts for running IO on mounts
+ g.log.info("Upload io scripts to clients %s for running IO on mounts",
+ cls.clients)
+ cls.script_upload_path = ("/usr/share/glustolibs/io/scripts/"
+ "file_dir_ops.py")
+ ret = upload_scripts(cls.clients, cls.script_upload_path)
+ if not ret:
+ raise ExecutionError("Failed to upload IO scripts to clients %s"
+ % cls.clients)
+ g.log.info("Successfully uploaded IO scripts to clients %s",
+ cls.clients)
+
+ def setUp(self):
+ # Calling GlusterBaseClass setUp
+ self.get_super_method(self, 'setUp')()
+
+ self.all_mounts_procs = []
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup Volume and Mount Volume")
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume and Mount_Volume")
+ g.log.info("Successful in Setup Volume and Mount Volume")
+
+ def tearDown(self):
+ """
+ Cleanup and umount volume
+ """
+ # Cleanup and umount volume
+ g.log.info("Starting to Unmount Volume and Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
+
+ # Calling GlusterBaseClass teardown
+ self.get_super_method(self, 'tearDown')()
+
+ def test_quota_rebalance_heal(self):
+ """
+ * Enable quota on the volume
+ * set hard and soft time out to zero.
+ * Create some files and directories from mount point
+ so that the limits are reached.
+ * Perform add-brick operation on the volume.
+ * Start rebalance on the volume.
+ * While rebalance is running, kill one of the bricks of the volume
+ and start after a while.
+ * While rebalance + self heal is in progress,
+ create some more files and
+ directories from the mount point until limit is hit
+ """
+
+ # Enable Quota
+ g.log.info("Enabling quota on the volume %s", self.volname)
+ ret, _, _ = quota_enable(self.mnode, self.volname)
+ self.assertEqual(ret, 0, ("Failed to enable quota on the volume %s",
+ self.volname))
+ g.log.info("Successfully enabled quota on the volume %s", self.volname)
+
+ # Set the Quota timeouts to 0 for strict accounting
+ ret, _, _ = quota_set_hard_timeout(self.mnode, self.volname, 0)
+ self.assertEqual(ret, 0, ("Failed to set softtimeout ot 0 for %s",
+ self.volname))
+
+ ret, _, _ = quota_set_soft_timeout(self.mnode, self.volname, 0)
+ self.assertEqual(ret, 0, ("Failed to set softtimeout ot 0 for %s",
+ self.volname))
+ g.log.info("soft and hard timeout has been set to 0 for %s",
+ self.volname)
+
+ # Create Directories and files (write 4MB of data)
+ for mount_object in self.mounts:
+ g.log.info("Creating Directories on %s:%s",
+ mount_object.client_system, mount_object.mountpoint)
+ cmd = ("/usr/bin/env python %s create_deep_dirs_with_files -d 0 "
+ "-f 1024 -l 4 --fixed-file-size 1k %s" % (
+ self.script_upload_path,
+ mount_object.mountpoint))
+
+ proc = g.run_async(mount_object.client_system, cmd,
+ user=mount_object.user)
+ self.all_mounts_procs.append(proc)
+
+ # Validate IO
+ g.log.info("Wait for IO to complete and validate IO ...")
+ ret = validate_io_procs(self.all_mounts_procs, self.mounts)
+ self.assertTrue(ret, "IO failed on some of the clients")
+ g.log.info("IO is successful on all mounts")
+
+ # Set limit of 4 MB on root dir
+ g.log.info("Set Quota Limit on root directory of the volume %s",
+ self.volname)
+ ret, _, _ = quota_limit_usage(self.mnode, self.volname, '/', '4MB')
+ self.assertEqual(ret, 0, "Failed to set Quota for dir /.")
+ g.log.info("Set quota for dir / successfully.")
+
+ # Add bricks
+ replica_count_of_volume = self.volume['voltype']['replica_count']
+ bricks_list = form_bricks_list(self.mnode, self.volname,
+ replica_count_of_volume, self.servers,
+ self.all_servers_info)
+ g.log.info("new brick list: %s", str(bricks_list))
+ ret, _, _ = add_brick(self.mnode, self.volname,
+ bricks_list, False)
+ self.assertEqual(ret, 0, "Failed to add the bricks to the volume")
+ g.log.info("Successfully added bricks to volume")
+
+ # Perform rebalance start operation
+ ret, _, _ = rebalance_start(self.mnode, self.volname)
+ self.assertEqual(ret, 0, "Rebalance start is success")
+
+ # Sleep until rebalance has done some work
+ g.log.info("wait for rebalance to make progress")
+ sleep(3)
+
+ # Kill a brick and bring it up to trigerr self heal
+ all_bricks = get_all_bricks(self.mnode, self.volname)
+ self.assertIsNotNone(all_bricks, "unable to get list of bricks")
+ g.log.info("bringing down brick: %s", all_bricks[0])
+ ret = bring_bricks_offline(self.volname, all_bricks[0])
+ self.assertTrue(ret, "unable to bring brick1 offline")
+ g.log.info("Successfully brought the following brick offline "
+ ": %s", str(all_bricks[0]))
+
+ ret = bring_bricks_online(
+ self.mnode, self.volname,
+ [all_bricks[0]])
+ self.assertTrue(ret, "unable to bring %s online" % all_bricks[0])
+ g.log.info("Successfully brought the following brick online "
+ ": %s", str(all_bricks[0]))
+
+ # Do some more IO and check if hard limit is honoured
+ all_mounts_procs = []
+ for mount_object in self.mounts:
+ cmd = ("/usr/bin/env python %s create_files "
+ "-f 100 --base-file-name file %s" % (
+ self.script_upload_path,
+ mount_object.mountpoint))
+ proc = g.run_async(mount_object.client_system, cmd,
+ user=mount_object.user)
+ all_mounts_procs.append(proc)
+
+ # Validate I/O
+ g.log.info("Wait for IO to complete and validate IO.....")
+ ret = validate_io_procs(all_mounts_procs, self.mounts)
+ self.assertFalse(ret, "Writes allowed past quota limit")
+ g.log.info("Quota limits honored as expected")
diff --git a/tests/functional/quota/test_quota_renamed_dir.py b/tests/functional/quota/test_quota_renamed_dir.py
index 9f59d5ef0..e4bc11233 100755
--- a/tests/functional/quota/test_quota_renamed_dir.py
+++ b/tests/functional/quota/test_quota_renamed_dir.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2020 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
@@ -36,7 +36,7 @@ class TestQuotaRenamedDir(GlusterBaseClass):
which is used in tests
"""
# calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Setup Volume and Mount Volume
g.log.info("Starting to Setup and Mount Volume %s",
@@ -47,20 +47,17 @@ class TestQuotaRenamedDir(GlusterBaseClass):
% cls.volname)
g.log.info("Successful in Setup and Mount Volume %s", cls.volname)
- @classmethod
- def tearDownClass(cls):
- """
- Clean up the volume and umount volume from client
- """
- # stopping the volume
+ def tearDown(self):
+
+ # Unmount and cleanup original volume
g.log.info("Starting to Unmount Volume and Cleanup Volume")
- ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts)
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
if not ret:
- raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")
- g.log.info("Successful in Unmount Volume and Cleanup Volume")
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
- # calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
def test_quota_with_renamed_dir(self):
"""
diff --git a/tests/functional/quota/test_quota_single_brick_volume.py b/tests/functional/quota/test_quota_single_brick_volume.py
index d2ca8d637..cb228baee 100644
--- a/tests/functional/quota/test_quota_single_brick_volume.py
+++ b/tests/functional/quota/test_quota_single_brick_volume.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2017-2020 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
@@ -15,6 +15,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from glusto.core import Glusto as g
+
from glustolibs.gluster.gluster_base_class import (GlusterBaseClass,
runs_on)
from glustolibs.gluster.quota_ops import (quota_enable,
@@ -37,16 +38,14 @@ class QuotaListPathValues(GlusterBaseClass):
"""
# calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Upload io scripts for running IO on mounts
g.log.info("Upload io scripts to clients %s for running IO on mounts",
cls.clients)
- script_local_path = ("/usr/share/glustolibs/io/scripts/"
- "file_dir_ops.py")
cls.script_upload_path = ("/usr/share/glustolibs/io/scripts/"
"file_dir_ops.py")
- ret = upload_scripts(cls.clients, [script_local_path])
+ ret = upload_scripts(cls.clients, cls.script_upload_path)
if not ret:
raise ExecutionError("Failed to upload IO scripts to clients")
g.log.info("Successfully uploaded IO scripts to clients %s",
@@ -67,21 +66,17 @@ class QuotaListPathValues(GlusterBaseClass):
raise ExecutionError("Failed to Setup_Volume and Mount_Volume")
g.log.info("Successful in Setup and Mount Volume %s", cls.volname)
- @classmethod
- def tearDownClass(cls):
- """
- Clean up the volume and umount volume from client
- """
+ def tearDown(self):
- # stopping the volume
+ # Unmount and cleanup original volume
g.log.info("Starting to Unmount Volume and Cleanup Volume")
- ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts)
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
if not ret:
- raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")
- g.log.info("Successful in Unmount Volume and Cleanup Volume")
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
- # calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
def test_quota_single_brick_volume(self):
"""
@@ -121,14 +116,14 @@ class QuotaListPathValues(GlusterBaseClass):
for mount_obj in self.mounts:
g.log.info("Starting IO on %s:%s", mount_obj.client_system,
mount_obj.mountpoint)
- cmd = ("python %s create_deep_dirs_with_files "
+ cmd = ("/usr/bin/env python %s create_deep_dirs_with_files "
"--dirname-start-num %d "
"--dir-depth 2 "
"--dir-length 20 "
"--max-num-of-dirs 5 "
- "--num-of-files 5 %s" % (self.script_upload_path,
- count,
- mount_obj.mountpoint))
+ "--num-of-files 5 %s" % (
+ self.script_upload_path,
+ count, mount_obj.mountpoint))
proc = g.run_async(mount_obj.client_system, cmd,
user=mount_obj.user)
all_mounts_procs.append(proc)
diff --git a/tests/functional/quota/test_quota_symlink_limit.py b/tests/functional/quota/test_quota_symlink_limit.py
index 75ae83cb1..a4c27dac9 100644
--- a/tests/functional/quota/test_quota_symlink_limit.py
+++ b/tests/functional/quota/test_quota_symlink_limit.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2017-2020 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
@@ -34,7 +34,7 @@ class QuotaUniqueSoftLimit(GlusterBaseClass):
which is used in tests
"""
# Calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Setup Volume and Mount Volume
g.log.info("Starting to Setup and Mount Volume %s",
@@ -45,20 +45,17 @@ class QuotaUniqueSoftLimit(GlusterBaseClass):
% cls.volname)
g.log.info("Successful in Setup and Mount Volume %s", cls.volname)
- @classmethod
- def tearDownClass(cls):
- """
- Clean up the volume and umount volume from client
- """
- # Stopping the volume
+ def tearDown(self):
+
+ # Unmount and cleanup original volume
g.log.info("Starting to Unmount Volume and Cleanup Volume")
- ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts)
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
if not ret:
- raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")
- g.log.info("Successful in Unmount Volume and Cleanup Volume")
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
- # Calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
def test_quota_symlink_limit(self):
"""
diff --git a/tests/functional/quota/test_quota_unique_soft_limit.py b/tests/functional/quota/test_quota_unique_soft_limit.py
index b175f12a2..14bb15148 100644
--- a/tests/functional/quota/test_quota_unique_soft_limit.py
+++ b/tests/functional/quota/test_quota_unique_soft_limit.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2017-2020 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
@@ -37,7 +37,7 @@ class QuotaUniqueSoftLimit(GlusterBaseClass):
which is used in tests
"""
# Calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Setup Volume and Mount Volume
g.log.info("Starting to Setup and Mount Volume %s",
@@ -48,20 +48,17 @@ class QuotaUniqueSoftLimit(GlusterBaseClass):
% cls.volname)
g.log.info("Successful in Setup and Mount Volume %s", cls.volname)
- @classmethod
- def tearDownClass(cls):
- """
- Clean up the volume and umount volume from client
- """
- # Stopping the volume
+ def tearDown(self):
+
+ # Unmount and cleanup original volume
g.log.info("Starting to Unmount Volume and Cleanup Volume")
- ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts)
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
if not ret:
- raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")
- g.log.info("Successful in Unmount Volume and Cleanup Volume")
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
- # Calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
def test_quota_unique_soft_limit(self):
"""
diff --git a/tests/functional/quota/test_quota_volume_subdir_limits.py b/tests/functional/quota/test_quota_volume_subdir_limits.py
index 7e4245c16..aa5a8c13b 100644
--- a/tests/functional/quota/test_quota_volume_subdir_limits.py
+++ b/tests/functional/quota/test_quota_volume_subdir_limits.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2015-2020 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
@@ -38,7 +38,7 @@ class QuotaVolumeAndSubdirLimits(GlusterBaseClass):
"""
# calling GlusterBaseClass setUpClass
- GlusterBaseClass.setUpClass.im_func(cls)
+ cls.get_super_method(cls, 'setUpClass')()
# Setup Volume and Mount Volume
g.log.info("Starting to Setup and Mount Volume %s",
@@ -49,21 +49,17 @@ class QuotaVolumeAndSubdirLimits(GlusterBaseClass):
% cls.volname)
g.log.info("Successful in Setup and Mount Volume %s", cls.volname)
- @classmethod
- def tearDownClass(cls):
- """
- Clean up the volume and umount volume from client
- """
+ def tearDown(self):
- # stopping the volume
+ # Unmount and cleanup original volume
g.log.info("Starting to Unmount Volume and Cleanup Volume")
- ret = cls.unmount_volume_and_cleanup_volume(mounts=cls.mounts)
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
if not ret:
- raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")
- g.log.info("Successful in Unmount Volume and Cleanup Volume")
+ raise ExecutionError("Failed to umount the vol & cleanup Volume")
+ g.log.info("Successful in umounting the volume and Cleanup")
- # calling GlusterBaseClass tearDownClass
- GlusterBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ self.get_super_method(self, 'tearDown')()
def test_quota_volume_subdir_limits(self):
"""