openstackclient: booting from image-created volume w/ delete_on_termination
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 ... https://specs.openstack.org/openstack/nova-specs/specs/ussuri/implemented/de... Anything obvious I missed? Thanks, -- Kurt Garloff <kurt@garloff.de> Cologne, Germany
Hey! 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 https://docs.openstack.org/python-openstackclient/yoga/cli/command-objects/s... For API call it would be block_device_mapping_v2 option provided with request which supports kind of same format: https://docs.openstack.org/api-ref/compute/?expanded=create-server-detail#cr... ср, 6 июл. 2022 г. в 13:21, Kurt Garloff <openstack@garloff.de>:
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 ... https://specs.openstack.org/openstack/nova-specs/specs/ussuri/implemented/de...
Anything obvious I missed?
Thanks,
-- Kurt Garloff <kurt@garloff.de> Cologne, Germany
Hi Dmitriy, thanks for your response! It looks like this option is new in Wallaby and it looks like it would address my use-case. I'll grab newer client utils and see whether it works. -- Kurt On 06.07.22 13:56, Dmitriy Rabotyagov wrote:
Hey!
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 https://docs.openstack.org/python-openstackclient/yoga/cli/command-objects/s...
For API call it would be block_device_mapping_v2 option provided with request which supports kind of same format: https://docs.openstack.org/api-ref/compute/?expanded=create-server-detail#cr...
ср, 6 июл. 2022 г. в 13:21, Kurt Garloff <openstack@garloff.de>:
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? [...]
participants (2)
-
Dmitriy Rabotyagov
-
Kurt Garloff