[Libvir] PATCH: Specify BIOS clock offset for HVM

The attached patch introduces a new XML element for specifying information about the guest (BIOS) clock. For Xen HVM, and QEMU / KVM guests this is used to specifyc whether the guest clock should be in UTC, or localtime. The latter is useful for Windows which likes the BIOS to be localtime, while the former is useful for all other operating systems. The former is of course the default - so no change in existing semantics. The <clock> element currently takes a single attribute 'offset'. This is either 'utc' or 'localtime', but if we port to VMWare, it will also allow an arbitrary numeric offset as well as these special constants. <clock offset='utc'/> Or <clock offset='localtime'/> It may later also be desirable to add a 'sync=[yes|no]' attribute to specify whether the HV tries to keep the clock in sync with the HV while it is running. VMWare has this concept, and so does Xen paravirt - though Xen paravirt sets it via /proc/sys/xen/independant_wallclock inside the guest and AFAICT doesn't (yet) expose it to the guest config in Dom0. Anyway, my patch implements use of utc/localtime offsets for Xen, and QEMU drivers. I've tested to verify that -localtime gets passed to the QEMU process as appropriate. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Fri, Jul 13, 2007 at 05:07:03PM +0100, Daniel P. Berrange wrote:
The attached patch introduces a new XML element for specifying information about the guest (BIOS) clock. For Xen HVM, and QEMU / KVM guests this is used to specifyc whether the guest clock should be in UTC, or localtime. The latter is useful for Windows which likes the BIOS to be localtime, while the former is useful for all other operating systems. The former is of course the default - so no change in existing semantics.
The <clock> element currently takes a single attribute 'offset'. This is either 'utc' or 'localtime', but if we port to VMWare, it will also allow an arbitrary numeric offset as well as these special constants.
<clock offset='utc'/>
Or
<clock offset='localtime'/>
It may later also be desirable to add a 'sync=[yes|no]' attribute to specify whether the HV tries to keep the clock in sync with the HV while it is running. VMWare has this concept, and so does Xen paravirt - though Xen paravirt sets it via /proc/sys/xen/independant_wallclock inside the guest and AFAICT doesn't (yet) expose it to the guest config in Dom0.
Anyway, my patch implements use of utc/localtime offsets for Xen, and QEMU drivers. I've tested to verify that -localtime gets passed to the QEMU process as appropriate.
Looks fine, the patch also includes a few cleanups. And this should fix the clock annoyance when running Windows. I assume this will be automatically added when installing a new Windows guest with virt-manager. Cool, +1 Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Mon, Jul 16, 2007 at 03:50:07AM -0400, Daniel Veillard wrote:
On Fri, Jul 13, 2007 at 05:07:03PM +0100, Daniel P. Berrange wrote:
The attached patch introduces a new XML element for specifying information about the guest (BIOS) clock. For Xen HVM, and QEMU / KVM guests this is used to specifyc whether the guest clock should be in UTC, or localtime. The latter is useful for Windows which likes the BIOS to be localtime, while the former is useful for all other operating systems. The former is of course the default - so no change in existing semantics.
The <clock> element currently takes a single attribute 'offset'. This is either 'utc' or 'localtime', but if we port to VMWare, it will also allow an arbitrary numeric offset as well as these special constants.
<clock offset='utc'/>
Or
<clock offset='localtime'/>
It may later also be desirable to add a 'sync=[yes|no]' attribute to specify whether the HV tries to keep the clock in sync with the HV while it is running. VMWare has this concept, and so does Xen paravirt - though Xen paravirt sets it via /proc/sys/xen/independant_wallclock inside the guest and AFAICT doesn't (yet) expose it to the guest config in Dom0.
Anyway, my patch implements use of utc/localtime offsets for Xen, and QEMU drivers. I've tested to verify that -localtime gets passed to the QEMU process as appropriate.
Looks fine, the patch also includes a few cleanups. And this should fix the clock annoyance when running Windows. I assume this will be automatically added when installing a new Windows guest with virt-manager.
Yeah, ignore the unrelated cleanups - I didn't mean to include them - i'll commit them separately. Also ignore the stupid printf() debugging! We're gonna hook it up in virt-install and virt-manager so that if you select a 'Windows' OS type, then it'll automagically configure the clock to be in localtime. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Mon, Jul 16, 2007 at 02:32:01PM +0100, Daniel P. Berrange wrote:
On Mon, Jul 16, 2007 at 03:50:07AM -0400, Daniel Veillard wrote:
On Fri, Jul 13, 2007 at 05:07:03PM +0100, Daniel P. Berrange wrote:
The attached patch introduces a new XML element for specifying information about the guest (BIOS) clock. For Xen HVM, and QEMU / KVM guests this is used to specifyc whether the guest clock should be in UTC, or localtime. The latter is useful for Windows which likes the BIOS to be localtime, while the former is useful for all other operating systems. The former is of course the default - so no change in existing semantics.
The <clock> element currently takes a single attribute 'offset'. This is either 'utc' or 'localtime', but if we port to VMWare, it will also allow an arbitrary numeric offset as well as these special constants.
<clock offset='utc'/>
Or
<clock offset='localtime'/>
It may later also be desirable to add a 'sync=[yes|no]' attribute to specify whether the HV tries to keep the clock in sync with the HV while it is running. VMWare has this concept, and so does Xen paravirt - though Xen paravirt sets it via /proc/sys/xen/independant_wallclock inside the guest and AFAICT doesn't (yet) expose it to the guest config in Dom0.
Anyway, my patch implements use of utc/localtime offsets for Xen, and QEMU drivers. I've tested to verify that -localtime gets passed to the QEMU process as appropriate.
Looks fine, the patch also includes a few cleanups. And this should fix the clock annoyance when running Windows. I assume this will be automatically added when installing a new Windows guest with virt-manager.
Yeah, ignore the unrelated cleanups - I didn't mean to include them - i'll commit them separately. Also ignore the stupid printf() debugging!
Ok, this is now committed, along with yet more test cases for XML parsing and formatting. Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard