From 3cb5df10f4e247267fd8b8dc01aa9e5734f79658 Mon Sep 17 00:00:00 2001 From: Benny Zlotnik Date: Wed, 13 Mar 2024 10:27:37 +0200 Subject: [PATCH] make the openstack vm image based and have a volume attached Signed-off-by: Benny Zlotnik --- cluster/providers/openstack/utils.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/cluster/providers/openstack/utils.sh b/cluster/providers/openstack/utils.sh index ccd3a11..347e280 100644 --- a/cluster/providers/openstack/utils.sh +++ b/cluster/providers/openstack/utils.sh @@ -218,12 +218,25 @@ function packstack_create_cirros_volume { openstack volume create --image cirros --size 1 cirros-volume # wait for the volume to be created - sleep 10 + while [ "$(openstack volume show -f value -c status cirros-volume)" != "available" ]; do + echo "waiting for volume to be created" + sleep 3 + done + + # boot VM instance from image + openstack server create --image cirros --flavor m1.tiny --wait cirros-server + + # wait for the server to be created + while [ "$(openstack server show -f value -c status cirros-server)" != "ACTIVE" ]; do + echo "waiting for server to be created" + sleep 3 + done + + # attach the cirros-volume to the server + echo "attaching volume to server" + openstack server add volume cirros-server cirros-volume - # boot VM instance from volume - openstack server create --flavor m1.tiny --volume cirros-volume cirros-volume - sleep 15 - openstack volume list + openstack volume list openstack server list }