Alex Lourie has uploaded a new change for review.

Change subject: packaging: Updated VDC utilities to accept alternative binary
......................................................................

packaging: Updated VDC utilities to accept alternative binary

* Added the optional parameter for engine-conf binary in getVdcOptions
function
* Added the optional parameters for engine-conf binary and configuration
in updateVdcOptions function.
* Updated the definition of configureTasksTimeout function to utilize the
aforementioned parameters.
* Updated the usage of configureTasksTimeout function.

Change-Id: Ica1c009bffbcd956c64929050e9ebb806be006af
Signed-off-by: Alex Lourie <alou...@redhat.com>
---
M packaging/fedora/setup/common_utils.py
M packaging/fedora/setup/engine-upgrade.py
2 files changed, 19 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/8913/1

diff --git a/packaging/fedora/setup/common_utils.py 
b/packaging/fedora/setup/common_utils.py
index 407d0db..ea60b66 100755
--- a/packaging/fedora/setup/common_utils.py
+++ b/packaging/fedora/setup/common_utils.py
@@ -825,13 +825,13 @@
                                basedefs.DB_POSTGRES, sqlQuery, True,
                                output_messages.ERR_DB_RENAME % (oldname, 
newname))
 
-def getVDCOption(key):
+def getVDCOption(key, engineConfigBin=basedefs.FILE_RHEVM_CONFIG_BIN):
     """
     Query vdc_option in db and return its value.
     """
 
     cmd = [
-        basedefs.FILE_RHEVM_CONFIG_BIN,
+        engineConfigBin,
         "-g", key,
     ]
 
@@ -842,7 +842,7 @@
     else:
         return None
 
-def updateVDCOption(key, value, maskList=[], keyType='text'):
+def updateVDCOption(key, value, maskList=[], keyType='text', 
engineConfigBin=basedefs.FILE_RHEVM_CONFIG_BIN, 
engineConfigExtended=basedefs.FILE_RHEVM_EXTENDED_CONF):
     """
     Update vdc_option value in db
     using rhevm-config
@@ -860,7 +860,7 @@
 
     # The first part of the command is really simple:
     cmd = [
-        basedefs.FILE_RHEVM_CONFIG_BIN,
+        engineConfigBin,
     ]
 
     # For text options we just provide the name of the option and the value in
@@ -885,7 +885,7 @@
     cmd.extend([
         '--cver=' + basedefs.VDC_OPTION_CVER,
         '-p',
-        basedefs.FILE_RHEVM_EXTENDED_CONF,
+        engineConfigExtended,
     ])
 
     # Execute the command, and always remember to remove the password file:
@@ -1371,19 +1371,23 @@
     # Return the result:
     return javaHome
 
-def configureTasksTimeout(timeout):
+def configureTasksTimeout(timeout,
+                          engineConfigBin=basedefs.FILE_RHEVM_CONFIG_BIN,
+                          
engineConfigExtended=basedefs.FILE_RHEVM_EXTENDED_CONF):
     """
     Set AsyncTaskZombieTaskLifeInMinutes
     to a specified value
     """
 
     # First, get the originalTimeout value
-    originalTimeout = getVDCOption("AsyncTaskZombieTaskLifeInMinutes")
+    originalTimeout = getVDCOption("AsyncTaskZombieTaskLifeInMinutes", 
engineConfigBin)
 
     # Now, set the value to timeout
     updateVDCOption(key="AsyncTaskZombieTaskLifeInMinutes",
                     value=timeout,
-                    keyType='text')
+                    keyType='text',
+                    engineConfigBin=engineConfigBin,
+                    engineConfigExtended=engineConfigExtended)
 
     # Return the original value
     return originalTimeout
diff --git a/packaging/fedora/setup/engine-upgrade.py 
b/packaging/fedora/setup/engine-upgrade.py
index 9fbc03c..a10883c 100755
--- a/packaging/fedora/setup/engine-upgrade.py
+++ b/packaging/fedora/setup/engine-upgrade.py
@@ -785,7 +785,7 @@
                                        userName=SERVER_ADMIN,
                                        dbHost=SERVER_NAME,
                                        dbPort=SERVER_PORT,
-                                       dbName=basedefs.DB_NAME,
+                                       dbName=dbName,
                                        sqlQuery=ASYNC_TASKS_QUERY,
                                        failOnError=True,
                                        errMsg="Can't get async tasks list",
@@ -803,7 +803,7 @@
                                        userName=SERVER_ADMIN,
                                        dbHost=SERVER_NAME,
                                        dbPort=SERVER_PORT,
-                                       dbName=basedefs.DB_NAME,
+                                       dbName=dbName,
                                        sqlQuery=COMPENSATIONS_QUERY,
                                        failOnError=True,
                                        errMsg="Can't get compensations list",
@@ -822,6 +822,7 @@
     deployDbAsyncTasks(dbName)
     runningTasks = getRunningTasks(dbName)
     compensations = getCompensations(dbName)
+    engineConfigBinary = basedefs.FILE_RHEVM_CONFIG_BIN
     origTimeout = 0
 
     if runningTasks or compensations:
@@ -843,7 +844,8 @@
 
             # restart jboss/engine in maintenace mode (i.e different port):
             utils.configureEngineForMaintenance()
-            origTimeout = utils.configureTasksTimeout(timeout=0)
+            origTimeout = utils.configureTasksTimeout(timeout=0,
+                                                      
engineConfigBin=engineConfigBinary)
             startEngine(service)
 
             # Pull tasks in a loop for some time
@@ -880,7 +882,8 @@
             # Restore previous engine configuration
             utils.restoreEngineFromMaintenance()
             if origTimeout != 0:
-                utils.configureTasksTimeout(origTimeout)
+                utils.configureTasksTimeout(timeout=origTimeout,
+                                            engineConfigBin=engineConfigBinary)
 
 
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica1c009bffbcd956c64929050e9ebb806be006af
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <alou...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to