summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShwethaHP <spandura@redhat.com>2017-11-23 02:29:35 +0530
committerNigel Babu <nigelb@redhat.com>2018-01-30 04:43:08 +0000
commit9c5e828e51ca14ec5151a629175ed95cce0106fe (patch)
tree2c5f91608a4dfc374e65231b8fe0e3ea8d32e80f
parent3134c04e29b39fcdf1bd70c33b6670ff26404251 (diff)
Adding a cifs security option while mouting if the client is rhel6
Change-Id: Ifc6aa4d106dadf97e1741ec54a3323ea96e33101 Signed-off-by: ShwethaHP <spandura@redhat.com>
-rw-r--r--glustolibs-gluster/glustolibs/gluster/mount_ops.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/mount_ops.py b/glustolibs-gluster/glustolibs/gluster/mount_ops.py
index 10d323a62..c0c7cc08e 100644
--- a/glustolibs-gluster/glustolibs/gluster/mount_ops.py
+++ b/glustolibs-gluster/glustolibs/gluster/mount_ops.py
@@ -357,8 +357,28 @@ def mount_volume(volname, mtype, mpoint, mserver, mclient, options='',
"for cifs mounts")
return (1, '', '')
- mcmd = ("mount -t cifs -o username=%s,password=%s "
- "\\\\\\\\%s\\\\gluster-%s %s" % (smbuser, smbpasswd, mserver,
+ # Check if client is running rhel. If so add specific options
+ cifs_options = ""
+ try:
+ conn = g.rpyc_get_connection(mclient, user=user)
+ if conn is None:
+ g.log.error("Unable to get connection to %s on node %s"
+ " in mount_volume()", user, mclient)
+ return (1, '', '')
+
+ os, version, name = conn.modules.platform.linux_distribution()
+ if "Santiago" in name:
+ cifs_options = "sec=ntlmssp"
+ except Exception as e:
+ g.log.error("Exception occured while getting the platform "
+ "of node %s: %s", mclient, str(e))
+ return (1, '', '')
+ finally:
+ g.rpyc_close_connection(host=mclient, user=user)
+
+ mcmd = ("mount -t cifs -o username=%s,password=%s,%s "
+ "\\\\\\\\%s\\\\gluster-%s %s" % (smbuser, smbpasswd,
+ cifs_options, mserver,
volname, mpoint))
# Create mount dir