cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/master to 35de50d
Date Fri, 17 May 2013 00:11:34 GMT
Updated Branches:
  refs/heads/master 890603be3 -> 35de50deb


cloud-sysvmadm: 1) added -z paramters. If specified, restrict system vm restarts to specific
zone. If not specified, the intances will be restarted in all zones. 2) Fixed the help for
restartNetwork option. It gets triggered by -n, not -e parameter


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/35de50de
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/35de50de
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/35de50de

Branch: refs/heads/master
Commit: 35de50debfadf82dfbec2aab473abeea74fc6248
Parents: 890603b
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Thu May 16 14:26:46 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Thu May 16 17:05:38 2013 -0700

----------------------------------------------------------------------
 setup/bindir/cloud-sysvmadm.in |   50 +++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35de50de/setup/bindir/cloud-sysvmadm.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-sysvmadm.in b/setup/bindir/cloud-sysvmadm.in
index 0a7b454..3cb7858 100755
--- a/setup/bindir/cloud-sysvmadm.in
+++ b/setup/bindir/cloud-sysvmadm.in
@@ -23,7 +23,7 @@
 #set -x
 
 usage() {
-  printf "\nThe tool stopping/starting running system vms and domain routers \n\nUsage: %s:
[-d] [-u] [-p] [-m] [-s] [-r] [-a] [-t] [-e]\n\n -d - cloud DB server ip address, defaulted
to localhost if not specified \n -u - user name to access cloud DB, defaulted to "root" if
not specified \n -p - cloud DB user password, defaulted to no password if not specified \n\n
-m - the ip address of management server, defaulted to localhost if not specified\n\n -s -
stop then start all running SSVMs and Console Proxies \n -r - stop then start all running
Virtual Routers\n -a - stop then start all running SSVMs, Console Proxies, and Virtual Routers
\n -e - restart all Guest networks \n -t - number of parallel threads used for stopping Domain
Routers. Default is 10.\n -l - log file location. Default is cloud.log under current directory.\n\n"
$(basename $0) >&2
+  printf "\nThe tool stopping/starting running system vms and domain routers \n\nUsage: %s:
[-d] [-u] [-p] [-m] [-s] [-r] [-a] [-t] [-n] [-z]\n\n -d - cloud DB server ip address, defaulted
to localhost if not specified \n -u - user name to access cloud DB, defaulted to "root" if
not specified \n -p - cloud DB user password, defaulted to no password if not specified \n\n
-m - the ip address of management server, defaulted to localhost if not specified\n\n -s -
stop then start all running SSVMs and Console Proxies \n -r - stop then start all running
Virtual Routers\n -a - stop then start all running SSVMs, Console Proxies, and Virtual Routers
\n -n - restart all Guest networks \n -t - number of parallel threads used for stopping Domain
Routers. Default is 10.\n -l - log file location. Default is cloud.log under current directory.\n
-z - do restart only for the instances in the specific zone. If not specified, restart will
apply to instances in all zones\n\n" $(basename $0) >&2
 }
 
 
@@ -37,9 +37,12 @@ password=
 help=
 maxthreads=10
 LOGFILE=cloud.log
+zone=""
+inzone=""
 
 
-while getopts 'sarhnd:m:u:p:t:l:' OPTION
+
+while getopts 'sarhnd:m:u:p:t:l:z:' OPTION
 do
   case $OPTION in
   s)    system=1
@@ -63,6 +66,9 @@ do
   t)	maxthreads="$OPTARG"
   		;;
   l)	LOGFILE="$OPTARG"
+        ;;
+  z)    zone=" AND data_center_id=""$OPTARG"
+        inzone=" in zone id=""$OPTARG"
   esac
 done
 
@@ -70,14 +76,14 @@ done
 
 
 stop_start_system() {
-secondary=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e
"select id from vm_instance where state=\"Running\" and type=\"SecondaryStorageVm\""`)
-console=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e
"select id from vm_instance where state=\"Running\" and type=\"ConsoleProxy\""`)
+secondary=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e
"select id from vm_instance where state=\"Running\" and type=\"SecondaryStorageVm\"$zone"`)
+console=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e
"select id from vm_instance where state=\"Running\" and type=\"ConsoleProxy\"$zone"`)
 length_secondary=(${#secondary[@]})
 length_console=(${#console[@]})
 
 
-echo -e "\nStopping and starting $length_secondary secondary storage vm(s)..."
-echo -e "Stopping and starting $length_secondary secondary storage vm(s)..." >>$LOGFILE
+echo -e "\nStopping and starting $length_secondary secondary storage vm(s)$inzone..."
+echo -e "Stopping and starting $length_secondary secondary storage vm(s)$inzone..." >>$LOGFILE
 
 for d in "${secondary[@]}"; do
 	echo "INFO: Stopping secondary storage vm with id $d" >>$LOGFILE
@@ -98,12 +104,12 @@ done
 if [ "$length_secondary" == "0" ];then
 	echo -e "No running secondary storage vms found \n"
 else 
-	echo -e "Done stopping and starting secondary storage vm(s)"
-	echo -e "Done stopping and starting secondary storage vm(s)." >>$LOGFILE
+	echo -e "Done stopping and starting secondary storage vm(s)$inzone"
+	echo -e "Done stopping and starting secondary storage vm(s)$inzone." >>$LOGFILE
 fi
 
-echo -e "\nStopping and starting $length_console console proxy vm(s)..."
-echo -e "Stopping and starting $length_console console proxy vm(s)..." >>$LOGFILE
+echo -e "\nStopping and starting $length_console console proxy vm(s)$inzone..."
+echo -e "Stopping and starting $length_console console proxy vm(s)$inzone..." >>$LOGFILE
 
 for d in "${console[@]}"; do
 	echo "INFO: Stopping console proxy with id $d" >>$LOGFILE
@@ -124,17 +130,17 @@ done
 if [ "$length_console" == "0" ];then
         echo -e "No running console proxy vms found \n"
 else
-        echo "Done stopping and starting console proxy vm(s)."
-		echo "Done stopping and starting console proxy vm(s)." >>$LOGFILE
+        echo "Done stopping and starting console proxy vm(s) $inzone."
+		echo "Done stopping and starting console proxy vm(s) $inzone." >>$LOGFILE
 fi
 }
 
 stop_start_router() {
-	router=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e
"select id from vm_instance where state=\"Running\" and type=\"DomainRouter\""`)
+	router=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e
"select id from vm_instance where state=\"Running\" and type=\"DomainRouter\"$zone"`)
 	length_router=(${#router[@]})
 	
-	echo -e "\nStopping and starting $length_router running routing vm(s)... "
-	echo -e "Stopping and starting $length_router running routing vm(s)... " >>$LOGFILE
+	echo -e "\nStopping and starting $length_router running routing vm(s)$inzone... "
+	echo -e "Stopping and starting $length_router running routing vm(s)$inzone... " >>$LOGFILE
 	
 	#Spawn reboot router in parallel - run commands in <n> chunks - number of threads
is configurable
 
@@ -185,8 +191,8 @@ stop_start_router() {
 			sleep 10
 		done
 		
-		echo -e "Done restarting router(s). \n"
-		echo -e "Done restarting router(s). \n" >>$LOGFILE
+		echo -e "Done restarting router(s)$inzone. \n"
+		echo -e "Done restarting router(s)$inzone. \n" >>$LOGFILE
 		
 	fi
 }
@@ -231,11 +237,11 @@ reboot_router(){
 
 restart_networks(){
     networks=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud
-e "select n.id 
-    from networks n, network_offerings no where n.network_offering_id = no.id and no.system_only
= 0 and n.removed is null"`)
+    from networks n, network_offerings no where n.network_offering_id = no.id and no.system_only
= 0 and n.removed is null$zone"`)
     length_networks=(${#networks[@]})
     
-    echo -e "\nRestarting networks... "
-    echo -e "Restarting networks... " >>$LOGFILE
+    echo -e "\nRestarting $length_networks networks$inzone... "
+    echo -e "Restarting $length_networks networks$inzone... " >>$LOGFILE
     
     #Spawn restart network in parallel - run commands in <n> chunks - number of threads
is configurable
 
@@ -287,8 +293,8 @@ restart_networks(){
             sleep 10
         done
         
-        echo -e "Done restarting networks. \n"
-        echo -e "Done restarting networks. \n" >>$LOGFILE
+        echo -e "Done restarting networks$inzone. \n"
+        echo -e "Done restarting networks$inzone. \n" >>$LOGFILE
         
     fi
 }


Mime
View raw message