--- a/ocaml/xapi/xapi.ml
+++ b/ocaml/xapi/xapi.ml
@@ -171,6 +171,8 @@
 
 let domain0_setup () =
   with_xc_and_xs (fun xc xs ->
+    let already_setup = try ignore(xs.Xs.read "/local/domain/0/name"); true with _ -> false in
+    if not already_setup then begin
 	     (* Write an initial neutral target in for domain 0 *)
 	     let di = Xc.domain_getinfo xc 0 in
 	     let memory_actual_kib = Xc.pages_to_kib (Int64.of_nativeint di.Xc.total_memory_pages) in
@@ -188,6 +190,7 @@
 				  t.Xst.write Xapi_globs.xe_key Xapi_globs.xe_val;
 				  t.Xst.setperms Xapi_globs.xe_key (0, Xsraw.PERM_READ, [])
 			       )
+    end
           )
 
 let random_setup () =
