Bug 1555398
| Summary: | SYNC_TIME does not work on autostarted guests | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | Orion Poplawski <orion> |
| Component: | libvirt | Assignee: | Tim Wiederhake <twiederh> |
| Status: | CLOSED ERRATA | QA Contact: | Fangge Jin <fjin> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 8.0 | CC: | berrange, chhu, ddepaula, dyuan, fjin, jdenemar, knoel, virt-maint, xuzhang, yalzhang |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | 8.3 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-6.10.0-1.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-05-25 06:41:16 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: | 6.10.0 |
| Embargoed: | |||
merged upstream: https://gitlab.com/libvirt/libvirt/-/commit/a501fa7cae2b93807496295945e6d3b51e5ccb3f Verify with libvirt-6.10.0-1.module
Steps:
1. Set SYNC_TIME=1 in /etc/sysconfig/libvirt-guests
2. Start and enable libvirt-guests and libvirtd service
systemctl start libvirtd
systemctl enable libvirtd
systemctl start libvirt-guests
systemctl enable libvirt-guests
3. Start a vm with qemu-guest-agent configured
4. Set vm to "autostart":
# virsh autostart vm
5.Reboot host
6. Check vm system time after rebooting, it is synced with rtc time:
[In guest]# hwclock;date
7. Check libvirtd debug log:
2020-12-14 09:43:10.847+0000: 1148: debug : qemuAgentCommandFull:1103 : Send command '{"execute":"guest-set-time"}' for write, seconds = -2
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 (virt:av bug fix and enhancement update), 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://access.redhat.com/errata/RHBA-2021:2098 |
Description of problem: Setting SYNC_TIME=1 does not work on autostarted guests. On boot libvirt-guests on the host reports: Mar 14 05:02:40 vmhost libvirt-guests.sh[2536]: Resuming guests on default URI... Mar 14 05:02:40 vmhost libvirt-guests.sh[2536]: Resuming guest flexlm: already active Presumably because libvirtd has already automatically started the guest as it is marked for autostart. This causes domtime --sync not to be run. I believe this patch should fix it: diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in index d5e68e5..5034997 100644 --- a/tools/libvirt-guests.sh.in +++ b/tools/libvirt-guests.sh.in @@ -209,9 +209,10 @@ start() { retval run_virsh "$uri" start $bypass "$name" \ >/dev/null && \ gettext "done"; echo - if "$sync_time"; then - run_virsh "$uri" domtime --sync "$name" >/dev/null - fi + fi + # Guest may have already been started by libvirtd + if "$sync_time"; then + run_virsh "$uri" domtime --sync "$name" >/dev/null fi fi done Version-Release number of selected component (if applicable): libvirt-3.2.0-14.el7_4.9.x86_64