summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py
diff options
context:
space:
mode:
authorShwethaHP <spandura@redhat.com>2017-08-04 16:43:43 +0530
committerShwethaHP <spandura@redhat.com>2017-08-09 15:19:37 +0530
commit0a4cdc909d4f5cb60b5dba5f2ca360db8e74796f (patch)
treebd641dedeb422eb40b61b4e806349efc9a77f101 /glustolibs-gluster/glustolibs/gluster/gluster_base_class.py
parent3f38fd0b62eb0e2397e9bef4bcf8227a33f5361c (diff)
Providing configs to set volume options, group options when exporting volume as 'smb share',
'nfs-ganesha export' in the config yml. Reading the configs in the gluster_base_class and setting those configs when exporting the volumes as 'smb share' or 'nfs-ganesha export'. recommended options when exporting volume as 'smb share': group: "metadata-cache" cache-samba-metadata: "on" Change-Id: I86a118c7015eaedd849a0f6e8b613605df5b6c32 Signed-off-by: ShwethaHP <spandura@redhat.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/gluster_base_class.py')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/gluster_base_class.py45
1 files changed, 44 insertions, 1 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py
index 3dd8f97..3f94fbf 100644
--- a/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py
+++ b/glustolibs-gluster/glustolibs/gluster/gluster_base_class.py
@@ -28,7 +28,7 @@ import datetime
from glusto.core import Glusto as g
from glustolibs.gluster.exceptions import ExecutionError, ConfigError
from glustolibs.gluster.peer_ops import is_peer_connected, peer_status
-from glustolibs.gluster.volume_ops import volume_info
+from glustolibs.gluster.volume_ops import volume_info, set_volume_options
from glustolibs.gluster.volume_libs import (setup_volume, cleanup_volume,
log_volume_info_and_status)
from glustolibs.gluster.samba_libs import share_volume_over_smb
@@ -210,6 +210,22 @@ class GlusterBaseClass(unittest.TestCase):
g.config['gluster'].get('volume_options')):
cls.volume_options = g.config['gluster']['volume_options']
+ # If the volume is exported as SMB Share, then set the following
+ # volume options on the share.
+ cls.smb_share_options = {}
+ if (g.config.get('gluster') and
+ g.config['gluster'].get('smb_share_options')):
+ cls.smb_share_options = (
+ g.config['gluster']['smb_share_options'])
+
+ # If the volume is exported as NFS-Ganesha export,
+ # then set the following volume options on the export.
+ cls.nfs_ganesha_export_options = {}
+ if (g.config.get('gluster') and
+ g.config['gluster'].get('nfs_ganesha_export_options')):
+ cls.nfs_ganesha_export_options = (
+ g.config['gluster']['nfs_ganesha_export_options'])
+
# Get the volume configuration.
cls.volume = {}
if cls.volume_type:
@@ -425,6 +441,20 @@ class GlusterVolumeBaseClass(GlusterBaseClass):
raise ExecutionError("Failed to export volume %s "
"as NFS export", cls.volname)
+ # Set NFS-Ganesha specific volume options
+ if cls.enable_nfs_ganesha and cls.nfs_ganesha_export_options:
+ g.log.info("Setting NFS-Ganesha export specific "
+ "volume options")
+ ret = set_volume_options(
+ mnode=cls.mnode, volname=cls.volname,
+ options=cls.nfs_ganesha_export_options)
+ if not ret:
+ raise ExecutionError("Failed to set NFS-Ganesha "
+ "export specific options on "
+ "volume %s", cls.volname)
+ g.log.info("Successful in setting NFS-Ganesha export "
+ "specific volume options")
+
if "smb" in cls.mount_type or "cifs" in cls.mount_type:
ret = share_volume_over_smb(mnode=cls.mnode,
volname=cls.volname,
@@ -433,6 +463,19 @@ class GlusterVolumeBaseClass(GlusterBaseClass):
raise ExecutionError("Failed to export volume %s "
"as SMB Share", cls.volname)
+ # Set SMB share specific volume options
+ if cls.smb_share_options:
+ g.log.info("Setting SMB share specific volume options")
+ ret = set_volume_options(mnode=cls.mnode,
+ volname=cls.volname,
+ options=cls.smb_share_options)
+ if not ret:
+ raise ExecutionError("Failed to set SMB share "
+ "specific options "
+ "on volume %s", cls.volname)
+ g.log.info("Successful in setting SMB share specific "
+ "volume options")
+
# Log Volume Info and Status
ret = log_volume_info_and_status(cls.mnode, cls.volname)
if not ret: