Yaniv Bronhaim has uploaded a new change for review.

Change subject: sanlock isconfigured raises an exception instead of returning 
result
......................................................................

sanlock isconfigured raises an exception instead of returning result

isconfigured calls expect boolean as return value. Exception should be
raised only on critical failures such as sanlock service isn't installed,
or sanlock group does not exist.

Change-Id: Ic174c702f7f5b491975829e227d8311aed26ec90
Signed-off-by: Yaniv Bronhaim <[email protected]>
---
M lib/vdsm/tool/configurator.py
1 file changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/22184/1

diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py
index 51eda80..83bdb22 100644
--- a/lib/vdsm/tool/configurator.py
+++ b/lib/vdsm/tool/configurator.py
@@ -141,6 +141,7 @@
         Return 0 if sanlock service requires a restart to reload the relevant
         supplementary groups.
         """
+        _isconfigured = True
         proc_status_group_prefix = "Groups:\t"
         try:
             with open("/var/run/sanlock/sanlock.pid", "r") as f:
@@ -158,15 +159,18 @@
 
         except IOError as e:
             if e.errno == os.errno.ENOENT:
-                raise RuntimeError("sanlock service is not running")
-            raise
+                sys.stdout.write("sanlock service is not running")
+                _isconfigured = False
+            else:
+                raise
 
         diskimage_gid = grp.getgrnam(DISKIMAGE_GROUP)[2]
         if diskimage_gid not in groups:
-            raise RuntimeError("sanlock service requires restart")
+            sys.stdout.write("sanlock service requires restart\n")
+            _isconfigured = False
 
         sys.stdout.write("sanlock service is already configured\n")
-        return True
+        return _isconfigured
 
 
 __configurers = (


-- 
To view, visit http://gerrit.ovirt.org/22184
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic174c702f7f5b491975829e227d8311aed26ec90
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to