Kiril Nesenko has uploaded a new change for review.

Change subject: packaging: Stop dwhd serive on engine-upgrade (BZ#843495)
......................................................................

packaging: Stop dwhd serive on engine-upgrade (BZ#843495)

https://bugzilla.redhat.com/show_bug.cgi?id=843495

This patch stops dwhd service on engine-upgrade. The issue is when dwhd
service is up, engine update will fail due to open connections to the
DB. So we need to stop all DB related services.

Change-Id: I13af2147f2134ad42e0bddd804cfcbe954f785a9
Signed-off-by: Kiril Nesenko <[email protected]>
---
M packaging/fedora/setup/engine-upgrade.py
1 file changed, 26 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/90/7690/1

diff --git a/packaging/fedora/setup/engine-upgrade.py 
b/packaging/fedora/setup/engine-upgrade.py
index 6f0d06e..5b67b13 100755
--- a/packaging/fedora/setup/engine-upgrade.py
+++ b/packaging/fedora/setup/engine-upgrade.py
@@ -604,9 +604,9 @@
         messages.append(MSG_INFO_REPORTS)
 
 
-def stopDbRelatedServices(etlService, notificationService):
+def stopDbRelatedServices(etlService, notificationService, dwhService):
     """
-    shut down etl and notifier services
+    shut down etl, notifier and dwhd services
     in order to disconnect any open sessions to the db
     """
     # If the ovirt-engine-etl service is installed, then try and stop it.
@@ -630,7 +630,20 @@
             logging.warn(traceback.format_exc())
             messages.append(MSG_ERR_FAILED_STOP_SERVICE % 
"ovirt-engine-notifierd")
 
-def startDbRelatedServices(etlService, notificationService):
+    #  If the ovirt-engine-dwhd service is up, then try and stop it.
+    if dwhService.isServiceAvailable():
+        try:
+            (status, rc) = dwhService.status()
+            if utils.verifyStringFormat(status, ".*running.*"):
+                logging.debug("stopping ovirt-engine-dwhd service..")
+                notificationService.stop()
+        except:
+            logging.warn("Failed to stop ovirt-engine-dwhd service")
+            logging.warn(traceback.format_exc())
+            messages.append(MSG_ERR_FAILED_STOP_SERVICE % "ovirt-engine-dwhd")
+
+
+def startDbRelatedServices(etlService, notificationService, dwhService):
     """
     bring back any service we stopped
     we won't start services that are down
@@ -647,6 +660,13 @@
         if rc != 0:
             logging.warn("Failed to start ovirt-engine-notifierd: exit code 
%d" % rc)
             messages.append(MSG_ERR_FAILED_START_SERVICE % 
"ovirt-engine-notifierd")
+
+    if dwhService.isServiceAvailable():
+        (output, rc) = dwhService.conditionalStart()
+        if rc != 0:
+            logging.warn("Failed to start ovirt-engine-dwhd: exit code %d" % 
rc)
+            messages.append(MSG_ERR_FAILED_START_SERVICE % "ovirt-engine-dwhd")
+
 
 def unsupportedVersionsPresent(oldversion=UNSUPPORTED_VERSION):
     """ Check whether there are UNSUPPORTED_VERSION
@@ -753,17 +773,18 @@
         # define db connections services
         etlService = utils.Service("ovirt-engine-etl")
         notificationService = utils.Service("ovirt-engine-notifierd")
+        dwhService = utils.Service("ovirt-engine-dwhd")
 
         # check if update is relevant to db update
         if isUpdateRelatedToDb(rhyum):
-            stopDbRelatedServices(etlService, notificationService)
+            stopDbRelatedServices(etlService, notificationService, dwhService)
 
             # Update the db and restore its name back
             runFunc([db.update], MSG_INFO_DB_UPDATE)
             runFunc([[db.rename, basedefs.DB_NAME]], MSG_INFO_RESTORE_DB)
 
             # Bring up any services we shut down before db upgrade
-            startDbRelatedServices(etlService, notificationService)
+            startDbRelatedServices(etlService, notificationService, dwhService)
 
         # post install conf
         runFunc(postFunc, MSG_INFO_RUN_POST)


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

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

Reply via email to