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:
parent
6c7443223b
commit
e0c875a367
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user