summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/brick_ops.py4
-rw-r--r--tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py121
-rw-r--r--tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/mount_ops.py2
-rw-r--r--tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/peer_ops.py26
-rw-r--r--tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/quota_ops.py4
-rw-r--r--tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance.py6
-rw-r--r--tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance_ops.py12
-rw-r--r--tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/snap_ops.py44
-rw-r--r--tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/volume_ops.py29
-rw-r--r--tests/distaf/distaf_libs/distaflibs-io/distaflibs/io/file_ops.py8
-rw-r--r--tests/distaf/tests_d/examples/test_basic_gluster_tests.py33
-rw-r--r--tests/distaf/tests_d/examples/test_docstring.py2
-rw-r--r--tests/distaf/tests_d/examples/test_passfail.py6
13 files changed, 217 insertions, 80 deletions
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/brick_ops.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/brick_ops.py
index 3c363c2bfed..a8fad5a3efb 100644
--- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/brick_ops.py
+++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/brick_ops.py
@@ -36,7 +36,7 @@ def add_brick(volname, nbricks, replica=1, stripe=1, peers='', mnode=''):
if peers == '':
peers = tc.peers[:]
if mnode == '':
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
replica = int(replica)
stripe = int(stripe)
volinfo = tc.run(mnode, "gluster volume info | egrep \"^Brick[0-9]+\"", \
@@ -75,7 +75,7 @@ def bring_down_brick(volname, bindex, node=''):
"""
global tc
if node == '':
- node = tc.nodes[0]
+ node = tc.servers[0]
ret, rnode, _ = tc.run(node, "gluster volume info %s | egrep \"^Brick%d:\""
" | awk '{print $2}' | awk -F : '{print $1}'"
% (volname, bindex))
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py
new file mode 100644
index 00000000000..128288bb10f
--- /dev/null
+++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/gluster_base_class.py
@@ -0,0 +1,121 @@
+# 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
+from distaflibs.gluster.volume_ops import (setup_vol, get_volume_info,
+ cleanup_volume)
+
+
+class GlusterBaseClass():
+ """
+ This is the base class for the distaf tests
+
+ All tests can subclass this and then write test cases
+ """
+
+ def __init__(self, config_data):
+ """
+ Initialise the class with the config values
+ """
+ if config_data['global_mode']:
+ self.volname = config_data['volumes'].keys()[0]
+ self.voltype = config_data['volumes'][self.volname]['voltype']
+ self.servers = config_data['volumes'][self.volname]['servers']
+ self.peers = config_data['volumes'][self.volname]['peers']
+ self.clients = config_data['volumes'][self.volname]['clients']
+ self.mount_proto = (config_data['volumes'][self.volname]
+ ['mount_proto'])
+ self.mountpoint = (config_data['volumes'][self.volname]
+ ['mountpoint'])
+ else:
+ self.voltype = config_data['voltype']
+ self.volname = "%s-testvol" % self.voltype
+ self.servers = config_data['servers'].keys()
+ self.clients = config_data['clients'].keys()
+ self.peers = []
+ if config_data['peers'] is not None:
+ self.peers = config_data['peers'].keys()
+ self.mount_proto = config_data['mount_proto']
+ self.mountpoint = "/mnt/%s_mount" % self.mount_proto
+ self.mnode = self.servers[0]
+ self.config_data = config_data
+
+ def _create_volume(self):
+ """
+ Create the volume with proper configurations
+ """
+ dist = rep = dispd = red = stripe = 1
+ trans = ''
+ if self.voltype == 'distribute':
+ dist = self.config_data[self.voltype]['dist_count']
+ trans = self.config_data[self.voltype]['transport']
+ elif self.voltype == 'replicate':
+ rep = self.config_data[self.voltype]['replica']
+ trans = self.config_data[self.voltype]['transport']
+ elif self.voltype == 'dist_rep':
+ dist = self.config_data[self.voltype]['dist_count']
+ rep = self.config_data[self.voltype]['replica']
+ trans = self.config_data[self.voltype]['transport']
+ elif self.voltype == 'disperse':
+ dispd = self.config_data[self.voltype]['disperse']
+ red = self.config_data[self.voltype]['redundancy']
+ trans = self.config_data[self.voltype]['transport']
+ elif self.voltype == 'dist_disperse':
+ dist = self.config_data[self.voltype]['dist_count']
+ dispd = self.config_data[self.voltype]['disperse']
+ red = self.config_data[self.voltype]['redundancy']
+ trans = self.config_data[self.voltype]['transport']
+ else:
+ tc.logger.error("The volume type is not present")
+ return False
+ ret = setup_vol(self.volname, dist, rep, dispd, red, stripe, trans,
+ servers=self.servers)
+ if not ret:
+ tc.logger.error("Unable to setup volume %s", self.volname)
+ return False
+ return True
+
+ def setup(self):
+ """
+ Function to setup the volume for testing.
+ """
+ volinfo = get_volume_info(server=self.servers[0])
+ if volinfo is not None and self.volname in volinfo.keys():
+ tc.logger.debug("The volume %s is already present in %s",
+ self.volname, self.mnode)
+ if not self.config_data['reuse_setup']:
+ ret = cleanup_volume(self.volname, self.mnode)
+ if not ret:
+ tc.logger.error("Unable to cleanup the setup")
+ return False
+ return self._create_volume()
+ else:
+ return self._create_volume()
+ return True
+
+ def teardown(self):
+ """
+ The function to cleanup the test setup
+ """
+ return True
+
+ def cleanup(self):
+ """
+ The function to cleanup the volume
+ """
+ return cleanup_volume(self.volname, self.mnode)
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/mount_ops.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/mount_ops.py
index 165e389f4da..00bb49bf82d 100644
--- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/mount_ops.py
+++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/mount_ops.py
@@ -30,7 +30,7 @@ def mount_volume(volname, mtype='glusterfs', mpoint='/mnt/glusterfs', \
"""
global tc
if mserver == '':
- mserver = tc.nodes[0]
+ mserver = tc.servers[0]
if mclient == '':
mclient = tc.clients[0]
if options != '':
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/peer_ops.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/peer_ops.py
index 18938f41224..c235e637801 100644
--- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/peer_ops.py
+++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/peer_ops.py
@@ -53,7 +53,7 @@ def peer_probe(server, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster peer probe %s" % server
return tc.run(mnode, cmd)
@@ -82,7 +82,7 @@ def peer_detach(server, force=False, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
if force:
cmd = "gluster peer detach %s force" % server
@@ -111,7 +111,7 @@ def peer_status(mnode=None):
"""
tc.logger.info("Inside peer status")
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster peer status"
return tc.run(mnode, cmd)
@@ -136,7 +136,7 @@ def pool_list(mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster pool list"
return tc.run(mnode, cmd)
@@ -160,11 +160,11 @@ def peer_probe_servers(servers=None, validate=True, time_delay=10, mnode=None):
bool: True on success and False on failure.
"""
if servers is None:
- servers = tc.nodes[:]
+ servers = tc.servers[:]
if not isinstance(servers, list):
servers = [servers]
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
if mnode in servers:
servers.remove(mnode)
@@ -217,11 +217,11 @@ def peer_detach_servers(servers=None, force=False, validate=True,
bool: True on success and False on failure.
"""
if servers is None:
- servers = tc.nodes[:]
+ servers = tc.servers[:]
if not isinstance(servers, list):
servers = [servers]
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
if mnode in servers:
servers.remove(mnode)
@@ -255,7 +255,7 @@ def nodes_from_pool_list(mnode=None):
list: List of nodes in pool on Success, Empty list on failure.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
pool_list_data = get_pool_list(mnode)
if pool_list_data is None:
@@ -297,7 +297,7 @@ def get_peer_status(mnode=None):
]
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
ret, out, _ = tc.run(mnode, "gluster peer status --xml", verbose=False)
if ret != 0:
@@ -353,7 +353,7 @@ def get_pool_list(mnode=None):
]
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
ret, out, _ = tc.run(mnode, "gluster pool list --xml", verbose=False)
if ret != 0:
@@ -398,11 +398,11 @@ def is_peer_connected(servers=None, mnode=None):
failure.
"""
if servers is None:
- servers = tc.nodes[:]
+ servers = tc.servers[:]
if not isinstance(servers, list):
servers = [servers]
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
if mnode in servers:
servers.remove(mnode)
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/quota_ops.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/quota_ops.py
index fe90b5f359f..ad41c460c47 100644
--- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/quota_ops.py
+++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/quota_ops.py
@@ -26,7 +26,7 @@ def enable_quota(volname, server=''):
Returns the output of quota cli command
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
cmd = "gluster volume quota %s enable" % volname
return tc.run(server, cmd)
@@ -39,6 +39,6 @@ def set_quota_limit(volname, path='/', limit='100GB', server=''):
Returs the output of quota limit-usage command
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
cmd = "gluster volume quota %s limit-usage %s %s" % (volname, path, limit)
return tc.run(server, cmd)
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance.py
index e36b7ee9855..721e1a907dc 100644
--- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance.py
+++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance.py
@@ -59,7 +59,7 @@ def get_rebal_status(volname, server=''):
if the server pararmeter is empty it takes node info from config file
'''
if server == "":
- server = tc.nodes[0]
+ server = tc.servers[0]
status = tc.run(server, "gluster v rebalance %s status" %volname)
if status[0] != 0:
if "not started" in status[2]:
@@ -105,13 +105,13 @@ def rebal_start(volname, server=''):
Simple interface to start the gluster rebalance
@ pararmeter:
* volname
- * server - defaults to tc.nodes[0]
+ * server - defaults to tc.servers[0]
@ returns:
True on success
False otherwise
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
ret = tc.run(server, "gluster volume rebalance %s start" % volname)
if ret[0] != 0:
tc.logger.error("rebalance start %s failed" % volname)
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance_ops.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance_ops.py
index 4e4ea6bb6db..271d4f4001f 100644
--- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance_ops.py
+++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/rebalance_ops.py
@@ -61,7 +61,7 @@ def rebalance_start(volname, mnode=None, fix_layout=False, force=False):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
flayout = ''
if fix_layout:
@@ -106,7 +106,7 @@ def rebalance_stop(volname, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster volume rebalance %s stop" % volname
ret = tc.run(mnode, cmd)
@@ -138,7 +138,7 @@ def rebalance_status(volname, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster volume rebalance %s status" % volname
ret = tc.run(mnode, cmd)
@@ -183,7 +183,7 @@ def get_rebalance_status(volname, mnode=None):
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster volume rebalance %s status --xml" % volname
ret, out, _ = tc.run(mnode, cmd, verbose=False)
@@ -256,7 +256,7 @@ def rebalance_stop_and_get_status(volname, mnode=None):
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster volume rebalance %s stop --xml" % volname
ret, out, _ = tc.run(mnode, cmd, verbose=False)
@@ -308,7 +308,7 @@ def wait_for_rebalance_to_complete(volname, mnode=None):
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
count = 0
flag = 0
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/snap_ops.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/snap_ops.py
index 633ef3b44a8..91785cc618f 100644
--- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/snap_ops.py
+++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/snap_ops.py
@@ -65,7 +65,7 @@ def snap_create(volname, snapname, timestamp=False, description='',
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
if description != '':
description = "description '%s'" % description
@@ -110,7 +110,7 @@ def snap_clone(snapname, clonename, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster snapshot clone %s %s --mode=script" % (clonename, snapname)
return tc.run(mnode, cmd)
@@ -141,7 +141,7 @@ def snap_restore(snapname, mnode=None):
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster snapshot restore %s --mode=script" % snapname
return tc.run(mnode, cmd)
@@ -164,7 +164,7 @@ def snap_restore_complete(volname, snapname, mnode=None):
bool: True on success, False on failure
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
# Stopping volume before snap restore
ret = stop_volume(volname, mnode)
@@ -210,7 +210,7 @@ def snap_status(snapname="", volname="", mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
if snapname != "" and volname != "":
tc.logger.error("Incorrect cmd. snap status cli accepts either "
@@ -251,7 +251,7 @@ def get_snap_status(mnode=None):
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
ret, out, _ = tc.run(mnode, "gluster snapshot status --xml", verbose=False)
if ret != 0:
@@ -315,7 +315,7 @@ def get_snap_status_by_snapname(snapname, mnode=None):
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
snap_status_list = get_snap_status(mnode=mnode)
if not snap_status_list:
@@ -360,7 +360,7 @@ def get_snap_status_by_volname(volname, mnode=None):
'uuid': 'dcf0cd31-c0db-47ad-92ec-f72af2d7b385'}]
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster snapshot status volume %s --xml" % volname
ret, out, _ = tc.run(mnode, cmd, verbose=False)
@@ -423,7 +423,7 @@ def snap_info(snapname="", volname="", mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
if snapname != "" and volname != "":
tc.logger.error("Incorrect cmd. snap info cli accepts either "
@@ -461,7 +461,7 @@ def get_snap_info(mnode=None):
'2016-04-07 13:59:43', 'name': 'snap1'}]
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
ret, out, _ = tc.run(mnode, "gluster snapshot info --xml", verbose=False)
if ret != 0:
@@ -519,7 +519,7 @@ def get_snap_info_by_snapname(snapname, mnode=None):
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
snap_info_list = get_snap_info(mnode=mnode)
if not snap_info_list:
@@ -561,7 +561,7 @@ def get_snap_info_by_volname(volname, mnode=None):
'2016-04-07 12:03:11', 'name': 'next_snap1'}]}
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster snapshot info volume %s --xml" % volname
ret, out, _ = tc.run(mnode, cmd, verbose=False)
@@ -633,7 +633,7 @@ def snap_list(mnode=None):
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster snapshot list"
return tc.run(mnode, cmd)
@@ -654,7 +654,7 @@ def get_snap_list(mnode=None):
['snap1', 'snap2']
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
ret, out, _ = tc.run(mnode, "gluster snapshot list --xml", verbose=False)
if ret != 0:
@@ -699,7 +699,7 @@ def snap_config(volname=None, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
if volname is None:
volname = ""
@@ -730,7 +730,7 @@ def get_snap_config(volname=None, mnode=None):
'autoDelete': 'disable'}}
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
ret, out, _ = tc.run(mnode, "gluster snapshot config --xml", verbose=False)
if ret != 0:
@@ -794,7 +794,7 @@ def set_snap_config(option, volname=None, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
if volname is None:
volname = ""
@@ -829,7 +829,7 @@ def snap_delete(snapname, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster snapshot delete %s --mode=script" % snapname
return tc.run(mnode, cmd)
@@ -860,7 +860,7 @@ def snap_delete_by_volumename(volname, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster snapshot delete volume %s --mode=script" % volname
return tc.run(mnode, cmd)
@@ -888,7 +888,7 @@ def snap_delete_all(mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster snapshot delete all --mode=script"
return tc.run(mnode, cmd)
@@ -921,7 +921,7 @@ def snap_activate(snapname, force=False, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
frce = ''
if force:
@@ -956,6 +956,6 @@ def snap_deactivate(snapname, mnode=None):
of the command execution.
"""
if mnode is None:
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster snapshot deactivate %s --mode=script" % snapname
return tc.run(mnode, cmd)
diff --git a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/volume_ops.py b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/volume_ops.py
index f44aeec3043..a77c0ae2729 100644
--- a/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/volume_ops.py
+++ b/tests/distaf/distaf_libs/distaflibs-gluster/distaflibs/gluster/volume_ops.py
@@ -26,8 +26,9 @@ try:
except ImportError:
import xml.etree.ElementTree as etree
from distaflibs.gluster.mount_ops import mount_volume
-from distaflibs.gluster.peer_ops import peer_probe, nodes_from_pool_list
from distaflibs.gluster.gluster_init import env_setup_servers, start_glusterd
+from distaflibs.gluster.peer_ops import ( peer_probe_servers,
+ nodes_from_pool_list )
"""
This file contains the gluster volume operations like create volume,
@@ -44,7 +45,7 @@ def create_volume(volname, dist, rep=1, stripe=1, trans='tcp', servers='', \
if servers == '':
servers = nodes_from_pool_list()
if not servers:
- servers = tc.nodes
+ servers = tc.servers
dist = int(dist)
rep = int(rep)
stripe = int(stripe)
@@ -107,7 +108,7 @@ def start_volume(volname, mnode='', force=False):
Returns True if success and False if failure
"""
if mnode == '':
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
frce = ''
if force:
frce = 'force'
@@ -123,7 +124,7 @@ def stop_volume(volname, mnode='', force=False):
Returns True if success and False if failure
"""
if mnode == '':
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
frce = ''
if force:
frce = 'force'
@@ -140,7 +141,7 @@ def delete_volume(volname, mnode=''):
Returns True if success and False if failure
"""
if mnode == '':
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
volinfo = get_volume_info(volname, mnode)
if volinfo is None or volname not in volinfo:
tc.logger.info("Volume %s does not exist in %s" % (volname, mnode))
@@ -166,7 +167,7 @@ def reset_volume(volname, mnode='', force=False):
Returns True if success and False if failure
"""
if mnode == '':
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
frce = ''
if force:
frce = 'force'
@@ -185,7 +186,7 @@ def cleanup_volume(volname, mnode=''):
TODO: Add snapshot cleanup part here
"""
if mnode == '':
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
ret = stop_volume(volname, mnode, True) | \
delete_volume(volname, mnode)
if not ret:
@@ -200,7 +201,7 @@ def setup_meta_vol(servers=''):
specified.
"""
if servers == '':
- servers = tc.nodes
+ servers = tc.servers
meta_volname = 'gluster_shared_storage'
mount_point = '/var/run/gluster/shared_storage'
metav_dist = int(tc.config_data['META_VOL_DIST_COUNT'])
@@ -255,7 +256,7 @@ def setup_vol(volname='', dist='', rep='', dispd='', red='', stripe='', \
Returns True on success and False for failure.
"""
if servers == '':
- servers = tc.nodes
+ servers = tc.servers
volinfo = get_volume_info(server=servers[0])
if volinfo is not None and volname in volinfo.keys():
tc.logger.debug("volume %s already exists in %s. Returning..." \
@@ -270,7 +271,7 @@ def setup_vol(volname='', dist='', rep='', dispd='', red='', stripe='', \
tc.logger.error("glusterd did not start in at least one server")
return False
time.sleep(5)
- ret = peer_probe(servers[0], servers[1:])
+ ret = peer_probe_servers(servers[1:], mnode=servers[0])
if not ret:
tc.logger.error("Unable to peer probe one or more machines")
return False
@@ -342,7 +343,7 @@ def get_volume_status(volname='all', service='', options='', mnode=''):
"""
if mnode == '':
- mnode = tc.nodes[0]
+ mnode = tc.servers[0]
cmd = "gluster vol status %s %s %s --xml" % (volname, service, options)
@@ -427,7 +428,7 @@ def get_volume_option(volname, option='all', server=''):
None, on failure
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
cmd = "gluster volume get %s %s" % (volname, option)
ret = tc.run(server, cmd)
@@ -462,7 +463,7 @@ def get_volume_info(volname='all', server=''):
-- For bricks, the value is a list of bricks (hostname:/brick_path)
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
ret = tc.run(server, "gluster volume info %s --xml" % volname, \
verbose=False)
if ret[0] != 0:
@@ -506,7 +507,7 @@ def set_volume_option(volname, options, server=''):
False, on failure
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
_rc = True
for option in options:
cmd = "gluster volume set %s %s %s" % (volname, option, \
diff --git a/tests/distaf/distaf_libs/distaflibs-io/distaflibs/io/file_ops.py b/tests/distaf/distaf_libs/distaflibs-io/distaflibs/io/file_ops.py
index e5c17432c44..796c0982882 100644
--- a/tests/distaf/distaf_libs/distaflibs-io/distaflibs/io/file_ops.py
+++ b/tests/distaf/distaf_libs/distaflibs-io/distaflibs/io/file_ops.py
@@ -42,7 +42,7 @@ def write_file(filename, file_contents=" ", create_mode='', filesize='', \
False, on failure
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
if create_mode == '':
create_mode = 'open'
@@ -123,7 +123,7 @@ def remove_file(filename, server=''):
False, on failure
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
try:
conn = tc.get_connection(server, 'root')
if conn == -1:
@@ -155,7 +155,7 @@ def calculate_checksum(file_list, server=''):
None, on failure
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
cmd = "sha256sum %s" % ' '.join(file_list)
ret = tc.run(server, cmd)
@@ -191,7 +191,7 @@ def get_extended_attributes_info(file_list, encoding='hex', attr_name='', \
None, on failure
"""
if server == '':
- server = tc.nodes[0]
+ server = tc.servers[0]
server = socket.gethostbyname(server)
if attr_name == '':
diff --git a/tests/distaf/tests_d/examples/test_basic_gluster_tests.py b/tests/distaf/tests_d/examples/test_basic_gluster_tests.py
index 47dfd9372a7..d981c0b8ab5 100644
--- a/tests/distaf/tests_d/examples/test_basic_gluster_tests.py
+++ b/tests/distaf/tests_d/examples/test_basic_gluster_tests.py
@@ -17,10 +17,8 @@
from distaf.util import tc, testcase
-from distaf.gluster_base_class import GlusterBaseClass
-from distaf.gluster_libs.mount_ops import mount_volume, umount_volume
-from distaf.gluster_libs.volume_ops import (setup_vol, stop_volume,
- delete_volume)
+from distaflibs.gluster.gluster_base_class import GlusterBaseClass
+from distaflibs.gluster.mount_ops import mount_volume, umount_volume
@testcase("gluster_basic_test")
@@ -28,17 +26,17 @@ class gluster_basic_test(GlusterBaseClass):
"""
runs_on_volumes: ALL
runs_on_protocol: [ glusterfs, nfs ]
- reuse_setup: True
+ 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)
+ 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))
+ 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:
@@ -47,3 +45,20 @@ class gluster_basic_test(GlusterBaseClass):
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
index 1a73998eb66..a939da8da9e 100644
--- a/tests/distaf/tests_d/examples/test_docstring.py
+++ b/tests/distaf/tests_d/examples/test_docstring.py
@@ -17,7 +17,7 @@
from distaf.util import tc, testcase
-from distaf.gluster_base_class import GlusterBaseClass
+from distaflibs.gluster.gluster_base_class import GlusterBaseClass
# An example with both doc and config in docstring
diff --git a/tests/distaf/tests_d/examples/test_passfail.py b/tests/distaf/tests_d/examples/test_passfail.py
index 3b14c117190..78396349fc4 100644
--- a/tests/distaf/tests_d/examples/test_passfail.py
+++ b/tests/distaf/tests_d/examples/test_passfail.py
@@ -17,7 +17,7 @@
from distaf.util import tc, testcase
-from distaf.gluster_base_class import GlusterBaseClass
+from distaflibs.gluster.gluster_base_class import GlusterBaseClass
@testcase("this_should_pass")
@@ -44,7 +44,7 @@ class GoingToPass(GlusterBaseClass):
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.nodes[0], "hostname")
+ ret, _, _ = tc.run(self.servers[0], "hostname")
if ret != 0:
tc.logger.error("hostname command failed")
return False
@@ -80,7 +80,7 @@ class GoingToFail(GlusterBaseClass):
config = self.config_data
tc.logger.info("Testing fail output")
tc.logger.debug("Tag 1 is %s" % config["tags"][0])
- ret, _, _ = tc.run(self.nodes[0], "false")
+ ret, _, _ = tc.run(self.servers[0], "false")
if ret != 0:
tc.logger.error("false command failed")
return False