[PATCHv2] Tear down all devices after finding existing installations

Vratislav Podzimek vpodzime at redhat.com
Wed Jul 1 08:26:29 UTC 2015


On Mon, 2015-06-29 at 10:55 -0500, David Lehman wrote:
> On 06/29/2015 10:17 AM, Vratislav Podzimek wrote:
> > 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 done we need to tear all/rest of the devices 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 | 5 +++++
> >   1 file changed, 5 insertions(+)
> >
> > diff --git a/blivet/__init__.py b/blivet/__init__.py
> > index 47cb1dd..772ca16 100644
> > --- a/blivet/__init__.py
> > +++ b/blivet/__init__.py
> > @@ -490,6 +490,11 @@ class Blivet(object):
> >                   self.roots = findExistingInstallations(self.devicetree)
> >               except Exception: # pylint: disable=broad-except
> >                   log_exception_info(log.info, "failure detecting existing installations")
> > +            finally:
> > +                # make sure no devices are left activated after finding existing
> > +                # installations (we don't quite know which ones got activated in
> > +                # that process)
> > +                self.devicetree.teardownAll()
> >
> >               self.dumpState("initial")
> >
> >
The problem with this approach is that anaconda also calls
findExistingInstallations(). It seems to me a bit silly to add the
teardownAll() call to anaconda too so I'm proposing a bit different
approach of adding an extra argument to findExistingInstallations() and
tearing down all devices there. We also need one more patch that fixes
recursive teardown of inactive devices. Sending version 3.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list