Use the qemu-kvm wrapper
This commit is contained in:
parent
7a32f2d15a
commit
57c35c94ca
|
@ -30,7 +30,7 @@ sub new {
|
|||
if (!$startCommand) {
|
||||
# !!! merge with qemu-vm.nix.
|
||||
$startCommand =
|
||||
"$ENV{'qemu'} -enable-kvm -m 384 " .
|
||||
"qemu-kvm -m 384 " .
|
||||
"-net nic,model=virtio \$QEMU_OPTS ";
|
||||
my $iface = $args->{hdaInterface} || "virtio";
|
||||
$startCommand .= "-drive file=" . Cwd::abs_path($args->{hda}) . ",if=$iface,boot=on,werror=report "
|
||||
|
|
|
@ -27,9 +27,8 @@ rec {
|
|||
cp ${./test-driver/Logger.pm} $libDir/Logger.pm
|
||||
|
||||
wrapProgram $out/bin/nixos-test-driver \
|
||||
--prefix PATH : "${pkgs.qemu}/bin:${pkgs.vde2}/bin:${imagemagick}/bin:${coreutils}/bin" \
|
||||
--prefix PERL5LIB : "${lib.makePerlPath [ perlPackages.TermReadLineGnu perlPackages.XMLWriter perlPackages.IOTty ]}:$out/lib/perl5/site_perl" \
|
||||
--set qemu qemu-system-${if pkgs.stdenv.system == "x86_64-linux" then "x86_64" else "i386"}
|
||||
--prefix PATH : "${pkgs.qemu_kvm}/bin:${pkgs.vde2}/bin:${imagemagick}/bin:${coreutils}/bin" \
|
||||
--prefix PERL5LIB : "${lib.makePerlPath [ perlPackages.TermReadLineGnu perlPackages.XMLWriter perlPackages.IOTty ]}:$out/lib/perl5/site_perl"
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ with pkgs.lib;
|
|||
''
|
||||
mkdir $out
|
||||
diskImage=$out/nixos.img
|
||||
${pkgs.vmTools.kvm}/bin/qemu-img create -f raw $diskImage "4G"
|
||||
${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "4G"
|
||||
mv closure xchg/
|
||||
'';
|
||||
buildInputs = [ pkgs.utillinux pkgs.perl ];
|
||||
|
|
|
@ -12,7 +12,7 @@ with pkgs.lib;
|
|||
''
|
||||
mkdir $out
|
||||
diskImage=$out/image
|
||||
${pkgs.vmTools.kvm}/bin/qemu-img create -f raw $diskImage "4G"
|
||||
${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "4G"
|
||||
mv closure xchg/
|
||||
'';
|
||||
buildInputs = [ pkgs.utillinux pkgs.perl ];
|
||||
|
|
4
modules/virtualisation/qemu-opts
Normal file
4
modules/virtualisation/qemu-opts
Normal file
|
@ -0,0 +1,4 @@
|
|||
-device virtio-serial \
|
||||
-chardev socket,id=charconsole0,path=/tmp/nixos-socket,server,nowait \
|
||||
#-device virtconsole,chardev=charconsole0,id=console0 \
|
||||
-device virtserialport,chardev=chardev=charconsole0,id=serial0
|
|
@ -158,7 +158,7 @@ let
|
|||
NIX_DISK_IMAGE=$(readlink -f ''${NIX_DISK_IMAGE:-${config.virtualisation.diskImage}})
|
||||
|
||||
if ! test -e "$NIX_DISK_IMAGE"; then
|
||||
${pkgs.qemu}/bin/qemu-img create -f qcow2 "$NIX_DISK_IMAGE" \
|
||||
${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 "$NIX_DISK_IMAGE" \
|
||||
${toString config.virtualisation.diskSize}M || exit 1
|
||||
fi
|
||||
|
||||
|
@ -172,15 +172,14 @@ let
|
|||
idx=2
|
||||
extraDisks=""
|
||||
${flip concatMapStrings cfg.emptyDiskImages (size: ''
|
||||
${pkgs.qemu}/bin/qemu-img create -f raw "empty$idx" "${toString size}M"
|
||||
${pkgs.qemu_kvm}/bin/qemu-img create -f raw "empty$idx" "${toString size}M"
|
||||
extraDisks="$extraDisks -drive index=$idx,file=$(pwd)/empty$idx,if=virtio,werror=report"
|
||||
idx=$((idx + 1))
|
||||
'')}
|
||||
|
||||
# Start QEMU.
|
||||
# "-boot menu=on" is there, because I don't know how to make qemu boot from 2nd hd.
|
||||
exec ${pkgs.qemu}/bin/qemu-system-${if pkgs.stdenv.system == "x86_64-linux" then "x86_64" else "i386"} \
|
||||
-enable-kvm \
|
||||
exec ${pkgs.qemu_kvm}/bin/qemu-kvm \
|
||||
-name ${vmName} \
|
||||
-m ${toString config.virtualisation.memorySize} \
|
||||
${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} \
|
||||
|
@ -226,7 +225,7 @@ let
|
|||
''
|
||||
mkdir $out
|
||||
diskImage=$out/disk.img
|
||||
${pkgs.qemu}/bin/qemu-img create -f qcow2 $diskImage "32M"
|
||||
${pkgs.qemu_kvm}/bin/qemu-img create -f qcow2 $diskImage "32M"
|
||||
'';
|
||||
buildInputs = [ pkgs.utillinux ];
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@ with pkgs.lib;
|
|||
''
|
||||
mkdir $out
|
||||
diskImage=$out/image
|
||||
${pkgs.vmTools.kvm}/bin/qemu-img create -f raw $diskImage "10G"
|
||||
${pkgs.vmTools.qemu}/bin/qemu-img create -f raw $diskImage "10G"
|
||||
mv closure xchg/
|
||||
'';
|
||||
postVM =
|
||||
''
|
||||
${pkgs.vmTools.kvm}/bin/qemu-img convert -f raw -O vdi $diskImage $out/disk.vdi
|
||||
${pkgs.vmTools.qemu}/bin/qemu-img convert -f raw -O vdi $diskImage $out/disk.vdi
|
||||
rm $diskImage
|
||||
'';
|
||||
buildInputs = [ pkgs.utillinux pkgs.perl ];
|
||||
|
|
Loading…
Reference in a new issue