dom0/spec: fix HVM settings on upgrade

HVM should have meminfo-writer disabled by default (and now have). But existing
VMs have it already enabled so it must be fixed now. Generic HVM isn't capable
of dynamic memory management.

Previously it was forced to always have maxmem=memory but it wasn't fully
correct because someone could install Qubes agents/PV drivers including
meminfo-writer and xen-balloon even in HVM so it should be possible to turn it.
This commit is contained in:
Marek Marczykowski 2013-01-11 04:35:56 +01:00
parent 214461f448
commit 4b44f977db

View File

@ -291,6 +291,25 @@ fi
mkdir -p /var/lib/qubes/removed-udev-scripts
mv -f /lib/udev/rules.d/69-xorg-vmmouse.rules /var/lib/qubes/removed-udev-scripts/ 2> /dev/null || :
if [ "$1" -gt 1 ] ; then
# upgrade
# Fix HVM setting - meminfo-writer was erroneously enabled by default
cat << __EOF__ | python
from qubes.qubes import QubesVmCollection
qc = QubesVmCollection ()
qc.lock_db_for_writing ()
qc.load ()
for vm in qc.values():
if vm.type == "HVM" and vm.memory == vm.maxmem:
vm.services['meminfo-writer'] = False
qc.save()
qc.unlock_db ()
exit()
__EOF__
fi
%clean
rm -rf $RPM_BUILD_ROOT
rm -f %{name}-%{version}