Skip to content

Commit 77e3c13

Browse files
mg12ctxlindig
authored andcommitted
CP-24361: abstract qemu interface: rebase patch CP-24090 d1cfa14 into qemu backends
Rebase the following patch into the qemu backends: > commit d1cfa14 > Refs: 0.9.30.1-797-gd1cfa14 > Author: Liang Dai <liang.dai1@citrix.com> > AuthorDate: Tue Sep 12 23:03:39 2017 +0800 > Commit: Liang Dai <liang.dai1@citrix.com> > CommitDate: Wed Sep 20 10:18:24 2017 +0800 > > CP-24090: Respond to RTC_CHANGE QMP message > > For QEMU-upstream, when receives RTC_CHANGE event, write the value to > xenstore path /vm/<uuid>/rtc/timeoffset, which will wakeup xenstore > watcher in xenops_server_xen to uptdate timeoffset. > > Signed-off-by: Liang Dai <liang.dai1@citrix.com> Signed-off-by: Marcus Granado <marcus.granado@citrix.com>
1 parent fc98abb commit 77e3c13

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

xc/device.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,16 @@ module Backend = struct
20632063

20642064
let qmp_event_handle domid qmp_event =
20652065
(* This function will be extended to handle qmp events *)
2066-
debug "Got QMP event, domain-%d: %s" domid qmp_event.event
2066+
debug "Got QMP event, domain-%d: %s" domid qmp_event.event;
2067+
qmp_event.data >>= function
2068+
| RTC_CHANGE timeoffset ->
2069+
with_xs (fun xs ->
2070+
let timeoffset_key = sprintf "/vm/%s/rtc/timeoffset" (Uuidm.to_string (Xenops_helpers.uuid_of_domid ~xs domid)) in
2071+
try
2072+
let rtc = xs.Xs.read timeoffset_key in
2073+
xs.Xs.write timeoffset_key Int64.(add timeoffset (of_string rtc) |> to_string)
2074+
with e -> error "Failed to process RTC_CHANGE for domain %d: %s" domid (Printexc.to_string e)
2075+
)
20672076

20682077
let qmp_event_thread () =
20692078
while true do

0 commit comments

Comments
 (0)