Re: [PATCH] Schedule removal actions for any format on a --onpart= device (#576976).

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

 



Ack. Consider nominating this for F13Blocker if you haven't already.

On Thu, 2010-04-01 at 13:14 -0400, Chris Lumens wrote:
> We need to recursively remove any format on top of a device that's getting
> reused so we don't attempt to use those formats again later.
> ---
>  kickstart.py |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/kickstart.py b/kickstart.py
> index d45326a..a0fa7d4 100644
> --- a/kickstart.py
> +++ b/kickstart.py
> @@ -178,6 +178,18 @@ def deviceMatches(spec):
>  
>      return matches
>  
> +# Remove any existing formatting on a device, but do not remove the partition
> +# itself.  This sets up an existing device to be used in a --onpart option.
> +def removeExistingFormat(device, devicetree):
> +    deps = storage.deviceDeps(device)
> +    while deps:
> +        leaves = [d for d in deps if d.isleaf]
> +        for leaf in leaves:
> +            storage.destroyDevice(leaf)
> +            deps.remove(leaf)
> +
> +    devicetree.registerAction(ActionDestroyFormat(device))
> +
>  ###
>  ### SUBCLASSES OF PYKICKSTART COMMAND HANDLERS
>  ###
> @@ -465,6 +477,7 @@ class LogVolData(commands.logvol.F12_LogVolData):
>              if not device:
>                  raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent LV %s in logvol command" % self.name)
>  
> +            removeExistingFormat(device, devicetree)
>              devicetree.registerAction(ActionCreateFormat(device, format))
>          else:
>              # If a previous device has claimed this mount point, delete the
> @@ -734,6 +747,7 @@ class PartitionData(commands.partition.F12_PartData):
>              if not device:
>                  raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent partition %s in partition command" % self.onPart)
>  
> +            removeExistingFormat(device, devicetree)
>              devicetree.registerAction(ActionCreateFormat(device, kwargs["format"]))
>          else:
>              # If a previous device has claimed this mount point, delete the
> @@ -875,6 +889,7 @@ class RaidData(commands.raid.F12_RaidData):
>              if not device:
>                  raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specifeid nonexistent RAID %s in raid command" % devicename)
>  
> +            removeExistingFormat(device, devicetree)
>              devicetree.registerAction(ActionCreateFormat(device, kwargs["format"]))
>          else:
>              # If a previous device has claimed this mount point, delete the


_______________________________________________
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