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

[Xen-changelog] [xen stable-4.5] oxenstored: log request and response during transaction replay



commit ec3ddd656b315b9a5f214c66ec130962d06b4346
Author:     Jonathan Davies <jonathan.davies@xxxxxxxxxx>
AuthorDate: Thu Mar 23 17:30:49 2017 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Wed Apr 5 15:22:33 2017 +0100

    oxenstored: log request and response during transaction replay
    
    During a transaction replay, the replayed requests and the new responses are
    logged in the same way as the original requests and the original responses.
    
    Reported-by: Juergen Gross <jgross@xxxxxxxx>
    Signed-off-by: Jonathan Davies <jonathan.davies@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jon Ludlam <jonathan.ludlam@xxxxxxxxxx>
    Reviewed-by: Euan Harris <euan.harris@xxxxxxxxxx>
    Acked-by: David Scott <dave@xxxxxxxxxx>
---
 tools/ocaml/xenstored/process.ml | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 8fbb6b6..9d58fd0 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -275,6 +275,18 @@ let input_handle_error ~cons ~doms ~fct ~con ~t ~req =
        | (Failure "int_of_string")    -> reply_error "EINVAL"
        | Define.Unknown_operation     -> reply_error "ENOSYS"
 
+let write_access_log ~ty ~tid ~con ~data =
+       Logging.xb_op ~ty ~tid ~con data
+
+let write_answer_log ~ty ~tid ~con ~data =
+       Logging.xb_answer ~ty ~tid ~con data
+
+let write_response_log ~ty ~tid ~con ~response =
+       match response with
+       | Packet.Ack _   -> write_answer_log ~ty ~tid ~con ~data:""
+       | Packet.Reply x -> write_answer_log ~ty ~tid ~con ~data:x
+       | Packet.Error e -> write_answer_log ~ty:(Xenbus.Xb.Op.Error) ~tid ~con 
~data:e
+
 (* Replay a stored transaction against a fresh store, check the responses are
    all equivalent: if so, commit the transaction. Otherwise send the abort to
    the client. *)
@@ -288,8 +300,10 @@ let transaction_replay c t doms cons =
                let new_t = Transaction.make tid cstore in
                let con = sprintf "r(%d):%s" id (Connection.get_domstr c) in
                let perform_exn (request, response) =
+                       write_access_log ~ty:request.Packet.ty ~tid ~con 
~data:request.Packet.data;
                        let fct = function_of_type_simple_op request.Packet.ty 
in
                        let response' = input_handle_error ~cons ~doms ~fct 
~con:c ~t:new_t ~req:request in
+                       write_response_log ~ty:request.Packet.ty ~tid ~con 
~response:response';
                        if not(Packet.response_equal response response') then 
raise Transaction_again in
                finally
                (fun () ->
@@ -444,12 +458,6 @@ let process_packet ~store ~cons ~doms ~con ~req =
                error "process packet: %s" (Printexc.to_string exn);
                Connection.send_error con tid rid "EIO"
 
-let write_access_log ~ty ~tid ~con ~data =
-       Logging.xb_op ~ty ~tid ~con:(Connection.get_domstr con) data
-
-let write_answer_log ~ty ~tid ~con ~data =
-       Logging.xb_answer ~ty ~tid ~con:(Connection.get_domstr con) data
-
 let do_input store cons doms con =
        let newpacket =
                try
@@ -476,7 +484,7 @@ let do_input store cons doms con =
                         (Connection.get_domstr con) tid
                         (Xenbus.Xb.Op.to_string ty) (sanitize_data data); *)
                process_packet ~store ~cons ~doms ~con ~req;
-               write_access_log ~ty ~tid ~con ~data;
+               write_access_log ~ty ~tid ~con:(Connection.get_domstr con) 
~data;
                Connection.incr_ops con;
        )
 
@@ -489,7 +497,7 @@ let do_output store cons doms con =
                           info "[%s] <- %s \"%s\""
                                 (Connection.get_domstr con)
                                 (Xenbus.Xb.Op.to_string ty) (sanitize_data 
data);*)
-                       write_answer_log ~ty ~tid ~con ~data;
+                       write_answer_log ~ty ~tid ~con:(Connection.get_domstr 
con) ~data;
                );
                try
                        ignore (Connection.do_output con)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.5

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.