[f21-branch][PATCH] Search for a valid stage1 device on disks with stage1 mount points (#1168118)

Anne Mulhern amulhern at redhat.com
Mon Dec 1 15:36:20 UTC 2014





----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Friday, November 28, 2014 5:49:09 AM
> Subject: [f21-branch][PATCH] Search for a valid stage1 device on disks with	stage1 mount points (#1168118)
> 
> From: Adam Williamson <awilliam at redhat.com>
> 
> Otherwise we try the first disk which may not contain a valid stage1 device
> and
> then give up (because the first disk is used to boot from, right?).
> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  pyanaconda/kickstart.py | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> index 72d77f3..d44b349 100644
> --- a/pyanaconda/kickstart.py
> +++ b/pyanaconda/kickstart.py
> @@ -379,9 +379,20 @@ class Bootloader(commands.bootloader.F21_Bootloader):
>          if self.timeout is not None:
>              storage.bootloader.timeout = self.timeout
>  
> +        # try to reduce the set of possible 'boot disks' to the disks
> containing
> +        # a valid stage1 mount point, if there are any, because those disks
> +        # should be searched for a stage1_valid device
> +        disks = storage.disks
> +        if platform.bootStage1ConstraintDict["mountpoints"]:
> +            disks = [p.disk for p in storage.devices if getattr(p.format,
> "mountpoint", None) in platform.bootStage1ConstraintDict["mountpoints"]]
> +            if not disks:
> +                # but if not, just go ahead and use the set of all disks or
> +                # else we'll error out later
> +                disks = storage.disks

Might as well make lines above:

disks = [p.disk for p in storage.devices if getattr(p.format, "mountpoint", None) in platform.bootStage1ConstraintDict["mountpoints"]] or storage.disks

it does the same thing.

Would be nice if comment explained why disk with mountpoint in mountpoints is _preferred_ but not _required_. Why isn't it better to error out
now if no satisfying disk is found, for instance?

> +
>          # Throw out drives specified that don't exist or cannot be used
>          (iSCSI
>          # device on an s390 machine)
> -        disk_names = [d.name for d in storage.disks
> +        disk_names = [d.name for d in disks
>                        if not d.format.hidden and not d.protected and
>                        (not blivet.arch.isS390() or not isinstance(d,
>                        blivet.devices.iScsiDiskDevice))]
>          diskSet = set(disk_names)
> --
> 1.9.3
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

- mulhern


More information about the anaconda-patches mailing list