소스 검색

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 년 전
부모
커밋
dadcfc334d
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  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