migration/remus: bug fix and cleanup
v3 cover migration/remus: bug fix and cleanup
Wen Congyang (5):
remus: don't call stream_continue() when doing failover
remus: resume immediately if libxl__xc_domain_save_done() completes tools/libxc: don't send end record if remus fails tools/libxc: error handling for the postcopy() callback tools/libxl: remove unused function libxl__domain_save_device_model()
tools/libxc/xc_sr_save.c | 6 ++- tools/libxl/libxl.c | 4 -- tools/libxl/libxl_dom.c | 91 ---------------------------------------- tools/libxl/libxl_internal.h | 6 --- tools/libxl/libxl_stream_read.c | 21 +++++++--- tools/libxl/libxl_stream_write.c | 13 +++++- 6 files changed, 31 insertions(+), 110 deletions(-)
Signature · 1 line
2.5.0
PATCH v3 1/5 remus: don't call stream_continue() when doing failover
stream_continue() is used for migration to read emulator xenstore data and emulator context. For remus, if we do failover, we have read it in the checkpoint cycle, and we only need to complete the stream.
--- tools/libxl/libxl_stream_read.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
tools/libxl/libxl_stream_read.c +16 -5
@@ -758,6 +758,9 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void,libxl__stream_read_state *stream = &dcs->srs;STATE_AO_GC (dcs->ao); +/* convenience aliases */ +const int checkpointed_stream = dcs->restore_params.checkpointed_stream; +if (rc) goto err;
@@ -777,11 +780,19 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void,* If the stream is not still alive, we must not continue any work. */ if (libxl__stream_read_inuse (stream)) { -/* -* Libxc has indicated that it is done with the stream. Resume reading -* libxl records from it. -*/ -stream_continue (egc, stream); +if (checkpointed_stream) { +/* +* Failover from primary. Domain state is currently at a +* consistent checkpoint, ready to go. +*/ +stream_complete (egc, stream,0 ); + }else { +/* +* Libxc has indicated that it is done with the stream. +* Resume reading libxl records from it. +*/ +stream_continue (egc, stream); + } } }
Signature · 1 line
2.5.0
Re: [PATCH v3 1/5] remus: don't call stream_continue() when doing failover
Quoted 35 lines · Wen Congyang
stream_continue()is used for migration to read emulator xenstore data and emulator context. For remus, if we do failover, we have read it in the checkpoint cycle, and we only need to complete the stream.Signed-off-by Wen Congyang <[email protected]>Reviewed-by Andrew Cooper <[email protected]>---
tools/libxl/libxl_stream_read.c | 21 ++++++++++++++++-----1 file changed, 16 insertions(+), 5 deletions(-)tools/libxl/libxl_stream_read.c +0
-0@@ -758,6 +758,9 @@ void libxl__xc_domain_restore_done(libxl__egc *egc,void *dcs_void, libxl__stream_read_state *stream = &dcs->srs; STATE_AO_GC(dcs->ao);
+ /* convenience aliases */
+ const intcheckpointed_stream= dcs-Quoted 1 line
restore_params.checkpointed_stream;
+
if (rc)
goto err;tools/libxl/libxl_stream_read.c +0
-2@@ -777,11 +780,19 @@ void libxl__xc_domain_restore_done(libxl__egc *egc,void *dcs_void, * If the stream is not still alive, we must not continue any work. */ if (libxl__stream_read_inuse(stream)) { - /* -* Libxc has indicated that it is done with the stream. Resume
Quoted 8 lines
reading
- * libxl records from it.
- */
- stream_continue(egc, stream);
+ if (checkpointed_stream) {
+ /*
+ * Failover from primary. Domain state is currently at a + * consistent checkpoint, ready to go.
This implies that the stream is currently at a consistent point. Whereas what I think is meant is that things have failed (perhaps halfway through a checkpoint, i.e. not at a consistent state), therefore we stop and continue with the previous fully consistent checkpoint (which may have been earlier in the stream, not at the current point). Is that right?
And what does "ready to go" mean? Does it mean that we will return back to the next higher level or that we go somewhere else first?
The big comment about flow control at the top of this file doesn't seem to cover the checkpoint case, if it did I suspect I would have found the answers there.
Quoted 4 lines
+ */
+ stream_complete(egc, stream, 0);
+ } else {
+ /*
Quoted 8 lines
+ * Libxc has indicated that it is done with the stream. + * Resume reading libxl records from it.
+ */
+ stream_continue(egc, stream);
+ }
}
}
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 1/5] remus: don't call stream_continue() when doing failover
Quoted 42 lines · Ian Campbell
Quoted 41 lines · Wen Congyang
stream_continue()is used for migration to read emulator xenstore data and emulator context. For remus, if we do failover, we have read it in the checkpoint cycle, and we only need to complete the stream.Signed-off-by Wen Congyang <[email protected]>Reviewed-by Andrew Cooper <[email protected]>--- tools/libxl/libxl_stream_read.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)tools/libxl/libxl_stream_read.c +3
-0@@ -758,6 +758,9 @@ void libxl__xc_domain_restore_done(libxl__egc *egc,void *dcs_void, libxl__stream_read_state *stream = &dcs->srs;STATE_AO_GC (dcs->ao); +/* convenience aliases */ +const int checkpointed_stream = dcs- > restore_params.checkpointed_stream; +if (rc)goto err;tools/libxl/libxl_stream_read.c +0
-2@@ -777,11 +780,19 @@ void libxl__xc_domain_restore_done(libxl__egc *egc,void *dcs_void, * If the stream is not still alive, we must not continue any work. */ if (libxl__stream_read_inuse (stream)) { -/* -* Libxc has indicated that it is done with the stream. Resume reading
tools/libxl/libxl_stream_read.c +2
-3-* libxl records from it. -*/ -stream_continue (egc, stream); +if (checkpointed_stream) { +/*
Quoted 8 lines
tools/libxl/libxl_stream_read.c void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void, · line 786
Quoted 2 lines
tools/libxl/libxl_stream_read.c +2
-0+* Failover from primary. Domain state is currently at a +* consistent checkpoint, ready to go. This implies that the stream is currently at a consistent point. Whereas what I think is meant is that things have failed (perhaps halfway through a checkpoint, i.e. not at a consistent state), therefore we stop and continue with the previous fully consistent checkpoint (which may have been earlier in the stream, not at the current point). Is that right?
The state is always consistent, because we buffer the state until all state are received.
Quoted 3 lines
And what does "ready to go" mean? Does it mean that we will return back to the next higher level or that we go somewhere else first?
stream's callback will be called to resume the guest.
Quoted 4 lines
The big comment about flow control at the top of this file doesn't seem to cover the checkpoint case, if it did I suspect I would have found the answers there.
We buffer the state in xc_sr_restore.c.
Thanks
Wen Congyang
Quoted 14 lines
Quoted 13 lines
tools/libxl/libxl_stream_read.c +9
-0+*/ +stream_complete (egc, stream,0 ); + }else { +/* +* Libxc has indicated that it is done with the stream. +* Resume reading libxl records from it. +*/ +stream_continue (egc, stream); + } } }
Re: [PATCH v3 1/5] remus: don't call stream_continue() when doing failover
Quoted 60 lines · Wen Congyang
Quoted 50 lines · Ian Campbell
Quoted 39 lines · Wen Congyang
stream_continue()is used for migration to read emulator xenstore data and emulator context. For remus, if we do failover, we have read it in the checkpoint cycle, and we only need to complete the stream.Signed-off-by Wen Congyang <[email protected]>Reviewed-by Andrew Cooper <[email protected]>---
tools/libxl/libxl_stream_read.c | 21 ++++++++++++++++-----1 file changed, 16 insertions(+), 5 deletions(-)tools/libxl/libxl_stream_read.c +0
-0@@ -758,6 +758,9 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void, libxl__stream_read_state *stream = &dcs->srs; STATE_AO_GC(dcs->ao);
+ /* convenience aliases */
+ const intcheckpointed_stream= dcs-Quoted 1 line
restore_params.checkpointed_stream;
+
if (rc)
goto err;tools/libxl/libxl_stream_read.c +0
-0@@ -777,11 +780,19 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void, * If the stream is not still alive, we must not continue anywork.
*/
if (libxl__stream_read_inuse(stream)) {
- /*
- * Libxc has indicated that it is done with the stream. ResumeQuoted 8 lines
reading
- * libxl records from it.
- */
- stream_continue(egc, stream);
+ if (checkpointed_stream) {
+ /*
+ * Failover from primary. Domain state is currently at a + * consistent checkpoint, ready to go.This implies that the stream is currently at a consistent point.
Quoted 8 lines
Whereas
what I think is meant is that things have failed (perhaps halfway through a
checkpoint, i.e. not at a consistent state), therefore we stop and continue
with the previous fully consistent checkpoint (which may have been earlier
in the stream, not at the current point). Is that right?
Quoted 2 lines
The state is always consistent, because we buffer the state until all state are received.
I think the comment is misleading, it implies that the state up to and including the current point is consistent, when really there is buffered partial state which is not consistent (because it is partial). This misleadingness is mainly because of the "at a consistent checkpoint" wording I think.
Quoted 7 lines
Quoted 5 lines
And what does "ready to go" mean? Does it mean that we will return back to
the next higher level or that we go somewhere else first?stream's callback will be called to resume the guest.
Please update the comment.
Quoted 6 lines
Quoted 4 lines
The big comment about flow control at the top of this file doesn't seem to cover the checkpoint case, if it did I suspect I would have found the answers there.
We buffer the state in
xc_sr_restore.c.
Perhaps I was too subtle: Please update the comment about flow control at the top of the file.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 1/5] remus: don't call stream_continue() when doing failover
In reply to Wen CongyangQuoted 4 lines · Wen Congyang
stream_continue()is used for migration to read emulator xenstore data and emulator context. For remus, if we do failover, we have read it in the checkpoint cycle, and we only need to complete the stream.
Quoted 47 lines
Signed-off-by Wen Congyang <[email protected]>Reviewed-by Andrew Cooper <[email protected]>--- tools/libxl/libxl_stream_read.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)tools/libxl/libxl_stream_read.c +16
-5@@ -758,6 +758,9 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void,libxl__stream_read_state *stream = &dcs->srs;STATE_AO_GC (dcs->ao); +/* convenience aliases */ +const int checkpointed_stream = dcs->restore_params.checkpointed_stream; +if (rc) goto err;@@ -777,11 +780,19 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void,* If the stream is not still alive, we must not continue any work. */ if (libxl__stream_read_inuse (stream)) { -/* -* Libxc has indicated that it is done with the stream. Resume reading -* libxl records from it. -*/ -stream_continue (egc, stream); +if (checkpointed_stream) { +/* +* Failover from primary. Domain state is currently at a +* consistent checkpoint, ready to go. +*/ +stream_complete (egc, stream,0 ); + }else { +/* +* Libxc has indicated that it is done with the stream. +* Resume reading libxl records from it. +*/ +stream_continue (egc, stream); + } } }
Signature · 2 lines
Thanks, Yang
PATCH v3 2/5 remus: resume immediately if libxl__xc_domain_save_done() completes
In reply to Wen CongyangFor example: if the secondary host is down, and we fail to send the data to the secondary host. xc_domain_save() returns 0. So in the function libxl__xc_domain_save_done(), rc is 0(the helper program exits normally), and retval is 0(it is xc_domain_save()'s return value). In such case, we just need to complete the stream.
--- tools/libxl/libxl_stream_write.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
tools/libxl/libxl_stream_write.c +11 -2
@@ -354,8 +354,17 @@ void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void,* alive, and check_all_finished() may have torn it down around us. * If the stream is not still alive, we must not continue any work. */ -if (libxl__stream_write_inuse (stream)) -write_emulator_xenstore_record (egc, stream); +if (libxl__stream_write_inuse (stream)) { +if (dss->remus) +/* +* For remus, if libxl__xc_domain_save_done() completes, +* there was an error sending data to the secondary. +* Resume the primary ASAP. +*/ +stream_complete (egc, stream,0 ); +else +write_emulator_xenstore_record (egc, stream); + } } static void write_emulator_xenstore_record(libxl__egc *egc,
Signature · 1 line
2.5.0
Re: [PATCH v3 2/5] remus: resume immediately if libxl__xc_domain_save_done() completes
Quoted 7 lines · Wen Congyang
For example: if the secondary host is down, and we fail to send the data to the secondary host.
xc_domain_save()returns 0. So in the functionlibxl__xc_domain_save_done(), rc is 0(the helper program exits normally), and retval is 0(it is xc_domain_save()'s return value). In such case, we just need to complete the stream.Signed-off-by Wen Congyang <[email protected]>
Re: [PATCH v3 2/5] remus: resume immediately if libxl__xc_domain_save_done() completes
In reply to Wen CongyangQuoted 3 lines · Wen Congyang
For example: if the secondary host is down, and we fail to send the data to
the secondary host.xc_domain_save()returns 0.
Just to be check: On failure in this way xc_domain_save() returns 0 (i.e. success)?
Quoted 20 lines
So in the function
libxl__xc_domain_save_done(), rc is 0(the helper program exits normally), and retval is 0(it is xc_domain_save()'s return value). In such case, we just need to complete the stream.Signed-off-by Wen Congyang <[email protected]>---
tools/libxl/libxl_stream_write.c | 13 +++++++++++--1 file changed, 11 insertions(+), 2 deletions(-)tools/libxl/libxl_stream_write.c +0
-0@@ -354,8 +354,17 @@ void libxl__xc_domain_save_done(libxl__egc *egc,void *dss_void, * alive, and check_all_finished() may have torn it down around us. * If the stream is not still alive, we must not continue any work. */
tools/libxl/libxl_stream_write.c void libxl__xc_domain_save_done(libxl__egc *egc, · line 365
Quoted 10 lines
tools/libxl/libxl_stream_write.c +8
-2- if (libxl__stream_write_inuse(stream)) - write_emulator_xenstore_record(egc, stream); + if (libxl__stream_write_inuse(stream)) { + if (dss->remus) + /* + * For remus, if libxl__xc_domain_save_done() completes, + * there was an error sending data to the secondary. + * Resume the primary ASAP. + */ + stream_complete(egc, stream, 0);
Is there an indication to the caller that things have failed in this way? Would that information be of use to the caller?
Or does the called infer this has happened because otherwise libxl_domain_remus_start is not supposed to return?
Quoted 6 lines
tools/libxl/libxl_stream_write.c +3
-0+ else + write_emulator_xenstore_record(egc, stream); + } }
static void write_emulator_xenstore_record(libxl__egc *egc,
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 2/5] remus: resume immediately if libxl__xc_domain_save_done() completes
Quoted 7 lines · Ian Campbell
Quoted 3 lines · Wen Congyang
For example: if the secondary host is down, and we fail to send the data to
the secondary host.xc_domain_save()returns 0.Just to be check: On failure in this way
xc_domain_save()returns 0 (i.e. success)?
Yes, it returns 0. I am not sure the return value is right.
Quoted 26 lines
Quoted 26 lines
So in the function
libxl__xc_domain_save_done(), rc is 0(the helper program exits normally), and retval is 0(it is xc_domain_save()'s return value). In such case, we just need to complete the stream.Signed-off-by Wen Congyang <[email protected]>--- tools/libxl/libxl_stream_write.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)tools/libxl/libxl_stream_write.c +3
-2@@ -354,8 +354,17 @@ void libxl__xc_domain_save_done(libxl__egc *egc,void *dss_void, * alive, and check_all_finished() may have torn it down around us. * If the stream is not still alive, we must not continue any work. */ -if (libxl__stream_write_inuse (stream)) -write_emulator_xenstore_record (egc, stream); +if (libxl__stream_write_inuse (stream)) { +if (dss->remus) +/*
Quoted 8 lines
tools/libxl/libxl_stream_write.c void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void, · line 364
Quoted 5 lines
tools/libxl/libxl_stream_write.c +5
-0+* For remus, if libxl__xc_domain_save_done() completes, +* there was an error sending data to the secondary. +* Resume the primary ASAP. +*/ +stream_complete (egc, stream,0 );Is there an indication to the caller that things have failed in this way? Would that information be of use to the caller?
For remus, when we come here, something is wrong regardless of the return value.
Quoted 3 lines
Or does the called infer this has happened because otherwise
libxl_domain_remus_startis not supposed to return?
Yes, libxl_domain_remus_start() should not return unless somethins is wrong.
Thanks
Wen Congyang
Quoted 11 lines
Quoted 7 lines
tools/libxl/libxl_stream_write.c +3
-0+else +write_emulator_xenstore_record (egc, stream); + } }static void write_emulator_xenstore_record(libxl__egc *egc,
.
Re: [PATCH v3 2/5] remus: resume immediately if libxl__xc_domain_save_done() completes
Quoted 53 lines · Wen Congyang
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Wen Congyang
For example: if the secondary host is down, and we fail to send the data
to
the secondary host.xc_domain_save()returns 0.Just to be check: On failure in this way
xc_domain_save()returns 0 (i.e.
success)?Yes, it returns 0. I am not sure the return value is right.
Quoted 31 lines
Quoted 31 lines
So in the function
libxl__xc_domain_save_done(), rc is 0(the helper program exits normally),
and retval is 0(it is xc_domain_save()'s return value). In such case, we
just need to complete the stream.Signed-off-by Wen Congyang <[email protected]>---
tools/libxl/libxl_stream_write.c | 13 +++++++++++--1 file changed, 11 insertions(+), 2 deletions(-)tools/libxl/libxl_stream_write.c +0
-0@@ -354,8 +354,17 @@ void libxl__xc_domain_save_done(libxl__egc *egc,void *dss_void, * alive, and check_all_finished() may have torn it down aroundus.
* If the stream is not still alive, we must not continue any work.
*/
- if (libxl__stream_write_inuse(stream))
- write_emulator_xenstore_record(egc, stream);
+ if (libxl__stream_write_inuse(stream)) {
+ if (dss->remus)
+ /*
+ * For remus, iflibxl__xc_domain_save_done()completes,Quoted 8 lines
Quoted 4 lines
+ * there was an error sending data to the secondary. + * Resume the primary ASAP.
+ */
+ stream_complete(egc, stream, 0);Is there an indication to the caller that things have failed in this way?
Would that information be of use to the caller?
Quoted 2 lines
For remus, when we come here, something is wrong regardless of the return value.
But does the caller know this? Can it tell.
Quoted 7 lines
Quoted 4 lines
Or does the called infer this has happened because otherwise
libxl_domain_remus_startis not supposed to return?Yes,
libxl_domain_remus_start()should not return unless somethins is wrong.
This really ought to be documented somewhere.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 2/5] remus: resume immediately if libxl__xc_domain_save_done() completes
Quoted 61 lines · Ian Campbell
Quoted 53 lines · Wen Congyang
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Wen Congyang
For example: if the secondary host is down, and we fail to send the data
to
the secondary host.xc_domain_save()returns 0.Just to be check: On failure in this way
xc_domain_save()returns 0 (i.e.
success)?Yes, it returns 0. I am not sure the return value is right.
Quoted 31 lines
Quoted 31 lines
So in the function
libxl__xc_domain_save_done(), rc is 0(the helper program exits normally),
and retval is 0(it is xc_domain_save()'s return value). In such case, we
just need to complete the stream.Signed-off-by Wen Congyang <[email protected]>--- tools/libxl/libxl_stream_write.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)tools/libxl/libxl_stream_write.c +0
-0@@ -354,8 +354,17 @@ void libxl__xc_domain_save_done(libxl__egc *egc,void *dss_void, * alive, and check_all_finished() may have torn it down aroundus.
* If the stream is not still alive, we must not continue any
work.*/tools/libxl/libxl_stream_write.c +4
-2-if (libxl__stream_write_inuse (stream)) -write_emulator_xenstore_record (egc, stream); +if (libxl__stream_write_inuse (stream)) { +if (dss->remus) +/* +* For remus, if libxl__xc_domain_save_done() completes, Quoted 8 lines
tools/libxl/libxl_stream_write.c void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void, · line 364
Quoted 4 lines
tools/libxl/libxl_stream_write.c +4
-0+* there was an error sending data to the secondary. +* Resume the primary ASAP. +*/ +stream_complete (egc, stream,0 );Is there an indication to the caller that things have failed in this way?
Would that information be of use to the caller?Quoted 2 lines
For remus, when we come here, something is wrong regardless of the return value.
But does the caller know this? Can it tell.
Quoted 2 lines
Quoted 2 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Or does the called infer this has happened because otherwise
libxl_domain_remus_startis not supposed to return?Yes,
libxl_domain_remus_start()should not return unless somethins is wrong.This really ought to be documented somewhere.
libxl_domain_remus_start():
/* Point of no return */
libxl__remus_setup(egc, dss);
return AO_INPROGRESS;Thanks
Wen Congyang
Quoted 6 lines
.
Re: [PATCH v3 2/5] remus: resume immediately if libxl__xc_domain_save_done() completes
Quoted 76 lines · Wen Congyang
Quoted 75 lines · Ian Campbell
Quoted 60 lines · Wen Congyang
Quoted 10 lines · Ian Campbell
Quoted 5 lines · Wen Congyang
For example: if the secondary host is down, and we fail to send the
data
to
the secondary host.xc_domain_save()returns 0.Just to be check: On failure in this way
xc_domain_save()returns 0 (i.e.
success)?Yes, it returns 0. I am not sure the return value is right.
Quoted 37 lines
Quoted 37 lines
So in the function
libxl__xc_domain_save_done(), rc is 0(the helper program exits normally),
and retval is 0(it is xc_domain_save()'s return value). In such case,
we
just need to complete the stream.Signed-off-by Wen Congyang <[email protected]>---
tools/libxl/libxl_stream_write.c | 13 +++++++++++--1 file changed, 11 insertions(+), 2 deletions(-)tools/libxl/libxl_stream_write.c +0
-0@@ -354,8 +354,17 @@ void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void, * alive, and check_all_finished() may have torn it downaround
us.
* If the stream is not still alive, we must not continue any
work.
*/
- if (libxl__stream_write_inuse(stream))
- write_emulator_xenstore_record(egc, stream);
+ if (libxl__stream_write_inuse(stream)) {
+ if (dss->remus)
+ /*
+ * For remus, iflibxl__xc_domain_save_done()completes,
+ * there was an error sending data to the secondary.Quoted 8 lines
Quoted 3 lines
+ * Resume the primary ASAP.
+ */
+ stream_complete(egc, stream, 0);Is there an indication to the caller that things have failed in this
way?
Would that information be of use to the caller?Quoted 3 lines
For remus, when we come here, something is wrong regardless of the return
value.But does the caller know this? Can it tell.
Quoted 7 lines
Quoted 4 lines
Or does the called infer this has happened because otherwise
libxl_domain_remus_startis not supposed to return?Yes,
libxl_domain_remus_start()should not return unless somethins is wrong.
Quoted 6 lines
Quoted 1 line
This really ought to be documented somewhere.
libxl_domain_remus_start():
/* Point of no return */
libxl__remus_setup(egc, dss);
returnAO_INPROGRESS;
This is (obviously) not documentation.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 2/5] remus: resume immediately if libxl__xc_domain_save_done() completes
Quoted 77 lines · Ian Campbell
Quoted 76 lines · Wen Congyang
Quoted 75 lines · Ian Campbell
Quoted 60 lines · Wen Congyang
Quoted 10 lines · Ian Campbell
Quoted 5 lines · Wen Congyang
For example: if the secondary host is down, and we fail to send the
data
to
the secondary host.xc_domain_save()returns 0.Just to be check: On failure in this way
xc_domain_save()returns 0 (i.e.
success)?Yes, it returns 0. I am not sure the return value is right.
Quoted 37 lines
Quoted 37 lines
So in the function
libxl__xc_domain_save_done(), rc is 0(the helper program exits normally),
and retval is 0(it is xc_domain_save()'s return value). In such case,
we
just need to complete the stream.Signed-off-by Wen Congyang <[email protected]>--- tools/libxl/libxl_stream_write.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)tools/libxl/libxl_stream_write.c +0
-0@@ -354,8 +354,17 @@ void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void, * alive, and check_all_finished() may have torn it downaround
us.
* If the stream is not still alive, we must not continue
any
work.*/tools/libxl/libxl_stream_write.c +4
-2-if (libxl__stream_write_inuse (stream)) -write_emulator_xenstore_record (egc, stream); +if (libxl__stream_write_inuse (stream)) { +if (dss->remus) +/* +* For remus, if libxl__xc_domain_save_done() completes,
+ * there was an error sending data to the secondary.Quoted 8 lines
tools/libxl/libxl_stream_write.c void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void, · line 364
Quoted 3 lines
tools/libxl/libxl_stream_write.c +3
-0+* Resume the primary ASAP. +*/ +stream_complete (egc, stream,0 );Is there an indication to the caller that things have failed in this
way?
Would that information be of use to the caller?Quoted 3 lines
For remus, when we come here, something is wrong regardless of the return
value.But does the caller know this? Can it tell.
Quoted 7 lines
Quoted 4 lines
Or does the called infer this has happened because otherwise
libxl_domain_remus_startis not supposed to return?Yes,
libxl_domain_remus_start()should not return unless somethins is wrong.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
This really ought to be documented somewhere.
libxl_domain_remus_start():/* Point of no return */ libxl__remus_setup(egc, dss); return AO_INPROGRESS;This is (obviously) not documentation.
OK, I will update the comment.
Thanks
Wen Congyang
Quoted 5 lines
.
Re: [PATCH v3 2/5] remus: resume immediately if libxl__xc_domain_save_done() completes
In reply to Wen CongyangQuoted 16 lines · Wen Congyang
For example: if the secondary host is down, and we fail to send the data to the secondary host.
xc_domain_save()returns 0. So in the functionlibxl__xc_domain_save_done(), rc is 0(the helper program exits normally), and retval is 0(it is xc_domain_save()'s return value). In such case, we just need to complete the stream.Signed-off-by Wen Congyang <[email protected]>--- tools/libxl/libxl_stream_write.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)tools/libxl/libxl_stream_write.c +0
-0
tools/libxl/libxl_stream_write.c void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void, · line 360
Quoted 9 lines
tools/libxl/libxl_stream_write.c +4
-2@@ -354,8 +354,17 @@ void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void,* alive, and check_all_finished() may have torn it down around us. * If the stream is not still alive, we must not continue any work. */ -if (libxl__stream_write_inuse (stream)) -write_emulator_xenstore_record (egc, stream); +if (libxl__stream_write_inuse (stream)) { +if (dss->remus) +/* +* For remus, if libxl__xc_domain_save_done() completes,
xc_domain_save() completes.
Quoted 11 lines
tools/libxl/libxl_stream_write.c +7
-0+* there was an error sending data to the secondary. +* Resume the primary ASAP. +*/ +stream_complete (egc, stream,0 ); + else +write_emulator_xenstore_record (egc ,stream ); + } } static void write_emulator_xenstore_record(libxl__egc *egc,
Signature · 2 lines
Thanks, Yang
PATCH v3 3/5 tools/libxc: don't send end record if remus fails
In reply to Wen Congyang--- tools/libxc/xc_sr_save.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_sr_save.c +1 -1
@@ -795,7 +795,7 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type) rc = ctx->save.callbacks->checkpoint (ctx->save.callbacks->data);if ( rc <=0 ) - ctx->save.checkpointed = false; + goto err; } }while ( ctx->save.checkpointed );
Signature · 1 line
2.5.0
Re: [PATCH v3 3/5] tools/libxc: don't send end record if remus fails
some commit message would be better.
Quoted 20 lines · Wen Congyang
Signed-off-by Wen Congyang <[email protected]>Reviewed-by Andrew Cooper <[email protected]>--- tools/libxc/xc_sr_save.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/libxc/xc_sr_save.c +1
-1@@ -795,7 +795,7 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type) rc = ctx->save.callbacks->checkpoint (ctx->save.callbacks->data);if ( rc <=0 ) - ctx->save.checkpointed = false; + goto err; } }while ( ctx->save.checkpointed );
Signature · 2 lines
Thanks, Yang
PATCH v3 4/5 tools/libxc: error handling for the postcopy() callback
In reply to Wen Congyang--- tools/libxc/xc_sr_save.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/libxc/xc_sr_save.c +3 -1
@@ -791,7 +791,9 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)if ( rc ) goto err; - ctx->save.callbacks->postcopy (ctx->save.callbacks->data); + rc = ctx->save.callbacks->postcopy (ctx->save.callbacks->data); +if ( rc <=0 ) + goto err; rc = ctx->save.callbacks->checkpoint (ctx->save.callbacks->data);if ( rc <=0 )
Signature · 1 line
2.5.0
Re: [PATCH v3 4/5] tools/libxc: error handling for the postcopy() callback
ditto
Quoted 22 lines · Wen Congyang
Signed-off-by Wen Congyang <[email protected]>Reviewed-by Andrew Cooper <[email protected]>--- tools/libxc/xc_sr_save.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/libxc/xc_sr_save.c +3
-1@@ -791,7 +791,9 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)if ( rc ) goto err; - ctx->save.callbacks->postcopy (ctx->save.callbacks->data); + rc = ctx->save.callbacks->postcopy (ctx->save.callbacks->data); +if ( rc <=0 ) + goto err; rc = ctx->save.callbacks->checkpoint (ctx->save.callbacks->data);if ( rc <=0 )
Signature · 2 lines
Thanks, Yang
Re: [PATCH v3 4/5] tools/libxc: error handling for the postcopy() callback
Quoted 3 lines · Yang Hongyang
ditto
Reviewed-by Yang Hongyang <[email protected]>
The newest version is v5, and this series is in the staging now.
Thanks for your review.
Wen Congyang
Quoted 25 lines · Wen Congyang
Quoted 22 lines
Signed-off-by Wen Congyang <[email protected]>Reviewed-by Andrew Cooper <[email protected]>--- tools/libxc/xc_sr_save.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/libxc/xc_sr_save.c +3
-1@@ -791,7 +791,9 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)if ( rc ) goto err; - ctx->save.callbacks->postcopy (ctx->save.callbacks->data); + rc = ctx->save.callbacks->postcopy (ctx->save.callbacks->data); +if ( rc <=0 ) + goto err; rc = ctx->save.callbacks->checkpoint (ctx->save.callbacks->data);if ( rc <=0 )
Re: [PATCH v3 4/5] tools/libxc: error handling for the postcopy() callback
Quoted 6 lines · Wen Congyang
Quoted 3 lines · Yang Hongyang
ditto
Reviewed-by Yang Hongyang <[email protected]>The newest version is v5, and this series is in the staging now.
Sorry for the noise...I saw the series too late, please ignore my comments...
Quoted 33 lines
Thanks for your review.
Wen CongyangQuoted 25 lines · Wen Congyang
Quoted 22 lines
Signed-off-by Wen Congyang <[email protected]>Reviewed-by Andrew Cooper <[email protected]>--- tools/libxc/xc_sr_save.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)tools/libxc/xc_sr_save.c +3
-1@@ -791,7 +791,9 @@ static int save(struct xc_sr_context *ctx, uint16_t guest_type)if ( rc ) goto err; - ctx->save.callbacks->postcopy (ctx->save.callbacks->data); + rc = ctx->save.callbacks->postcopy (ctx->save.callbacks->data); +if ( rc <=0 ) + goto err; rc = ctx->save.callbacks->checkpoint (ctx->save.callbacks->data);if ( rc <=0 )
Signature · 2 lines
Thanks, Yang
Re: [PATCH v3 4/5] tools/libxc: error handling for the postcopy() callback
Quoted 11 lines · Yang Hongyang
Quoted 6 lines · Wen Congyang
Quoted 3 lines · Yang Hongyang
ditto
Reviewed-by Yang Hongyang <[email protected]>The newest version is v5, and this series is in the staging now.
Sorry for the noise...I saw the series too late, please ignore my comments...
Is an update to the MAINTAINERS file required?
Ian.
PATCH v3 5/5 tools/libxl: remove unused function libxl__domain_save_device_model()
In reply to Wen CongyangAfter the commit d77570e7, libxl__domain_save_device_model() can be dropped.
--- tools/libxl/libxl.c | 4 -- tools/libxl/libxl_dom.c | 91 -------------------------------------------- tools/libxl/libxl_internal.h | 6 --- 3 files changed, 101 deletions(-)
tools/libxl/libxl.c +0 -4
@@ -1551,10 +1551,6 @@ static void stubdom_destroy_callback(libxl__egc *egc, dds->stubdom_finished =1 ; savefile =libxl__device_model_savefile (gc, dis->domid); rc =libxl__remove_file (gc, savefile); -/* -* On suspend libxl__domain_save_device_model will have already -* unlinked the save file. -*/ if (rc) {LOG (ERROR ,"failed to remove device-model savefile %s" , savefile); }
tools/libxl/libxl_dom.c +0 -91
97 lines not on this page · raw message
tools/libxl/libxl_internal.h +0 -6
@@ -3103,9 +3103,6 @@ struct libxl__domain_suspend_state {libxl__logdirty_switch logdirty;void (*callback_common_done)(libxl__egc *,struct libxl__domain_suspend_state *,int ok); -/* private for libxl__domain_save_device_model */ -libxl__save_device_model_cb *save_dm_callback; -libxl__datacopier_state save_dm_datacopier; };
@@ -3498,9 +3495,6 @@ static inline bool libxl__save_helper_inuse(const libxl__save_helper_state *shs)/* Each time the dm needs to be saved, we must call suspend and then save */ _hidden int libxl__domain_suspend_device_model(libxl__gc *gc,libxl__domain_suspend_state *dss); -_hidden void libxl__domain_save_device_model(libxl__egc *egc, -libxl__domain_suspend_state *dss, -libxl__save_device_model_cb *callback); _hidden const char *libxl__device_model_savefile(libxl__gc *gc, uint32_t domid);
Signature · 1 line
2.5.0
Re: [PATCH v3 5/5] tools/libxl: remove unused function libxl__domain_save_device_model()
Quoted 1 line · Wen Congyang
After the commit
d77570e7,libxl__domain_save_device_model()can
^ is completely unused and can ...
apart from that:
Quoted 3 lines
be dropped.
Signed-off-by Wen Congyang <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel