[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V8 5/8] libxl: use the API to setup/teardown network buffering
If there is network buffering hotplug scripts, call libxl__remus_netbuf_setup() to setup the network buffering and libxl__remus_netbuf_teardown() to teardown network buffering. Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx> Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx> Reviewed-by: Wen Congyang <wency@xxxxxxxxxxxxxx> --- tools/libxl/libxl.c | 6 +----- tools/libxl/libxl_dom.c | 11 +++++++++++ tools/libxl/libxl_internal.h | 7 +++++++ tools/libxl/libxl_remus.c | 22 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index f7696a3..88b34a4 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -768,7 +768,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, } /* Point of no return */ - libxl__domain_suspend(egc, dss); + libxl__remus_setup_initiate(egc, dss); return AO_INPROGRESS; out: @@ -784,10 +784,6 @@ static void remus_failover_cb(libxl__egc *egc, * backup died or some network error occurred preventing us * from sending checkpoints. */ - - /* TBD: Remus cleanup - i.e. detach qdisc, release other - * resources. - */ libxl__ao_complete(egc, ao, rc); } diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index 20aaec8..0695f3e 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -1715,6 +1715,17 @@ void domain_suspend_done(libxl__egc *egc, xc_suspend_evtchn_release(CTX->xch, CTX->xce, domid, dss->guest_evtchn.port, &dss->guest_evtchn_lockfd); + if (dss->remus_state) { + /* + * With Remus, if we reach this point, it means either + * backup died or some network error occurred preventing us + * from sending checkpoints. Teardown the network buffers and + * release netlink resources. This is an async op. + */ + libxl__remus_teardown_initiate(egc, dss, rc); + return; + } + dss->callback(egc, dss, rc); } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 1357f2d..34953ae 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2472,6 +2472,13 @@ _hidden int libxl__remus_netbuf_release_prev_epoch(libxl__gc *gc, uint32_t domid, libxl__remus_state *remus_state); +_hidden void libxl__remus_setup_initiate(libxl__egc *egc, + libxl__domain_suspend_state *dss); + +_hidden void libxl__remus_teardown_initiate(libxl__egc *egc, + libxl__domain_suspend_state *dss, + int rc); + struct libxl__domain_suspend_state { /* set by caller of libxl__domain_suspend */ libxl__ao *ao; diff --git a/tools/libxl/libxl_remus.c b/tools/libxl/libxl_remus.c index 4e40412..da303e7 100644 --- a/tools/libxl/libxl_remus.c +++ b/tools/libxl/libxl_remus.c @@ -18,6 +18,15 @@ #include "libxl_internal.h" /*----- remus setup/teardown code -----*/ +void libxl__remus_setup_initiate(libxl__egc *egc, + libxl__domain_suspend_state *dss) +{ + libxl__ev_time_init(&dss->remus_state->timeout); + if (!dss->remus_state->netbufscript) + libxl__remus_setup_done(egc, dss, 0); + else + libxl__remus_netbuf_setup(egc, dss); +} void libxl__remus_setup_done(libxl__egc *egc, libxl__domain_suspend_state *dss, @@ -34,6 +43,19 @@ void libxl__remus_setup_done(libxl__egc *egc, domain_suspend_done(egc, dss, rc); } +void libxl__remus_teardown_initiate(libxl__egc *egc, + libxl__domain_suspend_state *dss, + int rc) +{ + /* stash rc somewhere before invoking teardown ops. */ + dss->remus_state->saved_rc = rc; + + if (!dss->remus_state->netbuf_state) + libxl__remus_teardown_done(egc, dss); + else + libxl__remus_netbuf_teardown(egc, dss); +} + void libxl__remus_teardown_done(libxl__egc *egc, libxl__domain_suspend_state *dss) { -- 1.8.3.2 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |