Don't use token for glance & check for some unset vars

There is a regression issue in stable/liberty where using a token for
auth is failing for glance. We don't need to use a token as we already
have our credentials. So stop using a token to upload to glance.

We call various commands to set certain variables. Add some checks to
make sure those variables are set and fail if they are not.

Partial-Bug: #1549095
Change-Id: Ic941d061edf3fe68c18b3eda198b1ed03f4a18fc
This commit is contained in:
John L. Villalovos 2016-02-11 13:24:53 -08:00
parent f7268313dc
commit e6b3c4217f
1 changed files with 8 additions and 8 deletions

View File

@ -451,6 +451,7 @@ function init_ironic {
# Save private network as cleaning network
local cleaning_network_uuid
cleaning_network_uuid=$(neutron net-list | grep private | get_field 1)
die_if_not_set $LINENO cleaning_network_uuid "Failed to get ironic cleaning network id"
iniset $IRONIC_CONF_FILE neutron cleaning_network_uuid ${cleaning_network_uuid}
# (Re)create ironic database
@ -524,20 +525,24 @@ function stop_ironic {
function create_ovs_taps {
local ironic_net_id
ironic_net_id=$(neutron net-list | grep private | get_field 1)
die_if_not_set $LINENO ironic_net_id "Failed to get ironic network id"
# Work around: No netns exists on host until a Neutron port is created. We
# need to create one in Neutron to know what netns to tap into prior to the
# first node booting.
local port_id
port_id=$(neutron port-create private | grep " id " | get_field 2)
die_if_not_set $LINENO port_id "Failed to create neutron port"
# intentional sleep to make sure the tag has been set to port
sleep 10
local tapdev
tapdev=$(sudo ip netns exec qdhcp-${ironic_net_id} ip link list | grep " tap" | cut -d':' -f2 | cut -d'@' -f1 | cut -b2-)
die_if_not_set $LINENO tapdev "Failed to get tap device id"
local tag_id
tag_id=$(sudo ovs-vsctl show |grep ${tapdev} -A1 -m1 | grep tag | cut -d':' -f2 | cut -b2-)
die_if_not_set $LINENO tag_id "Failed to get tag id"
# make sure veth pair is not existing, otherwise delete its links
sudo ip link show ovs-tap1 && sudo ip link delete ovs-tap1
@ -856,27 +861,22 @@ function upload_baremetal_ironic_deploy {
fi
fi
local token
token=$(openstack token issue -c id -f value)
die_if_not_set $LINENO token "Keystone fail to get token"
# load them into glance
IRONIC_DEPLOY_KERNEL_ID=$(openstack \
--os-token $token \
--os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT \
image create \
$(basename $IRONIC_DEPLOY_KERNEL_PATH) \
--public --disk-format=aki \
--container-format=aki \
< $IRONIC_DEPLOY_KERNEL_PATH | grep ' id ' | get_field 2)
die_if_not_set $LINENO IRONIC_DEPLOY_KERNEL_ID "Failed to load kernel image into glance"
IRONIC_DEPLOY_RAMDISK_ID=$(openstack \
--os-token $token \
--os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT \
image create \
$(basename $IRONIC_DEPLOY_RAMDISK_PATH) \
--public --disk-format=ari \
--container-format=ari \
< $IRONIC_DEPLOY_RAMDISK_PATH | grep ' id ' | get_field 2)
die_if_not_set $LINENO IRONIC_DEPLOY_RAMDISK_ID "Failed to load ramdisk image into glance"
}
function prepare_baremetal_basic_ops {