[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/03: vm: Avoid needless file copy in 'load-in-linux-vm'.
From: |
Ludovic Courtès |
Subject: |
03/03: vm: Avoid needless file copy in 'load-in-linux-vm'. |
Date: |
Mon, 28 Nov 2016 21:59:17 +0000 (UTC) |
civodul pushed a commit to branch master
in repository guix.
commit d2bcf35e1805b06fb575352531d9c439425dc379
Author: Ludovic Courtès <address@hidden>
Date: Mon Nov 28 22:56:41 2016 +0100
vm: Avoid needless file copy in 'load-in-linux-vm'.
Reported by Chris Webber.
* gnu/build/vm.scm (load-in-linux-vm)[image-file]: Remove. Directly
refer to OUTPUT instead.
---
gnu/build/vm.scm | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index cc5cf45..60ee18e 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -79,12 +79,9 @@ it via /dev/hda.
REFERENCES-GRAPHS can specify a list of reference-graph files as produced by
the #:references-graphs parameter of 'derivation'."
- (define image-file
- (string-append "image." disk-image-format))
-
(when make-disk-image?
(unless (zero? (system* "qemu-img" "create" "-f" disk-image-format
- image-file
+ output
(number->string disk-image-size)))
(error "qemu-img failed")))
@@ -115,7 +112,7 @@ the #:references-graphs parameter of 'derivation'."
builder)
(append
(if make-disk-image?
- `("-drive" ,(string-append "file=" image-file
+ `("-drive" ,(string-append "file=" output
",if=virtio"))
'())
;; Only enable kvm if we see /dev/kvm exists.
@@ -126,11 +123,10 @@ the #:references-graphs parameter of 'derivation'."
'()))))
(error "qemu failed" qemu))
- (if make-disk-image?
- (copy-file image-file output)
- (begin
- (mkdir output)
- (copy-recursively "xchg" output))))
+ ;; When MAKE-DISK-IMAGE? is true, the image is in OUTPUT already.
+ (unless make-disk-image?
+ (mkdir output)
+ (copy-recursively "xchg" output)))
;;;