In my opinion, at least one of the two following statements should be true to some extent:
- LibCloud is poorly documented.
- Google ranks as more important those pages where the information about LibCloud is a total mishmash.
In any case, I struggled for quite some time to do a very basic thing, such as creating a VM in OpenStack through LibCloud, therefore, I wanted to share the outcome with the rest of the wold.
What the following code is about:
In a few words, the following code creates a VM within a particular network and associates to it a floating IP address.
The main two issues that are addressed here are:
- Dealing with the fact that Neutron does not support auto-assignment of floating IP addresses.
- Allowing the user to specify either the ID or the name of attributes (image, size, network, etc).
What the following code is NOT:
This is not supposed to be production code. In this gist, I put together some parts of my actual code just to give the idea of how I am dealing with these two problems. I don’t claim this is the only or the best way.