Comment 16 for bug 1174654

Revision history for this message
tobias (j1n-po5ias-xqt) wrote :

Did some testing: if one pauses the vms that run windows before suspending ubuntu no high cpu usage is there once the host and windows vms are resumed.
 for me it's workable then in ubuntu by using a suspend / resume script with power manaager. I put this in /etc/pm/sleep.d (and make it executable) :

#!/bin/bash
PS_VM=/var/run/paused_vms

is_there_virsh () {
if [[ -z `which virsh` ]]
then echo "no actions for suspend or resume required"
exit 0
fi
}
case "$1" in
    suspend)
        is_there_virsh
        echo "" > /var/run/paused_vms
        for i in $(virsh list --state-running | grep running | awk {'print $2'})
        do echo $i >> /var/run/paused_vms
           virsh suspend $i
        done
        ;;
    resume)
        is_there_virsh
        for i in $(cat $PS_VM)
        do virsh resume $i
        done
        # optionally remove the file but this seems not required?
        rm $PS_VM
        ;;
    *)
        ;;
esac