Fix script for DispVM cleanup

Cleanup DispVMs after non-clean shutdown

Fixes QubesOS/qubes-issues#3037
This commit is contained in:
Marek Marczykowski-Górecki 2017-12-05 03:59:34 +01:00
parent 4d6bfbab4d
commit e209e448f2
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1,16 +1,12 @@
#!/usr/bin/python
from qubes.qubes import QubesVmCollection
from qubesadmin import Qubes
def main():
qvm_collection = QubesVmCollection()
qvm_collection.lock_db_for_writing()
qvm_collection.load()
for vm in qvm_collection.values():
if vm.is_disposablevm() and not vm.is_running():
qvm_collection.pop(vm.qid)
qvm_collection.save()
qvm_collection.unlock_db()
app = Qubes()
for vm in app.domains:
if vm.klass == 'DispVM' and not vm.is_running():
if vm.auto_cleanup:
del app.domains[vm]
main()