[master 1/1] Teardown all descendants devices before tearing disk images down

vpodzime installerbot-noreply at redhat.com
Fri Nov 13 13:51:14 UTC 2015


From: Vratislav Podzimek <vpodzime at redhat.com>

DM maps cannot be removed while they are in use so in order to make them
removable, we need to teardown all devices "built" on top of them first. This
makes our examples (and possibly some tests) better clean after themselves.
---
 blivet/devicetree.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index fe10aa5..b44bcbb 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1048,6 +1048,11 @@ def setup_disk_images(self):
 
     def teardown_disk_images(self):
         """ Tear down any disk image stacks. """
+        for dev_name in self.disk_images.keys():
+            dm_device = self.get_device_by_name(dev_name)
+            descendants = self.get_dependent_devices(dm_device)
+            for dev in reversed(descendants):
+                dev.teardown(recursive=True)
         self._populator.teardown_disk_images()
 
     @property


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


More information about the anaconda-patches mailing list