From nobody Fri May 3 07:32:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1679493525828302.1352402154761; Wed, 22 Mar 2023 06:58:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.513475.794518 (Exim 4.92) (envelope-from ) id 1peyyo-00045S-8u; Wed, 22 Mar 2023 13:58:18 +0000 Received: by outflank-mailman (output) from mailman id 513475.794518; Wed, 22 Mar 2023 13:58:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1peyyo-00045L-6B; Wed, 22 Mar 2023 13:58:18 +0000 Received: by outflank-mailman (input) for mailman id 513475; Wed, 22 Mar 2023 13:58:16 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1peyym-00045F-Ey for xen-devel@lists.xenproject.org; Wed, 22 Mar 2023 13:58:16 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 961de917-c8b9-11ed-b464-930f4c7d94ae; Wed, 22 Mar 2023 14:58:13 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CBAE64B3; Wed, 22 Mar 2023 06:58:56 -0700 (PDT) Received: from e125920.cambridge.arm.com (unknown [10.1.199.64]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E652B3F71E; Wed, 22 Mar 2023 06:58:11 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 961de917-c8b9-11ed-b464-930f4c7d94ae From: Peter Hoyes To: xen-devel@lists.xenproject.org Cc: wei.chen@arm.com, bertrand.marquis@arm.com, Peter Hoyes , Wei Liu , Anthony PERARD Subject: [PATCH] tools/xendomains: Only save/restore/migrate if supported by xenlight Date: Wed, 22 Mar 2023 13:58:00 +0000 Message-Id: <20230322135800.3869458-1-peter.hoyes@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1679493527711100005 Content-Type: text/plain; charset="utf-8" From: Peter Hoyes Saving, restoring and migrating domains are not currently supported on arm and arm64 platforms, so xendomains prints the warning: An error occurred while saving domain: command not implemented when attempting to run `xendomains stop`. It otherwise continues to shut down the domains cleanly, with the unsupported steps skipped. Use `xl help` to detect whether save/restore/migrate is supported by the platform. If not, do not attempt to run the corresponding command. Signed-off-by: Peter Hoyes --- tools/hotplug/Linux/xendomains.in | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/hotplug/Linux/xendomains.in b/tools/hotplug/Linux/xendom= ains.in index 70f4129ef4..bafcb874e1 100644 --- a/tools/hotplug/Linux/xendomains.in +++ b/tools/hotplug/Linux/xendomains.in @@ -229,6 +229,15 @@ parseln() [ -n "$name" -a -n "$id" ] && return 0 || return 1 } =20 +subcmd_supported() +{ + local output + output=3D$("$CMD help | grep "^ $1"") + if [ ! "$output" ]; then + return 1 + fi +} + is_running() { get_xsdomid @@ -260,7 +269,8 @@ start() =20 saved_domains=3D" " if [ "$XENDOMAINS_RESTORE" =3D "true" ] && - contains_something "$XENDOMAINS_SAVE" + contains_something "$XENDOMAINS_SAVE" && + subcmd_supported "restore" then echo -n "Restoring Xen domains:" saved_domains=3D`ls $XENDOMAINS_SAVE` @@ -411,7 +421,7 @@ stop() echo -n "(zomb)" continue fi - if test -n "$XENDOMAINS_MIGRATE"; then + if test -n "$XENDOMAINS_MIGRATE" && subcmd_supported "migrate"; then echo -n "(migr)" watchdog_xencmd migrate & WDOG_PID=3D$! @@ -430,7 +440,7 @@ stop() continue fi fi - if test -n "$XENDOMAINS_SAVE"; then + if test -n "$XENDOMAINS_SAVE" && subcmd_supported "save"; then echo -n "(save)" watchdog_xencmd save & WDOG_PID=3D$! --=20 2.34.1