I would like to know if you know how I can shutdown ALL VM / CT in parallel ? (as in the GUI).
I have setup a script to shutdown VM, CT and then set the noout flag on the CEPH Cluster and finally shutdown the server.
Problem is that the script iterates with a for loop (which causes VM to be shutdown one by one) and not in parallel (which should greatly reduce the shutdown time.
Here is my script :
I have setup a script to shutdown VM, CT and then set the noout flag on the CEPH Cluster and finally shutdown the server.
Problem is that the script iterates with a for loop (which causes VM to be shutdown one by one) and not in parallel (which should greatly reduce the shutdown time.
Here is my script :
Bash:
#!/bin/bash
VM_LIST=/tmp/list_VM.list
CT_LIST=/tmp/list_CT.list
# We catch the VM & CT from each server
qm list | awk 'NR>1{ print $1 }' > $VM_LIST
pct list | awk 'NR>1{ print $1 }' > $CT_LIST
mapfile -t listvm < $VM_LIST
for i in ${listvm[@]};
do
echo "I will shutdown VM $i"
qm shutdown $i
echo "VM $i has been shutdown"
echo ""
done
mapfile -t listct < $CT_LIST
for i in ${listct[@]};
do
echo "I will shutdown CT $i"
pct shutdown $i
echo "CT $i has been shutdown"
echo ""
done
echo "We set the noout flag on CEPH Cluster:"
ceph osd set noout
echo "We now can safely shutdown the server"
shutdown -h now
echo "End of script and deletion of VM / CT lists"
rm $VM_LIST
rm $CT_LIST