From patchwork Tue Dec 15 16:35:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11975189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93039C2BBCA for ; Tue, 15 Dec 2020 16:36:41 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 52DCF22573 for ; Tue, 15 Dec 2020 16:36:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52DCF22573 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.54543.94920 (Exim 4.92) (envelope-from ) id 1kpDJQ-0006ft-CD; Tue, 15 Dec 2020 16:36:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 54543.94920; Tue, 15 Dec 2020 16:36:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kpDJQ-0006ff-6q; Tue, 15 Dec 2020 16:36:32 +0000 Received: by outflank-mailman (input) for mailman id 54543; Tue, 15 Dec 2020 16:36:30 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kpDJO-000667-Go for xen-devel@lists.xenproject.org; Tue, 15 Dec 2020 16:36:30 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ad375b72-b3e0-4ac5-a755-001c076d9bc0; Tue, 15 Dec 2020 16:36:12 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EFEEEB267; Tue, 15 Dec 2020 16:36:09 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ad375b72-b3e0-4ac5-a755-001c076d9bc0 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1608050170; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nPZAkpB2QjQ2BH5uTUJNNCYD4hmthye6v2/HhM/4weY=; b=n29LNHon97XlJ3SwFAAL9se/VmJcMCOGjszGdVU/BSKULo+CzD9a4hn456b/ZUNFzgmUns TpqqvWBYiD5pdGC2/DNpZ6lrTF4BgRRk3s3b9KRcLfglCFOK7CiId3/cAjFDKgnJU0jrn+ sOLUqhl9Oo4SzA8d59W7SO7tYMoLhrI= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu , Julien Grall , Paul Durrant Subject: [PATCH v10 11/25] tools/xenstore: add the basic framework for doing the live update Date: Tue, 15 Dec 2020 17:35:49 +0100 Message-Id: <20201215163603.21700-12-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201215163603.21700-1-jgross@suse.com> References: <20201215163603.21700-1-jgross@suse.com> MIME-Version: 1.0 Add the main framework for executing the live update. This for now only defines the basic execution steps with empty dummy functions. This final step returning means failure, as in case of success the new executable will have taken over. Signed-off-by: Juergen Gross Acked-by: Julien Grall Reviewed-by: Paul Durrant --- V4: - const (Julien Grall) --- tools/xenstore/xenstored_control.c | 39 ++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c index 2e0827b9ef..940b717741 100644 --- a/tools/xenstore/xenstored_control.c +++ b/tools/xenstore/xenstored_control.c @@ -304,9 +304,27 @@ static const char *lu_arch(const void *ctx, struct connection *conn, } #endif +static const char *lu_check_lu_allowed(const void *ctx, bool force, + unsigned int to) +{ + return NULL; +} + +static const char *lu_dump_state(const void *ctx, struct connection *conn) +{ + return NULL; +} + +static const char *lu_activate_binary(const void *ctx) +{ + return "Not yet implemented."; +} + static const char *lu_start(const void *ctx, struct connection *conn, bool force, unsigned int to) { + const char *ret; + syslog(LOG_INFO, "live-update: start, force=%d, to=%u\n", force, to); if (!lu_status || lu_status->conn != conn) @@ -317,10 +335,27 @@ static const char *lu_start(const void *ctx, struct connection *conn, return "Kernel not complete."; #endif - /* Will be replaced by real live-update later. */ + /* Check for state to allow live update. */ + ret = lu_check_lu_allowed(ctx, force, to); + if (ret) { + if (!strcmp(ret, "BUSY")) + return ret; + goto out; + } + + /* Dump out internal state, including "OK" for live update. */ + ret = lu_dump_state(ctx, conn); + if (ret) + goto out; + + /* Perform the activation of new binary. */ + ret = lu_activate_binary(ctx); + /* We will reach this point only in case of failure. */ + + out: talloc_free(lu_status); - return NULL; + return ret; } static int do_control_lu(void *ctx, struct connection *conn,