Browse code

Ironic: 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
(cherry-picked from openstack/ironic commit e6b3c4217f27818acedb15c925641f9d1aa5ab34)
Change-Id: I398cd61dd731c03346cf10e5b3102d8d809d3f87

John L. Villalovos authored on 2016/03/10 06:09:38
Showing 1 changed files
... ...
@@ -499,11 +499,13 @@ function stop_ironic {
499 499
 
500 500
 function create_ovs_taps {
501 501
     local ironic_net_id=$(neutron net-list | grep private | get_field 1)
502
+    die_if_not_set $LINENO ironic_net_id "Failed to get ironic network id"
502 503
 
503 504
     # Work around: No netns exists on host until a Neutron port is created.  We
504 505
     # need to create one in Neutron to know what netns to tap into prior to the
505 506
     # first node booting.
506 507
     local port_id=$(neutron port-create private | grep " id " | get_field 2)
508
+    die_if_not_set $LINENO port_id "Failed to create neutron port"
507 509
 
508 510
     # intentional sleep to make sure the tag has been set to port
509 511
     sleep 10
... ...
@@ -513,7 +515,9 @@ function create_ovs_taps {
513 513
     else
514 514
         local tapdev=$(sudo ip link list | grep " tap" | cut -d':' -f2 | cut -d'@' -f1 | cut -b2-)
515 515
     fi
516
+    die_if_not_set $LINENO tapdev "Failed to get tap device id"
516 517
     local tag_id=$(sudo ovs-vsctl show |grep ${tapdev} -A1 -m1 | grep tag | cut -d':' -f2 | cut -b2-)
518
+    die_if_not_set $LINENO tag_id "Failed to get tag id"
517 519
 
518 520
     # make sure veth pair is not existing, otherwise delete its links
519 521
     sudo ip link show ovs-tap1 && sudo ip link delete ovs-tap1
... ...
@@ -771,26 +775,22 @@ function upload_baremetal_ironic_deploy {
771 771
         fi
772 772
     fi
773 773
 
774
-    local token=$(openstack token issue -c id -f value)
775
-    die_if_not_set $LINENO token "Keystone fail to get token"
776
-
777 774
     # load them into glance
778 775
     IRONIC_DEPLOY_KERNEL_ID=$(openstack \
779
-        --os-token $token \
780
-        --os-url http://$GLANCE_HOSTPORT \
781 776
         image create \
782 777
         $(basename $IRONIC_DEPLOY_KERNEL_PATH) \
783 778
         --public --disk-format=aki \
784 779
         --container-format=aki \
785 780
         < $IRONIC_DEPLOY_KERNEL_PATH  | grep ' id ' | get_field 2)
781
+    die_if_not_set $LINENO IRONIC_DEPLOY_KERNEL_ID "Failed to load kernel image into glance"
782
+
786 783
     IRONIC_DEPLOY_RAMDISK_ID=$(openstack \
787
-        --os-token $token \
788
-        --os-url http://$GLANCE_HOSTPORT \
789 784
         image create \
790 785
         $(basename $IRONIC_DEPLOY_RAMDISK_PATH) \
791 786
         --public --disk-format=ari \
792 787
         --container-format=ari \
793 788
         < $IRONIC_DEPLOY_RAMDISK_PATH  | grep ' id ' | get_field 2)
789
+    die_if_not_set $LINENO IRONIC_DEPLOY_RAMDISK_ID "Failed to load ramdisk image into glance"
794 790
 }
795 791
 
796 792
 function prepare_baremetal_basic_ops {