summaryrefslogtreecommitdiffstats
path: root/py/mock/plugins
diff options
context:
space:
mode:
authorKalev Lember <kalev@smartlink.ee>2010-07-30 11:51:14 -0500
committerClark Williams <williams@redhat.com>2010-07-30 11:51:14 -0500
commit2eb48d066ec3144b9e564c2d2ad1c445706aa112 (patch)
tree43dcf407f4a22077f684905b688429633992f8ba /py/mock/plugins
parentb3b1ede4f16aa7c20cac8b91f14749a0850a5e29 (diff)
downloadmock-2eb48d066ec3144b9e564c2d2ad1c445706aa112.tar.gz
mock-2eb48d066ec3144b9e564c2d2ad1c445706aa112.tar.xz
mock-2eb48d066ec3144b9e564c2d2ad1c445706aa112.zip
patch that allows specifying max tmpfs size to tmpfs plugin
Add a 'max_fs_size' parameter to the tmpfs plugin that allows specification of sizes greater than default (50% of RAM). Signed-off-by: Clark Williams <williams@redhat.com>
Diffstat (limited to 'py/mock/plugins')
-rw-r--r--py/mock/plugins/tmpfs.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/py/mock/plugins/tmpfs.py b/py/mock/plugins/tmpfs.py
index cf89bc1..1708275 100644
--- a/py/mock/plugins/tmpfs.py
+++ b/py/mock/plugins/tmpfs.py
@@ -33,6 +33,11 @@ class Tmpfs(object):
def __init__(self, rootObj, conf):
self.rootObj = rootObj
self.conf = conf
+ self.maxSize = self.conf['max_fs_size']
+ if self.maxSize:
+ self.optArgs = ['-o', 'size=' + self.maxSize]
+ else:
+ self.optArgs = []
rootObj.addHook("preinit", self._tmpfsPreInitHook)
rootObj.addHook("postbuild", self._tmpfsPostBuildHook)
rootObj.addHook("initfailed", self._tmpfsPostBuildHook)
@@ -40,8 +45,8 @@ class Tmpfs(object):
decorate(traceLog())
def _tmpfsPreInitHook(self):
getLog().info("mounting tmpfs.")
- mountCmd = ["mount", "-n", "-t", "tmpfs", "mock_chroot_tmpfs",
- self.rootObj.makeChrootPath()]
+ mountCmd = ["mount", "-n", "-t", "tmpfs"] + self.optArgs + \
+ ["mock_chroot_tmpfs", self.rootObj.makeChrootPath()]
mock.util.do(mountCmd, shell=False)
decorate(traceLog())