[node-patches] Change in ovirt-node[ovirt-3.6]: mount_liveos: Check a few more places, don't break to much

fabiand at redhat.com fabiand at redhat.com
Thu Nov 26 16:57:30 UTC 2015


Fabian Deutsch has uploaded a new change for review.

Change subject: mount_liveos: Check a few more places, don't break to much
......................................................................

mount_liveos: Check a few more places, don't break to much

This is a conservative patch to fix mount_liveos on el7.
It seems that a device can not be mounted more than once anymore.
But the previous mount_liveos logic assumed this.

Instead of mounting a device multiple times, bind mounts can be used.
The logic has been updated to use bind mounts, if well known places
are already mounted.
Otherwise the old logic is used.

The old logic was also updated to complete the loop over mapper
devices.

Change-Id: I600f70aec8ad8054ec93770a9c8dc410ac2bb9cb
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1285607
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirtnode/ovirtfunctions.py
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/63/49263/1

diff --git a/src/ovirtnode/ovirtfunctions.py b/src/ovirtnode/ovirtfunctions.py
index d152bc1..19af9dd 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -523,6 +523,14 @@
             connect_iscsi_root()
         system_closefds("mkdir -p /liveos")
         if not system("mount LABEL=Root /liveos &>/dev/null"):
+            # Let's first see if Root is maybe already mounted
+            if os.path.ismount("/dev/.initramfs/live"):
+                system_closefds("mount -o bind /dev/.initramfs/live /liveos")
+            elif os.path.ismount("/run/initramfs/live"):
+                system_closefds("mount -o bind /run/initramfs/live /liveos")
+            if os.path.ismount("/liveos"):
+                return True
+
             # just in case /dev/disk/by-label is not using devmapper and fails
             for dev in os.listdir("/dev/mapper"):
                 if system("e2label \"/dev/mapper/" + dev + "\" 2>/dev/null|grep Root|grep -v Backup"):
@@ -535,8 +543,10 @@
                             system_closefds("mount -o bind /dev/.initramfs/live /liveos")
                         elif os.path.ismount("/run/initramfs/live"):
                             system_closefds("mount -o bind /run/initramfs/live /liveos")
-                        else:
-                            return False
+                        if os.path.ismount("/liveos"):
+                            return True
+
+            return False
         else:
             return True
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I600f70aec8ad8054ec93770a9c8dc410ac2bb9cb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list