Re: [PATCH 2/2] Activate storage before looking up the hdiso source drive (#491781).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2009-04-02 at 14:17 -0400, Chris Lumens wrote:
> ---
>  storage/__init__.py |   32 +++++++++++++++++++++++++-------
>  1 files changed, 25 insertions(+), 7 deletions(-)

I wish we didn't have three separate calls to storage.reset in there
but, if that's how it has to be, so be it.

> 
> diff --git a/storage/__init__.py b/storage/__init__.py
> index 7c17ec8..56223df 100644
> --- a/storage/__init__.py
> +++ b/storage/__init__.py
> @@ -43,7 +43,7 @@ from formats import getFormat
>  from formats import get_device_format_class
>  from formats import get_default_filesystem_type
>  from devicelibs.lvm import safeLvmName
> -from udev import udev_trigger
> +from udev import *
>  import iscsi
>  import zfcp
>  
> @@ -69,12 +69,32 @@ def storageInitialize(anaconda):
>         stat.S_ISBLK(os.stat("/dev/live")[stat.ST_MODE]):
>          target = os.readlink("/dev/live")
>          storage.protectedPartitions = [target]
> +        storage.reset()
>      elif anaconda.methodstr and anaconda.methodstr.startswith("hd:"):
>          method = anaconda.methodstr[3:]
>          devspec = method.split(":", 3)[0]
>  
> -        device = storage.devicetree.resolveDevice(devspec)
> -        if device is None:
> +        for entry in udev_get_block_devices():
> +            if devspec.startswith("LABEL=") and udev_device_get_label(entry) == devspec[6:]:
> +                storage.protectedPartitions = [udev_device_get_name(entry)]
> +                break
> +            elif devspec.startswith("UUID=") and udev_device_get_uuid(entry) == devspec[5:]:
> +                storage.protectedPartitions = [udev_device_get_name(entry)]
> +                break
> +            else:
> +                if devspec.startswith("/dev/"):
> +                    dev = devspec[5:]
> +                else:
> +                    dev = devspec
> +
> +                name = udev_device_get_name(entry)
> +                if name == dev:
> +                    storage.protectedPartitions = [name]
> +                    break
> +
> +        storage.reset()
> +
> +        if not storage.protectedPartitions or not storage.devicetree.getDeviceByName(storage.protectedPartitions[0]):
>              if anaconda.id.getUpgrade():
>                  return
>              else:
> @@ -84,10 +104,8 @@ def storageInitialize(anaconda):
>                        "parameters and try again.") % devspec,
>                      type="custom", custom_buttons = [_("_Exit installer")])
>                  sys.exit(1)
> -
> -        storage.protectedPartitions = [device.name]
> -
> -    storage.reset()
> +    else:
> +        storage.reset()
>  
>  # dispatch.py helper function
>  def storageComplete(anaconda):

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux