Change in vdsm[ovirt-3.5-gluster]: gluster: run restorecon for files created during geo-rep cre...

dnarayan at redhat.com dnarayan at redhat.com
Fri Jun 26 12:37:35 UTC 2015


Hello Piotr Kliczewski, Bala.FA, Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/42913

to review the following change.

Change subject: gluster: run restorecon for files created during geo-rep create.
......................................................................

gluster: run restorecon for files created during geo-rep create.

This patch runs restorecon on ssh directory and authorized_keys
file if they are created as part of geoRepKeysUpdate verb.
This is used by geo replication feature. When selinux is
enabled, without this fix ssh between master and slave nodes
fail.

Change-Id: I23a9bb5dfd2e22f91a796635a3192ca617b69632
Bug-Url:https://bugzilla.redhat.com/show_bug.cgi?id=1230353
Signed-off-by: Darshan N <dnarayan at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/42804
Continuous-Integration: Jenkins CI
Reviewed-by: Bala.FA <barumuga at redhat.com>
Reviewed-by: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M vdsm/gluster/api.py
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/42913/1

diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index c007b28..0c5829f 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -21,6 +21,7 @@
 import errno
 import fcntl
 import os
+import selinux
 from functools import wraps
 from vdsm.define import doneCode
 from vdsm import constants, utils
@@ -129,6 +130,8 @@
         try:
             os.makedirs(sshDir, 0700)
             os.chown(sshDir, uid, gid)
+            if selinux.is_selinux_enabled():
+                selinux.restorecon(sshDir)
         except OSError as e:
             raise ge.GlusterGeoRepPublicKeyWriteFailedException(err=[str(e)])
 
@@ -155,7 +158,9 @@
         safeWrite(authKeysFile, ''.join(outLines))
         os.chmod(authKeysFile, 0600)
         os.chown(authKeysFile, uid, gid)
-    except IOError as e:
+        if selinux.is_selinux_enabled():
+            selinux.restorecon(authKeysFile)
+    except (IOError, OSError) as e:
         raise ge.GlusterGeoRepPublicKeyWriteFailedException(err=[str(e)])
 
 


-- 
To view, visit https://gerrit.ovirt.org/42913
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I23a9bb5dfd2e22f91a796635a3192ca617b69632
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5-gluster
Gerrit-Owner: Darshan N <dnarayan at redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>


More information about the vdsm-patches mailing list