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

[Xen-changelog] [xen master] oxenstored: make --restart option best-effort



commit ce70926b4f88d3f7510bd4699dc7fc3996539084
Author:     Jonathan Davies <jonathan.davies@xxxxxxxxxx>
AuthorDate: Fri Apr 7 14:27:22 2017 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Mon Apr 10 14:46:45 2017 +0100

    oxenstored: make --restart option best-effort
    
    Only attempt to restore from saved state if it exists.
    
    Without this, oxenstored immediately exits with an exception if the
    --restart option is provided but the state file is not present.
    
    (The time-of-check to time-of-use race isn't a concern as oxenstored is
    the only thing that should write the state file.)
    
    Signed-off-by: Jonathan Davies <jonathan.davies@xxxxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
    Release-acked-by: Julien Grall <julien.grall@xxxxxxx>
---
 tools/ocaml/xenstored/xenstored.ml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/xenstored.ml 
b/tools/ocaml/xenstored/xenstored.ml
index 77fd9e3..bb780d0 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -287,8 +287,9 @@ let _ =
 
        Logging.init_xenstored_log();
 
-       if cf.restart then (
-               DB.from_file store domains cons (Paths.xen_run_stored ^ "/db");
+       let filename = Paths.xen_run_stored ^ "/db" in
+       if cf.restart && Sys.file_exists filename then (
+               DB.from_file store domains cons filename;
                Event.bind_dom_exc_virq eventchn
        ) else (
                if !Disk.enable then (
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
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®.