[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V9 09/12] libxl: use the API to setup/teardown network buffering
--- tools/libxl/libxl.c | 6 +----- tools/libxl/libxl_dom.c | 11 +++++++++++ tools/libxl/libxl_internal.h | 10 ++++++++++ tools/libxl/libxl_remus.c | 16 ++++++++++++++++ 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 687a2a9..32b836f 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -766,7 +766,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: @@ -782,10 +782,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 fc0c136..16ea7d8 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -1728,6 +1728,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 b72643b..3c0f94d 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2467,6 +2467,9 @@ typedef struct libxl__remus_state { int saved_rc; /* Opaque context containing device related stuff */ void *device_state; + + /* used for checkpoint */ + libxl__ev_time timeout; } libxl__remus_state; _hidden int libxl__netbuffer_enabled(libxl__gc *gc); @@ -2491,6 +2494,13 @@ _hidden int libxl__remus_device_postsuspend(libxl__remus_state *remus_state); _hidden int libxl__remus_device_preresume(libxl__remus_state *remus_state); _hidden int libxl__remus_device_commit(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 05af451..1e17259 100644 --- a/tools/libxl/libxl_remus.c +++ b/tools/libxl/libxl_remus.c @@ -18,6 +18,12 @@ #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); + libxl__remus_device_setup(egc, dss); +} void libxl__remus_setup_done(libxl__egc *egc, libxl__domain_suspend_state *dss, @@ -34,6 +40,16 @@ 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; + + libxl__remus_device_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 |