Alon Bar-Lev has uploaded a new change for review.

Change subject: db: cleanup: move task clean into custom
......................................................................

db: cleanup: move task clean into custom

this is engine specific.

Change-Id: If4c099e23dd1903171cdce71f5c410ce3f05320a
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M packaging/dbscripts/dbfunc-common.sh
M packaging/dbscripts/dbfunc-custom.sh
M packaging/dbscripts/upgrade.sh
3 files changed, 15 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/25221/1

diff --git a/packaging/dbscripts/dbfunc-common.sh 
b/packaging/dbscripts/dbfunc-common.sh
index 9be9413..76745fe 100644
--- a/packaging/dbscripts/dbfunc-common.sh
+++ b/packaging/dbscripts/dbfunc-common.sh
@@ -7,6 +7,10 @@
        return 0
 }
 
+dbfunc_common_hook_pre_upgrade() {
+       return 0
+}
+
 dbfunc_common_hook_views_refresh() {
        return 0
 }
@@ -346,12 +350,7 @@
        #drop materialized views to support views changesin upgrade
        #Materialized views are restored in the post_upgrade step
        dbfunc_common_hook_materialized_views_drop
-
-       # TODO: move this to custom?
-       if [ -n "${CLEAN_TASKS}" ]; then
-               echo "Cleaning tasks metadata..."
-               dbfunc_psql_die 
--file="delete_async_tasks_and_compensation_data.sql" > /dev/null
-       fi
+       dbfunc_common_hook_pre_upgrade
 }
 
 _dbfunc_common_run_post_upgrade() {
diff --git a/packaging/dbscripts/dbfunc-custom.sh 
b/packaging/dbscripts/dbfunc-custom.sh
index d6ca760..ddf50d5 100644
--- a/packaging/dbscripts/dbfunc-custom.sh
+++ b/packaging/dbscripts/dbfunc-custom.sh
@@ -4,6 +4,8 @@
 DBFUNC_DB_USER="${DBFUNC_DB_USER:-engine}"
 DBFUNC_DB_DATABASE="${DBFUNC_DB_DATABASE:-engine}"
 
+DBFUNC_CUSTOM_CLEAN_TASKS=
+
 dbfunc_common_hook_init_insert_data() {
        echo "Inserting data..."
        dbfunc_psql_die --file="insert_data.sql" > /dev/null
@@ -11,6 +13,13 @@
        dbfunc_psql_die --file="insert_predefined_roles.sql" > /dev/null
 }
 
+dbfunc_common_hook_pre_upgrade() {
+       if [ -n "${DBFUNC_CUSTOM_CLEAN_TASKS}" ]; then
+               echo "Cleaning tasks metadata..."
+               dbfunc_psql_die 
--file="delete_async_tasks_and_compensation_data.sql" > /dev/null
+       fi
+}
+
 #refreshes views
 dbfunc_common_hook_views_refresh() {
        echo "Creating views..."
diff --git a/packaging/dbscripts/upgrade.sh b/packaging/dbscripts/upgrade.sh
index 3edad24..5458b6a 100755
--- a/packaging/dbscripts/upgrade.sh
+++ b/packaging/dbscripts/upgrade.sh
@@ -68,7 +68,7 @@
                u) DBFUNC_DB_USER="${OPTARG}";;
                l) DBFUNC_LOGFILE="${OPTARG}";;
                f) VERSION="${OPTARG}";;
-               c) CLEAN_TASKS=1;;
+               c) DBFUNC_CUSTOM_CLEAN_TASKS=1;;
                m) DBFUNC_COMMON_MD5DIR="${OPTARG}";;
                v) DBFUNC_VERBOSE=1;;
                h) usage; exit 0;;


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

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

Reply via email to