FedoraForum.org - Fedora Support Forums and Community
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2005
    Location
    Netherlands
    Age
    43
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    QEMU Windows Guest suspend and time issues

    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:
    Code:
    <clock offset='localtime'>
      <timer name='hypervclock' present='yes'/>
    </clock>
    Of course, this did not work.
    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:
    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
    This didn't work either...

    So now I am turning to you, because I can't figure out how to solve this issue.
    Any pointers in the right direction?
    http://www.benweb.eu

  2. #2
    Join Date
    Jun 2010
    Location
    Lost...
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: QEMU Windows Guest suspend and time issues

    Please look at the bug report https://bugzilla.redhat.com/show_bug.cgi?id=1102411
    You will need the guest agent & to use the virsh domtime command after the resume (see comment 23).
    :confused:

  3. #3
    Join Date
    Nov 2005
    Location
    Netherlands
    Age
    43
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: QEMU Windows Guest suspend and time issues

    Quote Originally Posted by Skull One
    Please look at the bug report https://bugzilla.redhat.com/show_bug.cgi?id=1102411
    You will need the guest agent & to use the virsh domtime command after the resume (see comment 23).
    Cool, trying that out now.
    Is there also a "suggested" block that I should use for:
    Code:
      <clock offset='localtime'>
        <timer name='rtc' tickpolicy='catchup'/>
        <timer name='pit' tickpolicy='delay'/>
        <timer name='hpet' present='no'/>
      </clock>
    in the VM.xml?
    http://www.benweb.eu

  4. #4
    Join Date
    Jun 2010
    Location
    Lost...
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: QEMU Windows Guest suspend and time issues

    Quote Originally Posted by Ben.Hahlen
    Cool, trying that out now.
    Is there also a "suggested" block that I should use for:
    Code:
      <clock offset='localtime'>
        <timer name='rtc' tickpolicy='catchup'/>
        <timer name='pit' tickpolicy='delay'/>
        <timer name='hpet' present='no'/>
      </clock>
    in the VM.xml?
    I don't know. Try the domtime command without it to check.
    :confused:

  5. #5
    Join Date
    Nov 2005
    Location
    Netherlands
    Age
    43
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: QEMU Windows Guest suspend and time issues

    Quote Originally Posted by Skull One
    I don't know. Try the domtime command without it to check.
    I just left it like this, and it works as expected now
    Thanks for the help!

    Marking as solved!
    http://www.benweb.eu

Similar Threads

  1. Replies: 10
    Last Post: 18th July 2014, 12:34 PM
  2. [SOLVED]
    qemu kvm fedora guest problems
    By Grub3r in forum Servers & Networking
    Replies: 5
    Last Post: 25th January 2013, 11:37 PM
  3. qemu-kvm F15 host and guest - guest screen problem
    By gmangum in forum Using Fedora
    Replies: 0
    Last Post: 25th June 2011, 05:39 PM
  4. Replies: 1
    Last Post: 2nd September 2010, 06:22 PM
  5. QEMU guest networking setup
    By greno in forum Servers & Networking
    Replies: 3
    Last Post: 29th May 2007, 02:19 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •