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

[Xen-API] [PATCH] Some minor improvements to the with-vdi script


  • To: xen-api@xxxxxxxxxxxxxxxxxxx
  • From: Zheng Li <dev@xxxxxxxx>
  • Date: Wed, 16 Jun 2010 15:30:42 -0000
  • Delivery-date: Wed, 16 Jun 2010 08:32:01 -0700
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

- return the user command's exit code as the exit code of with-vdi script 
(unless something else failed in the preparation or post run steps)
- relax the requirement on the user command parameter, both absolute paths and 
in-paths executables are acceptable
- allow a user command to have its own arguments (i.e. with-vdi vdi-uuid 
user-command arg1 arg2 ... argn)

Signed-off-by: Zheng Li <dev@xxxxxxxx>


 scripts/with-vdi |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)


diff -r c0e27f018867 -r a6596df3debe scripts/with-vdi
--- a/scripts/with-vdi  Tue May 04 07:18:23 2010 +0100
+++ b/scripts/with-vdi  Wed Jun 16 16:26:42 2010 +0100
@@ -18,14 +18,17 @@
   usage
   exit 1
 fi
+
 COMMAND=$2
 if [ -z "$COMMAND" ]; then
   COMMAND=/bin/sh
-fi
-if [ ! -x "$COMMAND" ]; then
+elif ! which "$COMMAND" > /dev/null ; then
   echo Failed to find command: ${COMMAND}
   usage
   exit 1
+else
+  shift 1
+  COMMAND=$*
 fi
 
 . /etc/xensource-inventory
@@ -41,6 +44,7 @@
 export DEVICE
 echo DEVICE=${DEVICE}
 ${COMMAND}
+RC=$?
 xe vbd-unplug uuid=${VBD}
 xe vbd-destroy uuid=${VBD}
-
+exit ${RC}

Attachment: xen-api.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

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