Hello,
Today I played with salt.cloud.clouds.opennebula, salt.states.cloud and
salt.modules.cloud to try to automatically generate and maintain master
VM images.
I had no success in creating states to do so, here is what I manage to
do with plain OpenNebula XML RPC API:
1. create an empty disk
2. download an ISO from an URL
3. start a VM by providing the VM template directly to OpenNebula (the
template has no existence in itself, it's not registered)
4. proceed the installation
5. install stuff in the VM (contextualisation package)
6. shutdown the VM
7. save the disk image for future use
8. register a VM template using the saved image
Now I have a fresh install image and VM template, I can:
1. start a VM from the saved template
2. connect to the running VM
3. add stuffs (for example some dev tools)
4. shutdown the VM
5. save the disk and template
Now, I have a “developer VM”.
The global idea is to regenerate the VMs regularly, starting from the
beginning.
This permit to have ready to use VMs in OpenNebula without the need to
wait for packages installation and configuration when a user start them.
It looks like the salt OpenNebula module cloud do all of this but I
don't manage to use salt.cloud.clouds.opennebula from states.
It looks like I can only make sure I have a specific VM started.
Another point, the salt.cloud.clouds.opennebula is >= 4k lines, what do
you think about using python-oca[1] to make a prototype of
salt.cloud.clouds.oca, and expose everything in a salt.states.oca?
For example we could define oca.host, oca.cluster, oca.vnet,
oca.datastore, oca.image, oca.template, oca.vm, etc.
This way we could make a state files to populate an OpenNebula, in
addition to the existing formula[2] to setup and configure the
OpenNebula services.
Regards.
Footnotes:
[1]
https://github.com/python-oca/python-oca
[2]
https://github.com/bechtoldt/saltstack-opennebula-formula
--
Daniel Dehennin
Récupérer ma clef GPG: gpg --recv-keys 0xCC1E9E5B7A6FE2DF
Fingerprint: 3E69 014E 5C23 50E8 9ED6 2AAD CC1E 9E5B 7A6F E2DF