You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: setup/bindir/cloud-sysvmadm.in
+28-22Lines changed: 28 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@
23
23
#set -x
24
24
25
25
usage() {
26
-
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
26
+
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
27
27
}
28
28
29
29
@@ -37,9 +37,12 @@ password=
37
37
help=
38
38
maxthreads=10
39
39
LOGFILE=cloud.log
40
+
zone=""
41
+
inzone=""
40
42
41
43
42
-
whilegetopts'sarhnd:m:u:p:t:l:' OPTION
44
+
45
+
whilegetopts'sarhnd:m:u:p:t:l:z:' OPTION
43
46
do
44
47
case$OPTIONin
45
48
s) system=1
@@ -63,21 +66,24 @@ do
63
66
t) maxthreads="$OPTARG"
64
67
;;
65
68
l) LOGFILE="$OPTARG"
69
+
;;
70
+
z) zone=" AND data_center_id=""$OPTARG"
71
+
inzone=" in zone id=""$OPTARG"
66
72
esac
67
73
done
68
74
69
75
70
76
71
77
72
78
stop_start_system() {
73
-
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\""`)
74
-
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\""`)
79
+
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"`)
80
+
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"`)
75
81
length_secondary=(${#secondary[@]})
76
82
length_console=(${#console[@]})
77
83
78
84
79
-
echo -e "\nStopping and starting $length_secondary secondary storage vm(s)..."
80
-
echo -e "Stopping and starting $length_secondary secondary storage vm(s)...">>$LOGFILE
85
+
echo -e "\nStopping and starting $length_secondary secondary storage vm(s)$inzone..."
86
+
echo -e "Stopping and starting $length_secondary secondary storage vm(s)$inzone...">>$LOGFILE
81
87
82
88
fordin"${secondary[@]}";do
83
89
echo"INFO: Stopping secondary storage vm with id $d">>$LOGFILE
@@ -98,12 +104,12 @@ done
98
104
if [ "$length_secondary"=="0" ];then
99
105
echo -e "No running secondary storage vms found \n"
100
106
else
101
-
echo -e "Done stopping and starting secondary storage vm(s)"
102
-
echo -e "Done stopping and starting secondary storage vm(s).">>$LOGFILE
107
+
echo -e "Done stopping and starting secondary storage vm(s)$inzone"
108
+
echo -e "Done stopping and starting secondary storage vm(s)$inzone.">>$LOGFILE
103
109
fi
104
110
105
-
echo -e "\nStopping and starting $length_console console proxy vm(s)..."
106
-
echo -e "Stopping and starting $length_console console proxy vm(s)...">>$LOGFILE
111
+
echo -e "\nStopping and starting $length_console console proxy vm(s)$inzone..."
112
+
echo -e "Stopping and starting $length_console console proxy vm(s)$inzone...">>$LOGFILE
107
113
108
114
fordin"${console[@]}";do
109
115
echo"INFO: Stopping console proxy with id $d">>$LOGFILE
@@ -124,17 +130,17 @@ done
124
130
if [ "$length_console"=="0" ];then
125
131
echo -e "No running console proxy vms found \n"
126
132
else
127
-
echo"Done stopping and starting console proxy vm(s)."
128
-
echo"Done stopping and starting console proxy vm(s).">>$LOGFILE
133
+
echo"Done stopping and starting console proxy vm(s)$inzone."
134
+
echo"Done stopping and starting console proxy vm(s)$inzone.">>$LOGFILE
129
135
fi
130
136
}
131
137
132
138
stop_start_router() {
133
-
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\""`)
139
+
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"`)
134
140
length_router=(${#router[@]})
135
141
136
-
echo -e "\nStopping and starting $length_router running routing vm(s)... "
137
-
echo -e "Stopping and starting $length_router running routing vm(s)... ">>$LOGFILE
142
+
echo -e "\nStopping and starting $length_router running routing vm(s)$inzone... "
143
+
echo -e "Stopping and starting $length_router running routing vm(s)$inzone... ">>$LOGFILE
138
144
139
145
#Spawn reboot router in parallel - run commands in <n> chunks - number of threads is configurable
0 commit comments