17. Validate the overcloud deploymentΒΆ

  • Create cleanup env function for heat
function cleanup() {
     heat stack-delete -y pingtest_stack
    if [[ $(tripleo wait_for -w 300 -d 30 -s "Stack not found" -- "heat stack-show pingtest_stack") ]]; then
        echo "Heat stack delete"
    else
        if [[ $(heat stack-list | grep pingtest_stack | grep -i failed) ]]; then
                     heat stack-delete -y pingtest_stack
                fi
    fi
    # Remove images and network
    rm -f /home/stack/cirros_images/cirros.*
    glance image-list | grep pingtest | awk '{print $2}' | while read IMAGEID; do glance image-delete $IMAGEID; done
    #neutron net-delete nova > /dev/null 2>&1 || true
    neutron net-delete nova
}
# trap on exit #nodocs
trap cleanup EXIT #nodocs
  • Source tenantrc file
source /home/stack/overcloudrc
  • Check if an environment is already deployed and, in case, cleanup it
[ "x$(heat stack-list | grep pingtest_stack || true)" != "x" ] && cleanup
# get validate image
if [[ ! -d /home/stack/cirros_images ]]; then
    mkdir /home/stack/cirros_images;
fi
IMAGE_PATH=/home/stack/cirros_images/cirros.img
INITRAMFS_PATH=/home/stack/cirros_images/cirros.initramfs
KERNEL_PATH=/home/stack/cirros_images/cirros.kernel
curl -L -o $IMAGE_PATH http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
curl -L -o $INITRAMFS_PATH http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-initramfs
curl -L -o $KERNEL_PATH http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-kernel
  • Upload cirros image into glance
ramdisk_id=$(openstack image create pingtest_initramfs --public --container-format ari --disk-format ari --file $INITRAMFS_PATH | grep ' id ' | awk '{print $4}')
kernel_id=$(openstack image create pingtest_kernel --public --container-format aki --disk-format aki --file $KERNEL_PATH | grep ' id ' | awk '{print $4}')
openstack image create pingtest_image --public --container-format ami --disk-format ami \
    --property kernel_id=$kernel_id --property ramdisk_id=$ramdisk_id --file $IMAGE_PATH
  • Create external network
..note: Liberty comparability:
heat can’t create an external network in liberty)
neutron net-create nova --router:external=True \
    --provider:network_type flat \
    --provider:physical_network datacentre \


neutron subnet-create --name ext-subnet \
    --allocation-pool \
    start=10.0.0.50,end=10.0.0.100 \
    --disable-dhcp \
    --gateway 10.0.0.1 \
    nova 10.0.0.0/24
  • Create test ping stack
heat stack-create pingtest_stack --template-file  tenantvm_floatingip.yaml
  • Get the floating ip
novaid=`nova list|grep Server1 |awk  '{print $2}'`
floating_ip=`nova floating-ip-list | grep $novaid | awk  '{print $4}'`
nova console-log Server1
ping -c 1 $floating_ip
nova show Server1 || :
nova service-list || :
neutron agent-list ||:
nova console-log Server1