Browse Source

dispvm: set 'memory' to the size reported on savefile generation

That parameter will be used later to request memory from qmemman just
before loading savefile to memory, so it should match the real need.

Do not allow values smaller than 400, to prevent storing some erroneous
values.

Fixes qubesos/qubes-issues#973
Marek Marczykowski-Górecki 9 năm trước cách đây
mục cha
commit
dadcfc334d
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      dispvm/qubes-prepare-saved-domain.sh

+ 9 - 0
dispvm/qubes-prepare-saved-domain.sh

@@ -58,6 +58,15 @@ if ! virsh -c xen:/// save $1 $2; then
 	exit 1
 fi
 rm -f $QMEMMAN_STOP
+# Do not allow smaller allocation than 400MB. If that small number comes from
+# an error, it would prevent further savefile regeneration (because VM would
+# not start with too little memory). Also 'maxmem' depends on 'memory', so
+# 400MB is sane compromise.
+if [ "$MEM" -lt 409600 ]; then
+    qvm-prefs -s $1 memory 400
+else
+    qvm-prefs -s $1 memory $[ $MEM / 1024 ]
+fi
 ln -snf $VMDIR /var/lib/qubes/dvmdata/vmdir
 cd $VMDIR
 bsdtar -cSf saved-cows.tar volatile.img