me
/
guix
Archived
1
0
Fork 0

gnu: Remove uses of deprecated Qemu network configuration.

* gnu/build/vm.scm (load-in-linux-vm): Move Qemu network configuration from
ARCH-SPECIFIC-FLAGS to the Qemu command line.  Use the "-nic" option of Qemu
instead of "-device" and "-net".
* gnu/system/vm.scm (common-qemu-options): Do not add a '-net' command.
(virtual-machine-compiler): Use "-nic user,..." instead of "-net".
* doc/guix.texi (Installing Guix in a VM, Invoking guix system, Running Guix
in a VM): Do the same for examples.
master
Marius Bakke 2019-12-06 20:53:08 +01:00
parent 7ebf4c40f1
commit 8e53fe2b91
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
3 changed files with 17 additions and 26 deletions

View File

@ -46,7 +46,7 @@ Copyright @copyright{} 2017, 2018 Carlo Zancanaro@*
Copyright @copyright{} 2017 Thomas Danckaert@* Copyright @copyright{} 2017 Thomas Danckaert@*
Copyright @copyright{} 2017 humanitiesNerd@* Copyright @copyright{} 2017 humanitiesNerd@*
Copyright @copyright{} 2017 Christopher Allan Webber@* Copyright @copyright{} 2017 Christopher Allan Webber@*
Copyright @copyright{} 2017, 2018 Marius Bakke@* Copyright @copyright{} 2017, 2018, 2019 Marius Bakke@*
Copyright @copyright{} 2017, 2019 Hartmut Goebel@* Copyright @copyright{} 2017, 2019 Hartmut Goebel@*
Copyright @copyright{} 2017, 2019 Maxim Cournoyer@* Copyright @copyright{} 2017, 2019 Maxim Cournoyer@*
Copyright @copyright{} 2017, 2018, 2019 Tobias Geerinckx-Rice@* Copyright @copyright{} 2017, 2018, 2019 Tobias Geerinckx-Rice@*
@ -2472,7 +2472,7 @@ Boot the USB installation image in an VM:
@example @example
qemu-system-x86_64 -m 1024 -smp 1 -enable-kvm \ qemu-system-x86_64 -m 1024 -smp 1 -enable-kvm \
-net user -net nic,model=virtio -boot menu=on,order=d \ -nic user,model=virtio-net-pci -boot menu=on,order=d \
-drive file=guix-system.img \ -drive file=guix-system.img \
-drive media=cdrom,file=guix-system-install-@value{VERSION}.@var{system}.iso -drive media=cdrom,file=guix-system-install-@value{VERSION}.@var{system}.iso
@end example @end example
@ -26156,7 +26156,7 @@ below, which enables networking and requests 1@tie{}GiB of RAM for the
emulated machine: emulated machine:
@example @example
$ /gnu/store/@dots{}-run-vm.sh -m 1024 -net user $ /gnu/store/@dots{}-run-vm.sh -m 1024 -smp 2 -net user,model=virtio-net-pci
@end example @end example
The VM shares its store with the host system. The VM shares its store with the host system.
@ -26642,7 +26642,7 @@ vm-image} on x86_64 hardware:
@example @example
$ qemu-system-x86_64 \ $ qemu-system-x86_64 \
-net user -net nic,model=virtio \ -nic user,model=virtio-net-pci \
-enable-kvm -m 1024 \ -enable-kvm -m 1024 \
-device virtio-blk,drive=myhd \ -device virtio-blk,drive=myhd \
-drive if=none,file=/tmp/qemu-image,id=myhd -drive if=none,file=/tmp/qemu-image,id=myhd
@ -26655,16 +26655,14 @@ Here is what each of these options means:
This specifies the hardware platform to emulate. This should match the This specifies the hardware platform to emulate. This should match the
host. host.
@item -net user @item -nic user,model=virtio-net-pci
Enable the unprivileged user-mode network stack. The guest OS can Enable the unprivileged user-mode network stack. The guest OS can
access the host but not vice versa. This is the simplest way to get the access the host but not vice versa. This is the simplest way to get the
guest OS online. guest OS online. @code{model} specifies which network device to emulate:
@code{virtio-net-pci} is a special device made for virtualized operating
@item -net nic,model=virtio systems and recommended for most uses. Assuming your hardware platform is
You must create a network interface of a given model. If you do not
create a NIC, the boot will fail. Assuming your hardware platform is
x86_64, you can get a list of available NIC models by running x86_64, you can get a list of available NIC models by running
@command{qemu-system-x86_64 -net nic,model=help}. @command{qemu-system-x86_64 -nic model=help}.
@item -enable-kvm @item -enable-kvm
If your system has hardware virtualization extensions, enabling the If your system has hardware virtualization extensions, enabling the
@ -26688,11 +26686,11 @@ the ``myhd'' drive.
@end table @end table
The default @command{run-vm.sh} script that is returned by an invocation of The default @command{run-vm.sh} script that is returned by an invocation of
@command{guix system vm} does not add a @command{-net user} flag by default. @command{guix system vm} does not add a @command{-nic user} flag by default.
To get network access from within the vm add the @code{(dhcp-client-service)} To get network access from within the vm add the @code{(dhcp-client-service)}
to your system definition and start the VM using to your system definition and start the VM using
@command{`guix system vm config.scm` -net user}. An important caveat of using @command{`guix system vm config.scm` -nic user}. An important caveat of using
@command{-net user} for networking is that @command{ping} will not work, because @command{-nic user} for networking is that @command{ping} will not work, because
it uses the ICMP protocol. You'll have to use a different command to check for it uses the ICMP protocol. You'll have to use a different command to check for
network connectivity, for example @command{guix download}. network connectivity, for example @command{guix download}.
@ -26706,7 +26704,7 @@ To enable SSH inside a VM you need to add an SSH server like
22 by default, to the host. You can do this with 22 by default, to the host. You can do this with
@example @example
`guix system vm config.scm` -net user,hostfwd=tcp::10022-:22 `guix system vm config.scm` -nic user,model=virtio-net-pci,hostfwd=tcp::10022-:22
@end example @end example
To connect to the VM you can run To connect to the VM you can run

View File

@ -131,14 +131,7 @@ the #:references-graphs parameter of 'derivation'."
;; The serial port name differs between emulated ;; The serial port name differs between emulated
;; architectures/machines. ;; architectures/machines.
" console=" " console="
(if target-arm? "ttyAMA0" "ttyS0")) (if target-arm? "ttyAMA0" "ttyS0"))))
;; NIC is not supported on ARM "virt" machine, so use a user mode
;; network stack instead.
,@(if target-arm?
'("-device" "virtio-net-pci,netdev=mynet"
"-netdev" "user,id=mynet")
'("-net" "nic,model=virtio"))))
(when make-disk-image? (when make-disk-image?
(format #t "creating ~a image of ~,2f MiB...~%" (format #t "creating ~a image of ~,2f MiB...~%"
@ -163,6 +156,7 @@ the #:references-graphs parameter of 'derivation'."
;; CPU with the maximum possible feature set otherwise. ;; CPU with the maximum possible feature set otherwise.
"-cpu" "max" "-cpu" "max"
"-m" (number->string memory-size) "-m" (number->string memory-size)
"-nic" "user,model=virtio-net-pci"
"-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng" "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng"
"-device" "virtio-rng-pci,rng=guixsd-vm-rng" "-device" "virtio-rng-pci,rng=guixsd-vm-rng"
"-virtfs" "-virtfs"

View File

@ -927,7 +927,6 @@ with '-virtfs' options for the host file systems listed in SHARED-FS."
'()) '())
"-no-reboot" "-no-reboot"
"-net nic,model=virtio"
"-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng" "-object" "rng-random,filename=/dev/urandom,id=guixsd-vm-rng"
"-device" "virtio-rng-pci,rng=guixsd-vm-rng" "-device" "virtio-rng-pci,rng=guixsd-vm-rng"
@ -1046,8 +1045,8 @@ FORWARDINGS is a list of host-port/guest-port pairs."
(($ <virtual-machine> os qemu graphic? memory-size disk-image-size (($ <virtual-machine> os qemu graphic? memory-size disk-image-size
forwardings) forwardings)
(let ((options (let ((options
`("-net" ,(string-append `("-nic" ,(string-append
"user," "user,model=virtio-net-pci,"
(port-forwardings->qemu-options forwardings))))) (port-forwardings->qemu-options forwardings)))))
(system-qemu-image/shared-store-script os (system-qemu-image/shared-store-script os
#:qemu qemu #:qemu qemu