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

Re: [PATCH 1/1] Make sure we turn on swap flag. (#503457)



On Tue, 2009-06-02 at 14:19 +0200, Joel Granados Moreno wrote:
> ---
>  storage/devices.py |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)

The DeviceFormat classes all have a 'partedFlag' attribute which is
there for this purpose. If you want to force the flags based on
preexisting formatting, do it generically so we don't get a patch later
for raid members and then another for lvm pvs.

Dave

> 
> diff --git a/storage/devices.py b/storage/devices.py
> index b5e32af..2a9578d 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -1130,6 +1130,15 @@ class PartitionDevice(StorageDevice):
>          log_method_call(self, self.name)
>          StorageDevice._setFormat(self, format)
>  
> +        if format.type == "swap":
> +            if self.flagAvailable(parted.PARTITION_SWAP):
> +                self.setFlag(parted.PARTITION_SWAP)
> +            else:
> +                # Swap will still work if we fail.
> +                log.error("Failed to activate swap flag on %s" % self.name)
> +        else:
> +            self.unsetFlag(parted.PARTITION_SWAP)
> +
>      def _setBootable(self, bootable):
>          """ Set the bootable flag for this partition. """
>          if self.partedPartition:


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