qemu module: add virtualisation.cores option

QEMU can allow guests to access more than one host core at a time.
Previously, this had to be done via ad-hoc arguments:

    virtualisation.qemu.options = ["-smp 12"];

Now you can simply specify:

    virtualisation.cores = 12;
This commit is contained in:
Graham Christensen 2017-04-10 10:50:05 -04:00
parent 91ad6b3597
commit 4585fdb9d4
No known key found for this signature in database
GPG Key ID: ACA1C1D120C83D5C

View File

@ -75,6 +75,7 @@ let
exec ${qemu}/bin/qemu-kvm \
-name ${vmName} \
-m ${toString config.virtualisation.memorySize} \
-smp ${toString config.virtualisation.cores} \
${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} \
${concatStringsSep " " config.virtualisation.qemu.networkingOptions} \
-virtfs local,path=/nix/store,security_model=none,mount_tag=store \
@ -244,6 +245,18 @@ in
'';
};
virtualisation.cores =
mkOption {
default = 1;
type = types.int;
description =
''
Specify the number of cores the guest is permitted to use.
The number can be higher than the available cores on the
host system.
'';
};
virtualisation.pathsInNixDB =
mkOption {
default = [];