From 4286a501138cbb3d3f1d1e0db423fe44e5aa603c Mon Sep 17 00:00:00 2001 From: Bertrand Lallau Date: Tue, 7 Mar 2017 10:37:11 +0100 Subject: [PATCH] Fix Magnum Kolla demo in contrib Magnum demo scripts doesn't work cause compose/openstack.env doesn't exist anymore. * NETWORK_MANAGER check has been removed * script has been updated to use Openstack client instead of deprecated clients (neutron-client, glance-client). * Magnum client calls have been adapted too. * some enhancements (logs, variable) have been performed too. Change-Id: I294b1876c9c7090785c0ebdd09b43843f88fb00b Closes-Bug: #1670618 --- contrib/demos/magnum/start | 46 +++++++++++++++++--------------------- contrib/demos/magnum/stop | 9 ++++---- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/contrib/demos/magnum/start b/contrib/demos/magnum/start index 3a3cd29a60..3ce77a2e15 100755 --- a/contrib/demos/magnum/start +++ b/contrib/demos/magnum/start @@ -1,40 +1,34 @@ #!/bin/bash -NETWORK_MANAGER=$(grep -sri NETWORK_MANAGER ../../compose/openstack.env | cut -f2 -d "=") -if [ "$NETWORK_MANAGER" != "neutron" ]; then - echo 'Magnum depends on the Neutron network manager to operate.' - echo 'Exiting because the network manager is' "$NETWORK_MANAGER". - exit 1 -fi - -echo Downloading glance image. IMAGE_URL=https://fedorapeople.org/groups/magnum -IMAGE=fedora-21-atomic-3.qcow2 +IMAGE_NAME=fedora-21-atomic-6 +IMAGE=${IMAGE_NAME}.qcow2 if ! [ -f "$IMAGE" ]; then + echo "Downloading ${IMAGE_NAME} image" curl -L -o ./$IMAGE $IMAGE_URL/$IMAGE fi -NIC_ID=$(neutron net-show public1 | awk '/ id /{print $4}') +NIC_ID=$(openstack network show public1 | awk '/ id /{print $4}') -glance image-delete fedora-21-atomic-3 2> /dev/null +openstack image delete ${IMAGE_NAME} 2> /dev/null -echo Loading fedora-atomic image into glance -glance image-create --name fedora-21-atomic-3 --progress --is-public true --disk-format qcow2 --container-format bare --file ./$IMAGE -GLANCE_IMAGE_ID=$(glance image-show fedora-21-atomic-3 | grep id | awk '{print $4}') +echo "Loading ${IMAGE_NAME} image into glance" +openstack image create --public --disk-format qcow2 --container-format bare --file ./$IMAGE ${IMAGE_NAME} +GLANCE_IMAGE_ID=$(openstack image show ${IMAGE_NAME} | grep id | awk '{print $4}') -echo registering os-distro property with image -glance image-update $GLANCE_IMAGE_ID --property os_distro=fedora-atomic +echo "Registering os-distro property with image" +openstack image set $GLANCE_IMAGE_ID --property os_distro=fedora-atomic -echo Creating baymodel -magnum baymodel-create \ - --name testbaymodel \ - --image-id $GLANCE_IMAGE_ID \ - --keypair-id mykey \ +echo "Creating cluster-template" +magnum cluster-template-create \ + --name testclustertemplate \ + --image $GLANCE_IMAGE_ID \ + --keypair mykey \ --fixed-network 10.0.3.0/24 \ - --external-network-id $NIC_ID \ - --dns-nameserver 8.8.8.8 --flavor-id m1.small \ + --external-network $NIC_ID \ + --tls-disabled \ + --dns-nameserver 8.8.8.8 --flavor m1.small \ --docker-volume-size 5 --coe kubernetes -echo Creating Bay -magnum bay-create --name testbay --baymodel testbaymodel --node-count 2 - +echo "Creating cluster" +magnum cluster-create --name testcluster --cluster-template testclustertemplate --node-count 2 diff --git a/contrib/demos/magnum/stop b/contrib/demos/magnum/stop index 67da543e07..c99ca26ecd 100755 --- a/contrib/demos/magnum/stop +++ b/contrib/demos/magnum/stop @@ -1,8 +1,9 @@ #!/bin/bash -magnum bay-delete testbay -while magnum bay-list | grep -q testbay; do +echo "Deleting cluster" +magnum cluster-delete testcluster +while magnum cluster-list | grep -q testcluster; do sleep 1 done -magnum baymodel-delete testbaymodel - +echo "Deleting cluster-template" +magnum cluster-template-delete testclustertemplate