From: Lai Jiangshan Subject: [PATCH 10/13 V6] remus: use the API to teardown network buffering Date: Tue, 21 Jan 2014 17:05:14 +0800 Message-ID: <1390295117-718-11-git-send-email-laijs@cn.fujitsu.com> References: <1390295117-718-1-git-send-email-laijs@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1390295117-718-1-git-send-email-laijs@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ian Campbell , FNST-Wen Congyang , Stefano Stabellini , Andrew Cooper , Jiang Yunhong , Ian Jackson , Lai Jiangshan , Dong Eddie , Shriram Rajagopalan , Roger Pau Monne List-Id: xen-devel@lists.xenproject.org From: Shriram Rajagopalan If there is network buffering hotplug scripts, call libxl__remus_netbuf_teardown() to teardown network buffering. Signed-off-by: Shriram Rajagopalan Signed-off-by: Lai Jiangshan Reviewed-by: Wen Congyang --- tools/libxl/libxl.c | 4 ---- tools/libxl/libxl_dom.c | 11 +++++++++++ tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_remus.c | 13 +++++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index f45fd74..83d3772 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -778,10 +778,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 e3e9f6f..912a6e4 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -1519,6 +1519,17 @@ void domain_suspend_done(libxl__egc *egc, if (dss->xce != NULL) xc_evtchn_close(dss->xce); + 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 657cfc4..f818916 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2339,6 +2339,10 @@ _hidden void libxl__remus_netbuf_teardown(libxl__egc *egc, _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 38776e1..0d281a0 100644 --- a/tools/libxl/libxl_remus.c +++ b/tools/libxl/libxl_remus.c @@ -44,6 +44,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.4.2