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

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



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.

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
+}
+
 is_running()
 {
     get_xsdomid
@@ -260,7 +269,8 @@ start()
 
     saved_domains=" "
     if [ "$XENDOMAINS_RESTORE" = "true" ] &&
-       contains_something "$XENDOMAINS_SAVE"
+       contains_something "$XENDOMAINS_SAVE" &&
+       subcmd_supported "restore"
     then
        echo -n "Restoring Xen domains:"
        saved_domains=`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=$!
@@ -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=$!
-- 
2.34.1




 


Rackspace

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