Skip to content

Commit 6dfd2f2

Browse files
committed
1) More logging to cloud-sysvmadm script - to give the user better details on which domR is being restarted at the moment
2) When domR is executed in parallel thread, make sure that the thread "exit 0" after the restart is done
1 parent 254fa22 commit 6dfd2f2

1 file changed

Lines changed: 24 additions & 15 deletions

File tree

setup/bindir/cloud-sysvmadm.in

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,16 @@ length_secondary=(${#secondary[@]})
5858
length_console=(${#console[@]})
5959

6060

61-
echo -e "\nStopping and starting secondary storage vms..."
62-
echo -e "Stopping and starting secondary storage vms..." >>$LOGFILE
61+
echo -e "\nStopping and starting $length_secondary secondary storage vm(s)..."
62+
echo -e "Stopping and starting $length_secondary secondary storage vm(s)..." >>$LOGFILE
6363

6464
for d in "${secondary[@]}"; do
65+
echo "INFO: Stopping secondary storage vm with id $d" >>$LOGFILE
6566
jobresult=$(send_request stopSystemVm $d)
6667
if [ "$jobresult" != "1" ]; then
6768
echo "ERROR: Failed to stop secondary storage vm with id $d" >>$LOGFILE
6869
else
70+
echo "INFO: Starting secondary storage vm with id $d" >>$LOGFILE
6971
jobresult=$(send_request startSystemVm $d SSVM)
7072
if [ "$jobresult" != "1" ]; then
7173
echo "ERROR: Failed to start secondary storage vm with id $d" >>$LOGFILE
@@ -76,36 +78,41 @@ done
7678
if [ "$length_secondary" == "0" ];then
7779
echo -e "No running secondary storage vms found \n"
7880
else
79-
echo -e "Done stopping and starting secondary storage vms"
80-
echo -e "Done stopping and starting secondary storage vms." >>$LOGFILE
81+
echo -e "Done stopping and starting secondary storage vm(s)"
82+
echo -e "Done stopping and starting secondary storage vm(s)." >>$LOGFILE
8183
fi
8284

83-
echo -e "\nStopping and starting console proxy vms..."
84-
echo -e "Stopping and starting console proxy vms..." >>$LOGFILE
85+
echo -e "\nStopping and starting $length_console console proxy vm(s)..."
86+
echo -e "Stopping and starting $length_console console proxy vm(s)..." >>$LOGFILE
8587

8688
for d in "${console[@]}"; do
89+
echo "INFO: Stopping console proxy with id $d" >>$LOGFILE
8790
jobresult=$(send_request stopSystemVm $d)
8891
if [ "$jobresult" != "1" ]; then
89-
echo "ERROR: Failed to stop console proxy vm with id $d" >>$LOGFILE
92+
echo "ERROR: Failed to stop console proxy vm with id $d" >>$LOGFILE
9093
else
91-
jobresult=$(send_request startSystemVm $d consoleProxy)
94+
echo "INFO: Starting console proxy vm with id $d" >>$LOGFILE
95+
jobresult=$(send_request startSystemVm $d consoleProxy)
96+
if [ "$jobresult" != "1" ]; then
97+
echo "ERROR: Failed to start console proxy vm with id $d" >>$LOGFILE
98+
fi
9299
fi
93100
done
94101

95102
if [ "$length_console" == "0" ];then
96103
echo -e "No running console proxy vms found \n"
97104
else
98-
echo "Done stopping and starting console proxy vms."
99-
echo "Done stopping and starting console proxy vms." >>$LOGFILE
105+
echo "Done stopping and starting console proxy vm(s)."
106+
echo "Done stopping and starting console proxy vm(s)." >>$LOGFILE
100107
fi
101108
}
102109

103110
stop_start_router() {
104111
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\""`)
105112
length_router=(${#router[@]})
106113

107-
echo -e "\nStopping and starting running routing vms... "
108-
echo -e "Stopping and starting running routing vms... " >>$LOGFILE
114+
echo -e "\nStopping and starting $length_router running routing vm(s)... "
115+
echo -e "Stopping and starting $length_router running routing vm(s)... " >>$LOGFILE
109116

110117
#Spawn reboot router in parallel - run commands in <n> chunks - number of threads is configurable
111118

@@ -148,7 +155,6 @@ stop_start_router() {
148155
fi
149156

150157
done
151-
152158

153159
if [ "$length_router" == "0" ];then
154160
echo -e "No running router vms found \n" >>$LOGFILE
@@ -157,8 +163,8 @@ stop_start_router() {
157163
sleep 10
158164
done
159165

160-
echo -e "Done restarting routers. \n"
161-
echo -e "Done restarting routers. \n" >>$LOGFILE
166+
echo -e "Done restarting router(s). \n"
167+
echo -e "Done restarting router(s). \n" >>$LOGFILE
162168

163169
fi
164170
}
@@ -180,6 +186,7 @@ send_request(){
180186

181187

182188
reboot_router(){
189+
echo "INFO: Restarting router with id $1" >>$LOGFILE
183190
jobid=`curl -sS "http://$ms:8096/?command=rebootRouter&id=$1&response=json" | sed 's/\"//g' | sed 's/ //g' | sed 's/{//g' | sed 's/}//g' | awk -F: {'print $3'}`
184191
if [ "$jobid" == "" ]; then
185192
echo "ERROR: Failed to restart domainRouter with id $1" >>$LOGFILE
@@ -191,8 +198,10 @@ reboot_router(){
191198

192199
if [ "$jobresult" != "1" ]; then
193200
echo "ERROR: Failed to restart domainRouter with id $1" >>$LOGFILE
201+
exit 0
194202
else
195203
echo "INFO: Successfully restarted domainRouter with id $1" >>$LOGFILE
204+
exit 0
196205
fi
197206

198207
}

0 commit comments

Comments
 (0)