aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortilpner2018-09-05 11:18:53 +0200
committertilpner2018-09-05 11:18:53 +0200
commit6a075baa477e12979bf312b140bee38694b2971a (patch)
tree8a0cbf005d4497b70ca7c65f22a0a134d5341a83
parent692a6cb95ad770a4f46a540c2b8ba9db372af486 (diff)
downloadqeval-6a075baa477e12979bf312b140bee38694b2971a.tar.gz
qeval-6a075baa477e12979bf312b140bee38694b2971a.tar.xz
qeval-6a075baa477e12979bf312b140bee38694b2971a.zip
Don't always use lz4, might be slower on fast disks
-rw-r--r--default.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/default.nix b/default.nix
index 3966c2c..790bd36 100644
--- a/default.nix
+++ b/default.nix
@@ -377,6 +377,17 @@ in rec {
qemuDriveOptions = lib.concatMapStringsSep " " (d: "-drive if=virtio,readonly,format=raw,file=${d}");
+ suspensionUseCompression = true;
+ suspensionWriteCommand =
+ if suspensionUseCompression
+ then "${lz4}/bin/lz4 -9 --favor-decSpeed -"
+ else "cat >";
+
+ suspensionReadCommand =
+ if suspensionUseCompression
+ then "${lz4}/bin/lz4 -d --favor-decSpeed"
+ else "cat ";
+
run = args@{ name, fullPath, initrdPath, storeDrives, mem, desc, ... }: writeShellScriptBin "run-qemu" ''
# ${name}
# needs ''${concatStringsSep ", " fullPath}
@@ -396,7 +407,7 @@ in rec {
${qemu}/bin/qemu-system-x86_64 \
${commonQemuOptions}
${qemuDriveOptions (builtins.attrValues storeDrives)} \
- -incoming 'exec:${lz4}/bin/lz4 -d ${suspension args}' | ${dos2unix}/bin/dos2unix -f | head -c 1M
+ -incoming 'exec:${suspensionReadCommand} ${suspension args}' | ${dos2unix}/bin/dos2unix -f | head -c 1M
# ^ qemu incorrectly does crlf conversion, check in the future if still necessary
'' // args;
@@ -416,7 +427,7 @@ in rec {
( read ready < job/control
echo '{ "execute": "qmp_capabilities" }'
- echo '{ "execute": "migrate", "arguments": { "uri": "exec:lz4 -9 - '$out'" } }'
+ echo '{ "execute": "migrate", "arguments": { "uri": "exec:${suspensionWriteCommand} '$out'" } }'
sleep 15 # FIXME
echo '{ "execute": "quit" }'
) | ${netcat}/bin/nc -lU job/qmp &