* Allow more complex network topologies in distributed tests. Each
machine can now declare an option `virtualisation.vlans' that causes
it to have network interfaces connected to each listed virtual
network. For instance,
virtualisation.vlans = [ 1 2 ];
causes the machine to have two interfaces (in addition to eth0, used
by the test driver to control the machine): eth1 connected to
network 1 with IP address 192.168.1.<i>, and eth2 connected to
network 2 with address 192.168.2.<i> (where <i> is the index of the
machine in the `nodes' attribute set). On the other hand,
virtualisation.vlans = [ 2 ];
causes the machine to only have an eth1 connected to network 2 with
address 192.168.2.<i>. So each virtual network <n> is assigned the
IP range 192.168.<n>.0/24.
Each virtual network is implemented using a separate multicast
address on the host, so guests really cannot talk to networks to
which they are not connected.
* Added a simple NAT test to demonstrate this.
* Added an option `virtualisation.qemu.options' to specify QEMU
command-line options. Used to factor out some commonality between
the test driver script and the interactive test script.
svn path=/nixos/trunk/; revision=21928
This commit is contained in:
@@ -68,6 +68,37 @@ let
|
||||
database in the guest).
|
||||
'';
|
||||
};
|
||||
|
||||
virtualisation.vlans =
|
||||
mkOption {
|
||||
default = [ 1 ];
|
||||
example = [ 1 2 ];
|
||||
description =
|
||||
''
|
||||
Virtual networks to which the VM is connected. Each
|
||||
number <replaceable>N</replaceable> in this list causes
|
||||
the VM to have a virtual Ethernet interface attached to a
|
||||
separate virtual network on which it will be assigned IP
|
||||
address
|
||||
<literal>192.168.<replaceable>N</replaceable>.<replaceable>M</replaceable></literal>,
|
||||
where <replaceable>M</replaceable> is the index of this VM
|
||||
in the list of VMs.
|
||||
'';
|
||||
};
|
||||
|
||||
networking.primaryIPAddress =
|
||||
mkOption {
|
||||
default = "";
|
||||
internal = true;
|
||||
description = "Primary IP address used in /etc/hosts.";
|
||||
};
|
||||
|
||||
virtualisation.qemu.options =
|
||||
mkOption {
|
||||
default = "";
|
||||
example = "-vga std";
|
||||
description = "Options passed to QEMU.";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -94,13 +125,14 @@ let
|
||||
# hanging the VM on x86_64.
|
||||
exec ${pkgs.qemu_kvm}/bin/qemu-system-x86_64 -m ${toString config.virtualisation.memorySize} \
|
||||
-no-kvm-irqchip \
|
||||
-net nic,model=virtio -net user -smb / \
|
||||
-net nic,vlan=0,model=virtio -net user,vlan=0 -smb / \
|
||||
-drive file=$NIX_DISK_IMAGE,if=virtio,boot=on,werror=report \
|
||||
-kernel ${config.system.build.toplevel}/kernel \
|
||||
-initrd ${config.system.build.toplevel}/initrd \
|
||||
${qemuGraphics} \
|
||||
$QEMU_OPTS \
|
||||
-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.bootStage2} systemConfig=${config.system.build.toplevel} regInfo=${regInfo} ${kernelConsole} $QEMU_KERNEL_PARAMS"
|
||||
-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.bootStage2} systemConfig=${config.system.build.toplevel} regInfo=${regInfo} ${kernelConsole} $QEMU_KERNEL_PARAMS" \
|
||||
${config.virtualisation.qemu.options}
|
||||
'';
|
||||
|
||||
|
||||
@@ -186,7 +218,7 @@ in
|
||||
# host filesystem and thus deadlocks the system.
|
||||
networking.useDHCP = false;
|
||||
|
||||
networking.defaultGateway = "10.0.2.2";
|
||||
networking.defaultGateway = mkOverride 200 {} "10.0.2.2";
|
||||
|
||||
networking.nameservers = [ "10.0.2.3" ];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user