[f23-branch 1/1] Exclude isodir from valid disks

jkonecny12 installerbot-noreply at redhat.com
Tue Aug 25 07:57:50 UTC 2015


From: Jiri Konecny <jkonecny at redhat.com>

When dracut downloads stage2 from the repository on the iso
(inst.repo=hd:...) this iso file will mount to isodir so if isodir was
mounted we can't use the source device in a partitioning.
---
 blivet/populator.py | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/blivet/populator.py b/blivet/populator.py
index 7aaf3e1..2d68071 100644
--- a/blivet/populator.py
+++ b/blivet/populator.py
@@ -105,6 +105,7 @@ def __init__(self, devicetree=None, conf=None, passphrase=None,
         # protected device specs as provided by the user
         self.protectedDevSpecs = getattr(conf, "protectedDevSpecs", [])
         self.liveBackingDevice = None
+        self.mountedIsoBackingDevice = None
 
         # names of protected devices at the time of tree population
         self.protectedDevNames = []
@@ -743,7 +744,8 @@ def addUdevDevice(self, info, updateOrigFmt=False):
             device.protected = True
             # if this is the live backing device we want to mark its parents
             # as protected also
-            if device.name == self.liveBackingDevice:
+            if (device.name == self.liveBackingDevice or
+                device.name == self.mountedIsoBackingDevice):
                 for parent in device.parents:
                     parent.protected = True
 
@@ -1647,19 +1649,25 @@ def _populate(self):
             if name:
                 self.protectedDevNames.append(name)
 
-        # FIXME: the backing dev for the live image can't be used as an
-        # install target.  note that this is a little bit of a hack
-        # since we're assuming that /run/initramfs/live will exist
+        # FIXME: the backing dev for the live image and mounted isodir
+        # can't be used as an install target.
+        # note that this is a little bit of a hack since we're
+        # assuming that the path will exist
         for mnt in open("/proc/mounts").readlines():
-            if " /run/initramfs/live " not in mnt:
+            if " /run/initramfs/live " not in mnt and " /run/install/isodir " not in mnt:
                 continue
 
-            live_device_name = mnt.split()[0].split("/")[-1]
-            log.info("%s looks to be the live device; marking as protected",
-                     live_device_name)
-            self.protectedDevNames.append(live_device_name)
-            self.liveBackingDevice = live_device_name
-            break
+            protected_device_name = mnt.split()[0].split("/")[-1]
+            if " /run/initramfs/live " in mnt:
+                log.info("%s looks to be the live device; marking as protected",
+                     protected_device_name)
+                self.protectedDevNames.append(protected_device_name)
+                self.liveBackingDevice = protected_device_name
+            # iso device is already in protected devices now
+            elif " /run/install/isodir " in mnt:
+                log.info("%s looks to be the device with the mounted iso",
+                     protected_device_name)
+                self.mountedIsoBackingDevice = protected_device_name
 
         old_devices = {}
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/86a111e7b0ecf4460a6ad999c9d21627e4c31747


More information about the anaconda-patches mailing list