[rhinstaller/anaconda/pulls/383 master] don't delete shared/boot parts in deleteAll (#1183880)
AdamWill
installerbot-noreply at redhat.com
Thu Oct 1 19:46:40 UTC 2015
> @@ -1963,16 +1967,33 @@ def on_remove_clicked(self, button):
> return
>
> if dialog.deleteAll:
> - for dev in (s._device for s in page.members):
> - self._destroy_device(dev)
> - else:
> - self._destroy_device(device)
> + otherpgs = (pg for pg in self._accordion.allPages if
> + pg.pageTitle != page.pageTitle)
> + otherdevs = []
> + for otherpg in otherpgs:
> + otherdevs.extend([mem._device.id for mem in otherpg.members])
> + # we never want to delete known-shared devs here. we also
> + # exclude 'device' as we'll unconditionally delete it later
> + for dev in (s._device for s in page.members if
> + s._device.id not in otherdevs and
> + s._device.id != device.id):
> + # we only want to delete boot partitions if they're not
> + # shared *and* we have no unknown partitions
> + if (not self.unusedDevices or dev.format.type not in protected):
> + log.info("deleteall: removed %s", dev.name)
> + self._destroy_device(dev)
> + else:
> + log.info("deleteall: didn't remove %s", dev.name)
> +
> + # We do this even in deleteAll case, see above comment
> + self._destroy_device(device)
>
> log.info("ui: removed device %s", device.name)
>
> # Now that devices have been removed from the installation root,
> # refreshing the display will have the effect of making them disappear.
> # It's like they never existed.
> + self._storage_playground.roots = findExistingInstallations(self._storage_playground.devicetree)
This is something of a big hammer, it re-runs the 'find existing OSes' probe. It causes a second or two delay after you confirm the delete. If that's a big problem we could perhaps just directly take the root we're acting on out of `self._storage_playground.roots` with a comprehension or whatever; in theory that'd be wrong if so many partitions are shared that the bucket should stick around, but in practice I don't think that's anything to worry about, since you shouldn't be sharing root partitions...
--
To view this pull request on github, visit https://github.com/rhinstaller/anaconda/pull/383#discussion_r40957564
More information about the anaconda-patches
mailing list