Image customization and network context in ONE 4.6

Good morning,

I’d want to customize an ubuntu image, in order to deploy VMs which include some applications.

I made a test which consists in the following steps:

1- Creating a OS image with a minimal ubuntu iso.
2- Creating a persistent and empty datablock.
3- Creating a template with the two images, a vnet, etc.
4- Deploy a VM to boot from the OS image and install ubuntu in the datablock.
5- Delete the VM and make a copy of the datablock (change type to OS and make it not persistent). I’d preserve the old datablock if I want the VMs to have more applications in the future.
6- Deploy a VM from another template which has only the new OS image.

My problem is the network contextualization with the new images. I understand that since the datablock is persistent, it contains the network config of the VM that I used to install ubuntu, but what could I do so that each new VM, deployed in the step 6., contains its own network configuration, instead of the config from the old VM?

I used network contextualization in the two templates.

Thank you very much.



Any ideas? I’d appreciate them a lot

Thank you very much

The context packages clean the network configuration when they are installed and this configiration is regenerated each time the VM starts. Here is the post-install code that does the cleaning for debian based distros:

Thank you very much, but I don’t really understand what you mean. Should I generate a package which contains the code you showed in order to change the IP etc.?

When I deploy a VM with my custom CentOS, I see that a CD is mounted with the network data but if a type ifconfig, the confguration is the same as the one I used in the datablock when I first installed the SO.

Thank you very much

Hi Malfonso,

I’ve done essentially the same process in Windows. Basically you will need to make sure that the image you are building in the datablock includes the opennebula-context package (e.g. - you would need to add this to the preseed that you use to build the image in the datablock so that it is present in the new image, and runs when any new VMs are booted off it.


Hi Paul_Batchelor,

It works! Thank you very much, your answer was very helpfull. My mistake was that I added the package to the SO in the machine where OpenNebula frontend is installed.

Best regards