{"action":"created","comment":{"url":"https://api.github.com/repos/rhinstaller/blivet/pulls/comments/45867528","id":45867528,"diff_hunk":"@@ -177,14 +177,63 @@ def dict(self):\n     def freeSpaceEstimate(cls, device_size):\n         \"\"\" Get estimated free space when format will be done on device\n             with size ``device_size``.\n-            This is more guess then precise number.\n+\n+            .. note::\n+\n+                This is more guess than precise number. To get precise\n+                space taken the FS must provide this number to us.\n \n             :param device_size: original device size\n-            :type device_size: ``Size`` object\n+            :type device_size: :class:`~.size.Size` object\n             :return: estimated free size after format\n+            :rtype: :class:`~.size.Size`\n         \"\"\"\n         return device_size * cls._MetadataSizeFactor\n \n+    @classmethod\n+    def getRequiredSize(cls, free_space):\n+        \"\"\" Get device size we need to get a ``free_space`` on the device.\n+            This calculation will add metadata to usable device on the FS.\n+\n+            .. note::\n+\n+                This is more guess than precise number. To get precise\n+                space taken the FS must provide this number to us.\n+\n+            :param free_space: how much usable size we want on newly created device\n+            :type free_space: :class:`~.size.Size` object\n+            :return: estimated size of the device which will have given amount of\n+                ``free_space``\n+            :rtype: :class:`~.size.Size`\n+        \"\"\"\n+        # to get usable size without metadata we will use\n+        # usable_size = device_size * _MetadataSizeFactor\n+        # we can change this to get device size with required usable_size\n+        # device_size = usable_size / _MetadataSizeFactor\n+        return Size(Decimal(free_space) / Decimal(cls._MetadataSizeFactor))\n+\n+    @classmethod\n+    def biggestOverheadFS(cls, fs_list=None):\n+        \"\"\" Get format class from list of format classes with largest space taken\n+            by metadata.\n+\n+            :param fs_list: list of input filesystems\n+            :type fs_list: list of classes with parent :class:`~.FS`\n+            :return: FS which takes most space by metadata\n+        \"\"\"\n+        if fs_list is None:\n+            from . import device_formats\n+            fs_list = []\n+            for fs_class in device_formats.values():\n+                if issubclass(fs_class, cls):\n+                    fs_list.append(fs_class)\n+        else:\n+            for fs_class in fs_list:\n+                if not issubclass(fs_class, cls):\n+                    raise ValueError(\"You can provide only Filesystem classes!\")","path":"blivet/formats/fs.py","position":68,"original_position":68,"commit_id":"dc3c456e316af980b8eb242522fd367961be2898","original_commit_id":"dc3c456e316af980b8eb242522fd367961be2898","user":{"login":"vpodzime","id":1044278,"avatar_url":"https://avatars.githubusercontent.com/u/1044278?v=3","gravatar_id":"","url":"https://api.github.com/users/vpodzime","html_url":"https://github.com/vpodzime","followers_url":"https://api.github.com/users/vpodzime/followers","following_url":"https://api.github.com/users/vpodzime/following{/other_user}","gists_url":"https://api.github.com/users/vpodzime/gists{/gist_id}","starred_url":"https://api.github.com/users/vpodzime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vpodzime/subscriptions","organizations_url":"https://api.github.com/users/vpodzime/orgs","repos_url":"https://api.github.com/users/vpodzime/repos","events_url":"https://api.github.com/users/vpodzime/events{/privacy}","received_events_url":"https://api.github.com/users/vpodzime/received_events","type":"User","site_admin":false},"body":"*Only file system classes may be provided!* sounds better to me","created_at":"2015-11-25T13:46:37Z","updated_at":"2015-11-25T13:46:37Z","html_url":"https://github.com/rhinstaller/blivet/pull/287#discussion_r45867528","pull_request_url":"https://api.github.com/repos/rhinstaller/blivet/pulls/287","_links":{"self":{"href":"https://api.github.com/repos/rhinstaller/blivet/pulls/comments/45867528"},"html":{"href":"https://github.com/rhinstaller/blivet/pull/287#discussion_r45867528"},"pull_request":{"href":"https://api.github.com/repos/rhinstaller/blivet/pulls/287"}}},"pull_request":{"url":"https://api.github.com/repos/rhinstaller/blivet/pulls/287","id":51795438,"html_url":"https://github.com/rhinstaller/blivet/pull/287","diff_url":"https://github.com/rhinstaller/blivet/pull/287.diff","patch_url":"https://github.com/rhinstaller/blivet/pull/287.patch","issue_url":"https://api.github.com/repos/rhinstaller/blivet/issues/287","number":287,"state":"open","locked":false,"title":"Add more class methods for better use of metadata","user":{"login":"jkonecny12","id":1643889,"avatar_url":"https://avatars.githubusercontent.com/u/1643889?v=3","gravatar_id":"","url":"https://api.github.com/users/jkonecny12","html_url":"https://github.com/jkonecny12","followers_url":"https://api.github.com/users/jkonecny12/followers","following_url":"https://api.github.com/users/jkonecny12/following{/other_user}","gists_url":"https://api.github.com/users/jkonecny12/gists{/gist_id}","starred_url":"https://api.github.com/users/jkonecny12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkonecny12/subscriptions","organizations_url":"https://api.github.com/users/jkonecny12/orgs","repos_url":"https://api.github.com/users/jkonecny12/repos","events_url":"https://api.github.com/users/jkonecny12/events{/privacy}","received_events_url":"https://api.github.com/users/jkonecny12/received_events","type":"User","site_admin":false},"body":"Add new class methods:\r\n1) getRequiredSize(cls, free_space) - takes how much space we need and returns this space + metadata of this FS.\r\n2) biggestOverheadFS(cls, fs_list=None) - Return FS from the list which takes most of the space by metadata. Input list is useful to filter only the required FSs if None is set then it takes biggest from all supported FSs.\r\n\r\nThis patch is needed for this https://github.com/rhinstaller/anaconda/pull/424 which will go to anaconda.","created_at":"2015-11-25T13:43:52Z","updated_at":"2015-11-25T13:46:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4e26e4a926e971f4927f985f1532c57dbf2cf0b4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rhinstaller/blivet/pulls/287/commits","review_comments_url":"https://api.github.com/repos/rhinstaller/blivet/pulls/287/comments","review_comment_url":"https://api.github.com/repos/rhinstaller/blivet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rhinstaller/blivet/issues/287/comments","statuses_url":"https://api.github.com/repos/rhinstaller/blivet/statuses/dc3c456e316af980b8eb242522fd367961be2898","head":{"label":"jkonecny12:master-add-metadata","ref":"master-add-metadata","sha":"dc3c456e316af980b8eb242522fd367961be2898","user":{"login":"jkonecny12","id":1643889,"avatar_url":"https://avatars.githubusercontent.com/u/1643889?v=3","gravatar_id":"","url":"https://api.github.com/users/jkonecny12","html_url":"https://github.com/jkonecny12","followers_url":"https://api.github.com/users/jkonecny12/followers","following_url":"https://api.github.com/users/jkonecny12/following{/other_user}","gists_url":"https://api.github.com/users/jkonecny12/gists{/gist_id}","starred_url":"https://api.github.com/users/jkonecny12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkonecny12/subscriptions","organizations_url":"https://api.github.com/users/jkonecny12/orgs","repos_url":"https://api.github.com/users/jkonecny12/repos","events_url":"https://api.github.com/users/jkonecny12/events{/privacy}","received_events_url":"https://api.github.com/users/jkonecny12/received_events","type":"User","site_admin":false},"repo":{"id":33926448,"name":"blivet","full_name":"jkonecny12/blivet","owner":{"login":"jkonecny12","id":1643889,"avatar_url":"https://avatars.githubusercontent.com/u/1643889?v=3","gravatar_id":"","url":"https://api.github.com/users/jkonecny12","html_url":"https://github.com/jkonecny12","followers_url":"https://api.github.com/users/jkonecny12/followers","following_url":"https://api.github.com/users/jkonecny12/following{/other_user}","gists_url":"https://api.github.com/users/jkonecny12/gists{/gist_id}","starred_url":"https://api.github.com/users/jkonecny12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkonecny12/subscriptions","organizations_url":"https://api.github.com/users/jkonecny12/orgs","repos_url":"https://api.github.com/users/jkonecny12/repos","events_url":"https://api.github.com/users/jkonecny12/events{/privacy}","received_events_url":"https://api.github.com/users/jkonecny12/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jkonecny12/blivet","description":"A python module for configuration of block devices","fork":true,"url":"https://api.github.com/repos/jkonecny12/blivet","forks_url":"https://api.github.com/repos/jkonecny12/blivet/forks","keys_url":"https://api.github.com/repos/jkonecny12/blivet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jkonecny12/blivet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jkonecny12/blivet/teams","hooks_url":"https://api.github.com/repos/jkonecny12/blivet/hooks","issue_events_url":"https://api.github.com/repos/jkonecny12/blivet/issues/events{/number}","events_url":"https://api.github.com/repos/jkonecny12/blivet/events","assignees_url":"https://api.github.com/repos/jkonecny12/blivet/assignees{/user}","branches_url":"https://api.github.com/repos/jkonecny12/blivet/branches{/branch}","tags_url":"https://api.github.com/repos/jkonecny12/blivet/tags","blobs_url":"https://api.github.com/repos/jkonecny12/blivet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jkonecny12/blivet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jkonecny12/blivet/git/refs{/sha}","trees_url":"https://api.github.com/repos/jkonecny12/blivet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jkonecny12/blivet/statuses/{sha}","languages_url":"https://api.github.com/repos/jkonecny12/blivet/languages","stargazers_url":"https://api.github.com/repos/jkonecny12/blivet/stargazers","contributors_url":"https://api.github.com/repos/jkonecny12/blivet/contributors","subscribers_url":"https://api.github.com/repos/jkonecny12/blivet/subscribers","subscription_url":"https://api.github.com/repos/jkonecny12/blivet/subscription","commits_url":"https://api.github.com/repos/jkonecny12/blivet/commits{/sha}","git_commits_url":"https://api.github.com/repos/jkonecny12/blivet/git/commits{/sha}","comments_url":"https://api.github.com/repos/jkonecny12/blivet/comments{/number}","issue_comment_url":"https://api.github.com/repos/jkonecny12/blivet/issues/comments{/number}","contents_url":"https://api.github.com/repos/jkonecny12/blivet/contents/{+path}","compare_url":"https://api.github.com/repos/jkonecny12/blivet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jkonecny12/blivet/merges","archive_url":"https://api.github.com/repos/jkonecny12/blivet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jkonecny12/blivet/downloads","issues_url":"https://api.github.com/repos/jkonecny12/blivet/issues{/number}","pulls_url":"https://api.github.com/repos/jkonecny12/blivet/pulls{/number}","milestones_url":"https://api.github.com/repos/jkonecny12/blivet/milestones{/number}","notifications_url":"https://api.github.com/repos/jkonecny12/blivet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jkonecny12/blivet/labels{/name}","releases_url":"https://api.github.com/repos/jkonecny12/blivet/releases{/id}","created_at":"2015-04-14T10:51:19Z","updated_at":"2015-04-14T10:51:21Z","pushed_at":"2015-11-25T13:37:28Z","git_url":"git://github.com/jkonecny12/blivet.git","ssh_url":"git@github.com:jkonecny12/blivet.git","clone_url":"https://github.com/jkonecny12/blivet.git","svn_url":"https://github.com/jkonecny12/blivet","homepage":null,"size":6299,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rhinstaller:1.x-branch","ref":"1.x-branch","sha":"32f5239f5d328c60966c98254e5a68b67d9c3709","user":{"login":"rhinstaller","id":10549274,"avatar_url":"https://avatars.githubusercontent.com/u/10549274?v=3","gravatar_id":"","url":"https://api.github.com/users/rhinstaller","html_url":"https://github.com/rhinstaller","followers_url":"https://api.github.com/users/rhinstaller/followers","following_url":"https://api.github.com/users/rhinstaller/following{/other_user}","gists_url":"https://api.github.com/users/rhinstaller/gists{/gist_id}","starred_url":"https://api.github.com/users/rhinstaller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhinstaller/subscriptions","organizations_url":"https://api.github.com/users/rhinstaller/orgs","repos_url":"https://api.github.com/users/rhinstaller/repos","events_url":"https://api.github.com/users/rhinstaller/events{/privacy}","received_events_url":"https://api.github.com/users/rhinstaller/received_events","type":"Organization","site_admin":false},"repo":{"id":16584540,"name":"blivet","full_name":"rhinstaller/blivet","owner":{"login":"rhinstaller","id":10549274,"avatar_url":"https://avatars.githubusercontent.com/u/10549274?v=3","gravatar_id":"","url":"https://api.github.com/users/rhinstaller","html_url":"https://github.com/rhinstaller","followers_url":"https://api.github.com/users/rhinstaller/followers","following_url":"https://api.github.com/users/rhinstaller/following{/other_user}","gists_url":"https://api.github.com/users/rhinstaller/gists{/gist_id}","starred_url":"https://api.github.com/users/rhinstaller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhinstaller/subscriptions","organizations_url":"https://api.github.com/users/rhinstaller/orgs","repos_url":"https://api.github.com/users/rhinstaller/repos","events_url":"https://api.github.com/users/rhinstaller/events{/privacy}","received_events_url":"https://api.github.com/users/rhinstaller/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rhinstaller/blivet","description":"A python module for configuration of block devices","fork":false,"url":"https://api.github.com/repos/rhinstaller/blivet","forks_url":"https://api.github.com/repos/rhinstaller/blivet/forks","keys_url":"https://api.github.com/repos/rhinstaller/blivet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhinstaller/blivet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhinstaller/blivet/teams","hooks_url":"https://api.github.com/repos/rhinstaller/blivet/hooks","issue_events_url":"https://api.github.com/repos/rhinstaller/blivet/issues/events{/number}","events_url":"https://api.github.com/repos/rhinstaller/blivet/events","assignees_url":"https://api.github.com/repos/rhinstaller/blivet/assignees{/user}","branches_url":"https://api.github.com/repos/rhinstaller/blivet/branches{/branch}","tags_url":"https://api.github.com/repos/rhinstaller/blivet/tags","blobs_url":"https://api.github.com/repos/rhinstaller/blivet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhinstaller/blivet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhinstaller/blivet/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhinstaller/blivet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhinstaller/blivet/statuses/{sha}","languages_url":"https://api.github.com/repos/rhinstaller/blivet/languages","stargazers_url":"https://api.github.com/repos/rhinstaller/blivet/stargazers","contributors_url":"https://api.github.com/repos/rhinstaller/blivet/contributors","subscribers_url":"https://api.github.com/repos/rhinstaller/blivet/subscribers","subscription_url":"https://api.github.com/repos/rhinstaller/blivet/subscription","commits_url":"https://api.github.com/repos/rhinstaller/blivet/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhinstaller/blivet/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhinstaller/blivet/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhinstaller/blivet/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhinstaller/blivet/contents/{+path}","compare_url":"https://api.github.com/repos/rhinstaller/blivet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhinstaller/blivet/merges","archive_url":"https://api.github.com/repos/rhinstaller/blivet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhinstaller/blivet/downloads","issues_url":"https://api.github.com/repos/rhinstaller/blivet/issues{/number}","pulls_url":"https://api.github.com/repos/rhinstaller/blivet/pulls{/number}","milestones_url":"https://api.github.com/repos/rhinstaller/blivet/milestones{/number}","notifications_url":"https://api.github.com/repos/rhinstaller/blivet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhinstaller/blivet/labels{/name}","releases_url":"https://api.github.com/repos/rhinstaller/blivet/releases{/id}","created_at":"2014-02-06T16:02:44Z","updated_at":"2015-11-11T07:09:49Z","pushed_at":"2015-11-25T13:43:53Z","git_url":"git://github.com/rhinstaller/blivet.git","ssh_url":"git@github.com:rhinstaller/blivet.git","clone_url":"https://github.com/rhinstaller/blivet.git","svn_url":"https://github.com/rhinstaller/blivet","homepage":null,"size":9076,"stargazers_count":20,"watchers_count":20,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":28,"mirror_url":null,"open_issues_count":32,"forks":28,"open_issues":32,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rhinstaller/blivet/pulls/287"},"html":{"href":"https://github.com/rhinstaller/blivet/pull/287"},"issue":{"href":"https://api.github.com/repos/rhinstaller/blivet/issues/287"},"comments":{"href":"https://api.github.com/repos/rhinstaller/blivet/issues/287/comments"},"review_comments":{"href":"https://api.github.com/repos/rhinstaller/blivet/pulls/287/comments"},"review_comment":{"href":"https://api.github.com/repos/rhinstaller/blivet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rhinstaller/blivet/pulls/287/commits"},"statuses":{"href":"https://api.github.com/repos/rhinstaller/blivet/statuses/dc3c456e316af980b8eb242522fd367961be2898"}}}}