Hello Eli Mesika,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/18766

to review the following change.

Change subject: core:  Installation fails with message of...
......................................................................

core:  Installation fails with message of...

core:  Installation fails with message of "Failed to execute stage
'Misc configuration': Command
'/usr/share/ovirt-engine/dbscripts/create_schema.sh' failed to execute"

In case that clean install is performed on a database that already has
the old uuid implementation , we should remove the old uuid
implementation before attempting to create the new uuid implementation

Change-Id: I4a2d406ff71f312805c8e55c1fe58886c591e1f6
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=997370
Signed-off-by: Eli Mesika <emes...@redhat.com>
---
M packaging/dbscripts/create_schema.sh
M packaging/dbscripts/dbfunctions.sh
2 files changed, 15 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/66/18766/1

diff --git a/packaging/dbscripts/create_schema.sh 
b/packaging/dbscripts/create_schema.sh
index 06ed77a..fce73a1 100755
--- a/packaging/dbscripts/create_schema.sh
+++ b/packaging/dbscripts/create_schema.sh
@@ -56,6 +56,7 @@
 execute_file "create_tables.sql" ${DATABASE} ${SERVERNAME} ${PORT} > /dev/null
 
 printf "Creating functions...\n"
+drop_old_uuid_functions
 execute_file "create_functions.sql" ${DATABASE} ${SERVERNAME} ${PORT} > 
/dev/null
 
 printf "Creating common functions...\n"
diff --git a/packaging/dbscripts/dbfunctions.sh 
b/packaging/dbscripts/dbfunctions.sh
index d1b016b..b441f07 100755
--- a/packaging/dbscripts/dbfunctions.sh
+++ b/packaging/dbscripts/dbfunctions.sh
@@ -96,6 +96,19 @@
     \rm -f drop_all_views.sql
 }
 
+drop_old_uuid_functions() {
+    #
+    # dropping the uuid extension and old functions is
+    # required only if we upgrade from old database
+    # as it requires special privileges, so
+    # before execution check if actually required
+    #
+    CMD="select count(*) from pg_proc where proname = 'uuid_nil';"
+    if [ "$(execute_command "$CMD" ${DATABASE} ${SERVERNAME} ${PORT} | sed -e 
's/ //g' -e '/^$/d')" != 0 ]; then
+        su postgres -c "psql -f drop_old_uuid_functions.sql ${DATABASE}"  > 
/dev/null
+    fi
+}
+
 #drops sps before upgrade or refresh operations
 drop_sps() {
 # common stored procedures are executed first (for new added functions to be 
valid)
@@ -107,16 +120,7 @@
     execute_file "${drop_all_functions}" ${DATABASE} ${SERVERNAME} ${PORT} > 
/dev/null
     \rm -f "${drop_all_functions}"
 
-    #
-    # dropping the uuid extension and old functions is
-    # required only if we upgrade from old database
-    # as it requires special privileges, so
-    # before execution check if actually required
-    #
-    CMD="select count(*) from pg_proc where proname = 'uuid_nil';"
-    if [ "$(execute_command "$CMD" ${DATABASE} ${SERVERNAME} ${PORT} | sed -e 
's/ //g' -e '/^$/d')" != 0 ]; then
-        psql -w -U postgres -h ${SERVERNAME} -p ${PORT} -f 
drop_old_uuid_functions.sql ${DATABASE} > /dev/null
-    fi
+    drop_old_uuid_functions
     # recreate generic functions
     execute_file "create_functions.sql" ${DATABASE} ${SERVERNAME} ${PORT} > 
/dev/null
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a2d406ff71f312805c8e55c1fe58886c591e1f6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to