vm: Disable QEMU networking in the disk image initrd.

* gnu/system/linux-initrd.scm (qemu-initrd): Add #:qemu-networking?
  parameter and honor it.
* gnu/system/vm.scm (system-disk-image): Pass #:qemu-networking #f.
This commit is contained in:
Ludovic Courtès 2014-05-23 22:35:08 +02:00
parent a68d976b66
commit 112440a7b8
2 changed files with 10 additions and 2 deletions

View File

@ -204,12 +204,16 @@ initrd code."
(define* (qemu-initrd file-systems (define* (qemu-initrd file-systems
#:key #:key
guile-modules-in-chroot? guile-modules-in-chroot?
(qemu-networking? #t)
volatile-root?) volatile-root?)
"Return a monadic derivation that builds an initrd for use in a QEMU guest "Return a monadic derivation that builds an initrd for use in a QEMU guest
where the store is shared with the host. FILE-SYSTEMS is a list of where the store is shared with the host. FILE-SYSTEMS is a list of
file-systems to be mounted by the initrd, possibly in addition to the root file-systems to be mounted by the initrd, possibly in addition to the root
file system specified on the kernel command line via '--root'. file system specified on the kernel command line via '--root'.
When QEMU-NETWORKING? is true, set up networking with the standard QEMU
parameters.
When VOLATILE-ROOT? is true, the root file system is writable but any changes When VOLATILE-ROOT? is true, the root file system is writable but any changes
to it are lost. to it are lost.
@ -267,7 +271,7 @@ exception and backtrace!)."
(boot-system #:mounts '#$(map file-system->spec file-systems) (boot-system #:mounts '#$(map file-system->spec file-systems)
#:linux-modules '#$linux-modules #:linux-modules '#$linux-modules
#:qemu-guest-networking? #t #:qemu-guest-networking? #$qemu-networking?
#:guile-modules-in-chroot? '#$guile-modules-in-chroot? #:guile-modules-in-chroot? '#$guile-modules-in-chroot?
#:volatile-root? '#$volatile-root?)) #:volatile-root? '#$volatile-root?))
#:name "qemu-initrd" #:name "qemu-initrd"

View File

@ -271,7 +271,11 @@ to USB sticks meant to be read-only."
(operating-system-file-systems os))) (operating-system-file-systems os)))
(let ((os (operating-system (inherit os) (let ((os (operating-system (inherit os)
(initrd (cut qemu-initrd <> #:volatile-root? volatile?)) ;; Since this is meant to be used on real hardware, don't set up
;; QEMU networking.
(initrd (cut qemu-initrd <>
#:volatile-root? volatile?
#:qemu-networking? #f))
;; Force our own root file system. ;; Force our own root file system.
(file-systems (cons (file-system (file-systems (cons (file-system