Pino Toscano
2015-Dec-04 10:03 UTC
[Libguestfs] [PATCH] builder: create temporary images in the cachedir (RHBZ#1288201)
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
Richard W.M. Jones
2015-Dec-04 10:05 UTC
Re: [Libguestfs] [PATCH] builder: create temporary images in the cachedir (RHBZ#1288201)
On Fri, Dec 04, 2015 at 11:03:48AM +0100, Pino Toscano wrote:> 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 onlyACK - thanks for fixing. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Maybe Matching Threads
- [PATCH] builder: Remove duplicate planner transition.
- [PATCH v2 2/2] builder: Choose better weights in the planner.
- [PATCH 5/5] mllib: add a new run_command helper
- [PATCH v3 0/2] builder: Choose better weights in the planner.
- [PATCH 0/2] builder: Choose better weights in the planner.