What is needed to make Cloud-Init and OpenNebula work?

Hi all,

Hopefully someone can help me with this request. First the setup:

vCenter environment running 5.5
OpenNebula 4.14 (from source)
vCenter template with CentOS 6.7 prepped with one-context-4.14.rpm and Cloud-Init 0.7.5
Using the below template to deploy VM:

CONTEXT=[
 SET_HOSTNAME="testvm003.staging4",
 ETH0_DNS="10.16.1.135 10.16.1.136",
 ETH0_GATEWAY="10.26.1.1",
 ETH0_IP="10.26.1.94",
 ETH0_MASK="255.255.255.0",
 ETH0_NETWORK="10.26.1.0",
 ETH0_SEARCH_DOMAIN="staging4",
 NETWORK="YES",
 DNS_HOSTNAME="YES",
 SSH_PUBLIC_KEY="ssh-rsa blahblahblah jmalena@host123",
 USER_DATA="#cloud-config
runcmd:
  - mkdir -p /usr/local/test
  - touch /usr/local/test/file.out " ]
NAME = "testvm003.staging4"
CPU = 2
VCPU = 2
MEMORY = 2048
GRAPHICS=[
  LISTEN="0.0.0.0",
  TYPE="vnc" ]
HYPERVISOR="vcenter"
NIC=[
  NETWORK="VLAN_101_10_26_1_0 - SJCCLUSTER",
  NETWORK_UNAME="oneadmin" ]
PUBLIC_CLOUD=[
 TYPE="vcenter",
 VM_TEMPLATE="42218aad-096a-a487-820d-c9ac9d018af5" ]
SCHED_REQUIREMENTS="NAME=\"SJCCLUSTER\""

Here is the generated context.sh file in the deployed VM:

# Context variables generated by OpenNebula
DISK_ID='0'
DNS_HOSTNAME='YES'
ETH0_DNS='10.16.1.135 10.16.1.136'
ETH0_GATEWAY='10.26.1.1'
ETH0_IP='10.26.1.92'
ETH0_MAC='02:00:63:8e:2a:08'
ETH0_MASK='255.255.255.0'
ETH0_NETWORK='10.26.1.0'
ETH0_SEARCH_DOMAIN='staging4'
NETWORK='YES'
SET_HOSTNAME='testvm001.staging4'
SSH_PUBLIC_KEY='ssh-rsa blahblahblah jmalena@host123'
TARGET='hda'
USER_DATA='#cloud-config
runcmd:
  - mkdir -p /usr/local/test
  - touch /usr/local/test/file.out '

Now the problem:

The contextualization of the VM works, but what does not work is the Cloud-Init section. I can’t seem to figure out what I’m doing wrong. From what I can tell is that a route is placed in the interface eth0 configuration for the network 169.254.0.0/16. The VM tries to communicate with the IP address 169.254.169.254 to obtain its metadata information. This information is locally on the server via the /tmp/context.sh script that was generated during the deployment of the VM, but this data doesn’t seem to be getting to Cloud-Init. Am I missing something? Does cloud.cfg in /etc/cloud/ in the VM template need to be configured differently than the default? I have tried the below setup with different options for dsmode. I have tried net and local and they don’t work:

disable_ec2_metadata: True
datasource_list: ['OpenNebula']
datasource:
  OpenNebula:
    dsmode: net
    parseuser: nobody

Thanks in advance,
Jesus

cloud-init does not work with OpenNebula using the vcenter as the way of contextualizing the VM is a little bit different. Instead of attaching a CDROM with context.sh the information is retrieved using vmwaretools.

You should use only one method of contextualization, with vcenter use OpenNebula context packages alone. To execute some commands in the machine you can use START_SCRIPT. For example:

CONTEXT = [
  NETWORK="YES",
  START_SCRIPT="mkdir -p /usr/local/test
touch /usr/local/test/file.out"
]

HIi Javi,

Thank you for letting me know that this does not work, but that there is a work around with START_SCRIPT. I have gone ahead and tested this and I can definitely run it this way. I was thinking that this was impossible to do, but now I can setup and install chef-client and my systems are getting configured properly via Chef, which was my ultimate goal. Thank you for the hint. Now we can setup OpenNebula in our infrastructure and replace OpenStack. :smile:

One more thing, support for OpenNebula. Where can I buy it? How much does it cost? How does this play into new features down the road, say if my company wanted a feature that currently is not in OpenNebula? One more question, if the choice was between OpenNebula, or vOneCloud, which would be the best one for a vCenter infrastructure, but with the ability to phase out VMware in the future?

Thanks,
Jesus

Nice it works for you. There’s also the variable START_SCRIPT_BASE64. This is decoded by the context packages in case you need to add a more complex script:

http://docs.opennebula.org/4.14/user/virtual_machine_setup/cong.html#using-user-template-variables

OpenNebula Systems can give you the support and professional services needed. Please, send an email to contact@opennebula.systems and one of my colleagues will be in touch.

Oh, forgot about the OpenNebula vOneCloud question. If you are planning to use also KVM or Xen you should better use OpenNebula as vOneCloud comes with those drivers, and some sunstone features disabled. They can be enabled editing configuration files but in the next upgrade they will be disabled again.

Why cloud-init is not supported in Opennebula. What is the better alternative to this? How to do this?