[node-patches] Change in ovirt-node[ovirt-3.5]: Avoiding mounting of leftovers in fresh install.

fabiand at redhat.com fabiand at redhat.com
Mon Jan 5 09:48:33 UTC 2015


Hello Anatoly Litovsky,

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

    http://gerrit.ovirt.org/36564

to review the following change.

Change subject: Avoiding mounting of leftovers in fresh install.
......................................................................

Avoiding mounting of leftovers in fresh install.

depending on leftovers from previous installs the welcome page mounts
and blocks the device for the rest of changes we do to the disk. This
happens inside the get_istalled_version_number finction which should jow
restore the mount points after execution.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1167240
Change-Id: I046abe87f94e5fe0eefd3d246ff1cfbe53e2aba2
Signed-off-by: Tolik Litovsky <tlitovsk at redhat.com>
---
M src/ovirt/node/installer/core/welcome_page.py
M src/ovirtnode/ovirtfunctions.py
2 files changed, 25 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/64/36564/1

diff --git a/src/ovirt/node/installer/core/welcome_page.py b/src/ovirt/node/installer/core/welcome_page.py
index 2e2b918..5566868 100644
--- a/src/ovirt/node/installer/core/welcome_page.py
+++ b/src/ovirt/node/installer/core/welcome_page.py
@@ -91,10 +91,11 @@
                     ui.Button("button.reinstall", _("Reinstall (dry)"))]
 
         media = utils.system.InstallationMedia()
-        installed = utils.system.InstalledMedia()
-        is_installed = installed.available()
 
         if not is_reinstall():
+            # Only check installed, if reinstall, rhbz 1167240
+            installed = utils.system.InstalledMedia()
+            is_installed = installed.available()
             if is_installed and \
                (media.version_major != installed.version_major):
                 block_upgrade = True
diff --git a/src/ovirtnode/ovirtfunctions.py b/src/ovirtnode/ovirtfunctions.py
index c067a6b..0dd714c 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -1505,21 +1505,32 @@
         system_closefds(cmd)
 
 def get_installed_version_number():
+    #rhbz 1167240 restoring mount situation
+    retval = False
+    unmount = False
+    if not os.path.ismount("/liveos"):
+        unmount = True
     if mount_liveos() and os.path.exists("/liveos/version"):
-        existing_version = open("/liveos/version")
-        existing_install = {}
-        for line in existing_version.readlines():
-            try:
-                key, value = line.strip().split("=")
-                value = value.replace("'", "")
-                existing_install[key] = value
-            except:
-                pass
+        with open("/liveos/version") as existing_version:
+            existing_install = {}
+            for line in existing_version.readlines():
+                try:
+                    key, value = line.strip().split("=")
+                    value = value.replace("'", "")
+                    existing_install[key] = value
+                except:
+                    pass
 
         if existing_install.has_key("VERSION") and existing_install.has_key("RELEASE"):
-            return [existing_install["VERSION"],existing_install["RELEASE"]]
+            retval = [existing_install["VERSION"],existing_install["RELEASE"]]
 
-    return False
+    if unmount:
+            if system("umount /liveos &>/dev/null"):
+                logger.debug("unmounted liveos")
+            else:
+                logger.error("Wasnt able to restore mounting")
+
+    return retval
 
 def get_media_version_number():
     new_install = {}


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I046abe87f94e5fe0eefd3d246ff1cfbe53e2aba2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>
Gerrit-Reviewer: Anatoly Litovsky <tlitovsk at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list