Bug 1110429 - need a non-event way to determine qemu's current offset from utc
Summary: need a non-event way to determine qemu's current offset from utc
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.0
Hardware: All
OS: All
unspecified
low
Target Milestone: rc
: ---
Assignee: Marcelo Tosatti
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1100419
Blocks: 1110708 1139766
TreeView+ depends on / blocked
 
Reported: 2014-06-17 15:51 UTC by Ademar Reis
Modified: 2016-04-26 15:09 UTC (History)
28 users (show)

Fixed In Version: qemu 2.1.0
Doc Type: Bug Fix
Doc Text:
Clone Of: 1100419
: 1139766 (view as bug list)
Environment:
Last Closed: 2015-03-05 09:47:27 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0624 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2015-03-05 14:37:36 UTC

Comment 2 Paolo Bonzini 2014-07-08 08:35:26 UTC
Now upstream:

commit 654a36d857ff949e0d1989904b76f53fded9dc83
Author: Marcelo Tosatti <mtosatti@redhat.com>
Date:   Wed Jun 4 14:52:03 2014 -0300

    mc146818rtc: add "rtc-time" link to "/machine/rtc"
    
    Add a link to rtc under /machine providing a stable
    location for management apps to query the value of the
    time.  The link should be added by any object that sends
    RTC_TIME_CHANGE events.
    
    {"execute":"qom-get","arguments":{"path":"/machine","property":"rtc-time"} }
    
    Suggested by Paolo Bonzini and Andreas Faerber.
    
    Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Assigning back to Marcelo so that he takes care of the bug during QE.

Comment 3 Marcelo Tosatti 2014-08-22 21:09:15 UTC
QEMU commit 654a36d857ff949e0d1989904b76f53fded9dc83 part of QEMU 2.1.0, 
marking as MODIFIED.

Comment 4 juzhang 2014-08-25 01:07:12 UTC
(In reply to Marcelo Tosatti from comment #3)
> QEMU commit 654a36d857ff949e0d1989904b76f53fded9dc83 part of QEMU 2.1.0, 
> marking as MODIFIED.

Update this bz to qemu-kvm-rhev component since this bz is fixed qemu2.1. Free to correct me if there is wrong.

Best Regards,
Junyi

Comment 9 Sibiao Luo 2014-10-08 03:04:02 UTC
Verify this issue with the instruction of comment #8 on qemu-kvm-rhev-2.1.2-1.el7.x86_64.
host info:
# uname -r && rpm -q qemu-kvm-rhev && rpm -q seabios
3.10.0-171.el7.x86_64
qemu-kvm-rhev-2.1.2-1.el7.x86_64
seabios-1.7.5-5.el7.x86_64
guest info:
3.10.0-171.el7.x86_64

Steps:
1) Start guest via qemu command line.
e.g:/usr/libexec/qemu-kvm -M pc -S -cpu SandyBridge -enable-kvm -m 4096 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection...-rtc base=localtime,clock=host,driftfix=slew...
2) Execute the following QMP commands:
{ "execute": "qmp_capabilities" }
{"execute":"qom-get","arguments":{"path":"/machine","property":"rtc-time"} }

3) Save the output of "qom-get" command.
{"execute":"qom-get","arguments":{"path":"/machine","property":"rtc-time"} }
{"return": {"tm_year": 114, "tm_sec": 46, "tm_hour": 2, "tm_min": 53, "tm_mon": 9, "tm_mday": 8}}

4) Read RTC date inside the guest.
# hwclock 
Wed 08 Oct 2014 10:53:59 AM CST  -10.010463 seconds

5) Adjust RTC date inside the guest with "hwclock" command (--set --data XXXX i believe) to current RTC value minus one hour.
# hwclock --set --date "2014-10-08 11:53:59"

6) Execute the same "qom-get" command as in step 2.
{"execute":"qom-get","arguments":{"path":"/machine","property":"rtc-time"} }
{"return": {"tm_year": 114, "tm_sec": 16, "tm_hour": 3, "tm_min": 54, "tm_mon": 9, "tm_mday": 8}}

Results:
The difference between the values of "qom-get" in step 3 and step 6 is differ by approximately 1 hour.
{"return": {"tm_year": 114, "tm_sec": 46, "tm_hour": 2, "tm_min": 53, "tm_mon": 9, "tm_mday": 8}}                                  ^^^^^

{"return": {"tm_year": 114, "tm_sec": 16, "tm_hour": 3, "tm_min": 54, "tm_mon": 9, "tm_mday": 8}}                                  ^^^^^

Base on above, this issue has been fixed correctly, move to VERIFIED status, please correct me if any mistake, thanks.

Best Regards,
sluo

Comment 10 Sibiao Luo 2014-10-08 03:06:09 UTC
(In reply to Sibiao Luo from comment #9)
> Verify this issue with the instruction of comment #8 on
> qemu-kvm-rhev-2.1.2-1.el7.x86_64.
> host info:
> # uname -r && rpm -q qemu-kvm-rhev && rpm -q seabios
> 3.10.0-171.el7.x86_64
> qemu-kvm-rhev-2.1.2-1.el7.x86_64
> seabios-1.7.5-5.el7.x86_64
> guest info:
> 3.10.0-171.el7.x86_64
> 
> Steps:
> 1) Start guest via qemu command line.
> e.g:/usr/libexec/qemu-kvm -M pc -S -cpu SandyBridge -enable-kvm -m 4096 -smp
> 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection...-rtc
> base=localtime,clock=host,driftfix=slew...
> 2) Execute the following QMP commands:
> { "execute": "qmp_capabilities" }
> {"execute":"qom-get","arguments":{"path":"/machine","property":"rtc-time"} }
> 
> 3) Save the output of "qom-get" command.
> {"execute":"qom-get","arguments":{"path":"/machine","property":"rtc-time"} }
> {"return": {"tm_year": 114, "tm_sec": 46, "tm_hour": 2, "tm_min": 53,
> "tm_mon": 9, "tm_mday": 8}}
> 
> 4) Read RTC date inside the guest.
> # hwclock 
> Wed 08 Oct 2014 10:53:59 AM CST  -10.010463 seconds
> 
> 5) Adjust RTC date inside the guest with "hwclock" command (--set --data
> XXXX i believe) to current RTC value minus one hour.
> # hwclock --set --date "2014-10-08 11:53:59"
> 
I can get the RTC_CHANGE event after this steps.
{"timestamp": {"seconds": 1412736957, "microseconds": 817109}, "event": "RTC_CHANGE", "data": {"offset": -25308}}

> 6) Execute the same "qom-get" command as in step 2.
> {"execute":"qom-get","arguments":{"path":"/machine","property":"rtc-time"} }
> {"return": {"tm_year": 114, "tm_sec": 16, "tm_hour": 3, "tm_min": 54,
> "tm_mon": 9, "tm_mday": 8}}
> 
> Results:
> The difference between the values of "qom-get" in step 3 and step 6 is
> differ by approximately 1 hour.
> {"return": {"tm_year": 114, "tm_sec": 46, "tm_hour": 2, "tm_min": 53,
> "tm_mon": 9, "tm_mday": 8}}                                  ^^^^^
> 
> {"return": {"tm_year": 114, "tm_sec": 16, "tm_hour": 3, "tm_min": 54,
> "tm_mon": 9, "tm_mday": 8}}                                  ^^^^^
> 
> Base on above, this issue has been fixed correctly, move to VERIFIED status,
> please correct me if any mistake, thanks.
> 
> Best Regards,
> sluo

Comment 12 errata-xmlrpc 2015-03-05 09:47:27 UTC
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-2015-0624.html


Note You need to log in before you can comment on or make changes to this bug.