From 7d1b7b4cc8dcf80796fe56b3bf2c835bc6678f4d Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 23 Sep 2011 17:34:55 -0700 Subject: [PATCH] Allow a None to be passed as size to create_runtime This is so that imgutils.mkext4img can dynamically calculate the size of the image. --- src/pylorax/treebuilder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py index 493ea764..8f4d2393 100644 --- a/src/pylorax/treebuilder.py +++ b/src/pylorax/treebuilder.py @@ -130,7 +130,10 @@ class RuntimeBuilder(object): def create_runtime(self, outfile="/tmp/squashfs.img", compression="xz", compressargs=[], size=2): # make live rootfs image - must be named "LiveOS/rootfs.img" for dracut workdir = joinpaths(os.path.dirname(outfile), "runtime-workdir") - fssize = size * (1024*1024*1024) # 2GB sparse file compresses down to nothin' + if size: + fssize = size * (1024*1024*1024) # 2GB sparse file compresses down to nothin' + else: + fssize = None # Let mkext4img figure out the needed size os.makedirs(joinpaths(workdir, "LiveOS")) imgutils.mkext4img(self.vars.root, joinpaths(workdir, "LiveOS/rootfs.img"), label="Anaconda", size=fssize)