本文整理汇总了Python中kiwi.defaults.Defaults.get_default_inode_size方法的典型用法代码示例。如果您正苦于以下问题:Python Defaults.get_default_inode_size方法的具体用法?Python Defaults.get_default_inode_size怎么用?Python Defaults.get_default_inode_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.defaults.Defaults
的用法示例。
在下文中一共展示了Defaults.get_default_inode_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: customize
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_default_inode_size [as 别名]
def customize(self, size, requested_filesystem):
"""
Increase the sum of all file sizes by an empiric factor
Each filesystem has some overhead it needs to manage itself.
Thus the plain data size is always smaller as the size of
the container which embeds it. This method increases the
given size by a filesystem specific empiric factor to
ensure the given data size can be stored in a filesystem
of the customized size
:param int size: mbsize to update
:param str requested_filesystem: filesystem name
:return: mbytes
:rtype: int
"""
if requested_filesystem:
if requested_filesystem.startswith('ext'):
size *= 1.5
file_count = self.accumulate_files()
inode_mbytes = \
file_count * Defaults.get_default_inode_size() / 1048576
size += 2 * inode_mbytes
elif requested_filesystem == 'btrfs':
size *= 1.5
elif requested_filesystem == 'xfs':
size *= 1.5
return int(size)