[PATCH 0/3] qemu: fix broken RTC_CHANGE event when clock offset='variable'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch series is all about:

  https://bugzilla.redhat.com/show_bug.cgi?id=964177

which points out a flaw in qemu's RTC_CHANGE event when the base for
the guest's real time clock was given as an explicit date (rather than
as 'utc' or 'localtime'). Patch 3/3 explains what qemu does, and how
this patch fixes it. (NB: the flaw has been in QEMU for so long now
that it has been documented and cannot be changed, so libvirt must
work around it)

In the meantime, the fix required that we learn the offset of
localtime from utc, and that seems like something we might want to do
for other reasons, so Patch 1/3 adds a new utility function do get
that value that is (I hope!) POSIX compliant.

Since the original patch to fix this problem was incorrect, and the
new patch doesn't use any of its code, Patch 2/3 reverts that patch
completely.

Note that I have tested this patch by starting a domain with several
variations of <clock> parameters (in a locale that is currently at
UTC+3) and using the following short script to add and remove seconds
from the guest's RTC while watching both the <clock> line in
/var/run/libvirt/qemu/$domain.xml and the offset value sent in
libvirt's VIR_DOMAIN_EVENT_ID_RTC_CHANGE event (using
examples/domain-events/events-c/event-test from a libvirt source tree
that has been built). All cases appear to maintain the adjustment in
the status properly, as well as sending the correct value to any event
handler.

Here is the script I used to add/remove time from the RTC:

  #!/bin/sh

  old=$(hwclock --show | cut -f1-7 -d' ')
  oldabs=$(date +%s --date="$old")
  newabs=$(expr $oldabs + $1)
  new=$(date --date="@$newabs")

  echo Old: $oldabs $old
  echo New: $newabs $new
  hwclock --set --date="@$newabs"

Laine Stump (3):
  util: new function virTimeLocalOffsetFromUTC
  Revert "qemu: Report the offset from host UTC for RTC_CHANGE event"
  qemu: fix broken RTC_CHANGE event when clock offset='variable'

 src/conf/domain_conf.c   | 38 +++++++++++++++++++-------------------
 src/conf/domain_conf.h   |  9 ++++++---
 src/libvirt_private.syms |  1 +
 src/qemu/qemu_command.c  | 16 +++++++++++++---
 src/qemu/qemu_process.c  | 47 ++++++++++++++++++++++++++++++++---------------
 src/util/virtime.c       | 41 ++++++++++++++++++++++++++++++++++++++++-
 src/util/virtime.h       |  5 +++--
 7 files changed, 114 insertions(+), 43 deletions(-)

-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]