Пример остановки ВМ с контролем while
#!/bin/bash
declare -a vmlist='314f21ce-aa51-464c-9285-a6cf127ad610'
for vm in $vmlist; do
echo $vm
## server stop
openstack server stop $vm;
declare VMST=$(openstack server show -c status -f value $vm)
echo $VMST; sleep 1
while [[ $VMST = "ACTIVE" ]]; do
declare VMST=$(openstack server show -c status -f value $vm); echo $VMST
sleep 1;
done
echo shutoff
done
echo Complete