From f63eed3550221347c6bcb200e69da76a20121584 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 26 Jun 2008 09:41:36 +0000
Subject: [PATCH] devel/upload: Add --no-restart option

If --no-restart is passed to devel/upload, it'll not run
"/etc/init.d/ganeti restart" (which kills processes), making
debugging on a terminal a bit easier.

Reviewed-by: iustinp, ultrotter
---
 devel/upload.in | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/devel/upload.in b/devel/upload.in
index e85587a60..b408a7bef 100644
--- a/devel/upload.in
+++ b/devel/upload.in
@@ -26,6 +26,28 @@
 # $prefix/sbin. It needs passwordless root login to the nodes.
 
 set -e
+
+NO_RESTART=
+hosts=
+while [ "$#" -gt 0 ]; do
+  opt="$1"
+  case "$opt" in
+    --no-restart)
+      NO_RESTART=1
+    ;;
+    -*)
+      echo "Unknown option: $opt" >&2
+      exit 1
+    ;;
+    *)
+      hosts="$hosts $opt"
+    ;;
+  esac
+  shift
+done
+
+set ${hosts}
+
 TXD=`mktemp -d`
 trap 'rm -rf $TXD' EXIT
 
@@ -63,8 +85,10 @@ if [ -f ganeti-master-cron ]; then
 fi
 wait
 
-for host; do
-  echo Restarting ganeti-noded on ${host}...
-  ssh root@${host} /etc/init.d/ganeti restart &
-done
-wait
+if test -z "${NO_RESTART}"; then
+  for host; do
+    echo Restarting ganeti-noded on ${host}...
+    ssh root@${host} /etc/init.d/ganeti restart &
+  done
+  wait
+fi
-- 
GitLab