me
/
guix
Archived
1
0
Fork 0

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.
master
Ludovic Courtès 2016-11-28 22:56:41 +01:00
parent c062b1eb6c
commit d2bcf35e18
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 6 additions and 10 deletions

View File

@ -79,12 +79,9 @@ it via /dev/hda.
REFERENCES-GRAPHS can specify a list of reference-graph files as produced by REFERENCES-GRAPHS can specify a list of reference-graph files as produced by
the #:references-graphs parameter of 'derivation'." the #:references-graphs parameter of 'derivation'."
(define image-file
(string-append "image." disk-image-format))
(when make-disk-image? (when make-disk-image?
(unless (zero? (system* "qemu-img" "create" "-f" disk-image-format (unless (zero? (system* "qemu-img" "create" "-f" disk-image-format
image-file output
(number->string disk-image-size))) (number->string disk-image-size)))
(error "qemu-img failed"))) (error "qemu-img failed")))
@ -115,7 +112,7 @@ the #:references-graphs parameter of 'derivation'."
builder) builder)
(append (append
(if make-disk-image? (if make-disk-image?
`("-drive" ,(string-append "file=" image-file `("-drive" ,(string-append "file=" output
",if=virtio")) ",if=virtio"))
'()) '())
;; Only enable kvm if we see /dev/kvm exists. ;; Only enable kvm if we see /dev/kvm exists.
@ -126,11 +123,10 @@ the #:references-graphs parameter of 'derivation'."
'())))) '()))))
(error "qemu failed" qemu)) (error "qemu failed" qemu))
(if make-disk-image? ;; When MAKE-DISK-IMAGE? is true, the image is in OUTPUT already.
(copy-file image-file output) (unless make-disk-image?
(begin
(mkdir output) (mkdir output)
(copy-recursively "xchg" output)))) (copy-recursively "xchg" output)))
;;; ;;;