pm-utils: call qubes.SuspendPreAll/qubes.SuspendPostAll services

Host suspend notification may be useful not only to driver domains. For
example Whonix needs to resync time after suspend.

Thanks @adrelanos for help.

Fixes QubesOS/qubes-issues#1663
This commit is contained in:
Marek Marczykowski-Górecki 2016-03-15 23:13:48 +01:00
parent 6c7443223b
commit e0c875a367
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -12,6 +12,7 @@ if sys.argv[1] in ["suspend", "hibernate"]:
for vm in qc.values(): for vm in qc.values():
if vm.is_running(): if vm.is_running():
try: try:
vm.run_service("qubes.SuspendPreAll", user="root")
vm.suspend() vm.suspend()
except Exception as e: except Exception as e:
print >>sys.stderr, "Failed to suspend VM %s: %s" % (vm.name, e.message) print >>sys.stderr, "Failed to suspend VM %s: %s" % (vm.name, e.message)
@ -21,5 +22,6 @@ elif sys.argv[1] in ["resume", "thaw"]:
if vm.get_power_state() in ["Paused", "Suspended"]: if vm.get_power_state() in ["Paused", "Suspended"]:
try: try:
vm.resume() vm.resume()
vm.run_service("qubes.SuspendPostAll", user="root")
except Exception as e: except Exception as e:
print >>sys.stderr, "Failed to resume VM %s: %s" % (vm.name, e.message) print >>sys.stderr, "Failed to resume VM %s: %s" % (vm.name, e.message)