[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tools/xendomains: Only save/restore/migrate if supported by xenlight


  • To: Peter Hoyes <peter.hoyes@xxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 4 Apr 2023 17:28:58 +0100
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <wei.chen@xxxxxxx>, <bertrand.marquis@xxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 04 Apr 2023 16:29:13 +0000
  • 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+AyL0rDT4QuSGi4DVDEpQMMrtYk9RTEs/ laTmp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tpm+CQS801wiK4VWt1K4f /JPb9vk6wLRsgKbbhlDONEWsevDHfRKCi8Rl56DG6XYJ3vAUi93KLf8fEw/qWnaZYIxJw9lN DIV05Zr3c7fwbrBdeV1JNG/xjRSCHlNA6dgv129tx8oPnxVbDrOSqMRBQnlNahuewWBoneV+ yoMJxbDvf/JS/lGJpP3Qf5R55OQENuGfE9q5I+QRaDs8jLIorluqjSd+vSPqPkFXI+Vmb2Eh I4LU3OzQV7nzKWs1PD8WjssinWCzLCFLpLYdnn1vlWzpQRPYtRtQVQgUil56iwWE5/jpA=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Mar 22, 2023 at 01:58:00PM +0000, Peter Hoyes wrote:
> From: Peter Hoyes <Peter.Hoyes@xxxxxxx>
> 
> 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 <Peter.Hoyes@xxxxxxx>
> ---
>  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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.