...
Code Block | ||
---|---|---|
| ||
cat running_vms.json | jq -r '.[]|.uuid' | \ xargs -n 1 -I {} curl -X POST -H "apikey: $ADMIN_APIKEY" https://$API_HOST/v1/user-resource/admin/vm/stop -d uuid={} |
Check the responses, not all VMs might Open VMs panel in admin UI, change Filter by status to have only running and press the Reload button. Keep reloading every once in a while and see how the list gets shorter.
Not all VMs agree to stop. Windows is especially known for not stopping when requested. These VMs must be stopped forcefully.
Code Block | ||
---|---|---|
| ||
# There is no harm in sending stop again to VMs that are already stopped. We can reuse the same list.
cat running_vms.json | jq -r '.[]|.uuid' | \
xargs -n 1 -I {} curl -X POST -H "apikey: $ADMIN_APIKEY" https://$API_HOST/v1/user-resource/admin/vm/stop -d uuid={} -d force=True
|
...