Vmware CentOS 6 Contextualization


(serverx) #1

Hello im getting a problem that i couldn’t solve, basically i created a vm with centos 6, and as described here https://docs.opennebula.org/5.2/operation/vm_setup/kvm.html
I installed one-context_5.0.3.rpm then i executed:

yum install -y epel-release
yum install ruby
yum install -i dracut-modules-growroot
dracut -f

i removed the network card and i converted the vm into a template, so i imported the template into opennebula and i created the following contextualization

CONTEXT = [
ETH0_DNS = “$ETH0_DNS”,
ETH0_GATEWAY = “$ETH0_GATEWAY”,
ETH0_IP = “$ETH0_IP”,
ETH0_MASK = “$ETH0_MASK”,
ETH0_SEARCH_DOMAIN = “server.domain.com”,
PASSWORD = “$PASSWORD”,
SET_HOSTNAME = “$SET_HOSTNAME”,
START_SCRIPT = “yum install -y ntpdate” ]
CPU = "1"
DESCRIPTION = "Template CentOs 6 - 64bit"
GRAPHICS = [
KEYMAP = “en”,
LISTEN = “0.0.0.0”,
TYPE = “VNC” ]
HYPERVISOR = "vcenter"
KEEP_DISKS_ON_DONE = "NO"
LOGO = "images/logos/centos.png"
MEMORY = "1024"
NIC = [
NETWORK = “Public Switch- C”,
NETWORK_UNAME = “oneadmin” ]
PUBLIC_CLOUD = [
TYPE = “vcenter”,
VM_TEMPLATE = “42347588-55f3-8268-d355-bfed963f3491” ]
RESOURCE_POOL = "VPS"
SCHED_REQUIREMENTS = "NAME=“Cluster”"
USER_INPUTS = [
ETH0_DNS = “M|text|Server DNS”,
ETH0_GATEWAY = “M|text|Server Gateway”,
ETH0_IP = “M|text|Server Ip”,
ETH0_MASK = “M|text|Server SubnetMask”,
PASSWORD = “M|password|Root Password”,
SET_HOSTNAME = “M|text|Server Hostname” ]
VCENTER_DATASTORE = "STORAGE01"
VCPU = “1”

I set into my contextualization the “User Inputs” that will populate the network details of the server such ip, dns, gateway etc…
But after create the vm based on the template and contextualization the vm have the ip address of the centos installation and not the ip address and network details
as specified during the vm creation… just the password is correct, what im doing wrong ?

I saw also that when im starting the VM from the console i can see the following errors:

growroot: /dev/dm-0 is not a partition
Welcome to CentOS
start udev: udevd[451]: can not read '/etc/udev/rules.d/75-cd-aliases-generator.rules’
udevd[451]: can not read ‘/etc/udev/rules.d/75-cd-aliases-generator.rules’

udevd[451]: can not read '/etc/udev/rules.d/75-persistent-net-generator.rules’
udevd[451]: can not read ‘/etc/udev/rules.d/75-persistent-net-generator.rules’

Thanks for help


(Javi Fontán) #2

The context script need ETH0_MAC to search for the correct network interface. I believe this could work if you add to the context:

ETH0_MAC="$NIC[MAC,NIC_ID=0]"

Why don’t you let OpenNebula fill those values using NETWORK="YES" in context?


(serverx) #3

no way… i tried to add
ETH0_MAC="$NIC[MAC,NIC_ID=0]"
but the centos vm still not changing ip…

if i set NETWORK=“YES” in context how i can declare the vm ip during the provisioning?
Thanks