[blivet][rhel7-branch] Tear down devices recursively when finding existing installations

Vratislav Podzimek vpodzime at redhat.com
Mon Jun 29 13:10:37 UTC 2015


When trying to find existing installations we setup and mount devices (to check
if they have /etc/fstab). Setting a device up results in its parents being setup
too (recursively) so when tearing the device down we should also tear its
parents (recursively) down so that they are not left activated as that could
cause problems later (as for example in the bug where a thin pool was
activated/setup on setup of a thin LV and never deactivated/torn down).

Resolves: rhbz#1182229
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 blivet/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 47cb1dd..9c8bfac 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -3000,7 +3000,7 @@ def findExistingInstallations(devicetree):
             device.format.mount(options=options, mountpoint=getSysroot())
         except Exception: # pylint: disable=broad-except
             log_exception_info(log.warning, "mount of %s as %s failed", [device.name, device.format.type])
-            device.teardown()
+            device.teardown(recursive=True)
             continue
 
         if not os.access(getSysroot() + "/etc/fstab", os.R_OK):
@@ -3021,7 +3021,7 @@ def findExistingInstallations(devicetree):
                         {"product": product, "version": version, "arch": architecture}
 
         (mounts, swaps) = parseFSTab(devicetree, chroot=_sysroot)
-        device.teardown()
+        device.teardown(recursive=True)
         if not mounts and not swaps:
             # empty /etc/fstab. weird, but I've seen it happen.
             continue
-- 
2.1.0



More information about the anaconda-patches mailing list