openstackclient: booting from image-created volume w/ delete_on_termination

Dmitriy Rabotyagov noonedeadpunk at
Wed Jul 6 11:56:58 UTC 2022


delete_on_termination is a flag that is provided to nova during volume
attachment basically.
So in case of attaching volume to existing server, you can provide
that flag to attachment:

openstack server add volume --enable-delete-on-termination
--os-compute-api-version 2.79 $UUID

It's more complex when we're talking about server creation though.
What openstackclient allows you to do, is to provide --block-device
flag, where you can provide extra specs to the mapping. You can check
doc on how to use it here

For API call it would be block_device_mapping_v2 option provided with
request which supports kind of same format:

ср, 6 июл. 2022 г. в 13:21, Kurt Garloff <openstack at>:
> Hi openstack CLI wizards,
> Having flavors without disks, I want volumes to be created from images on the fly that I can boot from.
> But I don't want to do bookkeeping for these volumes; they should disappear once the server disappears.
> On the command line with nova, I can do this:
> nova boot --nic net-name=$MYNET --key-name $MYKEY --flavor $MYFLAVOR \
> --block-device "id=$MYIMGIFD,source=image,dest=volume,size=$MYSIZE,shutdown=remove,bootindex=0" $MYNAME
> I did not find a way to do this with openstack server create.
> Is there one?
> Here's what I tried:
> --image $MYIMGID --boot-from-volume $MYSIZE
> works, except that there is no way to specify delete_on_termination
> --block-device-mapping "sda=$MYIMGID:image:$MYSIZE:true"
> does complain that no --image or --volume have been passed.
> The option does not appear to be used for bootable volumes.
> I have seen a BP (merged with Ussuri) that would allow a PUT call to update delete_on_termination, but I don't see it usable with the openstackclient ...
> Anything obvious I missed?
> Thanks,
> --
> Kurt Garloff <kurt at>
> Cologne, Germany

More information about the openstack-discuss mailing list