[node-patches] Change in ovirt-node[master]: Unmount partitions before we mkfs them

rbarry at redhat.com rbarry at redhat.com
Fri Sep 19 22:07:53 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Unmount partitions before we mkfs them
......................................................................

Unmount partitions before we mkfs them

It seems that some partitions get held by EL7. They don't appear
in mtab, /proc/mounts, or any other location, but siphoning off
mkfs output shows it cowardly refusing because the partition is
mounted. Unmount before formatting, just in case.

Change-Id: Ib9ad90f7876137ec08f840e4b4cd649d55fe3f0e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1095081
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirtnode/ovirtfunctions.py
M src/ovirtnode/storage.py
2 files changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/88/33088/1

diff --git a/src/ovirtnode/ovirtfunctions.py b/src/ovirtnode/ovirtfunctions.py
index 4aa8c7b..5b0fcfa 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -522,7 +522,8 @@
         if is_iscsi_install():
             connect_iscsi_root()
         system_closefds("mkdir -p /liveos")
-        if not "CDLABEL" in open("/proc/cmdline").read():
+        if not "CDLABEL" in open("/proc/cmdline").read() and \
+                not "reinstall" in open("/proc/cmdline"):
             if not system("mount LABEL=Root /liveos &>/dev/null"):
                 # just in case /dev/disk/by-label is not using devmapper and fails
                 for dev in os.listdir("/dev/mapper"):
@@ -531,7 +532,8 @@
                         system("ln -s \"/dev/mapper/" + dev + "\" /dev/disk/by-label/Root")
                         if system("mount LABEL=Root /liveos"):
                             return True
-        elif "CDLABEL" in open("/proc/cmdline").read():
+        elif "CDLABEL" in open("/proc/cmdline").read() or \
+                "reinstall" in open("/proc/cmdline"):
             if os.path.ismount("/dev/.initramfs/live"):
                 system_closefds("mount -o bind /dev/.initramfs/live /liveos")
             elif os.path.ismount("/run/initramfs/live"):
diff --git a/src/ovirtnode/storage.py b/src/ovirtnode/storage.py
index 6bda242..c1d1cb2 100644
--- a/src/ovirtnode/storage.py
+++ b/src/ovirtnode/storage.py
@@ -885,10 +885,12 @@
             if not os.path.exists(partroot):
                 partroot = self.ROOTDRIVE + "p2"
                 partrootbackup = self.ROOTDRIVE + "p3"
+            _functions.system("umount -l " + partroot)
             _functions.system("mke2fs \"" + partroot + "\" -L Root")
             _functions.system("tune2fs -c 0 -i 0 \"" + partroot + "\"")
             _functions.system("ln -snf \"" + partrootbackup +
                    "\" /dev/disk/by-label/RootBackup")
+            _functions.system("umount -l " + partrootbackup)
             _functions.system("mke2fs \"" + partrootbackup + \
                               "\" -L RootBackup")
             _functions.system("tune2fs -c 0 -i 0 \"" + partrootbackup + "\"")


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9ad90f7876137ec08f840e4b4cd649d55fe3f0e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list