From patchwork Fri Mar 4 08:41:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changlong Xie X-Patchwork-Id: 8500031 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B4E47C0553 for ; Fri, 4 Mar 2016 08:42:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C13E7201DD for ; Fri, 4 Mar 2016 08:41:59 +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 DC1EF200F4 for ; Fri, 4 Mar 2016 08:41:58 +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 1ablHC-0006OE-2Q; Fri, 04 Mar 2016 08:39:58 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ablHA-0006Nb-PV for xen-devel@lists.xen.org; Fri, 04 Mar 2016 08:39:56 +0000 Received: from [193.109.254.147] by server-5.bemta-14.messagelabs.com id 78/E9-03497-CD949D65; Fri, 04 Mar 2016 08:39:56 +0000 X-Env-Sender: xiecl.fnst@cn.fujitsu.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1457080791!24937018!2 X-Originating-IP: [59.151.112.132] X-SpamReason: No, hits=0.0 required=7.0 tests=SUBJECT_RANDOMQ X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20595 invoked from network); 4 Mar 2016 08:39:55 -0000 Received: from cn.fujitsu.com (HELO heian.cn.fujitsu.com) (59.151.112.132) by server-8.tower-27.messagelabs.com with SMTP; 4 Mar 2016 08:39:55 -0000 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="4230639" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Mar 2016 16:39:44 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id AD3C342B4AFE; Fri, 4 Mar 2016 16:39:41 +0800 (CST) Received: from changlox.g08.fujitsu.local (10.167.225.55) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 4 Mar 2016 16:39:41 +0800 From: Changlong Xie To: xen devel , Konrad Rzeszutek Wilk , Andrew Cooper , Ian Campbell , Ian Jackson , Wei Liu Date: Fri, 4 Mar 2016 16:41:05 +0800 Message-ID: <1457080891-26054-2-git-send-email-xiecl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1457080891-26054-1-git-send-email-xiecl.fnst@cn.fujitsu.com> References: <1457080891-26054-1-git-send-email-xiecl.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.225.55] X-yoursite-MailScanner-ID: AD3C342B4AFE.A366F X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: xiecl.fnst@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: Lars Kurth , Changlong Xie , Wen Congyang , Gui Jianfeng , Jiang Yunhong , Dong Eddie , Anthony Perard , Shriram Rajagopalan , Yang Hongyang Subject: [Xen-devel] [PATCH v11 01/27] tools/libxl: introduction of libxl__qmp_restore to load qemu state 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 From: Wen Congyang In normal migration, the qemu state is passed to qemu as a parameter. With COLO, secondary vm is running. So we will do the following steps at every checkpoint: 1. suspend both primary vm and secondary vm 2. sync the state 3. resume both primary vm and secondary vm Primary will send qemu's state in step2, and secondary's qemu should read it and restore the state before it is resumed. We can not pass the state to qemu as a parameter because secondary QEMU is already started at this point, so we introduce libxl__qmp_restore() to do it. Signed-off-by: Yang Hongyang Signed-off-by: Wen Congyang Signed-off-by: Changlong Xie Cc: Anthony Perard Reviewed-by: Konrad Rzeszutek Wilk Acked-by: Ian Jackson --- tools/libxl/libxl_internal.h | 2 ++ tools/libxl/libxl_qmp.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 005fe53..7801385 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1762,6 +1762,8 @@ _hidden int libxl__qmp_stop(libxl__gc *gc, int domid); _hidden int libxl__qmp_resume(libxl__gc *gc, int domid); /* Save current QEMU state into fd. */ _hidden int libxl__qmp_save(libxl__gc *gc, int domid, const char *filename); +/* Load current QEMU state from file. */ +_hidden int libxl__qmp_restore(libxl__gc *gc, int domid, const char *filename); /* Set dirty bitmap logging status */ _hidden int libxl__qmp_set_global_dirty_log(libxl__gc *gc, int domid, bool enable); _hidden int libxl__qmp_insert_cdrom(libxl__gc *gc, int domid, const libxl_device_disk *disk); diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c index c45702e..c0bdfcb 100644 --- a/tools/libxl/libxl_qmp.c +++ b/tools/libxl/libxl_qmp.c @@ -906,6 +906,16 @@ int libxl__qmp_save(libxl__gc *gc, int domid, const char *filename) NULL, NULL); } +int libxl__qmp_restore(libxl__gc *gc, int domid, const char *state_file) +{ + libxl__json_object *args = NULL; + + qmp_parameters_add_string(gc, &args, "filename", state_file); + + return qmp_run_command(gc, domid, "xen-load-devices-state", args, + NULL, NULL); +} + static int qmp_change(libxl__gc *gc, libxl__qmp_handler *qmp, char *device, char *target, char *arg) {