From patchwork Fri Mar 11 05:39:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Congyang X-Patchwork-Id: 8562221 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 437829FDD5 for ; Fri, 11 Mar 2016 05:41:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 173E220375 for ; Fri, 11 Mar 2016 05:41:03 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B40C42034F for ; Fri, 11 Mar 2016 05:41:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aeFmA-0002zy-4Z; Fri, 11 Mar 2016 05:38:14 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aeFm9-0002yy-0h for xen-devel@lists.xen.org; Fri, 11 Mar 2016 05:38:13 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 4B/A0-07924-4C952E65; Fri, 11 Mar 2016 05:38:12 +0000 X-Env-Sender: wency@cn.fujitsu.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1457674689!28316994!1 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31944 invoked from network); 11 Mar 2016 05:38:10 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-10.tower-31.messagelabs.com with SMTP; 11 Mar 2016 05:38:10 -0000 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="4465738" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 11 Mar 2016 13:38:01 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 1B37342B4B19; Fri, 11 Mar 2016 13:37:59 +0800 (CST) Received: from G08FNSTD140052.g08.fujitsu.local (10.167.226.52) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 11 Mar 2016 13:37:58 +0800 From: Wen Congyang To: xen devel , Andrew Cooper , Wei Liu Date: Fri, 11 Mar 2016 13:39:04 +0800 Message-ID: <1457674744-12495-3-git-send-email-wency@cn.fujitsu.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457674744-12495-1-git-send-email-wency@cn.fujitsu.com> References: <1457674744-12495-1-git-send-email-wency@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.52] X-yoursite-MailScanner-ID: 1B37342B4B19.AA1B0 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: wency@cn.fujitsu.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Cc: Ian Jackson , Ian Campbell , Wen Congyang Subject: [Xen-devel] [PATCH v3 3/3] libxl: rename checkpointed_stream to stream_type X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Wen Congyang Acked-by: Wei Liu --- tools/libxl/libxl.c | 4 ++-- tools/libxl/libxl.h | 8 ++++++++ tools/libxl/libxl_create.c | 4 ++-- tools/libxl/libxl_dom_save.c | 6 +++--- tools/libxl/libxl_internal.h | 2 +- tools/libxl/libxl_save_callout.c | 4 ++-- tools/libxl/libxl_stream_read.c | 4 ++-- tools/libxl/libxl_stream_write.c | 2 +- tools/libxl/libxl_types.idl | 2 +- tools/libxl/xl_cmdimpl.c | 16 ++++++++-------- 10 files changed, 30 insertions(+), 22 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 4cdc169..7c2c9fc 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -876,7 +876,7 @@ int libxl_domain_remus_start(libxl_ctx *ctx, libxl_domain_remus_info *info, dss->live = 1; dss->debug = 0; dss->remus = info; - dss->checkpointed_stream = LIBXL_CHECKPOINTED_STREAM_REMUS; + dss->stream_type = LIBXL_CHECKPOINTED_STREAM_REMUS; assert(info); @@ -937,7 +937,7 @@ int libxl_domain_suspend(libxl_ctx *ctx, uint32_t domid, int fd, int flags, dss->type = type; dss->live = flags & LIBXL_SUSPEND_LIVE; dss->debug = flags & LIBXL_SUSPEND_DEBUG; - dss->checkpointed_stream = LIBXL_CHECKPOINTED_STREAM_NONE; + dss->stream_type = LIBXL_CHECKPOINTED_STREAM_NONE; rc = libxl__fd_flags_modify_save(gc, dss->fd, ~(O_NONBLOCK|O_NDELAY), 0, diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index f9e3ef5..86b1d06 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -863,6 +863,14 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, libxl_mac *src); #define LIBXL_HAVE_SRM_V1 1 /* + * LIBXL_HAVE_STREAM_TYPE + * + * If this is define, then the libxl_domain_create_restore() interfaces;s + * parameter checkpointed_stream is renamed to stream_type + */ +#define LIBXL_HAVE_STREAM_TYPE 1 + +/* * libxl_domain_build_info has the u.hvm.gfx_passthru_kind field and * the libxl_gfx_passthru_kind enumeration is defined. */ diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index f1028bc..b28eb89 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -993,7 +993,7 @@ static void domcreate_bootloader_done(libxl__egc *egc, libxl_domain_config *const d_config = dcs->guest_config; const int restore_fd = dcs->restore_fd; libxl__domain_build_state *const state = &dcs->build_state; - const int checkpointed_stream = dcs->restore_params.checkpointed_stream; + const int stream_type = dcs->restore_params.stream_type; if (rc) { domcreate_rebuild_done(egc, dcs, rc); @@ -1033,7 +1033,7 @@ static void domcreate_bootloader_done(libxl__egc *egc, dcs->srs.completion_callback = domcreate_stream_done; if (restore_fd >= 0) { - switch (checkpointed_stream) { + switch (stream_type) { case LIBXL_CHECKPOINTED_STREAM_REMUS: libxl__remus_restore_setup(egc, dcs); /* fall through */ diff --git a/tools/libxl/libxl_dom_save.c b/tools/libxl/libxl_dom_save.c index f3288b9..ff92ef0 100644 --- a/tools/libxl/libxl_dom_save.c +++ b/tools/libxl/libxl_dom_save.c @@ -338,7 +338,7 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_save_state *dss) unsigned int nr_vnodes = 0, nr_vmemranges = 0, nr_vcpus = 0; libxl__domain_suspend_state *dsps = &dss->dsps; - if (dss->checkpointed_stream != LIBXL_CHECKPOINTED_STREAM_NONE && !r_info) { + if (dss->stream_type != LIBXL_CHECKPOINTED_STREAM_NONE && !r_info) { LOG(ERROR, "Migration stream is checkpointed, but there's no " "checkpoint info!"); rc = ERROR_INVAL; @@ -383,12 +383,12 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain_save_state *dss) goto out; } - if (dss->checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_REMUS) { + if (dss->stream_type == LIBXL_CHECKPOINTED_STREAM_REMUS) { if (libxl_defbool_val(r_info->compression)) dss->xcflags |= XCFLAGS_CHECKPOINT_COMPRESS; } - if (dss->checkpointed_stream == LIBXL_CHECKPOINTED_STREAM_NONE) + if (dss->stream_type == LIBXL_CHECKPOINTED_STREAM_NONE) callbacks->suspend = libxl__domain_suspend_callback; callbacks->switch_qemu_logdirty = libxl__domain_suspend_common_switch_qemu_logdirty; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 005fe53..0aada0d 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -3128,7 +3128,7 @@ struct libxl__domain_save_state { libxl_domain_type type; int live; int debug; - int checkpointed_stream; + libxl_checkpointed_stream stream_type; const libxl_domain_remus_info *remus; /* private */ int rc; diff --git a/tools/libxl/libxl_save_callout.c b/tools/libxl/libxl_save_callout.c index 7f1f5d4..133d74e 100644 --- a/tools/libxl/libxl_save_callout.c +++ b/tools/libxl/libxl_save_callout.c @@ -61,7 +61,7 @@ void libxl__xc_domain_restore(libxl__egc *egc, libxl__domain_create_state *dcs, state->store_domid, state->console_port, state->console_domid, hvm, pae, superpages, - cbflags, dcs->restore_params.checkpointed_stream, + cbflags, dcs->restore_params.stream_type, }; shs->ao = ao; @@ -85,7 +85,7 @@ void libxl__xc_domain_save(libxl__egc *egc, libxl__domain_save_state *dss, const unsigned long argnums[] = { dss->domid, 0, 0, dss->xcflags, dss->hvm, - cbflags, dss->checkpointed_stream, + cbflags, dss->stream_type, }; shs->ao = ao; diff --git a/tools/libxl/libxl_stream_read.c b/tools/libxl/libxl_stream_read.c index f4781eb..2c480c0 100644 --- a/tools/libxl/libxl_stream_read.c +++ b/tools/libxl/libxl_stream_read.c @@ -773,7 +773,7 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void, STATE_AO_GC(dcs->ao); /* convenience aliases */ - const int checkpointed_stream = dcs->restore_params.checkpointed_stream; + const int stream_type = dcs->restore_params.stream_type; if (rc) goto err; @@ -794,7 +794,7 @@ 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)) { - switch (checkpointed_stream) { + switch (stream_type) { case LIBXL_CHECKPOINTED_STREAM_REMUS: /* * Failover from primary. Domain state is currently at a diff --git a/tools/libxl/libxl_stream_write.c b/tools/libxl/libxl_stream_write.c index f6ea55d..4894f51 100644 --- a/tools/libxl/libxl_stream_write.c +++ b/tools/libxl/libxl_stream_write.c @@ -355,7 +355,7 @@ void libxl__xc_domain_save_done(libxl__egc *egc, void *dss_void, * If the stream is not still alive, we must not continue any work. */ if (libxl__stream_write_inuse(stream)) { - if (dss->checkpointed_stream != LIBXL_CHECKPOINTED_STREAM_NONE) + if (dss->stream_type != LIBXL_CHECKPOINTED_STREAM_NONE) /* * For remus, if libxl__xc_domain_save_done() completes, * there was an error sending data to the secondary. diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 632c009..7cfeb83 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -382,7 +382,7 @@ libxl_domain_create_info = Struct("domain_create_info",[ ], dir=DIR_IN) libxl_domain_restore_params = Struct("domain_restore_params", [ - ("checkpointed_stream", integer), + ("stream_type", integer), ("stream_version", uint32, {'init_val': '1'}), ]) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 990d3c9..006f3e1 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -154,7 +154,7 @@ struct domain_create { int vnc; int vncautopass; int console_autoconnect; - int checkpointed_stream; + int stream_type; const char *config_file; char *extra_config; /* extra config string */ const char *restore_file; @@ -2890,7 +2890,7 @@ start: libxl_domain_restore_params_init(¶ms); - params.checkpointed_stream = dom_info->checkpointed_stream; + params.stream_type = dom_info->stream_type; params.stream_version = (hdr.mandatory_flags & XL_MANDATORY_FLAG_STREAMv2) ? 2 : 1; @@ -4435,7 +4435,7 @@ static void migrate_domain(uint32_t domid, const char *rune, int debug, static void migrate_receive(int debug, int daemonize, int monitor, int send_fd, int recv_fd, - libxl_checkpointed_stream checkpointed) + libxl_checkpointed_stream stream_type) { uint32_t domid; int rc, rc2; @@ -4460,7 +4460,7 @@ static void migrate_receive(int debug, int daemonize, int monitor, dom_info.paused = 1; dom_info.migrate_fd = recv_fd; dom_info.migration_domname_r = &migration_domname; - dom_info.checkpointed_stream = checkpointed; + dom_info.stream_type = stream_type; rc = create_domain(&dom_info); if (rc < 0) { @@ -4471,7 +4471,7 @@ static void migrate_receive(int debug, int daemonize, int monitor, domid = rc; - switch (checkpointed) { + switch (stream_type) { case LIBXL_CHECKPOINTED_STREAM_REMUS: /* If we are here, it means that the sender (primary) has crashed. * TODO: Split-Brain Check. @@ -4646,7 +4646,7 @@ int main_restore(int argc, char **argv) int main_migrate_receive(int argc, char **argv) { int debug = 0, daemonize = 1, monitor = 1; - libxl_checkpointed_stream checkpointed = LIBXL_CHECKPOINTED_STREAM_NONE; + libxl_checkpointed_stream stream_type = LIBXL_CHECKPOINTED_STREAM_NONE; int opt; SWITCH_FOREACH_OPT(opt, "Fedr", NULL, "migrate-receive", 0) { @@ -4661,7 +4661,7 @@ int main_migrate_receive(int argc, char **argv) debug = 1; break; case 'r': - checkpointed = LIBXL_CHECKPOINTED_STREAM_REMUS; + stream_type = LIBXL_CHECKPOINTED_STREAM_REMUS; break; } @@ -4671,7 +4671,7 @@ int main_migrate_receive(int argc, char **argv) } migrate_receive(debug, daemonize, monitor, STDOUT_FILENO, STDIN_FILENO, - checkpointed); + stream_type); return 0; }