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
Copy file name to clipboardExpand all lines: setup/bindir/cloud-sysvmadm.in
+90-3Lines changed: 90 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
#set -x
6
6
7
7
usage() {
8
-
printf"\nThe tool stopping/starting running system vms and domain routers \n\nUsage: %s: [-d] [-u] [-p] [-m] [-s] [-r] [-a] [-t]\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 -t - number of parallel threads used for stopping Domain Routers. Default is 5.\n -l - log file location. Default is cloud.log under current directory.\n\n"$(basename $0)>&2
8
+
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 5.\n -l - log file location. Default is cloud.log under current directory.\n\n"$(basename $0)>&2
9
9
}
10
10
11
11
@@ -21,13 +21,15 @@ maxthreads=5
21
21
LOGFILE=cloud.log
22
22
23
23
24
-
whilegetopts'sarhd:m:u:p:t:l:' OPTION
24
+
whilegetopts'sarhnd:m:u:p:t:l:' OPTION
25
25
do
26
26
case$OPTIONin
27
27
s) system=1
28
28
;;
29
29
r) router=1
30
30
;;
31
+
n) redundant=1
32
+
;;
31
33
a) all=1
32
34
;;
33
35
d) db="$OPTARG"
@@ -195,6 +197,86 @@ reboot_router(){
195
197
196
198
}
197
199
200
+
restart_networks(){
201
+
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"`)
202
+
length_networks=(${#networks[@]})
203
+
204
+
echo -e "\nRestarting networks... "
205
+
echo -e "Restarting networks... ">>$LOGFILE
206
+
207
+
#Spawn restart network in parallel - run commands in <n> chunks - number of threads is configurable
jobid=`curl -sS "http://$ms:8096/?command=restartNetwork&id=$1&response=json"| sed 's/\"//g'| sed 's/ //g'| sed 's/{//g'| sed 's/}//g'| awk -F: {'print $3'}`
265
+
if [ "$jobid"=="" ];then
266
+
echo"ERROR: Failed to restart network with id $1">>$LOGFILE
267
+
echo 2
268
+
return
269
+
fi
270
+
271
+
jobresult=$(query_async_job_result $jobid)
272
+
273
+
if [ "$jobresult"!="1" ];then
274
+
echo"ERROR: Failed to restart network with id $1">>$LOGFILE
275
+
else
276
+
echo"INFO: Successfully restarted network with id $1">>$LOGFILE
INSERT IGNORE INTO configuration VALUES ('Storage', 'DEFAULT', 'management-server', 'storage.pool.max.waitseconds', '3600', 'Timeout (in seconds) to synchronize storage pool operations.');
20
20
INSERT IGNORE INTO configuration VALUES ('Storage', 'DEFAULT', 'management-server', 'storage.template.cleanup.enabled', 'true', 'Enable/disable template cleanup activity, only take effect when overall storage cleanup is enabled');
UPDATE vm_instance SET vm_template_id=(SELECT id FROM vm_template WHERE name='systemvm-xenserver-2.2.10'AND removed IS NULL) where vm_template_id=1;
27
+
UPDATE vm_instance SET vm_template_id=(SELECT id FROM vm_template WHERE name='systemvm-kvm-2.2.10'AND removed IS NULL) where vm_template_id=3;
28
+
UPDATE vm_instance SET vm_template_id=(SELECT id FROM vm_template WHERE name='systemvm-vSphere-2.2.10'AND removed IS NULL) where vm_template_id=8;
29
+
30
+
-- Update system Vms using systemvm-xenserver-2.2.4 template;
31
+
UPDATE vm_instance SET vm_template_id=(SELECT id FROM vm_template WHERE name='systemvm-xenserver-2.2.10'AND removed IS NULL) where vm_template_id=(SELECT id FROM vm_template WHERE name='systemvm-xenserver-2.2.4'AND removed IS NULL);
0 commit comments