On 09/29/2014 02:28 AM, Martin Kletzander wrote:> On Fri, Sep 26, 2014 at 08:16:25AM +0800, Bill Kenworthy wrote: >> Hi, >> I am using libvirt with qemu/kvm with qemu-guest-agent and >> suspend/save/resume linux and windows vm's. Time in Windows gets >> handled fine with ntp but I can get neither ntp or chrony to sync after >> resume without manually setting the time close to correct first. >> >> Searching has gotten me to the point where I can manually set the time >> using qemu-guest-agent but I cant figure out how to get libvirt to >> automaticly trigger this on resume. I am finding information saying it >> works but not how, or that its still work in progress and not >> implemented yet (but patches exist). Can someone either say "its not >> working yet" or explain what I am missing please? >> > > What version of libvirt are you using? Since 1.2.5 there's > virDomainSetTime() API that can do this and since 1.2.8 it's called > automatically after resume.Umm, I have a problem with that statement. Anything that requires guest interaction (which guest-agent set-time does) must NOT default to being automatic; it is only safe to enable if explicitly allowed. What is the domain XML that must be explicitly set in order to turn on automatic time-set after resume? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Martin Kletzander
2014-Oct-02 10:01 UTC
Re: [libvirt-users] time setting after suspend/resume
On Mon, Sep 29, 2014 at 09:19:39AM -0600, Eric Blake wrote:>On 09/29/2014 02:28 AM, Martin Kletzander wrote: >> On Fri, Sep 26, 2014 at 08:16:25AM +0800, Bill Kenworthy wrote: >>> Hi, >>> I am using libvirt with qemu/kvm with qemu-guest-agent and >>> suspend/save/resume linux and windows vm's. Time in Windows gets >>> handled fine with ntp but I can get neither ntp or chrony to sync after >>> resume without manually setting the time close to correct first. >>> >>> Searching has gotten me to the point where I can manually set the time >>> using qemu-guest-agent but I cant figure out how to get libvirt to >>> automaticly trigger this on resume. I am finding information saying it >>> works but not how, or that its still work in progress and not >>> implemented yet (but patches exist). Can someone either say "its not >>> working yet" or explain what I am missing please? >>> >> >> What version of libvirt are you using? Since 1.2.5 there's >> virDomainSetTime() API that can do this and since 1.2.8 it's called >> automatically after resume. > >Umm, I have a problem with that statement. Anything that requires guest >interaction (which guest-agent set-time does) must NOT default to being >automatic; it is only safe to enable if explicitly allowed. What is the >domain XML that must be explicitly set in order to turn on automatic >time-set after resume? >Oh, sorry, my fault. I was under the impression that Michal created the API especially for this purpose, but looking at the code it's not done automatically. @Bill: And as Eric said, it makes sense since the communication with the guest agent is poorly designed. You probably have to do "resume; guest-set-time" if you want that yourself. One other option is to check your ntp version, configuration and implementation. Lot of detail can matter there, but that's out of my reach and the purpose of this list. Have a nice day, Martin
On 10/02/2014 04:01 AM, Martin Kletzander wrote:>>> What version of libvirt are you using? Since 1.2.5 there's >>> virDomainSetTime() API that can do this and since 1.2.8 it's called >>> automatically after resume. >> >> Umm, I have a problem with that statement. Anything that requires guest >> interaction (which guest-agent set-time does) must NOT default to being >> automatic; it is only safe to enable if explicitly allowed. What is the >> domain XML that must be explicitly set in order to turn on automatic >> time-set after resume? >> > > Oh, sorry, my fault. I was under the impression that Michal created > the API especially for this purpose, but looking at the code it's not > done automatically.At one point, I seem to recall a proposal of adding an <on_resume> tag to domain xml that could explicitly request time resync each time the domain is resumed; but I don't know if anyone implemented it yet. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org