Hi,

I've found a viable solution to this problem.
I've putted following script into /etc/pm/sleep.d:


#!/bin/bash
#
# A script to pause virtual machines before going into suspend

declare -r SAVES_DIRECTORY="/var/lib/libvirt/qemu/save"

for_each_line() {
    while read -r line; do $1 "$line"; done
}

save_virtual_machine() {
        TARGET_FILE="$SAVES_DIRECTORY/$1.save"
        echo "Saving $1 (to $TARGET_FILE)"
        virsh "connect qemu:///system;save $1 '$TARGET_FILE'"
}

virsh 'connect qemu:///system;list' | \
        sed -n  '/^\s\+[0-9]\+\s\+.\+\s\+running.*/p' | \
        sed -e 's/^\s\+[0-9]\+\s\+\(.\+\)\s\+running.*/\1/' | \
        for_each_line save_virtual_machine


This saves all running virtual machines when going to sleep.
Maybe this solution can find its way into debian? I could write
a python-script that uses the libvirt instead of this shell
script...

Chris


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to