Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: clearing only zombie tasks
......................................................................

packaging: setup: clearing only zombie tasks

We cannot upgrade while async tasks are still running and we have
to wait till they ends.
To avoid getting stuck we need to clear zombie task from the list
before checking if we have to wait.

Change-Id: I73dcb9ee0a465ef9552a085e59ab36576ee3b660
Bug-Url: https://bugzilla.redhat.com/1119639
Bug-Url: https://bugzilla.redhat.com/1164771
Signed-off-by: Simone Tiraboschi <stira...@redhat.com>
---
M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/upgrade/asynctasks.py
1 file changed, 28 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/59/38159/1

diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/upgrade/asynctasks.py 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/upgrade/asynctasks.py
index dc73be9..6a1b526 100644
--- 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/upgrade/asynctasks.py
+++ 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/upgrade/asynctasks.py
@@ -21,6 +21,7 @@
 
 import time
 import gettext
+import distutils.version
 _ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine-setup')
 
 
@@ -31,6 +32,7 @@
 
 
 from ovirt_engine_setup import dialog
+from ovirt_engine_setup import constants as osetupcons
 from ovirt_engine_setup.engine import constants as oenginecons
 from ovirt_engine_setup.engine_common import constants as oengcommcons
 from ovirt_engine_setup.engine_common import database
@@ -128,20 +130,29 @@
                 timeout=self._origTimeout,
             )
 
-    def _clearZombieTasks(self):
+    def _clearZombies(self):
+        inst_v = distutils.version.LooseVersion(
+            self.environment[
+                osetupcons.CoreEnv.ORIGINAL_GENERATED_BY_VERSION
+            ]
+        ).version[:2]
+        _args = (
+            oenginecons.FileLocations.OVIRT_ENGINE_TASKCLEANER,
+            '-l', self.environment[otopicons.CoreEnv.LOG_FILE_NAME],
+            '-u', self.environment[oenginecons.EngineDBEnv.USER],
+            '-s', self.environment[oenginecons.EngineDBEnv.HOST],
+            '-p', str(self.environment[oenginecons.EngineDBEnv.PORT]),
+            '-d', self.environment[oenginecons.EngineDBEnv.DATABASE],
+            '-R',
+            '-z',
+            '-C',
+            '-J',
+            '-q',
+        )
+        if inst_v > [3, 4]:
+            _args = _args + ('-r', '-Z',)
         rc, tasks, stderr = self.execute(
-            args=(
-                oenginecons.FileLocations.OVIRT_ENGINE_TASKCLEANER,
-                '-l', self.environment[otopicons.CoreEnv.LOG_FILE_NAME],
-                '-u', self.environment[oenginecons.EngineDBEnv.USER],
-                '-s', self.environment[oenginecons.EngineDBEnv.HOST],
-                '-p', str(self.environment[oenginecons.EngineDBEnv.PORT]),
-                '-d', self.environment[oenginecons.EngineDBEnv.DATABASE],
-                '-R',
-                '-A',
-                '-J',
-                '-q',
-            ),
+            args=_args,
             raiseOnError=False,
             envAppend={
                 'DBFUNC_DB_PGPASSFILE': self.environment[
@@ -153,8 +164,8 @@
         if rc:
             raise RuntimeError(
                 _(
-                    'Failed to clear zombie tasks. Please access support '
-                    'in attempt to resolve the problem'
+                    'Failed to clear zombie tasks and commands. '
+                    'Please access support in attempt to resolve the problem'
                 )
             )
 
@@ -417,9 +428,9 @@
     )
     def _validateZombies(self):
         self.logger.info(
-            _('Cleaning stale zombie tasks')
+            _('Cleaning stale zombie tasks and commands')
         )
-        self._clearZombieTasks()
+        self._clearZombies()
 
     @plugin.event(
         stage=plugin.Stages.STAGE_VALIDATION,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73dcb9ee0a465ef9552a085e59ab36576ee3b660
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5.2
Gerrit-Owner: Simone Tiraboschi <stira...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to