[node-patches] Change in ovirt-node[master]: block major version upgrades from tui and cli

jboggs at redhat.com jboggs at redhat.com
Mon Jun 23 16:53:11 UTC 2014


Joey Boggs has uploaded a new change for review.

Change subject: block major version upgrades from tui and cli
......................................................................

block major version upgrades from tui and cli

Bug-Url:https://bugzilla.redhat.com/show_bug.cgi?id=1095148

Change-Id: I8747d5c28e0c6ee763c27647420b2445c04690ca
Signed-off-by: Joey Boggs <jboggs at redhat.com>
---
M scripts/ovirt-init-functions.sh.in
M src/ovirt/node/installer/core/welcome_page.py
2 files changed, 35 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/84/29084/1

diff --git a/scripts/ovirt-init-functions.sh.in b/scripts/ovirt-init-functions.sh.in
index f5877bc..a8c73ff 100644
--- a/scripts/ovirt-init-functions.sh.in
+++ b/scripts/ovirt-init-functions.sh.in
@@ -1131,13 +1131,31 @@
 #trap 'exit $?' 1 2 13 15
 
 check_version(){
-    if [ -e "/dev/HostVG/Root" ]; then
-    log "                                          "
-    log "   Major version upgrades are not allowed."
-    log "   Please uninstall existing version and reinstall."
-    log "   Press Enter to drop to emergency shell."
-    read < /dev/console
-    bash < /dev/console
+    mount_liveos
+    if [ -e "/live/syslinux" ]; then
+      syslinux=syslinux
+    elif [ -e "/live/isolinux" ]; then
+      syslinux=isolinux
+    else
+      syslinux=
+    fi
+
+    . /liveos/version
+    local current_version=$VERSION
+    local current_major=$(echo $VERSION|cut -d. -f1)
+    # image version
+    . /live/$syslinux/version
+    local new_major=$(echo $VERSION|cut -d. -f1)
+    # only N.x -> N.y upgrades are allowed
+    if [ "$current_major" != "$new_major" ]; then
+        log "                                          "
+        log "   Major version upgrades are not allowed."
+        log "   Installed version: $current_version"
+        log "   New version      : $VERSION"
+        log "   Please uninstall existing version and reinstall."
+        log "   Press Enter to drop to emergency shell."
+        read < /dev/console
+        bash < /dev/console
     fi
 }
 
diff --git a/src/ovirt/node/installer/core/welcome_page.py b/src/ovirt/node/installer/core/welcome_page.py
index 91ceee9..bf71c94 100644
--- a/src/ovirt/node/installer/core/welcome_page.py
+++ b/src/ovirt/node/installer/core/welcome_page.py
@@ -80,6 +80,7 @@
         self.application.ui.navigate.to_next_plugin()
 
     def ___installation_options(self):
+        block_upgrade = False
         if self.application.args.dry:
             return [ui.Button("button.install", _("Install (dry)")),
                     ui.Button("button.upgrade", _("Upgrade (dry)")),
@@ -87,13 +88,19 @@
                     ui.Button("button.reinstall", _("Reinstall (dry)"))]
 
         media = utils.system.InstallationMedia()
+        installed = utils.system.InstalledMedia()
+        media_major = media.version.split(".")[0]
+        installed_major = installed.version.split(".")[0]
+        if media_major != installed_major:
+            block_upgrade = True
 
         has_hostvg = utils.system.has_hostvg()
         has_root = os.path.exists("/dev/disk/by-label/ROOT")
 
-        if has_hostvg and has_root:
-            return [ui.Label(_("Major version upgrades are unsupported, ") +
-                             _("uninstall existing version first"))]
+        if has_hostvg and has_root or block_upgrade:
+            return [ui.Label("lbl.blockupgrade", "Major version upgrades " +
+                             "are unsupported, uninstall existing version " +
+                             "first")]
 
         if has_hostvg:
             try:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8747d5c28e0c6ee763c27647420b2445c04690ca
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>



More information about the node-patches mailing list