Yaniv Bronhaim has uploaded a new change for review.

Change subject: Changing vdsm-tool and vdsmd pre-tasks outputs to be more 
meaningful to user
......................................................................

Changing vdsm-tool and vdsmd pre-tasks outputs to be more meaningful to user

Previously to this changes the output was misleading. Users
could not understand how to handle configuration issues properly.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1029812
Change-Id: If29f41081a70c0734cd78dab36f86c794a44b2d3
Signed-off-by: Yaniv Bronhaim <[email protected]>
---
M init/vdsmd_init_common.sh.in
M lib/vdsm/tool/configurator.py
M lib/vdsm/tool/service.py
3 files changed, 26 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/23253/1

diff --git a/init/vdsmd_init_common.sh.in b/init/vdsmd_init_common.sh.in
index 46af454..00a33db 100644
--- a/init/vdsmd_init_common.sh.in
+++ b/init/vdsmd_init_common.sh.in
@@ -209,7 +209,8 @@
         "task_${taskName}"
         rt=$?
         if [ "$rt" -ne 0 ]; then
-            echo "${prog}: failed to execute ${taskName}, error code ${rt}"
+            echo "${prog}: stopped during execute ${taskName} task" \
+                 "(task returned with error code ${rt})."
             exit 1
         fi
     done
diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py
index 13194cb..8818fd8 100644
--- a/lib/vdsm/tool/configurator.py
+++ b/lib/vdsm/tool/configurator.py
@@ -191,6 +191,8 @@
     """
     args = _parse_args("configure")
     configurer_to_trigger = []
+
+    sys.stdout.write("\nChecking configuration status...\n\n")
     for c in __configurers:
         if c.getName() in args.modules:
             if not c.validate():
@@ -203,21 +205,25 @@
     services = []
     for c in configurer_to_trigger:
         for s in c.getServices():
-            if service.service_status(s) == 0:
+            if service.service_status(s, False) == 0:
                 if not args.force:
                     raise RuntimeError(
-                        "Cannot configure while %s is running" % s
+                        "\n\nCannot configure while service '%s' is "
+                        "running.\n Stop the service manually or use the "
+                        "--force flag.\n" % s
                     )
                 services.append(s)
 
     for s in services:
         service.service_stop(s)
 
+    sys.stdout.write("\nRunning configure...\n")
     for c in configurer_to_trigger:
         c.configure()
 
     for s in reversed(services):
         service.service_start(s)
+    sys.stdout.write("\nDone configuring modules to VDSM.\n")
 
 
 @expose("is-configured")
@@ -240,7 +246,19 @@
         ret = False
 
     if not ret:
-        raise RuntimeError("Not configured. Try 'vdsm-tool configure'")
+        msg = \
+            """
+
+One of the modules is not configured to VDSM.
+To configure the module use the following:
+'vdsm-tool configure [module_name]'.
+
+If all modules are not configured try to use:
+'vdsm-tool configure --force'
+(The force flag will stop the module's service and start it
+afterwards automatically to load the new configuration.)
+"""
+        raise RuntimeError(msg)
 
 
 @expose("validate-config")
diff --git a/lib/vdsm/tool/service.py b/lib/vdsm/tool/service.py
index ee6a9cd..6793ef3 100644
--- a/lib/vdsm/tool/service.py
+++ b/lib/vdsm/tool/service.py
@@ -370,14 +370,15 @@
 
 
 @expose("service-status")
-def service_status(srvName):
+def service_status(srvName, verbose=True):
     """
     Get status of a system service
     """
     try:
         return _runAlts(_srvStatusAlts, srvName)
     except ServiceError as e:
-        sys.stderr.write('service-status: %s\n' % e)
+        if verbose:
+            sys.stderr.write('service-status: %s\n' % e)
         return 1
 
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If29f41081a70c0734cd78dab36f86c794a44b2d3
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