[Libguestfs] [PATCH] builder: create temporary images in the cachedir (RHBZ#1288201)

Pino Toscano ptoscano at redhat.com
Fri Dec 4 10:03:48 UTC 2015


Temporary images can be quite big, more than the space available in
$TMPDIR when it's on a tmpfs; hence, place them in our cachedir
instead.
---
 builder/builder.ml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/builder/builder.ml b/builder/builder.ml
index 957bc37..3750e5f 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -378,6 +378,8 @@ let main () =
 
     goal_must, goal_must_not in
 
+  let cache_dir = (open_guestfs ())#get_cachedir () in
+
   (* Planner: Transitions. *)
   let transitions itags =
     let is t = List.mem_assoc t itags in
@@ -394,7 +396,7 @@ let main () =
     (* Since the final plan won't run in parallel, we don't only need
      * to choose unique tempfiles per transition, so this is OK:
      *)
-    let tempfile = Filename.temp_file "vb" ".img" in
+    let tempfile = Filename.temp_file ~temp_dir:cache_dir "vb" ".img" in
     unlink_on_exit tempfile;
 
     (* Always possible to copy from one place to another.  The only
-- 
2.1.0




More information about the Libguestfs mailing list