Skip to content

Commit 489ca01

Browse files
shwstpprDaanHoogland
authored andcommitted
use uuid, fix queryjobresult
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 3849403 commit 489ca01

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

setup/bindir/cloud-sysvmadm.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ prepare_ids_clause() {
122122

123123
stop_start_system() {
124124
prepare_ids_clause
125-
secondary=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e "select id from $vmtable where state=\"Running\" and type=\"SecondaryStorageVm\"$zone$vmidsclause"`)
126-
console=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e "select id from $vmtable where state=\"Running\" and type=\"ConsoleProxy\"$zone$vmidsclause"`)
125+
secondary=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e "select uuid from $vmtable where state=\"Running\" and type=\"SecondaryStorageVm\"$zone$vmidsclause"`)
126+
console=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e "select uuid from $vmtable where state=\"Running\" and type=\"ConsoleProxy\"$zone$vmidsclause"`)
127127
length_secondary=(${#secondary[@]})
128128
length_console=(${#console[@]})
129129

@@ -159,7 +159,7 @@ stop_start_system() {
159159

160160
for d in "${console[@]}"; do
161161
echo "[$(date "+%Y.%m.%d-%H.%M.%S")] INFO: Stopping console proxy with id $d" >>$LOGFILE
162-
jobresult=$(send_request stopSystemVm $d)
162+
jobresult=$(send_request stopSystemVm $d)
163163
if [ "$jobresult" != "1" ]; then
164164
echo -e "ERROR: Failed to stop console proxy vm with id $d \n"
165165
echo "[$(date "+%Y.%m.%d-%H.%M.%S")] ERROR: Failed to stop console proxy vm with id $d" >>$LOGFILE
@@ -183,7 +183,7 @@ stop_start_system() {
183183

184184
stop_start_router() {
185185
prepare_ids_clause
186-
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$vmidsclause"`)
186+
router=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e "select uuid from vm_instance where state=\"Running\" and type=\"DomainRouter\"$zone$vmidsclause"`)
187187
length_router=(${#router[@]})
188188

189189
echo -e "\nStopping and starting $length_router running routing vm(s)$inzone$withids... "
@@ -391,7 +391,7 @@ restart_vpc(){
391391

392392

393393
restart_vpcs(){
394-
vpcs=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e "select id from vpc WHERE removed is null$zone"`)
394+
vpcs=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e "select uuid from vpc WHERE removed is null$zone"`)
395395
length_vpcs=(${#vpcs[@]})
396396

397397
echo -e "\nRestarting $length_vpcs vpcs... "
@@ -456,7 +456,7 @@ restart_vpcs(){
456456
query_async_job_result() {
457457
while [ 1 ]
458458
do
459-
jobstatus=`curl -sS "http://$ms:$integrationport/?command=queryAsyncJobResult&jobId=$1&response=json" | sed 's/\"//g' | sed 's/ //g' | sed 's/{//g' | sed 's/}//g' | awk -F, {'print $4'} | awk -F: {'print $2'}`
459+
jobstatus=`curl -sS "http://$ms:$integrationport/?command=queryAsyncJobResult&jobId=$1&response=json" | sed 's/\"//g' | sed 's/ //g' | sed 's/{//g' | sed 's/}//g' | awk -F, {'print $7'} | awk -F: {'print $2'}`
460460
if [ "$jobstatus" != "0" ]; then
461461
echo $jobstatus
462462
break

0 commit comments

Comments
 (0)