Eli Mesika has uploaded a new change for review.

Change subject: core: fix upgrade scripts gap validation
......................................................................

core: fix upgrade scripts gap validation

Current implementation of upgrade mechanism does not allow subsequent
scripts to have more than a 10 gap in their numbering.
For example, if last installed script is 03011500 then a subsequent
upgrade with 03011501 to 03011510 is OK while 03011511 03011512 and so
forth will be rejected.
This patch fix bug when moving to another major version , for example
from 0301 to 0302. It adds a condition that checks for gaps between two
subsequent versions only if their major version (first 4 digits) match.

Change-Id: Id260d437914911c71cc2ea22d9a0314e62d72c78
Signed-off-by: Eli Mesika <emes...@redhat.com>
---
M backend/manager/dbscripts/dbfunctions.sh
1 file changed, 12 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/33/9133/1

diff --git a/backend/manager/dbscripts/dbfunctions.sh 
b/backend/manager/dbscripts/dbfunctions.sh
index 122bfc3..5465f4b 100755
--- a/backend/manager/dbscripts/dbfunctions.sh
+++ b/backend/manager/dbscripts/dbfunctions.sh
@@ -255,13 +255,20 @@
             if [ "$ver" -gt "$current" ] ; then
                 # we should remove leading zero in order not to treat number 
as octal
                 xver="${ver:1:7}"
+                # taking major revision , i.e 03010000=>301
+                xverMajor="${xver:0:3}"
+                lastMajor="${last:0:3}"
+
                 # check for gaps in upgrade
                 if [ "$ver" -gt "$disable_gaps_from" ]; then
-                    if [ $(($xver - $last)) -gt 10 ]; then
-                        set_last_version
-                        echo "Illegal script version number ${ver},version 
should be in max 10 gap from last installed version: 0${last}"
-                        echo "Please fix numbering to interval 0$(( $last + 
1)) to 0$(( $last + 10)) and run the upgrade script."
-                    exit 1
+                    # check gaps only for identical major revisions
+                    if [ ${xverMajor} -eq ${lastMajor} ]; then
+                        if [ $(($xver - $last)) -gt 10 ]; then
+                           set_last_version
+                           echo "Illegal script version number ${ver},version 
should be in max 10 gap from last installed version: 0${last}"
+                           echo "Please fix numbering to interval 0$(( $last + 
1)) to 0$(( $last + 10)) and run the upgrade script."
+                           exit 1
+                        fi
                     fi
                 fi
                 # check if script was already installed with other version 
name.


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id260d437914911c71cc2ea22d9a0314e62d72c78
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: 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