Skip to content

Commit

Permalink
Teardown all descendants devices before tearing disk images down
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vpodzime committed Nov 13, 2015
1 parent 5f879b3 commit 299aa16
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blivet/devicetree.py
Expand Up @@ -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
Expand Down

0 comments on commit 299aa16

Please sign in to comment.