Hi,
On Thu, November 10, 2016 2:09 pm, Derek Atkins wrote:
On Thu, November 10, 2016 12:54 pm, Sven Kieske wrote:
> I'm afraid there is nothing builtin atm, so you must script your own
> stuff.
I'm working on it. I've got all the infrastructure in place to do that.
Just need one more thing -- the ability to test when the engine is
actually operational.
For future reference, here's what I did. First, I set up a user and
permissions in ovirt UI. The user has Login and RUN_VM permissions. Then
I configured .ovirtshellrc with the user credentials (including password).
Then I created the following scripts (obviously you can set the VM names
and the wait-time between startup to your own settings).
Hopefully these scripts will help the next person who needs to solve this
problem.
-derek
cat > /etc/sysconfig/vm_list <<EOF
# List of VMs. Key = VM Name. Value = seconds to wait after starting
declare -A vm_list=(
[vm-1]=60
[vm-2]=60
)
EOF
cat > /usr/local/sbin/start_vms.sh <<EOF
#!/bin/bash
[ -f /etc/sysconfig/vm_list ] || exit 0
. /etc/sysconfig/vm_list
# Wait for the engine to respond
while [ `ovirt-shell -I -c -F -E ping 2>/dev/null | grep -c success` != 1 ]
do
echo "Not ready... Sleeping..."
sleep 60
done
# Now start all of the VMs in the requested order.
for vm in "${!vm_list[@]}"
do
ovirt-shell -I -c -F -E "action vm $vm start"
sleep ${vm_list[$vm]}
done
EOF
chmod +x /usr/local/sbin/start_vms.sh
cat >> /etc/rc.d/rc.local <<EOF
# Start the list of defined virtual machines
/usr/local/sbin/start_vms.sh &
EOF
chmod +x /etc/rc.d/rc.local
--
Derek Atkins 617-623-3745
derek(a)ihtfp.com
www.ihtfp.com
Computer and Internet Security Consultant