-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestart_all_vms.sh
executable file
·38 lines (27 loc) · 1 KB
/
restart_all_vms.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# for each windowsmesh namespace
namespaces=""
namespaces=$(oc get ns | awk '/windowsmesh/ { print $1 }')
echo $namespaces
n=""
for n in $namespaces
do
virtctl restart winweb01 -n $n
virtctl restart winweb02 -n $n
virtctl restart database -n $n
done
# make the the VM works
#
read "chicken"
# get machine type
machine_type=$(oc get machines -A -l 'machine.openshift.io/cluster-api-machine-type=metal' -o jsonpath='{.items[0].metadata.labels.machine\.openshift\.io/instance-type}')
echo "#### Machine Type: $machine_type"
# watch the VMs and the nodes
watch "echo 'VMs per Metal Node:'; oc get vmi -A -o jsonpath='{.items[*].metadata.labels.kubevirt\.io/nodeName}' \
| tr ' ' '\n' \
| sort \
| uniq -c; \
echo 'VMs not yet Running:'; \
oc get vms -A | grep -v Running"
#watch -n10 "echo 'Created winweb03:'; oc get vms -A -l app=winweb03; echo 'Metal Node Capacity:';oc adm top nodes -l node.kubernetes.io/instance-type=$machine_type"
# delete all the VMs