Sometimes I want to bulk migrate my VMs from the command line rather than using the web interface. To do this, I just run a for loop like so:
Sometimes this works great, sometimes it doesn't. When it doesn't I get a error in the logs just saying "
service 'vm:205' - migration failed (exit code 1)". It seems to happen on the VM's managed by HA only but I can't say that for 100% certainty. However, I notice if I do them one at a time, it works fine. Is there a problem with using the for loop this way? Is there a better way to bulk migrate via command line?
Code:
for vm in $(qm list | awk '{print $1}' | grep -Eo '[0-9]{1,3}'); do qm migrate $vm node2 --online; done
Sometimes this works great, sometimes it doesn't. When it doesn't I get a error in the logs just saying "
service 'vm:205' - migration failed (exit code 1)". It seems to happen on the VM's managed by HA only but I can't say that for 100% certainty. However, I notice if I do them one at a time, it works fine. Is there a problem with using the for loop this way? Is there a better way to bulk migrate via command line?