[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)



> 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:

Looks good to me, though we may not want to log an error.  Non-i386
platforms may not even support the concept of partition flags so this
could be a distracting error message on those.

- Chris


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