summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py
diff options
context:
space:
mode:
authorArthy Loganathan <aloganat@redhat.com>2017-07-05 20:06:34 +0530
committerJonathan Holloway <jholloway@redhat.com>2017-07-26 15:06:26 +0000
commit697a43d7e00c236e2075508fda31ac986de11d0c (patch)
tree6e9d555635e82491f87a53b7505e9f0652dadd3f /glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py
parent9419fa59b809c3659fe502bdf64df4cdd65b2ee3 (diff)
Added more verification checks in NfsGaneshaVolumeBaseclass
Change-Id: I78bf4eda8c350b22d3a5fabb32b5a20f48ab474e Signed-off-by: Arthy Loganathan <aloganat@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py53
1 files changed, 31 insertions, 22 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py b/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py
index 23f187912..390a6b916 100644
--- a/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/nfs_ganesha_libs.py
@@ -33,7 +33,7 @@ from glustolibs.gluster.nfs_ganesha_ops import (
from glustolibs.gluster.gluster_base_class import GlusterBaseClass
from glustolibs.gluster.exceptions import ExecutionError, ConfigError
from glustolibs.gluster.peer_ops import peer_probe_servers, peer_status
-from glustolibs.gluster.volume_ops import volume_info
+from glustolibs.gluster.volume_ops import volume_info, get_volume_info
from glustolibs.gluster.volume_libs import (setup_volume, cleanup_volume,
log_volume_info_and_status,
get_volume_options,
@@ -266,12 +266,16 @@ class NfsGaneshaVolumeBaseClass(NfsGaneshaClusterSetupClass):
raise ExecutionError("Failed to export volume %s "
"as NFS export", cls.volname)
time.sleep(5)
+
+ ret = wait_for_nfs_ganesha_volume_to_get_exported(cls.mnode,
+ cls.volname)
+ if not ret:
+ raise ExecutionError("Failed to export volume %s. volume is "
+ "not listed in showmount" % cls.volname)
else:
- g.log.info("Volume %s is exported already"
+ g.log.info("Volume %s is exported successfully"
% cls.volname)
- _, _, _ = g.run(cls.mnode, "showmount -e")
-
# Log Volume Info and Status
ret = log_volume_info_and_status(cls.mnode, cls.volname)
if not ret:
@@ -317,25 +321,30 @@ class NfsGaneshaVolumeBaseClass(NfsGaneshaClusterSetupClass):
# Cleanup volume
if cleanup_vol:
- # Unexport volume, if it is not unexported already
- vol_option = get_volume_options(cls.mnode, cls.volname,
- option='ganesha.enable')
- if vol_option is None:
- raise ExecutionError("Failed to get ganesha.enable volume "
- " option for %s " % cls.volume)
- if vol_option['ganesha.enable'] != 'off':
- if is_volume_exported(cls.mnode, cls.volname, "nfs"):
- ret, out, err = unexport_nfs_ganesha_volume(
- mnode=cls.mnode, volname=cls.volname)
- if ret != 0:
- raise ExecutionError("Failed to unexport volume %s "
- % cls.volname)
- time.sleep(5)
+ volinfo = get_volume_info(cls.mnode, cls.volname)
+ if volinfo is None or cls.volname not in volinfo:
+ g.log.info("Volume %s does not exist in %s"
+ % (cls.volname, cls.mnode))
else:
- g.log.info("Volume %s is unexported already"
- % cls.volname)
-
- _, _, _ = g.run(cls.mnode, "showmount -e")
+ # Unexport volume, if it is not unexported already
+ vol_option = get_volume_options(cls.mnode, cls.volname,
+ option='ganesha.enable')
+ if vol_option is None:
+ raise ExecutionError("Failed to get ganesha.enable volume "
+ " option for %s " % cls.volume)
+ if vol_option['ganesha.enable'] != 'off':
+ if is_volume_exported(cls.mnode, cls.volname, "nfs"):
+ ret, out, err = unexport_nfs_ganesha_volume(
+ mnode=cls.mnode, volname=cls.volname)
+ if ret != 0:
+ raise ExecutionError("Failed to unexport volume %s"
+ % cls.volname)
+ time.sleep(5)
+ else:
+ g.log.info("Volume %s is unexported already"
+ % cls.volname)
+
+ _, _, _ = g.run(cls.mnode, "showmount -e")
ret = cleanup_volume(mnode=cls.mnode, volname=cls.volname)
if not ret: