All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Towards a restartable oxenstored
@ 2017-04-07 13:27 Jonathan Davies
  2017-04-07 13:27 ` [PATCH 1/5] oxenstored: initialise logging earlier Jonathan Davies
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: Jonathan Davies @ 2017-04-07 13:27 UTC (permalink / raw)
  To: xen-devel @ lists . xenproject . org
  Cc: Wei Liu, Jonathan Davies, Ian Jackson, Christian Lindig, David Scott

In order to make oxenstored restartable, we need to save internal state 
to a file on exit and restore from this file on startup.

Much of the infrastructure for making oxenstored restartable already 
existed, but a handful of bugs prevented it from working.

After these patches I can do the following:

    # xenstore-write foo bar
    # xenstore-read foo
    bar
    # xenstore-ls -f -p | sort > contents.before
    # killall oxenstored
    # ./oxenstored --restart
    # xenstore-ls -f -p | sort > contents.after
    # diff contents.before contents.after
    # xenstore-read foo
    bar

... and I can do similar kinds of activity in a guest across the 
restart.

Note that clients of local socket connections will get EPIPE or similar 
when oxenstored terminates. Hence these clients need to handle this
gracefully, e.g. by attempting to reconnect, if they wish to tolerate 
xenstored restarts.

With these patches, the state saved on exit contains information about 
inter-domain connections and active watches, and the contents of the
store. Some internal state is not currently preserved over a restart:
  1. quota usage info
  2. partially-read and already-queued packets from rings
  3. recent transaction history

Items 1 and 2 are probably needed for this to be considered fully 
functional, so fixes for them should follow. But the bugfixes in this 
series already represent a worthwhile improvement.

Jonathan Davies (5):
  oxenstored: initialise logging earlier
  oxenstored: avoid leading slash in paths in saved store state
  oxenstored: save remote evtchn port, not local port
  oxenstored: improve event-channel binding logging
  oxenstored: make --restart option best-effort

 tools/ocaml/xenstored/domain.ml    |  4 ++--
 tools/ocaml/xenstored/store.ml     |  8 +++++++-
 tools/ocaml/xenstored/xenstored.ml | 10 ++++++----
 3 files changed, 15 insertions(+), 7 deletions(-)

-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/5] oxenstored: initialise logging earlier
  2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
@ 2017-04-07 13:27 ` Jonathan Davies
  2017-04-07 13:27 ` [PATCH 2/5] oxenstored: avoid leading slash in paths in saved store state Jonathan Davies
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Jonathan Davies @ 2017-04-07 13:27 UTC (permalink / raw)
  To: xen-devel @ lists . xenproject . org
  Cc: Wei Liu, Jonathan Davies, Ian Jackson, Christian Lindig, David Scott

Otherwise we miss out on messages from things that try to log earlier in
the start-up procedure.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
---
 tools/ocaml/xenstored/xenstored.ml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 05ace4d..09da257 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -285,6 +285,8 @@ let _ =
 
 	let quit = ref false in
 
+	Logging.init_xenstored_log();
+
 	if cf.restart then (
 		DB.from_file store domains cons (Paths.xen_run_stored ^ "/db");
 		Event.bind_dom_exc_virq eventchn
@@ -311,7 +313,6 @@ let _ =
 	Sys.set_signal Sys.sigusr1 (Sys.Signal_handle (fun i -> sigusr1_handler store));
 	Sys.set_signal Sys.sigpipe Sys.Signal_ignore;
 
-	Logging.init_xenstored_log();
 	if cf.activate_access_log then begin
 		let post_rotate () = DB.to_file store cons (Paths.xen_run_stored ^ "/db") in
 		Logging.init_access_log post_rotate
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/5] oxenstored: avoid leading slash in paths in saved store state
  2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
  2017-04-07 13:27 ` [PATCH 1/5] oxenstored: initialise logging earlier Jonathan Davies
@ 2017-04-07 13:27 ` Jonathan Davies
  2017-04-07 13:27 ` [PATCH 3/5] oxenstored: save remote evtchn port, not local port Jonathan Davies
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Jonathan Davies @ 2017-04-07 13:27 UTC (permalink / raw)
  To: xen-devel @ lists . xenproject . org
  Cc: Wei Liu, Jonathan Davies, Ian Jackson, Christian Lindig, David Scott

Internally, paths are represented as lists of strings, where
  * path "/" is represented by []
  * path "/local/domain/0" is represented by ["local"; "domain"; "0"]
(see comment for Store.Path.t).

However, the traversal function generated paths like
    [""; "local"; "domain"; "0"]
because the name of the root node is "". Change it to generate paths
correctly.

Furthermore, the function passed to Store.dump_fct would render the node
"foo" under the path [] as "//foo". Change this to return "/foo".

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
---
 tools/ocaml/xenstored/store.ml     | 8 +++++++-
 tools/ocaml/xenstored/xenstored.ml | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/store.ml b/tools/ocaml/xenstored/store.ml
index 9f619b8..13cf3b5 100644
--- a/tools/ocaml/xenstored/store.ml
+++ b/tools/ocaml/xenstored/store.ml
@@ -122,6 +122,11 @@ let of_string s =
 		| "" :: path when is_valid path -> path
 		| _ -> raise Define.Invalid_path
 
+let of_path_and_name path name =
+	match path, name with
+	| [], "" -> []
+	| _ -> path @ [name]
+
 let create path connection_path =
 	of_string (Utils.path_validate path connection_path)
 
@@ -343,7 +348,8 @@ let path_exists store path =
 let traversal root_node f =
 	let rec _traversal path node =
 		f path node;
-		List.iter (_traversal (path @ [ Symbol.to_string node.Node.name ])) node.Node.children
+		let node_path = Path.of_path_and_name path (Symbol.to_string node.Node.name) in
+		List.iter (_traversal node_path) node.Node.children
 		in
 	_traversal [] root_node
 
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 09da257..77fd9e3 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -213,7 +213,7 @@ let to_channel store cons chan =
 	(* dump the store *)
 	Store.dump_fct store (fun path node ->
 		let name, perms, value = Store.Node.unpack node in
-		let fullpath = (Store.Path.to_string path) ^ "/" ^ name in
+		let fullpath = Store.Path.to_string (Store.Path.of_path_and_name path name) in
 		let permstr = Perms.Node.to_string perms in
 		fprintf chan "store,%s,%s,%s\n" (hexify fullpath) (hexify permstr) (hexify value)
 	);
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/5] oxenstored: save remote evtchn port, not local port
  2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
  2017-04-07 13:27 ` [PATCH 1/5] oxenstored: initialise logging earlier Jonathan Davies
  2017-04-07 13:27 ` [PATCH 2/5] oxenstored: avoid leading slash in paths in saved store state Jonathan Davies
@ 2017-04-07 13:27 ` Jonathan Davies
  2017-04-07 13:27 ` [PATCH 4/5] oxenstored: improve event-channel binding logging Jonathan Davies
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Jonathan Davies @ 2017-04-07 13:27 UTC (permalink / raw)
  To: xen-devel @ lists . xenproject . org
  Cc: Wei Liu, Jonathan Davies, Ian Jackson, Christian Lindig, David Scott

Previously, Domain.dump output the number of the local port
corresponding to each domain's event-channel. However, when oxenstored
exits, it closes /dev/xen/evtchn which causes the kernel to close the
local port (evtchn_release), so this port is no longer useful.

Instead, store the remote port. This can be used to reconnect the
event-channel by binding the original remote port to a fresh local port.

Indeed, the logic for parsing the stored state already expects a remote
port as it passes the parsed port number to Domain.make (via
Domains.create), which takes a remote port.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
---
 tools/ocaml/xenstored/domain.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index 4515650..eda2ea9 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -62,7 +62,7 @@ let string_of_port = function
 | Some x -> string_of_int (Xeneventchn.to_int x)
 
 let dump d chan =
-	fprintf chan "dom,%d,%nd,%s\n" d.id d.mfn (string_of_port d.port)
+	fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
 
 let notify dom = match dom.port with
 | None ->
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/5] oxenstored: improve event-channel binding logging
  2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
                   ` (2 preceding siblings ...)
  2017-04-07 13:27 ` [PATCH 3/5] oxenstored: save remote evtchn port, not local port Jonathan Davies
@ 2017-04-07 13:27 ` Jonathan Davies
  2017-04-07 13:27 ` [PATCH 5/5] oxenstored: make --restart option best-effort Jonathan Davies
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Jonathan Davies @ 2017-04-07 13:27 UTC (permalink / raw)
  To: xen-devel @ lists . xenproject . org
  Cc: Wei Liu, Jonathan Davies, Ian Jackson, Christian Lindig, David Scott

It's useful to see a bit more detail when an inter-domain event-channel
is bound, especially over an oxenstored restart.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
---
 tools/ocaml/xenstored/domain.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index eda2ea9..b0a01b0 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -72,7 +72,7 @@ let notify dom = match dom.port with
 
 let bind_interdomain dom =
 	dom.port <- Some (Event.bind_interdomain dom.eventchn dom.id dom.remote_port);
-	debug "domain %d bound port %s" dom.id (string_of_port dom.port)
+	debug "bound domain %d remote port %d to local port %s" dom.id dom.remote_port (string_of_port dom.port)
 
 
 let close dom =
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/5] oxenstored: make --restart option best-effort
  2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
                   ` (3 preceding siblings ...)
  2017-04-07 13:27 ` [PATCH 4/5] oxenstored: improve event-channel binding logging Jonathan Davies
@ 2017-04-07 13:27 ` Jonathan Davies
  2017-04-07 14:09 ` [PATCH 0/5] Towards a restartable oxenstored Wei Liu
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: Jonathan Davies @ 2017-04-07 13:27 UTC (permalink / raw)
  To: xen-devel @ lists . xenproject . org
  Cc: Wei Liu, Jonathan Davies, Ian Jackson, Christian Lindig, David Scott

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@citrix.com>
---
 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 (
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
                   ` (4 preceding siblings ...)
  2017-04-07 13:27 ` [PATCH 5/5] oxenstored: make --restart option best-effort Jonathan Davies
@ 2017-04-07 14:09 ` Wei Liu
  2017-04-07 14:21   ` Juergen Gross
  2017-04-07 14:15 ` Andrew Cooper
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 17+ messages in thread
From: Wei Liu @ 2017-04-07 14:09 UTC (permalink / raw)
  To: Jonathan Davies
  Cc: xen-devel @ lists . xenproject . org, Wei Liu, Ian Jackson,
	Christian Lindig, David Scott

On Fri, Apr 07, 2017 at 02:27:17PM +0100, Jonathan Davies wrote:
> In order to make oxenstored restartable, we need to save internal state 
> to a file on exit and restore from this file on startup.
> 
> Much of the infrastructure for making oxenstored restartable already 
> existed, but a handful of bugs prevented it from working.
> 
> After these patches I can do the following:
> 
>     # xenstore-write foo bar
>     # xenstore-read foo
>     bar
>     # xenstore-ls -f -p | sort > contents.before
>     # killall oxenstored
>     # ./oxenstored --restart
>     # xenstore-ls -f -p | sort > contents.after
>     # diff contents.before contents.after
>     # xenstore-read foo
>     bar
> 
> ... and I can do similar kinds of activity in a guest across the 
> restart.
> 
> Note that clients of local socket connections will get EPIPE or similar 
> when oxenstored terminates. Hence these clients need to handle this
> gracefully, e.g. by attempting to reconnect, if they wish to tolerate 
> xenstored restarts.
> 
> With these patches, the state saved on exit contains information about 
> inter-domain connections and active watches, and the contents of the
> store. Some internal state is not currently preserved over a restart:
>   1. quota usage info
>   2. partially-read and already-queued packets from rings
>   3. recent transaction history
> 
> Items 1 and 2 are probably needed for this to be considered fully 
> functional, so fixes for them should follow. But the bugfixes in this 
> series already represent a worthwhile improvement.
> 
> Jonathan Davies (5):
>   oxenstored: initialise logging earlier
>   oxenstored: avoid leading slash in paths in saved store state
>   oxenstored: save remote evtchn port, not local port
>   oxenstored: improve event-channel binding logging
>   oxenstored: make --restart option best-effort
> 

I think this series can be considered for 4.9, given they are small
changes.

The code looks good as far as I'm concerned. I will wait for OCaml
experts to review them.

>  tools/ocaml/xenstored/domain.ml    |  4 ++--
>  tools/ocaml/xenstored/store.ml     |  8 +++++++-
>  tools/ocaml/xenstored/xenstored.ml | 10 ++++++----
>  3 files changed, 15 insertions(+), 7 deletions(-)
> 
> -- 
> 2.7.4
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
                   ` (5 preceding siblings ...)
  2017-04-07 14:09 ` [PATCH 0/5] Towards a restartable oxenstored Wei Liu
@ 2017-04-07 14:15 ` Andrew Cooper
  2017-04-07 14:27   ` Jonathan Davies
  2017-04-10  8:10 ` Christian Lindig
  2017-04-10  9:47 ` Wei Liu
  8 siblings, 1 reply; 17+ messages in thread
From: Andrew Cooper @ 2017-04-07 14:15 UTC (permalink / raw)
  To: Jonathan Davies
  Cc: Ian Jackson, Xen-devel List, Wei Liu, Christian Lindig, David Scott

On 07/04/17 14:27, Jonathan Davies wrote:
> With these patches, the state saved on exit contains information about 
> inter-domain connections and active watches, and the contents of the
> store. Some internal state is not currently preserved over a restart:
>   1. quota usage info
>   2. partially-read and already-queued packets from rings
>   3. recent transaction history
>
> Items 1 and 2 are probably needed for this to be considered fully 
> functional, so fixes for them should follow. But the bugfixes in this 
> series already represent a worthwhile improvement.

Shouldn't quota usage be recalculated as part of parsing the stashed
database?  After all, the database is the canonical state of the world. 
What would you do if the database and the stashed quota differ?

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-07 14:09 ` [PATCH 0/5] Towards a restartable oxenstored Wei Liu
@ 2017-04-07 14:21   ` Juergen Gross
  2017-04-07 14:31     ` Jonathan Davies
  0 siblings, 1 reply; 17+ messages in thread
From: Juergen Gross @ 2017-04-07 14:21 UTC (permalink / raw)
  To: Wei Liu, Jonathan Davies
  Cc: xen-devel @ lists . xenproject . org, Ian Jackson,
	Christian Lindig, David Scott

On 07/04/17 16:09, Wei Liu wrote:
> On Fri, Apr 07, 2017 at 02:27:17PM +0100, Jonathan Davies wrote:
>> In order to make oxenstored restartable, we need to save internal state 
>> to a file on exit and restore from this file on startup.
>>
>> Much of the infrastructure for making oxenstored restartable already 
>> existed, but a handful of bugs prevented it from working.
>>
>> After these patches I can do the following:
>>
>>     # xenstore-write foo bar
>>     # xenstore-read foo
>>     bar
>>     # xenstore-ls -f -p | sort > contents.before
>>     # killall oxenstored
>>     # ./oxenstored --restart
>>     # xenstore-ls -f -p | sort > contents.after
>>     # diff contents.before contents.after
>>     # xenstore-read foo
>>     bar
>>
>> ... and I can do similar kinds of activity in a guest across the 
>> restart.
>>
>> Note that clients of local socket connections will get EPIPE or similar 
>> when oxenstored terminates. Hence these clients need to handle this
>> gracefully, e.g. by attempting to reconnect, if they wish to tolerate 
>> xenstored restarts.
>>
>> With these patches, the state saved on exit contains information about 
>> inter-domain connections and active watches, and the contents of the
>> store. Some internal state is not currently preserved over a restart:
>>   1. quota usage info
>>   2. partially-read and already-queued packets from rings
>>   3. recent transaction history
>>
>> Items 1 and 2 are probably needed for this to be considered fully 
>> functional, so fixes for them should follow. But the bugfixes in this 
>> series already represent a worthwhile improvement.
>>
>> Jonathan Davies (5):
>>   oxenstored: initialise logging earlier
>>   oxenstored: avoid leading slash in paths in saved store state
>>   oxenstored: save remote evtchn port, not local port
>>   oxenstored: improve event-channel binding logging
>>   oxenstored: make --restart option best-effort
>>
> 
> I think this series can be considered for 4.9, given they are small
> changes.
> 
> The code looks good as far as I'm concerned. I will wait for OCaml
> experts to review them.
> 
>>  tools/ocaml/xenstored/domain.ml    |  4 ++--
>>  tools/ocaml/xenstored/store.ml     |  8 +++++++-
>>  tools/ocaml/xenstored/xenstored.ml | 10 ++++++----
>>  3 files changed, 15 insertions(+), 7 deletions(-)

Is the data format of the saved state documented somewhere? I'd
appreciate any pointer or (in case there is no such doc) a followup
patch to add the documentation.

This would help later in case C-xenstored learns restartability, too,
and someone would like to switch the xenstored type on a running
system.


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-07 14:15 ` Andrew Cooper
@ 2017-04-07 14:27   ` Jonathan Davies
  0 siblings, 0 replies; 17+ messages in thread
From: Jonathan Davies @ 2017-04-07 14:27 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Ian Jackson, Xen-devel List, Wei Liu, Christian Lindig, David Scott

On 07/04/17 15:15, Andrew Cooper wrote:
> On 07/04/17 14:27, Jonathan Davies wrote:
>> With these patches, the state saved on exit contains information about
>> inter-domain connections and active watches, and the contents of the
>> store. Some internal state is not currently preserved over a restart:
>>   1. quota usage info
>>   2. partially-read and already-queued packets from rings
>>   3. recent transaction history
>>
>> Items 1 and 2 are probably needed for this to be considered fully
>> functional, so fixes for them should follow. But the bugfixes in this
>> series already represent a worthwhile improvement.
>
> Shouldn't quota usage be recalculated as part of parsing the stashed
> database?  After all, the database is the canonical state of the world.
> What would you do if the database and the stashed quota differ?

You're right. This would be recalculated when loading the saved state.

I had in mind that there were some quotas of "dynamic" things that 
aren't derived from the contents alone, but I can't spot them in the 
code so must have been imagining them.

So there's no need to dump quota state to disk.

Thanks,
Jonathan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-07 14:21   ` Juergen Gross
@ 2017-04-07 14:31     ` Jonathan Davies
  2017-04-07 14:34       ` Juergen Gross
  0 siblings, 1 reply; 17+ messages in thread
From: Jonathan Davies @ 2017-04-07 14:31 UTC (permalink / raw)
  To: Juergen Gross, Wei Liu
  Cc: xen-devel @ lists . xenproject . org, Ian Jackson,
	Christian Lindig, David Scott

On 07/04/17 15:21, Juergen Gross wrote:
> Is the data format of the saved state documented somewhere? I'd
> appreciate any pointer or (in case there is no such doc) a followup
> patch to add the documentation.
>
> This would help later in case C-xenstored learns restartability, too,
> and someone would like to switch the xenstored type on a running
> system.

That's a good idea. No, it's not currently documented as far as I'm aware.

My impression is that the existing bits of oxenstored code that produced 
this output have never been used in practice. So now would be a good 
time to review the format of the saved state before it potentially gets 
more widely used.

Thanks,
Jonathan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-07 14:31     ` Jonathan Davies
@ 2017-04-07 14:34       ` Juergen Gross
  0 siblings, 0 replies; 17+ messages in thread
From: Juergen Gross @ 2017-04-07 14:34 UTC (permalink / raw)
  To: Jonathan Davies, Wei Liu
  Cc: xen-devel @ lists . xenproject . org, Ian Jackson,
	Christian Lindig, David Scott

On 07/04/17 16:31, Jonathan Davies wrote:
> On 07/04/17 15:21, Juergen Gross wrote:
>> Is the data format of the saved state documented somewhere? I'd
>> appreciate any pointer or (in case there is no such doc) a followup
>> patch to add the documentation.
>>
>> This would help later in case C-xenstored learns restartability, too,
>> and someone would like to switch the xenstored type on a running
>> system.
> 
> That's a good idea. No, it's not currently documented as far as I'm aware.
> 
> My impression is that the existing bits of oxenstored code that produced
> this output have never been used in practice. So now would be a good
> time to review the format of the saved state before it potentially gets
> more widely used.

Oh yes, please!


Juergen


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
                   ` (6 preceding siblings ...)
  2017-04-07 14:15 ` Andrew Cooper
@ 2017-04-10  8:10 ` Christian Lindig
  2017-04-10  8:33   ` Wei Liu
  2017-04-10  9:47 ` Wei Liu
  8 siblings, 1 reply; 17+ messages in thread
From: Christian Lindig @ 2017-04-10  8:10 UTC (permalink / raw)
  To: Jonathan Davies
  Cc: xen-devel @ lists . xenproject . org, Ian Jackson, Wei Liu, David Scott


> On 7. Apr 2017, at 14:27, Jonathan Davies <Jonathan.Davies@citrix.com> wrote:
> 
> tools/ocaml/xenstored/domain.ml    |  4 ++--
> tools/ocaml/xenstored/store.ml     |  8 +++++++-
> tools/ocaml/xenstored/xenstored.ml | 10 ++++++----

The OCaml code is looking good and I’d be happy to take it as it is. 

I noticed that the (existing) code for handling the path for the database file uses (^) to construct it. It would be better to use Filename.concat and this could have been done as part of this patch. Admittedly, this would be mostly cosmetic as it would help mainly portability to Windows.

— Christian






_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-10  8:10 ` Christian Lindig
@ 2017-04-10  8:33   ` Wei Liu
  2017-04-10  8:34     ` Christian Lindig
  0 siblings, 1 reply; 17+ messages in thread
From: Wei Liu @ 2017-04-10  8:33 UTC (permalink / raw)
  To: Christian Lindig
  Cc: Jonathan Davies, Ian Jackson, David Scott, Wei Liu,
	xen-devel @ lists . xenproject . org

On Mon, Apr 10, 2017 at 09:10:15AM +0100, Christian Lindig wrote:
> 
> > On 7. Apr 2017, at 14:27, Jonathan Davies <Jonathan.Davies@citrix.com> wrote:
> > 
> > tools/ocaml/xenstored/domain.ml    |  4 ++--
> > tools/ocaml/xenstored/store.ml     |  8 +++++++-
> > tools/ocaml/xenstored/xenstored.ml | 10 ++++++----
> 
> The OCaml code is looking good and I’d be happy to take it as it is. 

Can I translate that to reviewed-by's?

> 
> I noticed that the (existing) code for handling the path for the
> database file uses (^) to construct it. It would be better to use
> Filename.concat and this could have been done as part of this patch.
> Admittedly, this would be mostly cosmetic as it would help mainly
> portability to Windows.
> 

Feel free to submit patches to fix that when the development window
opens.

Wei.

> — Christian

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-10  8:33   ` Wei Liu
@ 2017-04-10  8:34     ` Christian Lindig
  0 siblings, 0 replies; 17+ messages in thread
From: Christian Lindig @ 2017-04-10  8:34 UTC (permalink / raw)
  To: Wei Liu
  Cc: Jonathan Davies, Ian Jackson, David Scott,
	xen-devel @ lists . xenproject . org


> On 10. Apr 2017, at 09:33, Wei Liu <wei.liu2@citrix.com> wrote:
> 
> On Mon, Apr 10, 2017 at 09:10:15AM +0100, Christian Lindig wrote:
>> 
>>> On 7. Apr 2017, at 14:27, Jonathan Davies <Jonathan.Davies@citrix.com> wrote:
>>> 
>>> tools/ocaml/xenstored/domain.ml    |  4 ++--
>>> tools/ocaml/xenstored/store.ml     |  8 +++++++-
>>> tools/ocaml/xenstored/xenstored.ml | 10 ++++++----
>> 
>> The OCaml code is looking good and I’d be happy to take it as it is. 
> 
> Can I translate that to reviewed-by's?

Yes.

— C
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
                   ` (7 preceding siblings ...)
  2017-04-10  8:10 ` Christian Lindig
@ 2017-04-10  9:47 ` Wei Liu
  2017-04-10 13:33   ` Julien Grall
  8 siblings, 1 reply; 17+ messages in thread
From: Wei Liu @ 2017-04-10  9:47 UTC (permalink / raw)
  To: Jonathan Davies
  Cc: Wei Liu, Ian Jackson, Julien Grall, Christian Lindig,
	David Scott, xen-devel @ lists . xenproject . org

Cc Julien

These are small bug fixes that can be safely committed, IMHO.

On Fri, Apr 07, 2017 at 02:27:17PM +0100, Jonathan Davies wrote:
> In order to make oxenstored restartable, we need to save internal state 
> to a file on exit and restore from this file on startup.
> 
> Much of the infrastructure for making oxenstored restartable already 
> existed, but a handful of bugs prevented it from working.
> 
> After these patches I can do the following:
> 
>     # xenstore-write foo bar
>     # xenstore-read foo
>     bar
>     # xenstore-ls -f -p | sort > contents.before
>     # killall oxenstored
>     # ./oxenstored --restart
>     # xenstore-ls -f -p | sort > contents.after
>     # diff contents.before contents.after
>     # xenstore-read foo
>     bar
> 
> ... and I can do similar kinds of activity in a guest across the 
> restart.
> 
> Note that clients of local socket connections will get EPIPE or similar 
> when oxenstored terminates. Hence these clients need to handle this
> gracefully, e.g. by attempting to reconnect, if they wish to tolerate 
> xenstored restarts.
> 
> With these patches, the state saved on exit contains information about 
> inter-domain connections and active watches, and the contents of the
> store. Some internal state is not currently preserved over a restart:
>   1. quota usage info
>   2. partially-read and already-queued packets from rings
>   3. recent transaction history
> 
> Items 1 and 2 are probably needed for this to be considered fully 
> functional, so fixes for them should follow. But the bugfixes in this 
> series already represent a worthwhile improvement.
> 
> Jonathan Davies (5):
>   oxenstored: initialise logging earlier
>   oxenstored: avoid leading slash in paths in saved store state
>   oxenstored: save remote evtchn port, not local port
>   oxenstored: improve event-channel binding logging
>   oxenstored: make --restart option best-effort
> 
>  tools/ocaml/xenstored/domain.ml    |  4 ++--
>  tools/ocaml/xenstored/store.ml     |  8 +++++++-
>  tools/ocaml/xenstored/xenstored.ml | 10 ++++++----
>  3 files changed, 15 insertions(+), 7 deletions(-)
> 
> -- 
> 2.7.4
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/5] Towards a restartable oxenstored
  2017-04-10  9:47 ` Wei Liu
@ 2017-04-10 13:33   ` Julien Grall
  0 siblings, 0 replies; 17+ messages in thread
From: Julien Grall @ 2017-04-10 13:33 UTC (permalink / raw)
  To: Wei Liu, Jonathan Davies
  Cc: xen-devel @ lists . xenproject . org, Ian Jackson,
	Christian Lindig, David Scott

Hi Wei,

On 10/04/17 10:47, Wei Liu wrote:
> Cc Julien
>
> These are small bug fixes that can be safely committed, IMHO.

Release-acked-by: Julien Grall <julien.grall@arm.com>

Cheers,

>
> On Fri, Apr 07, 2017 at 02:27:17PM +0100, Jonathan Davies wrote:
>> In order to make oxenstored restartable, we need to save internal state
>> to a file on exit and restore from this file on startup.
>>
>> Much of the infrastructure for making oxenstored restartable already
>> existed, but a handful of bugs prevented it from working.
>>
>> After these patches I can do the following:
>>
>>     # xenstore-write foo bar
>>     # xenstore-read foo
>>     bar
>>     # xenstore-ls -f -p | sort > contents.before
>>     # killall oxenstored
>>     # ./oxenstored --restart
>>     # xenstore-ls -f -p | sort > contents.after
>>     # diff contents.before contents.after
>>     # xenstore-read foo
>>     bar
>>
>> ... and I can do similar kinds of activity in a guest across the
>> restart.
>>
>> Note that clients of local socket connections will get EPIPE or similar
>> when oxenstored terminates. Hence these clients need to handle this
>> gracefully, e.g. by attempting to reconnect, if they wish to tolerate
>> xenstored restarts.
>>
>> With these patches, the state saved on exit contains information about
>> inter-domain connections and active watches, and the contents of the
>> store. Some internal state is not currently preserved over a restart:
>>   1. quota usage info
>>   2. partially-read and already-queued packets from rings
>>   3. recent transaction history
>>
>> Items 1 and 2 are probably needed for this to be considered fully
>> functional, so fixes for them should follow. But the bugfixes in this
>> series already represent a worthwhile improvement.
>>
>> Jonathan Davies (5):
>>   oxenstored: initialise logging earlier
>>   oxenstored: avoid leading slash in paths in saved store state
>>   oxenstored: save remote evtchn port, not local port
>>   oxenstored: improve event-channel binding logging
>>   oxenstored: make --restart option best-effort
>>
>>  tools/ocaml/xenstored/domain.ml    |  4 ++--
>>  tools/ocaml/xenstored/store.ml     |  8 +++++++-
>>  tools/ocaml/xenstored/xenstored.ml | 10 ++++++----
>>  3 files changed, 15 insertions(+), 7 deletions(-)
>>
>> --
>> 2.7.4
>>

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2017-04-10 13:33 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07 13:27 [PATCH 0/5] Towards a restartable oxenstored Jonathan Davies
2017-04-07 13:27 ` [PATCH 1/5] oxenstored: initialise logging earlier Jonathan Davies
2017-04-07 13:27 ` [PATCH 2/5] oxenstored: avoid leading slash in paths in saved store state Jonathan Davies
2017-04-07 13:27 ` [PATCH 3/5] oxenstored: save remote evtchn port, not local port Jonathan Davies
2017-04-07 13:27 ` [PATCH 4/5] oxenstored: improve event-channel binding logging Jonathan Davies
2017-04-07 13:27 ` [PATCH 5/5] oxenstored: make --restart option best-effort Jonathan Davies
2017-04-07 14:09 ` [PATCH 0/5] Towards a restartable oxenstored Wei Liu
2017-04-07 14:21   ` Juergen Gross
2017-04-07 14:31     ` Jonathan Davies
2017-04-07 14:34       ` Juergen Gross
2017-04-07 14:15 ` Andrew Cooper
2017-04-07 14:27   ` Jonathan Davies
2017-04-10  8:10 ` Christian Lindig
2017-04-10  8:33   ` Wei Liu
2017-04-10  8:34     ` Christian Lindig
2017-04-10  9:47 ` Wei Liu
2017-04-10 13:33   ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.