[rhinstaller/blivet/pulls/63 master] Bits needed to enforce sane disk selection in anaconda

mulkieran installerbot-noreply at redhat.com
Wed Apr 1 17:57:28 UTC 2015


> @@ -361,28 +361,48 @@ def processActions(self, dryRun=False, callbacks=None):
>                               dryRun=dryRun,
>                               callbacks=callbacks)
>  
> -    def getDependentDevices(self, dep):
> +    def getDependentDevices(self, dep, hidden=False):
>          """ Return a list of devices that depend on dep.
>  
>              The list includes both direct and indirect dependents.
>  
>              :param dep: the device whose dependents we are looking for
>              :type dep: :class:`~.devices.StorageDevice`
> +            :keyword bool hidden: include hidden devices in search
>          """
>          dependents = []
> +        log_method_call(self, dep=dep, hidden=hidden)
>  
>          # don't bother looping looking for dependents if this is a leaf device
> -        if dep.isleaf:
> +        # XXX all hidden devices are leaves
> +        if dep.isleaf and not hidden:
> +            log.debug("dep is a leaf")
>              return dependents
>  
> -        incomplete = [d for d in self._devices
> -                            if not getattr(d, "complete", True)]
> -        for device in self.devices + incomplete:
> +        devices = self._devices[:]
> +        if hidden:
> +            devices.extend(self._hidden)
> +
> +        for device in devices:
> +            log.debug("checking if %s depends on %s", device.name, dep.name)
>              if device.dependsOn(dep):
>                  dependents.append(device)
>  
>          return dependents
>  
> +    def getRelatedDisks(self, disk):
> +        """ Return a list of disks related to disk by container membership.

Also the docstring talks about "container membership" but given the definition of getDependentDevices it feels like getRelatedDisks is doing something far more general than anything to do with containers, per se.

-- 
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/63#discussion_r27593736


More information about the anaconda-patches mailing list