Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 28A10C6FD1D for ; Tue, 4 Apr 2023 16:29:21 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.518070.804230 (Exim 4.92) (envelope-from ) id 1pjjWx-0003Vr-Tj; Tue, 04 Apr 2023 16:29:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 518070.804230; Tue, 04 Apr 2023 16:29:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pjjWx-0003Vk-R8; Tue, 04 Apr 2023 16:29:11 +0000 Received: by outflank-mailman (input) for mailman id 518070; Tue, 04 Apr 2023 16:29:11 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pjjWx-0003Ve-0a for xen-devel@lists.xenproject.org; Tue, 04 Apr 2023 16:29:11 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d279d7c6-d305-11ed-85db-49a42c6b2330; Tue, 04 Apr 2023 18:29:09 +0200 (CEST) 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: d279d7c6-d305-11ed-85db-49a42c6b2330 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1680625749; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=muyEy+imng+MiuS0rC7GNqhnQwFZmakSOGOJA1lr+IM=; b=EZQUfEaG6DqHe/5dnXKjbQUx7Cl9BPUw6Dy5D0Qf6JeaKkhPJM+sUtF/ LMb2mCwsSoFuhJYHw/gNTg2OaBR8Adfup2PHb/AXqzscXcPu06ncCTQfJ zZROcIDK1a/f9dPDX2dOmsTYLNki0wnpXCipBv/PzHtMj89UZPRCUDMhG 8=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 106727183 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.123 X-Policy: $RELAYED IronPort-Data: A9a23:jRNvnK/ES7sHIGEiyo3jDrUDvn6TJUtcMsCJ2f8bNWPcYEJGY0x3y jAYWzzVP/aOZDT1KN93Ot6z8BwD75eDyNNkGwZo/H88E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKicYXoZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ire7kI/1BjOkGlA5AdmOagX5AW2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklp9 MxfJSFcdCvaiuC8/JHkS+Zp3J0KeZyD0IM34hmMzBncBPciB5vCX7/L9ZlT2zJYasJmRKiEI ZBDMHw2MUqGOkcUUrsUIMtWcOOAj3/jczpeuRSNqLA++WT7xw1tyrn9dtHSf7RmQO0MxhjH/ D2frz+R7hcyDPnC2x3c3lGVp9CXvT3dYIY+BJn76as/6LGU7jNKU0BHPbehmtGhh1KzQZRfL F0Z4QInt610/0uuJvHtUhv9rHOasxo0X9tLD/Z8+Ay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hBgo/DXmZAVIIv7PeDl+hiXS6UkYoJkx9Tpm+CQS801wiK4VWt1K4f /JPb9vk6wLRsgKbbhlDONEWsevDHfRKCi8Rl56DG6XYJ3vAUi93KLf8fEw/qWnaZYIxJw9lN DIV05Zr3c7fwbrBdeV1JNG/xjRSCHlNA6dgv129tx8oPnxVbDrOSqMRBQnlNahuewWBoneV+ yoMJxbDvf/JS/lGJpP3Qf5R55OQENuGfE9q5I+QRaDs8jLIorluqjSd+vSPqPkFXI+Vmb2Eh I4LU3OzQV7nzKWs1PD8WjssinWCzLCFLpLYdnn1vlWzpQRPYtRtQVQgUil56iwWE5/jpA= X-IronPort-AV: E=Sophos;i="5.98,318,1673931600"; d="scan'208";a="106727183" Date: Tue, 4 Apr 2023 17:28:58 +0100 From: Anthony PERARD To: Peter Hoyes CC: , , , Wei Liu Subject: Re: [PATCH] tools/xendomains: Only save/restore/migrate if supported by xenlight Message-ID: References: <20230322135800.3869458-1-peter.hoyes@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230322135800.3869458-1-peter.hoyes@arm.com> On Wed, Mar 22, 2023 at 01:58:00PM +0000, Peter Hoyes wrote: > 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. The patch looks kind of ok, but shouldn't $XENDOMAINS_SAVE be set to an empty string in the config by the admin instead? Or is the issue that $XENDOMAINS_SAVE is set by default, even on arm* ? Maybe it's easier to check that the command is implemented at run time rather than trying to have a good default value for XENDOMAINS_SAVE at install/package time. > 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/xendomains.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 > } > > +subcmd_supported() > +{ > + local output > + output=$("$CMD help | grep "^ $1"") > + if [ ! "$output" ]; then > + return 1 > + fi It looks like some quote are in the wrong place. You probably wanted to write: output="$($CMD help | grep "^ $1")" But I'd like to have this slightly more robust, to match the whole command, rather than the beginning. (For example `subcmd_supported "pci"` would reture true even if no "pci" command exist.) Something like: $CMD help | grep "^ $1\( \|$\)" To check that the command name is followed by a space or end-of-line (even if it seems that there's always a space printed.) A similar pattern is used in "tools/xl/bash-completion", so it should probably be fine in the future. Then, we don't really need the "$output" from grep, we could just ask it if there's a match or not, with --quiet: $CMD help | grep -q "^ $1\( \|$\)" And that would be the whole function. Would that works for you? The rest of the patch looks fine. Thanks, -- Anthony PERARD