summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalev Lember <kalev@smartlink.ee>2010-07-30 11:51:14 -0500
committerClark Williams <williams@redhat.com>2010-07-31 14:17:44 -0500
commitef1a8749b9ca89546ff9384137c1b5ef91adcdbb (patch)
tree1c8473a9a6529558827ef9573d08f0700825dd43
parent6e1581655be49c03856e5640bb011e38fa3fbb50 (diff)
downloadmock-ef1a8749b9ca89546ff9384137c1b5ef91adcdbb.tar.gz
mock-ef1a8749b9ca89546ff9384137c1b5ef91adcdbb.tar.xz
mock-ef1a8749b9ca89546ff9384137c1b5ef91adcdbb.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>
-rw-r--r--etc/mock/site-defaults.cfg3
-rwxr-xr-xpy/mock.py4
-rw-r--r--py/mock/plugins/tmpfs.py9
3 files changed, 12 insertions, 4 deletions
diff --git a/etc/mock/site-defaults.cfg b/etc/mock/site-defaults.cfg
index 6297cef..496f70d 100644
--- a/etc/mock/site-defaults.cfg
+++ b/etc/mock/site-defaults.cfg
@@ -70,7 +70,8 @@
# config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/host/path', '/bind/mount/path/in/chroot/' ))
#
# config_opts['plugin_conf']['tmpfs_enable'] = False
-# config_opts['plugin_conf']['tmpfs_opts'] = {'required_ram_mb': 1024}
+# config_opts['plugin_conf']['tmpfs_opts']['required_ram_mb'] = 1024
+# config_opts['plugin_conf']['tmpfs_opts']['max_fs_size'] = '512m'
#############################################################################
#
diff --git a/py/mock.py b/py/mock.py
index 5400d21..62d0d1f 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -269,7 +269,9 @@ def setup_default_config_opts(config_opts, unprivUid):
# ('/another/host/path', '/another/bind/mount/path/in/chroot/'),
]},
'tmpfs_enable': False,
- 'tmpfs_opts': {'required_ram_mb': 900},
+ 'tmpfs_opts': {
+ 'required_ram_mb': 900,
+ 'max_fs_size': None},
}
# dependent on guest OS
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())