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
This commit is contained in:
Marek Marczykowski-Górecki 2015-05-15 02:41:18 +02:00
parent 2856b6a836
commit dadcfc334d

View File

@ -58,6 +58,15 @@ if ! virsh -c xen:/// save $1 $2; then
exit 1 exit 1
fi fi
rm -f $QMEMMAN_STOP 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 ln -snf $VMDIR /var/lib/qubes/dvmdata/vmdir
cd $VMDIR cd $VMDIR
bsdtar -cSf saved-cows.tar volatile.img bsdtar -cSf saved-cows.tar volatile.img