Aravinda VK has uploaded a new change for review.

Change subject: engine: Application Mode option in installer
......................................................................

engine: Application Mode option in installer

Application Mode option added to engine-setup, Engine can be
configured as gluster only, virtualization only or both.

Change-Id: Ieba515d2baf3559bf27185c7c6432160551ef172
Signed-off-by: Aravinda VK <avish...@redhat.com>
---
M packaging/fedora/setup/engine-setup.py
M packaging/fedora/setup/output_messages.py
2 files changed, 34 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/91/9991/1

diff --git a/packaging/fedora/setup/engine-setup.py 
b/packaging/fedora/setup/engine-setup.py
index 933f9a0..3789fca 100755
--- a/packaging/fedora/setup/engine-setup.py
+++ b/packaging/fedora/setup/engine-setup.py
@@ -130,7 +130,7 @@
                         'steps'           : [ { 'title'     : 
output_messages.INFO_SET_DB_SECURITY,
                                                 'functions' : [_encryptDBPass, 
_configEncryptedPass] },
                                               {  'title'     : 
output_messages.INFO_UPGRADE_DB,
-                                                'functions' : 
[stopRhevmDbRelatedServices, _upgradeDB, startRhevmDbRelatedServices]} ]
+                                                'functions' : 
[stopRhevmDbRelatedServices, _upgradeDB, _setApplicationMode, 
startRhevmDbRelatedServices]} ]
                        },
                       { 'description'     : 'Create DB',
                         'condition'       : [_isDbAlreadyInstalled],
@@ -138,7 +138,7 @@
                         'steps'           : [ { 'title'     : 
output_messages.INFO_SET_DB_SECURITY,
                                                 'functions' : [_encryptDBPass, 
_configEncryptedPass]},
                                               { 'title'     : 
output_messages.INFO_CREATE_DB,
-                                                'functions' : [_createDB,  
_updateVDCOptions]},
+                                                'functions' : [_createDB,  
_updateVDCOptions, _setApplicationMode]},
                                               { 'title'     : 
output_messages.INFO_UPD_DC_TYPE,
                                                 'functions' : 
[_updateDefaultDCType]} ]
                        },
@@ -331,6 +331,19 @@
                 "CONF_NAME"       : "DB_REMOTE_INSTALL",
                 "USE_DEFAULT"     : False,
                 "NEED_CONFIRM"    : False,
+                "CONDITION"       : False},
+
+             {  "CMD_OPTION"      :"application-mode",
+                "USAGE"           
:output_messages.INFO_CONF_PARAMS_APPLICATION_MODE_USAGE,
+                "PROMPT"          
:output_messages.INFO_CONF_PARAMS_APPLICATION_MODE_PROMPT,
+                "OPTION_LIST"     :["virt","gluster", "both"],
+                "VALIDATION_FUNC" :validate.validateOptions,
+                "DEFAULT_VALUE"   :"both",
+                "MASK_INPUT"      : False,
+                "LOOSE_VALIDATION": False,
+                "CONF_NAME"       : "APPLICATION_MODE",
+                "USE_DEFAULT"     : False,
+                "NEED_CONFIRM"    : False,
                 "CONDITION"       : False}]
          ,
          "LOCAL_DB": [
@@ -507,6 +520,7 @@
 
 #data center types enum
 controller.CONF["DC_TYPE_ENUM"] = utils.Enum(NFS=1, FC=2, ISCSI=3, POSIXFS=6)
+controller.CONF["APPLICATION_MODE_ENUM"] = utils.Enum(VIRT=1, GLUSTER=2, 
BOTH=255)
 
 def _getColoredText (text, color):
     ''' gets text string and color
@@ -942,6 +956,21 @@
         logging.error(traceback.format_exc())
         raise Exception(output_messages.ERR_EXP_FAILED_CFG_IPTABLES)
 
+def _setApplicationMode():
+    # No change with respect to default, No DB update required
+    if controller.CONF["APPLICATION_MODE"].upper() == "BOTH":
+        return
+
+    applicationMode = 
controller.CONF["APPLICATION_MODE_ENUM"].parse(str.upper(controller.CONF["APPLICATION_MODE"]))
+
+    sqlQuery = "select fn_db_update_config_value('ApplicationMode', '%s', 
'general')" % applicationMode
+    utils.execRemoteSqlCommand(getDbUser(), \
+                                   getDbHostName(), \
+                                   getDbPort(), \
+                                   basedefs.DB_NAME, \
+                                   sqlQuery, False, \
+                                   output_messages.ERR_DB_SET_APPLICATION_MODE)
+
 def _createDB():
     """
     create fresh engine db
diff --git a/packaging/fedora/setup/output_messages.py 
b/packaging/fedora/setup/output_messages.py
index 2714ead..6b4e53d 100644
--- a/packaging/fedora/setup/output_messages.py
+++ b/packaging/fedora/setup/output_messages.py
@@ -141,6 +141,8 @@
 INFO_CONF_PARAMS_DB_PASSWD_USAGE="Password for the local database 
administrator"
 INFO_CONF_PARAMS_DB_PASSWD_PROMPT="Enter a password for a local %s DB admin 
user (%s)" % (basedefs.APP_NAME, basedefs.DB_USER)
 INFO_CONF_PARAMS_PASSWD_CONFIRM_PROMPT="Confirm password"
+INFO_CONF_PARAMS_APPLICATION_MODE_USAGE="Application Mode"
+INFO_CONF_PARAMS_APPLICATION_MODE_PROMPT="Application Mode"
 
 #Remote DB interaction
 INFO_CONF_PARAMS_REMOTE_DB_USAGE="Select local or remote DB server"
@@ -241,6 +243,7 @@
 ERR_DB_UUID = "Error: uuid-ossp extension is not loaded into the DB.\n\
 Verify with the DB admin that uuid-ossp extension is loaded into newly created 
databases and \
 rerun the setup."
+ERR_DB_SET_APPLICATION_MODE = "Error: updating Application mode"
 
 #_updateVdcOptions
 ERR_CANT_FIND_VDC_OPTION_FILE="Unexpected error, Cannot find %s"


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

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

Reply via email to