cloud-init custom UUID?

asked 2018-06-27 10:15:40 -0600 gravatar image

updated 2018-06-27 10:15:50 -0600

Hi colleagues,

brief googling didn't answer whether it's possible to configure cloud-init to use custom UUID (e.g. provided in metadata) instead of one provided by Openstack.

Whether it's possible to configure cloud-init in this manner?

Thank you.

edit retag flag offensive close merge delete


If I understand your question correctly (do you mean the "ID" column in "openstack server list"?), I don't think that there's a way. Cloud-init is processed after the instance has been created initially by openstack, so it also creates the UUID before the rest of the launch sequence proceeds.

eblock gravatar imageeblock ( 2018-07-02 09:43:01 -0600 )edit

Sure and there is no way to say Openstack "create VM with this UUID", that's why I want to use custom UUID. When I need to resize root volume, I need to delete VM (to make volume 'available'), then resize it and then create VM back. gravatar ( 2018-07-02 12:02:48 -0600 )edit

Openstack will create it with new UUID and cloud-init will do all things as for new VM, while in fact it's same VM and I don't need new ssh keys, etc on the production VM :) Instead I will use own ID in metadata and point cloud-init on this value instead of system's UUID. gravatar ( 2018-07-02 12:03:15 -0600 )edit

You don't need to recreate your instance to resize a root volume, if that's all what the question is about. You simply shutdown the vm, make the volume available, resize it and set the state back to attached, then boot your vm and it will have the larger volume.

eblock gravatar imageeblock ( 2018-07-03 02:21:48 -0600 )edit

This should do it:

control:~ # openstack server stop <VM>
control:~ # openstack volume set --state available <VOLUME>
control:~ # openstack volume set --size <SIZE> <VOLUME>
control:~ # openstack volume set --state in-use <VOLUME>
control:~ # openstack server start <VM>
eblock gravatar imageeblock ( 2018-07-03 02:23:48 -0600 )edit