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

tlitovsk at redhat.com tlitovsk at redhat.com
Wed Dec 31 06:39:32 UTC 2014


Anatoly Litovsky has uploaded a new change for review.

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, 21 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/89/36489/1

diff --git a/src/ovirt/node/installer/core/welcome_page.py b/src/ovirt/node/installer/core/welcome_page.py
index 2e2b918..c42bc9f 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():
+            # 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 8ab7b12..7781051 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -1504,17 +1504,26 @@
         system_closefds(cmd)
 
 def get_installed_version_number():
+    #rhbz 1167240 restoring mount situation
+    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 unmount:
+            if system("umount /liveos &>/dev/null"):
+                logger.debug("unmounted liveos")
+            else:
+                logger.error("Wasnt able to restore mounting")
         if existing_install.has_key("VERSION") and existing_install.has_key("RELEASE"):
             return [existing_install["VERSION"],existing_install["RELEASE"]]
 


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

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



More information about the node-patches mailing list