Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: engine-backup: Allow provisioning
......................................................................

packaging: engine-backup: Allow provisioning

Change-Id: Ic3df8bb630395596b9f44d4718ec960b3fecc2d1
Signed-off-by: Yedidyah Bar David <[email protected]>
---
M packaging/bin/engine-backup.sh
1 file changed, 35 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/71/40471/1

diff --git a/packaging/bin/engine-backup.sh b/packaging/bin/engine-backup.sh
index 0c9b6ba..28aeedb 100755
--- a/packaging/bin/engine-backup.sh
+++ b/packaging/bin/engine-backup.sh
@@ -174,6 +174,7 @@
  --db-restore-jobs=JOBS             Number of restore jobs for the Engine DB, 
when
                                     using custom dump format and compressor 
None.
                                    Passed to pg_restore -j. Defaults to 2.
+ --provision-db                     Create a postgresql database for the engine
  --change-db-credentials            activate the following options, to restore
                                     the Engine database to a different location
                                    etc. If used, existing credentials are 
ignored.
@@ -189,6 +190,7 @@
  --dwh-db-compressor=COMPRESSOR     for DWH, same options as 
--archive-compressor
  --dwh-db-dump-format=FORMAT        for DWH, same options as --db-dump-format
  --dwh-db-restore-jobs=JOBS         for DWH, same as --db-restore-jobs
+ --provision-dwb-db                 Create a postgresql database for DWH
  --change-dwh-db-credentials        activate the following options, to restore
                                     the DWH database to a different location 
etc.
                                     If used, existing credentials are ignored.
@@ -204,6 +206,7 @@
  --reports-db-compressor=COMPRESSOR for Reports, same options as 
--archive-compressor
  --reports-db-dump-format=FORMAT    for Reports, same options as 
--db-dump-format
  --reports-db-restore-jobs=JOBS     for Reports, same as --db-restore-jobs
+ --provision-reports-db             Create a postgresql database for Reports
  --change-reports-db-credentials    activate the following options, to restore
                                     the Reports database to a different 
location
                                    etc. If used, existing credentials are 
ignored.
@@ -270,6 +273,7 @@
 DB_DUMP_COMPRESSOR=
 DB_DUMP_FORMAT=custom
 DB_RESTORE_JOBS=2
+PROVISION_DB=
 CHANGE_DB_CREDENTIALS=
 MY_DB_HOST=
 MY_DB_PORT=5432
@@ -283,6 +287,7 @@
 DWH_DB_DUMP_COMPRESSOR=
 DWH_DB_DUMP_FORMAT=custom
 DWH_DB_RESTORE_JOBS=2
+PROVISION_DWH_DB=
 CHANGE_DWH_DB_CREDENTIALS=
 MY_DWH_DB_HOST=
 MY_DWH_DB_PORT=5432
@@ -296,6 +301,7 @@
 REPORTS_DB_DUMP_COMPRESSOR=
 REPORTS_DB_DUMP_FORMAT=custom
 REPORTS_DB_RESTORE_JOBS=2
+PROVISION_REPORTS_DB=
 CHANGE_REPORTS_DB_CREDENTIALS=
 MY_REPORTS_DB_HOST=
 MY_REPORTS_DB_PORT=5432
@@ -425,6 +431,9 @@
                                DB_RESTORE_JOBS=$(parse_jobs "${v}")
                                [ $? != 0 ] && logdie "failed parsing jobs"
                        ;;
+                       --provision-db)
+                               PROVISION_DB=1
+                       ;;
                        --change-db-credentials)
                                CHANGE_DB_CREDENTIALS=1
                        ;;
@@ -471,6 +480,9 @@
                                DWH_DB_RESTORE_JOBS=$(parse_jobs "${v}")
                                [ $? != 0 ] && logdie "failed parsing jobs"
                        ;;
+                       --provision-dwh-db)
+                               PROVISION_DWH_DB=1
+                       ;;
                        --change-dwh-db-credentials)
                                CHANGE_DWH_DB_CREDENTIALS=1
                        ;;
@@ -516,6 +528,9 @@
                        --reports-db-restore-jobs=*)
                                REPORTS_DB_RESTORE_JOBS=$(parse_jobs "${v}")
                                [ $? != 0 ] && logdie "failed parsing jobs"
+                       ;;
+                       --provision-reports-db)
+                               PROVISION_REPORTS_DB=1
                        ;;
                        --change-reports-db-credentials)
                                CHANGE_REPORTS_DB_CREDENTIALS=1
@@ -575,6 +590,7 @@
                [ -e "${FILE}" ] || die "${FILE} does not exist"
        fi
        if [ -n "${CHANGE_DB_CREDENTIALS}" ]; then
+               [ -n "${PRIVION_DB}" ] && die "Cannot change credentials if 
provisioning a database"
                [ -n "${MY_DB_HOST}" ] || die "--db-host is missing"
                [ -n "${MY_DB_USER}" ] || die "--db-user is missing"
                [ -n "${MY_DB_PASSWORD}" ] || \
@@ -582,6 +598,7 @@
                [ -n "${MY_DB_DATABASE}" ] || die "--db-name is missing"
        fi
        if [ -n "${CHANGE_DWH_DB_CREDENTIALS}" ]; then
+               [ -n "${PRIVION_DWH_DB}" ] && die "Cannot change credentials if 
provisioning a database"
                [ -n "${MY_DWH_DB_HOST}" ] || die "--dwh-db-host is missing"
                [ -n "${MY_DWH_DB_USER}" ] || die "--dwh-db-user is missing"
                [ -n "${MY_DWH_DB_PASSWORD}" ] || \
@@ -589,6 +606,7 @@
                [ -n "${MY_DWH_DB_DATABASE}" ] || die "--dwh-db-name is missing"
        fi
        if [ -n "${CHANGE_REPORTS_DB_CREDENTIALS}" ]; then
+               [ -n "${PRIVION_REPORTS_DB}" ] && die "Cannot change 
credentials if provisioning a database"
                [ -n "${MY_REPORTS_DB_HOST}" ] || die "--reports-db-host is 
missing"
                [ -n "${MY_REPORTS_DB_USER}" ] || die "--reports-db-user is 
missing"
                [ -n "${MY_REPORTS_DB_PASSWORD}" ] || \
@@ -767,6 +785,23 @@
 
        log "Reloading configuration"
        my_load_config
+
+       if [ -n "${PRIVION_DB}" ]; then
+               TODO sysctl
+               write answer file to temp file
+               run provision-db with it, logdie if failed
+       fi
+       if [ -n "${PRIVION_DWH_DB}" ]; then
+               TODO sysctl
+               write answer file to temp file
+               run provision-db with it, logdie if failed
+       fi
+       if [ -n "${PRIVION_REPORTS_DB}" ]; then
+               TODO sysctl
+               write answer file to temp file
+               run provision-db with it, logdie if failed
+       fi
+
        [ -n "${CHANGE_DB_CREDENTIALS}" ] && setMyEngineDBCredentials
        [ -n "${CHANGE_DWH_DB_CREDENTIALS}" ] && setMyDwhDBCredentials
        [ -n "${CHANGE_REPORTS_DB_CREDENTIALS}" ] && setMyReportsDBCredentials


-- 
To view, visit https://gerrit.ovirt.org/40471
To unsubscribe, visit https://gerrit.ovirt.org/settings

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

Reply via email to