[one-users] Contextualization VM during deployment

igmph1 at gmail.com igmph1 at gmail.com
Thu Jun 24 08:14:00 PDT 2010


Hello,

I have problem with customizing to the VM during deployment. I use
CONTEXT variable.

I need set the hostname and IP address for the each VM.

The VM's template:

-----------------------------------   Start Template
--------------------------------
#NAME   = ubuntu
CPU    = 1
MEMORY = 512

OS      = [ BOOT   = hd ]

DISK   = [
  source   = "/storage/templates/ibob_ubuntu/disk2.qcow2",
  target   = "sda",
  readonly = "no" ]

DISK   = [
  source   = "/storage/templates/ibob_ubuntu/disk1.qcow2",
  target   = "sdb",
  readonly = "no" ]


DISK = [
        type   = swap,
        size   = 2048,
        target = sdb]

CONTEXT = [
  hostname  = "$NAME",
  ip_public = "$NIC[IP, NETWORK=\"wan01\"]",
  files     = "/storage/templates/vms_configuration/init.sh"
]


NIC    = [ NETWORK="wan01"]

GRAPHICS = [type="vnc",listen="0.0.0.0",port="-1"]

INPUT    = [ type = "tablet" ]
---------------------------------------End Template
------------------------------------------------------------

-------------------------------------- Error in oned.log
--------------------------------------------------------
Thu Jun 24 16:39:58 2010 [TM][D]: Message received: LOG - 72
tm_mkswap.sh: Initializing swap space

Thu Jun 24 16:39:58 2010 [TM][D]: Message received: LOG - 72
tm_mkswap.sh: Executed "/sbin/mkswap /var/lib/one/72/images/disk.2".

Thu Jun 24 16:39:58 2010 [TM][D]: Message received: LOG - 72
tm_mkswap.sh: Executed "chmod a+w /var/lib/one/72/images/disk.2".

Thu Jun 24 16:39:58 2010 [TM][D]: Message received: LOG - 72 COMMAND
not found: CONTEXT /var/lib/one/72/context.sh
/storage/templates/vms_configuration/init.sh
hive001:/storage/vms/72/images/disk.3.

Thu Jun 24 16:39:58 2010 [TM][D]: Message received: TRANSFER FAILURE
72 COMMAND not found: CONTEXT /var/lib/one/72/context.sh
/storage/templates/vms_configuration/init.sh
hive001:/storage/vms/72/images/disk.3.

Thu Jun 24 16:39:59 2010 [TM][D]: Message received: LOG - 72
tm_delete.sh: Deleting /var/lib/one/72/images

Thu Jun 24 16:39:59 2010 [TM][D]: Message received: LOG - 72
tm_delete.sh: Executed "rm -rf /var/lib/one/72/images".


-------------------------------------- End
--------------------------------------------------------------------------

cat /var/lib/one/72/context.sh

# Context variables generated by OpenNebula
FILES="/storage/templates/vms_configuration/init.sh"
HOSTNAME="one-72"
IP_PUBLIC="10.10.10.3"

----------------------------------- end
----------------------------------------------------------------------------


cat /storage/templates/vms_configuration/init.sh

#!/bin/bash

if [ -f /mnt/context.sh ]
  . /mnt/context.sh
fi

hostname $HOSTNAME
ifconfig eth0 $IP_PUBLIC

---------------------------------- end
-----------------------------------------------------------------------------
IP_PUBLIC is correct IP address.

If anyone solved this problem, please send steps how to fix it.

Regards,
Jeff


More information about the Users mailing list