[rhinstaller/blivet/pulls/265 master] Add more class methods for better use of metadata
vpodzime
installerbot-noreply at redhat.com
Mon Nov 2 14:02:48 UTC 2015
> @@ -179,12 +179,64 @@ def freeSpaceEstimate(cls, device_size):
> with size ``device_size``.
> This is more guess then precise number.
>
> + .. note::
> +
> + This is more guess then precise number. To get precise
> + space taken the FS must provide this number to us.
> +
> :param device_size: original device size
> - :type device_size: ``Size`` object
> + :type device_size: :class:`~.size.Size` object
> :return: estimated free size after format
> + :rtype: :class:`~.size.Size`
> """
> return device_size * cls._MetadataSizeFactor
>
> + @classmethod
> + def deviceSizeWithUsableSpace(cls, usable_size):
> + """ Get device size we need to get ``usable_size`` on the device.
> + This calculation will add metadata to usable device on the FS.
> +
> + .. note::
> +
> + This is more guess then precise number. To get precise
> + space taken the FS must provide this number to us.
> +
> + :param usable_size: how much usable size we want on newly created device
> + :type usable_size: :class:`~.size.Size` object
> + :return: estimated size of the device which will have given amount of
> + ``usable_size``
> + :rtype: :class:`~.size.Size`
> + """
> + # to get usable size without metadata we will use
> + # usable_size = device_size * _MetadataSizeFactor
> + # we can change this to get device size with required usable_size
> + # device_size = usable_size / _MetadataSizeFactor
> + return Size(Decimal(usable_size) / Decimal(cls._MetadataSizeFactor))
I see everybody has the same first wrong idea about the computation. :) I must say I don't see too much sense in returning the metadata size as it's not really useful for anything else than adding it to the requested size and getting the required size.
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/265#discussion_r43630389
More information about the anaconda-patches
mailing list