Bug 1139766
Summary: | need a non-event way to determine qemu's current offset from utc | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Laine Stump <laine> |
Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | low | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.0 | CC: | dyuan, fjin, mprivozn, mzhan, rbalakri |
Target Milestone: | rc | Keywords: | Upstream |
Target Release: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Fixed In Version: | libvirt-1.3.5-1.el7 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | 1110429 | Environment: | |
Last Closed: | 2016-11-03 18:10:36 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | 1110429 | ||
Bug Blocks: |
Description
Laine Stump
2014-09-09 15:14:41 UTC
Patches proposed upstream: https://www.redhat.com/archives/libvir-list/2016-April/msg02001.html I've just pushed the patches upstream: commit 6ee78d334a9e8e841880d6931892a8ebaa73faeb Author: Michal Privoznik <mprivozn> AuthorDate: Fri Apr 29 18:01:39 2016 +0200 Commit: Michal Privoznik <mprivozn> CommitDate: Tue May 3 11:44:13 2016 +0200 qemu: Refresh RTC adjustment on qemuProcessReconnect https://bugzilla.redhat.com/show_bug.cgi?id=1139766 Thing is, for some reasons you can have your domain's RTC to be in something different than UTC. More weirdly, it's not only time zone what you can shift it of, but an arbitrary value. So, if domain is configured that way, libvirt will correctly put it onto qemu cmd line and moreover track it as this offset changes during domain's life time (e.g. because guest OS decides the best thing to do is set new time to RTC). Anyway, they way in which this tracking is implemented is events. But we've got a problem if change in guest's RTC occurs and the daemon is not running. The event is lost and we end up reporting invalid value in domain XML. Therefore, when the daemon is starting up again and it is reconnecting to all running domains, re-fetch their RTC so the correct offset value can be computed. Signed-off-by: Michal Privoznik <mprivozn> commit b1e2f2d84d149e141f86f286a243536243862b55 Author: Michal Privoznik <mprivozn> AuthorDate: Fri Apr 29 16:01:47 2016 +0200 Commit: Michal Privoznik <mprivozn> CommitDate: Tue May 3 11:44:13 2016 +0200 qemu: Introduce qemuMonitorGetRTCTime Signed-off-by: Michal Privoznik <mprivozn> v1.3.4-81-g6ee78d3 Reproduce this BZ on build libvirt-1.3.4-1.el7.x86_64, qemu-kvm-rhev-2.6.0-9.el7.x86_64 Scenario 1: adjust guest hwclock when libvirtd.service is inactive, then restart libvirtd.service and check clock adjustment in guest live xml. 1. Add the following xml elements into domain xml: # virsh edit rhel7.2-min <clock offset='variable' adjustment='600' basis='utc'> <timer name='rtc' tickpolicy='catchup' track='guest'> <catchup threshold='123' slew='120' limit='10000'/> </timer> <timer name='pit' tickpolicy='delay'/> </clock> 2. # virsh start rhel7.2-min 3. In guest, adjust hwclock forward by 10 mins via a script: # hwclock;date Wed 29 Jun 2016 04:23:42 PM CST -0.449830 seconds Wed Jun 29 16:23:42 CST 2016 # ./addsecs 600 # hwclock;date Wed 29 Jun 2016 04:35:01 PM CST -10.011560 seconds Wed Jun 29 16:25:01 CST 2016 4. In host: # virsh dumpxml rhel7|grep utc <clock offset='variable' adjustment='1199' basis='utc'> 5. # systemctl stop libvirtd 6. In guest, adjust hwclock forward by 10 mins again: # ./addsecs 600 # hwclock;date Wed 29 Jun 2016 04:50:42 PM CST -10.011302 seconds Wed Jun 29 16:30:42 CST 2016 7. # systemctl start libvirtd 8. In host: # virsh dumpxml rhel7|grep utc <clock offset='variable' adjustment='1199' basis='utc'> ====> the adjustment should be 1800 approximately. 9. In guest, adjust hwclock forward by 10 mins again: # ./addsecs 600 10. In host: # virsh dumpxml rhel7|grep utc <clock offset='variable' adjustment='2399' basis='utc'> ====> the adjustment now is correct. Scenario 2: check time inside guest after migration 11. # systemctl stop libvirtd 12. In guest, adjust hwclock forward by 10 mins again: # ./addsecs 600 13. # systemctl start libvirtd 14. # virsh dumpxml rhel7|grep utc <clock offset='variable' adjustment='2399' basis='utc'> 15.Do migration: # virsh migrate rhel7 qemu+ssh://hp-dl385g7-06.lab.eng.pek2.redhat.com/system --live --verbose Migration: [100 %] 16. In guest: # hwclock;date Wed 29 Jun 2016 05:30:10 PM CST -0.694085 seconds Wed Jun 29 16:50:11 CST 2016 The time in guest is correct after migration. 17.On target host: # virsh dumpxml rhel7|grep utc <clock offset='variable' adjustment='2398' basis='utc'> Verify this BZ on buildlibvirt-1.3.5-1.el7.x86_64 Steps: 1. Add the following xml elements into domain xml: # virsh edit rhel7.2-min <clock offset='variable' adjustment='600' basis='utc'> <timer name='rtc' tickpolicy='catchup' track='guest'> <catchup threshold='123' slew='120' limit='10000'/> </timer> <timer name='pit' tickpolicy='delay'/> </clock> 2. # virsh start rhel7.2-min 3. In guest, adjust hwclock forward by 10 mins via a script: # hwclock;date Mon 27 Jun 2016 04:22:06 PM CST -0.636120 seconds Mon Jun 27 16:22:05 CST 2016 # ./addsecs 600 # hwclock;date Mon 27 Jun 2016 04:32:21 PM CST -0.727867 seconds Mon Jun 27 16:22:20 CST 2016 4. Stop libvirtd service # systemctl stop libvirtd 5. In guest, adjust hwclock forward by 10 mins again: # ./addsecs 600 # hwclock;date Mon 27 Jun 2016 04:53:31 PM CST -0.937840 seconds Mon Jun 27 16:33:30 CST 2016 6. Start libvirtd service: # systemctl start libvirtd 7. Check the time offset in domain dumpxml: # virsh dumpxml rhel7.2-min <clock offset='variable' adjustment='1798' basis='utc'> <timer name='rtc' tickpolicy='catchup' track='guest'> <catchup threshold='123' slew='120' limit='10000'/> </timer> <timer name='pit' tickpolicy='delay'/> </clock> 8. Do managedsave&start # virsh managedsave rhel7.2-min # virsh start rhel7.2-min 9.# virsh dumpxml rhel7.2-min <clock offset='variable' adjustment='1798' basis='utc'> <timer name='rtc' tickpolicy='catchup' track='guest'> <catchup threshold='123' slew='120' limit='10000'/> </timer> <timer name='pit' tickpolicy='delay'/> </clock> 10. In guest: # hwclock;date Mon 27 Jun 2016 04:56:54 PM CST -0.452379 seconds Mon Jun 27 16:36:53 CST 2016 11. Do migration: # virsh migrate rhel7.2-min qemu+ssh://hp-dl385g7-05.lab.eng.pek2.redhat.com/system --live --verbose Migration: [100 %] 12. In guest: # hwclock;date Mon 27 Jun 2016 04:57:28 PM CST -0.661982 seconds Mon Jun 27 16:37:27 CST 2016 13. Destroy guest: # virsh destroy rhel7.2-min # virsh dumpxml rhel7.2-min <clock offset='variable' adjustment='600' basis='utc'> ==> The adjustment is 600 instead of 1798 One question: I'm not sure if libvirt should rewrite the persistent domain XML with the latest RTC adjustment value when guest shuts down, in my test, this is not done(see comment 9 step13) (In reply to JinFangge from comment #10) > One question: > I'm not sure if libvirt should rewrite the persistent domain XML with the > latest RTC adjustment value when guest shuts down, in my test, this is not > done(see comment 9 step13) No, I don't think we should change that. If users want to keep the adjustment as you described, they can edit the domain XML. Otherwise, changing persistent XML without letting users know is a big no-no. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-2577.html |