Contextualization: Adding a volatile swap partition with cloud-init on CentOS 7

I am installing a CentOS 7 VM from scratch. I would like, of course, to contextualize it and, more specifically, to add a volatile swap partition.

I configured the template by adding a volatile image of size 2GB and type=swap. Then, I installed the package “cloud-init”. After reboot, cloud-init seemd to do some work, but I still don’t see the swap being added.

Any ideas?

Thank you.

Maybe adding a command snippet in the USER_DATA that does the mount?

I have successfully managed to achieve automatic swap mount by installing the package one-context_4.8.1.rpm in the guest OS. And that is, I highlight, automatically, without me having to do anything except add the volatile image to the template.

Your answer, requiring me to do any kind of command scripting, violates the very nature of contextualization, i.e. to make things automatically.

My specific question is how to achieve the same thing without using one-context_4.8.1.rpm (because it is deprecated and obtaining it requires non-official knowledge) and, instead, use cloud-init, which is, apparently, the new hot… thing right now.

My post was inspired by this mailing thread: http://lists.opennebula.org/pipermail/users-opennebula.org/2014-September/046142.html

You are right, we should populate the userdata section accordiningly so cloud-init can pick it up. Could you please open a feature request?

OpenNebula context packages are NOT deprecated and obtaining them is documented in the Basic Contextualization guide.

We would love to recommend using cloud-init but adding new features to them is really complex. Most of other cloud manager rely on DHCP. We have our reasons not to force people to have a DHCP service. The biggest problem in cloud-init packages is reconfiguring the network. In some distributions this means setting down and up each interface but the maintainer don’t think this is a valid solution and the patches don’t get accepted.

We still recommend using context packages until we can have the same level of features and confidence in cloud-init.

Javi, that is valuable information, thank you! It’s good to know. My conclusion about one-context not being officially recommended was based on Basic Contextualization guide ver. 4.10 where there is no link to the package. I am sorry about the confusion.