[libvirt] [PATCHv5 1/3] Support clock=variable relative to localtime

2012-04-02 Thread Philipp Hahn
Since Xen 3.1 the clock=variable semantic is supported. In addition to
qemu/kvm Xen also knows about a variant where the offset is relative to
'localtime' instead of 'utc'.

Extends the libvirt structure with a flag 'basis' to specify, if the
offset is relative to 'localtime' or 'utc'.

Extends the libvirt structure with a flag 'reset' to force the reset
behaviour of 'localtime' and 'utc'; this is needed for backward
compatibility with previous versions of libvirt, since they report
incorrect XML.

Adapt the only user 'qemu' to the new name.
Extend the RelaxNG schema accordingly.
Document the new 'basis' attribute in the HTML documentation.
Adapt test for the new attribute.

Signed-off-by: Philipp Hahn h...@univention.de
---
 docs/formatdomain.html.in  |   18 +-
 docs/schemas/domaincommon.rng  |   30 --
 src/conf/domain_conf.c |   61 ++-
 src/conf/domain_conf.h |   17 +-
 src/libvirt_private.syms   |1 +
 src/qemu/qemu_command.c|8 ++-
 src/qemu/qemu_process.c|2 +-
 .../qemuxml2argv-clock-variable.xml|2 +-
 8 files changed, 121 insertions(+), 18 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 863377c..3ff9c28 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -985,11 +985,20 @@
   dtcodeutc/code/dt
   dd
 The guest clock will always be synchronized to UTC when
-booted/dd
+booted.
+span class=sinceSince 0.9.11/span 'utc' mode can be converted
+to 'variable' mode, which can be controlled by using the
+codeadjustment/code attribute. If the value is 'reset', the
+conversion is never done and an error is returned. A numeric value
+forces the conversion to 'variable' mode using the value as the
+initial adjustment. The default is hypervisor specific.
+  /dd
   dtcodelocaltime/code/dt
   dd
 The guest clock will be synchronized to the host's configured
 timezone when booted, if any.
+span class=sinceSince 0.9.11/span codeadjustment/code
+attribute (see 'utc' mode).
   /dd
   dtcodetimezone/code/dt
   dd
@@ -1000,12 +1009,15 @@
   dtcodevariable/code/dt
   dd
 The guest clock will have an arbitrary offset applied
-relative to UTC. The delta relative to UTC is specified
+relative to UTC or localtime, depending on the codebasis/code
+attribute. The delta relative to UTC (or localtime) is specified
 in seconds, using the codeadjustment/code attribute.
 The guest is free to adjust the RTC over time and expect
 that it will be honoured at next reboot. This is in
-contrast to 'utc' mode, where the RTC adjustments are
+contrast to 'utc' and 'localtime' mode, where the RTC adjustments 
are
 lost at each reboot. span class=sinceSince 0.7.7/span
+span class=sinceSince 0.9.11/span the codebasis/code
+attribute can be either 'utc' (default) or 'localtime'.
   /dd
 /dl
 p
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 5ed47ac..0cc04af 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -582,12 +582,22 @@
 optional
   element name=clock
 choice
-  attribute name=offset
-valuelocaltime/value
-  /attribute
-  attribute name=offset
-valueutc/value
-  /attribute
+  group
+attribute name=offset
+  choice
+valuelocaltime/value
+valueutc/value
+  /choice
+/attribute
+optional
+  attribute name='adjustment'
+choice
+  ref name='timeDelta'/
+  valuereset/value
+/choice
+  /attribute
+/optional
+  /group
   group
 attribute name=offset
   valuetimezone/value
@@ -607,6 +617,14 @@
 ref name=timeDelta/
   /attribute
 /optional
+optional
+  attribute name=basis
+choice
+  valueutc/value
+  valuelocaltime/value
+/choice
+  /attribute
+/optional
   /group
 /choice
 zeroOrMore
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c800160..cca757d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -590,6 +590,10 @@ VIR_ENUM_IMPL(virDomainClockOffset, 

Re: [libvirt] [PATCHv5 1/3] Support clock=variable relative to localtime

2012-04-02 Thread Eric Blake
On 02/06/2012 06:59 AM, Philipp Hahn wrote:
 Since Xen 3.1 the clock=variable semantic is supported. In addition to
 qemu/kvm Xen also knows about a variant where the offset is relative to
 'localtime' instead of 'utc'.
 
 Extends the libvirt structure with a flag 'basis' to specify, if the
 offset is relative to 'localtime' or 'utc'.
 
 Extends the libvirt structure with a flag 'reset' to force the reset
 behaviour of 'localtime' and 'utc'; this is needed for backward
 compatibility with previous versions of libvirt, since they report
 incorrect XML.
 
 Adapt the only user 'qemu' to the new name.
 Extend the RelaxNG schema accordingly.
 Document the new 'basis' attribute in the HTML documentation.
 Adapt test for the new attribute.
 

 +++ b/docs/formatdomain.html.in
 @@ -985,11 +985,20 @@
dtcodeutc/code/dt
dd
  The guest clock will always be synchronized to UTC when
 -booted/dd
 +booted.
 +span class=sinceSince 0.9.11/span 'utc' mode can be 
 converted
 +to 'variable' mode, which can be controlled by using the
 +codeadjustment/code attribute. If the value is 'reset', the
 +conversion is never done and an error is returned. A numeric 
 value
 +forces the conversion to 'variable' mode using the value as the
 +initial adjustment. The default is hypervisor specific.

An error is not mandatory on 'reset' unless the hypervisor doesn't
support resetting the time back to utc on each reboot.


 @@ -1000,12 +1009,15 @@
dtcodevariable/code/dt
dd
  The guest clock will have an arbitrary offset applied
 -relative to UTC. The delta relative to UTC is specified
 +relative to UTC or localtime, depending on the codebasis/code
 +attribute. The delta relative to UTC (or localtime) is specified
  in seconds, using the codeadjustment/code attribute.
  The guest is free to adjust the RTC over time and expect
  that it will be honoured at next reboot. This is in

As long as we're touching this, we can favor US spelling.

 -contrast to 'utc' mode, where the RTC adjustments are
 +contrast to 'utc' and 'localtime' mode, where the RTC 
 adjustments are
  lost at each reboot. span class=sinceSince 0.7.7/span
 +span class=sinceSince 0.9.11/span the codebasis/code
 +attribute can be either 'utc' (default) or 'localtime'.

ACK, and I'm squashing the following tweak in:


diff --git i/docs/formatdomain.html.in w/docs/formatdomain.html.in
index 3ff9c28..a382d30 100644
--- i/docs/formatdomain.html.in
+++ w/docs/formatdomain.html.in
@@ -989,16 +989,19 @@
 span class=sinceSince 0.9.11/span 'utc' mode can be
converted
 to 'variable' mode, which can be controlled by using the
 codeadjustment/code attribute. If the value is 'reset', the
-conversion is never done and an error is returned. A
numeric value
+conversion is never done (not all hypervisors can
+synchronize to UTC on each boot; use of 'reset' will cause
+an error on those hypervisors). A numeric value
 forces the conversion to 'variable' mode using the value as the
-initial adjustment. The default is hypervisor specific.
+initial adjustment. The default codeadjustment/code is
+hypervisor specific.
   /dd
   dtcodelocaltime/code/dt
   dd
 The guest clock will be synchronized to the host's configured
 timezone when booted, if any.
-span class=sinceSince 0.9.11/span codeadjustment/code
-attribute (see 'utc' mode).
+span class=sinceSince 0.9.11,/span the
codeadjustment/code
+attribute behaves the same as in 'utc' mode.
   /dd
   dtcodetimezone/code/dt
   dd
@@ -1013,8 +1016,9 @@
 attribute. The delta relative to UTC (or localtime) is
specified
 in seconds, using the codeadjustment/code attribute.
 The guest is free to adjust the RTC over time and expect
-that it will be honoured at next reboot. This is in
-contrast to 'utc' and 'localtime' mode, where the RTC
adjustments are
+that it will be honored at next reboot. This is in
+contrast to 'utc' and 'localtime' mode (with the optional
+attribute adjustment='reset'), where the RTC adjustments are
 lost at each reboot. span class=sinceSince 0.7.7/span
 span class=sinceSince 0.9.11/span the codebasis/code
 attribute can be either 'utc' (default) or 'localtime'.

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com