nixos/qemu-vm: fix running VM with QEMU_NET_OPTS
I realized quite recently that running a test VM - as documented in the
manual - like
QEMU_NET_OPTS='hostfwd=tcp::8080-:80' ./result/bin/nixos-run-vms
doesn't work anymore on `master`. After bisecting I realized that the
introduction of a forward-port option[1] is the problem since it adds a
trailing comma even if no forwarding options are specified via
`virtualisation.forwardPorts`. In that case, the networking options
would look like `-netdev user,id=user.0,,hostfwd=tcp::8080-:80' which
confused QEMU and thus the VM refused to start.
Now, the trailing comma is only added if additional port forwards are
specified declaratively.
[1] b8bfc81d5b
This commit is contained in:
parent
1c1b567985
commit
60e731d1ce
|
@ -780,7 +780,7 @@ in
|
|||
in
|
||||
[
|
||||
"-net nic,netdev=user.0,model=virtio"
|
||||
"-netdev user,id=user.0,${forwardingOptions}\${QEMU_NET_OPTS:+,$QEMU_NET_OPTS}"
|
||||
"-netdev user,id=user.0,${forwardingOptions}$QEMU_NET_OPTS"
|
||||
];
|
||||
|
||||
# FIXME: Consolidate this one day.
|
||||
|
|
Loading…
Reference in New Issue
Block a user