start a bm poser node and ping it

This commit is contained in:
Derek Higgins 2013-05-16 19:13:02 +01:00
parent 932abe45e0
commit 8cf56aacb0
3 changed files with 33 additions and 8 deletions

View File

@ -18,3 +18,11 @@ ssh_noprompt(){
scp_noprompt(){
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $@
}
wait_for(){
for x in {0..60} ; do
$@ && return 0 || true
sleep 10
done
return 1
}

View File

@ -8,14 +8,15 @@ for repo in 'tripleo/incubator' 'tripleo/bm_poseur' 'stackforge/diskimage-builde
get_get_repo $repo
done
cd $TOCI_WORKING_DIR/tripleo_incubator
# patches can be added to git repo's like this, this just a temp measure we need to make faster progress
# until we get up and runing properly
cd $TOCI_WORKING_DIR/tripleo_incubator
for PATCH in $TOCI_SOURCE_DIR/patches/incubator* ; do
git am $PATCH
done
# install deps on host machine
cd $TOCI_WORKING_DIR/tripleo_incubator
./scripts/install-dependencies
id | grep libvirt || ( echo "You have been added to the libvirt group, this script will now exit but will succeed if run again in a new shell" ; exit 1 )
@ -29,15 +30,12 @@ bin/disk-image-create -u base -a i386 -o $TOCI_WORKING_DIR/tripleo_incubator/bas
cd $TOCI_WORKING_DIR/tripleo_incubator
sed -i "s/\"user\": \"stack\",/\"user\": \"`whoami`\",/" $TOCI_WORKING_DIR/stackforge_tripleo-image-elements/elements/boot-stack/config.json
ELEMENTS_PATH=$TOCI_WORKING_DIR/stackforge_tripleo-image-elements/elements \
DIB_PATH=$TOCI_WORKING_DIR/stackforge_diskimage-builder \
scripts/boot-elements boot-stack -o bootstrap
BOOTSTRAP_IP=`scripts/get-vm-ip bootstrap`
# We're going to give it 10 minutes to finish firstboot
for x in {0..60} ; do
ssh_noprompt root@$BOOTSTRAP_IP ls /opt/stack/boot-stack/boot-stack.done && break || true
sleep 10
done
# We're going to wait for it to finish firstboot
wait_for ssh_noprompt root@$BOOTSTRAP_IP ls /opt/stack/boot-stack/boot-stack.done && break || true

View File

@ -19,4 +19,23 @@ MAC=`$TOCI_WORKING_DIR/tripleo_bm_poseur/bm_poseur get-macs`
nova keypair-add --pub-key ~/.ssh/id_rsa.pub default
nova baremetal-node-create ubuntu 1 512 10 $MAC
wait_for ssh_noprompt root@$BOOTSTRAP_IP grep 'VCPUS' /var/log/upstart/nova-compute.log &> /dev/null && break || true
# Load the base image into glance
export DIB_PATH=$TOCI_WORKING_DIR/stackforge_diskimage-builder
./scripts/load-image base.qcow2
# place the bootstrap public key on host so that it can admin virt
ssh_noprompt root@$BOOTSTRAP_IP "cat /opt/stack/boot-stack/virtual-power-key.pub" >> ~/.ssh/authorized_keys
# Now we have to wait for the bm poseur to appear on the compute node and for the compute node to then
# update the scheduler
wait_for ssh_noprompt root@$BOOTSTRAP_IP grep \'record updated for\' /var/log/upstart/nova-compute.log
# I've tried all kinds of things to wait for before doing the nova boot and can't find a reliable combination,
# I suspect I need to watch the scheduler and compute log to follow a chain of events,
# but for now I'm tired so I'm going to
sleep 67
nova boot --flavor 256 --image base --key_name default bmtest
# ping the node TODO : make this more readable and output less errors
wait_for ssh_noprompt root@$BOOTSTRAP_IP 'source ~/stackrc ; ping -c 1 $(nova list | grep ctlplane | sed -e "s/.*=\(.*\) .*/\1/g")'