Static network contextualization with vCenter template

Hi all,

I’m trying to determine what I need to do here, but I don’t know if this is possible. Currently we have a vCenter infrastructure managed with OpenStack. We don’t use vCenter templates directly. We have converted a template from vCenter and imported it into OpenStack by converting it to Qemu. With this I can define my network interface with static information via Cloud-init. As I was going through setting up OpenNebula, I thought this could be done without the need to convert my templates to Qemu. My thought was that by removing Cloud-init, installing the contextualization package into my VM and creating a new template I could define static network information, but it seems based on this documentation here:

http://docs.opennebula.org/4.14/user/virtual_machine_setup/bcont.html#vcenter-context

This is not possible?

Also what complicates things is the fact that if I were to build my infrastructure with vCenter drivers, I can’t use the system datastore to deploy images into my vCenter infrastructure so the Qemu route is not going to work for my scenario.

Am I reading this correctly, or am I way off?

Please advise.
Jesus

After trying, unlike what it says in the documentation this actually works. Using the below template as an example, I’m able to add the IP that I want to an instance with the contextualization scripts:

CONTEXT=[
SET_HOST=“test-vm02”,
ETH0_DNS=“8.8.8.8 8.8.4.4”,
ETH0_GATEWAY=“130.10.0.1”,
ETH0_IP=“130.10.0.1”,
ETH0_MASK=“255.255.255.0”,
ETH0_NETWORK=“130.10.0.0”,
NETWORK=“YES”,
SSH_PUBLIC_KEY=“ssh-rsa blahblahblah jmalena@host123” ]
NAME="test-vm02"
CPU="2"
MEMORY="2048"
GRAPHICS=[
LISTEN=“0.0.0.0”,
TYPE=“vnc” ]
HYPERVISOR="vcenter"
NIC=[
NETWORK=“VLAN_201_172_26_1_128”,
NETWORK_UNAME=“oneadmin” ]
PUBLIC_CLOUD=[
TYPE=“vcenter”,
VM_TEMPLATE=“4221e46b-dd8c-9ca0-067e-2ff0cf7160f1” ]
SCHED_REQUIREMENTS=“NAME=“SJCCLUSTER””

What doesn’t work though is the tag SET_HOST in the CONTEXT section. I have also tried HOSTNAME and the name of the VM internally does not change. Am I doing something incorrectly?

Jesus

Well came to find out while looking at the 05-hostname script within the contextualization RPM that the correct definition for the name is:

SET_HOSTNAME

Not SET_HOST or HOSTNAME. So the documentation requires a little update.

Though I still have 2 issues which hopefully I can get a better understanding:

NAME which defines the name of the machine in OpenNebula does not get parsed during the instantiate run. Running this command:

onetemplate instantiate 2 test.tpl

Where test.tpl has the data above. Instead my VM ends up having the one-VMID-templatename-host name.

Also the FILES section doesn’t seem to work either. Where do I have to put the files I want to include in the contextualization phase? I thought it was datastore 2, but that requires the FILE_DS tag, but if you are using vCenter drivers, it states in the documentation that it does not work? If someone can point me in the right direction, I would gladly appreciate it.

Thanks in advance,
Jesus

OK I sincerely apologize to all as I’ve dragged many of you through my trials and errors. So I’ve managed to get the naming of VMs in OpenNebula corrected by using the onevm command to create the VMs instead of using the onetemplate instantiate command. Problem that I still have though is that VMs are defined as one-VMID-hostname. Tino pointed this out based on this code:

https://github.com/OpenNebula/one/commit/639fede40dc22893b5eca6e00a96a70440dedb4b

So I’m OK with this change. The other issue that I have may be related to the following limitation with the vCenter drivers?

http://docs.opennebula.org/4.14/administration/virtualization/vcenterg.html#considerations-limitations

Quote “No files in context: Passing entire files to VMs is not supported, but all the other CONTEXT sections will be honored”

Am I reading this correctly? Issue is that I need to automate the installation, registration and running of the chef-client application on these VMs. I can’t have admins logging in to run these manually as I’ll be creating hundreds of these. Sure I can run the VMs through an pssh command, but that defeats the purpose of the contextualization in my opinion.

One more thing I wanted to ask is it possible to resize the original root filesystem from a template created in vCenter? I ask this because looking at the same documentation page I linked above I see the following section:

http://docs.opennebula.org/4.14/administration/virtualization/vcenterg.html#requirements

In the ReconfigVM_Task, one of the tasks that is available is VirtualMachine.Config.DiskExtend. If it is possible, how do I accomplish this as I did try and nothing occurred? Below is a section from the template file I created. I wanted to extend the size of the current disk from 10GBs to 20GBs:

DISK=[
TYPE=“fs”,
SIZE=“20000”,
TARGET=“sda” ]

Thanks and I apologize in advance as I’m no expert in OpenNebula by any means so I hope you can bare with me.

Jesus

Hi Jesus,

Regarding the CONTEXT documentation, we’ve opened a ticket to amend this:

http://dev.opennebula.org/issues/4085

The FILES request is very reasonable and not currently possible, we added it to our roadmap:

http://dev.opennebula.org/issues/4086

Disk resizing is also not supported in vCenter, and will fall under a campaign to enable storage management.

Hi Tino,

Thanks for replying. I was able to fix my issue with your suggestion of using the start_script section of the contextualization from another ticket you had responded to.

Much appreciate the help.

Jesus