Not sure if this is the entirely correct forum, if not, please move this post.
I have been using Fedora for quite some time, and have always used VirtualBox as my go-to virtualization program. Because of reasons (outlined on my blog, won't bother you here), I decided to try out QEMU/KVM/lbvirt (or whatever the official name, I am not sure, but will refer to qemu from now on).
While I am pretty happy about using it, but still not totally convinced, there is an issue that keeps bothering me, that I can's seem to find the solution for.
Whenever I suspend my laptop (closing the lid), and then wake it again, the time in my VM will be stuck at the time which it was when I suspended the laptop.
I have tried numerous things, including editing /etc/libvirt/qemu/VM.xml as follows:
Of course, this did not work.Code:<clock offset='localtime'> <timer name='hypervclock' present='yes'/> </clock>
I had the "catchup" thing in there as well, but that is not really a solution, because the time it needs to catch up after being suspended for 8 hours is longer than it would take me to reboot the VM.
I also tried installing the Guest Agent, but that also did not solve the issue.
Another thing I tried is to make a script that would supsend the VM BEFORE suspending the laptop, figuring it might help:
This didn't work either...Code:#!/bin/bash #/usr/lib/systemd/system-sleep/suspend-resume-vms.sh PS_VM=/var/log/paused_vms SR_LOG=/var/log/sleep-resume.log is_there_virsh () { if [[ -z `which virsh` ]] then echo "no actions for suspend or resume required" >> $SR_LOG exit 0 fi } case $1/$2 in pre/*) echo "" >> $SR_LOG echo "`/bin/date +%Y%m%d-%H%M%S` - Going to state [$2]" >> $SR_LOG is_there_virsh echo "Suspending running VMs" >> $SR_LOG for i in $(virsh list --state-running | grep running | awk {'print $2'}) do echo $i > $PS_VM echo $i >> $SR_LOG virsh suspend $i echo "`/bin/date +%Y%m%d-%H%M%S` - Done suspending VMs" >> $SR_LOG done ;; post/*) echo "`/bin/date +%Y%m%d-%H%M%S` - Waking up from state [$2]" >> $SR_LOG is_there_virsh echo "Resuming suspended VMs" >> $SR_LOG for i in $(cat $PS_VM) do echo $i >> $SR_LOG virsh resume $i rm $PS_VM echo "`/bin/date +%Y%m%d-%H%M%S` - Done resuming VMs" >> $SR_LOG done ;; esac
So now I am turning to you, because I can't figure out how to solve this issue.
Any pointers in the right direction?


Reply With Quote
