pm-utils: try to suspend the VMs instead of just pause
This commit is contained in:
parent
19e7663928
commit
9f62349732
@ -1,23 +1,25 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/python
|
||||||
|
|
||||||
. "${PM_FUNCTIONS}"
|
from qubes.qubes import QubesVmCollection,QubesException
|
||||||
|
import sys
|
||||||
|
|
||||||
pause_vms()
|
qc = QubesVmCollection()
|
||||||
{
|
qc.lock_db_for_reading()
|
||||||
echo
|
qc.load()
|
||||||
qvm-run --all --pause
|
qc.unlock_db()
|
||||||
}
|
|
||||||
|
|
||||||
|
if sys.argv[1] in ["suspend", "hibernate"]:
|
||||||
|
for vm in qc.values():
|
||||||
|
if vm.is_running():
|
||||||
|
try:
|
||||||
|
vm.suspend()
|
||||||
|
except Exception as e:
|
||||||
|
print >>sys.stderr, "Failed to suspend VM %s: %s" % (vm.name, e.message)
|
||||||
|
|
||||||
unpause_vms()
|
elif sys.argv[1] in ["resume", "thaw"]:
|
||||||
{
|
for vm in qc.values():
|
||||||
echo
|
if vm.get_power_state() in ["Paused", "Suspended"]:
|
||||||
qvm-run --all --unpause
|
try:
|
||||||
}
|
vm.resume()
|
||||||
|
except Exception as e:
|
||||||
|
print >>sys.stderr, "Failed to resume VM %s: %s" % (vm.name, e.message)
|
||||||
case "$1" in
|
|
||||||
thaw|resume) unpause_vms ;;
|
|
||||||
suspend|hibernate) pause_vms ;;
|
|
||||||
*) exit 0 ;;
|
|
||||||
esac
|
|
||||||
|
Loading…
Reference in New Issue
Block a user