Use normal API not token/endpoint for image uploads
There is no reason to use keystone token bootstrapping for image uploads. Glance is a service, and images can be uploaded to it normally without special shenanigans. Depends-On: If7b81c4a6746c8a1eb0302c96e045fb0f457d67b Change-Id: I7092fb10cbe243e091789134263fab081af0c7f4
This commit is contained in:
parent
7224eecb98
commit
31c313d3a3
23
functions
23
functions
@ -71,7 +71,7 @@ function upload_image {
|
|||||||
# OpenVZ-format images are provided as .tar.gz, but not decompressed prior to loading
|
# OpenVZ-format images are provided as .tar.gz, but not decompressed prior to loading
|
||||||
if [[ "$image_url" =~ 'openvz' ]]; then
|
if [[ "$image_url" =~ 'openvz' ]]; then
|
||||||
image_name="${image_fname%.tar.gz}"
|
image_name="${image_fname%.tar.gz}"
|
||||||
openstack --os-token $token --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image create "$image_name" --public --container-format ami --disk-format ami < "${image}"
|
openstack --os-cloud=devstack-admin image create "$image_name" --public --container-format ami --disk-format ami < "${image}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ function upload_image {
|
|||||||
vmdk_adapter_type="${props[1]:-$vmdk_adapter_type}"
|
vmdk_adapter_type="${props[1]:-$vmdk_adapter_type}"
|
||||||
vmdk_net_adapter="${props[2]:-$vmdk_net_adapter}"
|
vmdk_net_adapter="${props[2]:-$vmdk_net_adapter}"
|
||||||
|
|
||||||
openstack --os-token $token --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image create "$image_name" --public --container-format bare --disk-format vmdk --property vmware_disktype="$vmdk_disktype" --property vmware_adaptertype="$vmdk_adapter_type" --property hw_vif_model="$vmdk_net_adapter" < "${image}"
|
openstack --os-cloud=devstack-admin image create "$image_name" --public --container-format bare --disk-format vmdk --property vmware_disktype="$vmdk_disktype" --property vmware_adaptertype="$vmdk_adapter_type" --property hw_vif_model="$vmdk_net_adapter" < "${image}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -199,8 +199,7 @@ function upload_image {
|
|||||||
force_vm_mode="--property vm_mode=xen"
|
force_vm_mode="--property vm_mode=xen"
|
||||||
fi
|
fi
|
||||||
openstack \
|
openstack \
|
||||||
--os-token $token \
|
--os-cloud=devstack-admin \
|
||||||
--os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT \
|
|
||||||
image create \
|
image create \
|
||||||
"$image_name" --public \
|
"$image_name" --public \
|
||||||
--container-format=ovf --disk-format=vhd \
|
--container-format=ovf --disk-format=vhd \
|
||||||
@ -214,8 +213,7 @@ function upload_image {
|
|||||||
if [[ "$image_url" =~ '.xen-raw.tgz' ]]; then
|
if [[ "$image_url" =~ '.xen-raw.tgz' ]]; then
|
||||||
image_name="${image_fname%.xen-raw.tgz}"
|
image_name="${image_fname%.xen-raw.tgz}"
|
||||||
openstack \
|
openstack \
|
||||||
--os-token $token \
|
--os-cloud=devstack-admin \
|
||||||
--os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT \
|
|
||||||
image create \
|
image create \
|
||||||
"$image_name" --public \
|
"$image_name" --public \
|
||||||
--container-format=tgz --disk-format=raw \
|
--container-format=tgz --disk-format=raw \
|
||||||
@ -231,8 +229,7 @@ function upload_image {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
openstack \
|
openstack \
|
||||||
--os-token $token \
|
--os-cloud=devstack-admin \
|
||||||
--os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT \
|
|
||||||
image create \
|
image create \
|
||||||
"$image_name" --public \
|
"$image_name" --public \
|
||||||
--container-format=bare --disk-format=ploop \
|
--container-format=bare --disk-format=ploop \
|
||||||
@ -314,9 +311,9 @@ function upload_image {
|
|||||||
|
|
||||||
if [ "$container_format" = "bare" ]; then
|
if [ "$container_format" = "bare" ]; then
|
||||||
if [ "$unpack" = "zcat" ]; then
|
if [ "$unpack" = "zcat" ]; then
|
||||||
openstack --os-token $token --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < <(zcat --force "${image}")
|
openstack --os-cloud=devstack-admin image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < <(zcat --force "${image}")
|
||||||
else
|
else
|
||||||
openstack --os-token $token --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < "${image}"
|
openstack --os-cloud=devstack-admin image create "$image_name" $img_property --public --container-format=$container_format --disk-format $disk_format < "${image}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Use glance client to add the kernel the root filesystem.
|
# Use glance client to add the kernel the root filesystem.
|
||||||
@ -324,12 +321,12 @@ function upload_image {
|
|||||||
# kernel for use when uploading the root filesystem.
|
# kernel for use when uploading the root filesystem.
|
||||||
local kernel_id="" ramdisk_id="";
|
local kernel_id="" ramdisk_id="";
|
||||||
if [ -n "$kernel" ]; then
|
if [ -n "$kernel" ]; then
|
||||||
kernel_id=$(openstack --os-token $token --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image create "$image_name-kernel" $img_property --public --container-format aki --disk-format aki < "$kernel" | grep ' id ' | get_field 2)
|
kernel_id=$(openstack --os-cloud=devstack-admin image create "$image_name-kernel" $img_property --public --container-format aki --disk-format aki < "$kernel" | grep ' id ' | get_field 2)
|
||||||
fi
|
fi
|
||||||
if [ -n "$ramdisk" ]; then
|
if [ -n "$ramdisk" ]; then
|
||||||
ramdisk_id=$(openstack --os-token $token --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image create "$image_name-ramdisk" $img_property --public --container-format ari --disk-format ari < "$ramdisk" | grep ' id ' | get_field 2)
|
ramdisk_id=$(openstack --os-cloud=devstack-admin image create "$image_name-ramdisk" $img_property --public --container-format ari --disk-format ari < "$ramdisk" | grep ' id ' | get_field 2)
|
||||||
fi
|
fi
|
||||||
openstack --os-token $token --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT image create "${image_name%.img}" $img_property --public --container-format ami --disk-format ami ${kernel_id:+--property kernel_id=$kernel_id} ${ramdisk_id:+--property ramdisk_id=$ramdisk_id} < "${image}"
|
openstack --os-cloud=devstack-admin image create "${image_name%.img}" $img_property --public --container-format ami --disk-format ami ${kernel_id:+--property kernel_id=$kernel_id} ${ramdisk_id:+--property ramdisk_id=$ramdisk_id} < "${image}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
stack.sh
2
stack.sh
@ -1216,8 +1216,6 @@ fi
|
|||||||
# See https://help.ubuntu.com/community/CloudInit for more on ``cloud-init``
|
# See https://help.ubuntu.com/community/CloudInit for more on ``cloud-init``
|
||||||
|
|
||||||
if is_service_enabled g-reg; then
|
if is_service_enabled g-reg; then
|
||||||
TOKEN=$(openstack token issue -c id -f value)
|
|
||||||
die_if_not_set $LINENO TOKEN "Keystone fail to get token"
|
|
||||||
|
|
||||||
echo_summary "Uploading images"
|
echo_summary "Uploading images"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user