Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: unlock all the entities closing the setup
......................................................................

packaging: setup: unlock all the entities closing the setup

On upgrades unlock all the entities closing the setup

Change-Id: I1ae892524931e66cd50e2b34a9754035447a6a95
Bug-Url: https://bugzilla.redhat.com/1204673
Signed-off-by: Simone Tiraboschi <[email protected]>
---
M packaging/setup/ovirt_engine_setup/engine/constants.py
M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/upgrade/asynctasks.py
2 files changed, 44 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/35/39035/1

diff --git a/packaging/setup/ovirt_engine_setup/engine/constants.py 
b/packaging/setup/ovirt_engine_setup/engine/constants.py
index a400d88..874e971 100644
--- a/packaging/setup/ovirt_engine_setup/engine/constants.py
+++ b/packaging/setup/ovirt_engine_setup/engine/constants.py
@@ -91,6 +91,10 @@
         OVIRT_ENGINE_DB_UTILS_DIR,
         'taskcleaner.sh'
     )
+    OVIRT_ENGINE_UNLOCK_ENTITY = os.path.join(
+        OVIRT_ENGINE_DB_UTILS_DIR,
+        'unlock_entity.sh'
+    )
 
     OVIRT_ENGINE_DB_CHANGE_OWNER = os.path.join(
         OVIRT_ENGINE_DB_UTILS_DIR,
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 f448fd2..e2e58bc 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
@@ -383,6 +383,36 @@
                     ]
                 )
 
+    def _unlockAll(self):
+        args = (
+            oenginecons.FileLocations.OVIRT_ENGINE_UNLOCK_ENTITY,
+            '-t', 'all',
+            '-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],
+        )
+        envPwd = {
+            'DBFUNC_DB_PGPASSFILE': self.environment[
+                oenginecons.EngineDBEnv.PGPASS_FILE
+            ]
+        }
+
+        rc, tasks, stderr = self.execute(
+            args=args,
+            raiseOnError=False,
+            envAppend=envPwd,
+        )
+        if rc:
+            raise RuntimeError(
+                _(
+                    'Failed to unlock entities. '
+                    'Please access support in attempt to resolve '
+                    'the problem'
+                )
+            )
+
     def __init__(self, context):
         super(Plugin, self).__init__(context=context)
         self._enabled = False
@@ -472,5 +502,15 @@
                     _('Upgrade cannot be completed due to running tasks.')
                 )
 
+    @plugin.event(
+        stage=plugin.Stages.STAGE_CLOSEUP,
+        condition=lambda self: self._enabled,
+    )
+    def _closeup(self):
+        self.logger.info(
+            _('Unlocking existing instances')
+        )
+        self._unlockAll()
+
 
 # vim: expandtab tabstop=4 shiftwidth=4


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1ae892524931e66cd50e2b34a9754035447a6a95
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Simone Tiraboschi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to