[devstack] Upload images with --file instead of stdin

This makes all the image upload commands in the devstack plugin use
--file instead of stdin redirection, and also uses an absolute path.
One of the commands was already doing it this way. By doing the upload
like this, it makes the devstack plugin usable with the OCaaS devstack
mode (for faster openstack client ops) since we can't pass the image
stream via stdin. Most people will be using --file for uploading
anyway, so this is probably more realistic anyway.

Change-Id: I8d97ed731133d02aed46a078c50769692ad7ba04
This commit is contained in:
Dan Smith 2024-05-08 11:00:44 -07:00
parent 5a75e9afbb
commit a0f48b6425
1 changed files with 7 additions and 5 deletions

View File

@ -3003,7 +3003,7 @@ function upload_image_if_needed {
openstack image create $IRONIC_PARTITIONED_IMAGE_NAME \
--public --disk-format raw --container-format bare \
--property kernel_id=$kernel_id --property ramdisk_id=$ramdisk_id \
--file "$dest"
--file $(readlink -f "$dest")
# Change the default image only if the provided settings prevent the
# default cirros image from working.
@ -3072,7 +3072,7 @@ function upload_baremetal_ironic_efiboot {
--public --disk-format=raw \
--container-format=bare \
-f value -c id \
< $IRONIC_EFIBOOT)
--file $(readlink -f $IRONIC_EFIBOOT))
die_if_not_set $LINENO IRONIC_EFIBOOT_ID "Failed to load EFI bootloader image into glance"
iniset $IRONIC_CONF_FILE conductor bootloader $IRONIC_EFIBOOT_ID
@ -3145,7 +3145,8 @@ function upload_baremetal_ironic_deploy {
$ironic_deploy_kernel_name \
--public --disk-format=aki \
--container-format=aki \
< $IRONIC_DEPLOY_KERNEL | grep ' id ' | get_field 2)
--file $(readlink -f $IRONIC_DEPLOY_KERNEL) | \
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-cloud devstack-admin \
@ -3153,7 +3154,8 @@ function upload_baremetal_ironic_deploy {
$ironic_deploy_ramdisk_name \
--public --disk-format=ari \
--container-format=ari \
< $IRONIC_DEPLOY_RAMDISK | grep ' id ' | get_field 2)
--file $(readlink -f $IRONIC_DEPLOY_RAMDISK) | \
grep ' id ' | get_field 2)
die_if_not_set $LINENO IRONIC_DEPLOY_RAMDISK_ID "Failed to load ramdisk image into glance"
else
@ -3162,7 +3164,7 @@ function upload_baremetal_ironic_deploy {
$(basename $IRONIC_DEPLOY_ISO) \
--public --disk-format=iso \
--container-format=bare \
< $IRONIC_DEPLOY_ISO -f value -c id)
--file $(readlink -f $IRONIC_DEPLOY_ISO) -f value -c id)
die_if_not_set $LINENO IRONIC_DEPLOY_ISO_ID "Failed to load deploy iso into glance"
fi
else