Guest Contextualization¶
The information defined at the VM Template building time is presented to the VM using the VMware VMCI channel. This information comes encoded in base64 can be gathered using the VMware Tools.
Note
VMware tools are needed in the guestOS to enable several features (contextualization and networking feedback). Please install VMware Tools (for Windows) or Open Virtual Machine Tools (for *nix) in the guestOS.
In order to make your VMs aware of OpenNebula, you must install the official packages. Packages for both Linux and Windows exist that can collect this data and configure the supported parameters.
In Linux guests, the information can be consumed using the following command:
$ vmtoolsd --cmd 'info-get guestinfo.opennebula.context' | base64 -d
MYSQLPASSWORD = 'MyPassword'
ENABLEWORDPRESS = 'YES'
The Linux packages can be downloaded from its project page and the Windows one from its project page. The steps to prepare a contextualized VM Template are:
Step 1. Start a VM with the OS you want to Customize¶
Supported contextualization packages are available for the following OS’s:
- CentOS/RHEL >= 6
- Debian >= 6
- Ubuntu >= 11.10
- Windows >= 7
- Windows Server >= 2008
If you already happen to have a VM or Template in vCenter with the installed OS you can start it and prepare it to be used with vOneCloud. Alternatively you can start an installation process with the OS media.
Step 2. Download Contextualization Packages to the VM¶
CentOS/RHEL¶
# wget https://github.com/OpenNebula/addon-context-linux/releases/download/v5.0.0/one-context_5.0.0.rpm
Debian/Ubuntu¶
# wget https://github.com/OpenNebula/addon-context-linux/releases/download/v5.0.0/one-context_5.0.0.deb
Windows¶
Downloads these two files to C:\
:
Step 3. Install Contextualization Packages and Dependencies¶
CentOS/RHEL 6¶
# rpm -Uvh one-context*rpm
# yum install -y epel-release
# yum install ruby # only needed for onegate command
# yum install -i dracut-modules-growroot
# dracut -f
CentOS/RHEL 7¶
# rpm -Uvh one-context*rpm
# yum install -y epel-release
# yum install ruby # only needed for onegate command
# yum install -y cloud-utils-growpart
Debian/Ubuntu¶
# dpkg -i one-context*deb
# apt-get install ruby # only needed for onegate command
# apt-get install -y cloud-utils
Windows¶
- Open the Local Group Policy Dialog by running
gpedit.msc
. - Go to Computer Configuration -> Windows Settings -> Scripts -> startup (right click).
- Browse to the
startup.vbs
file and enable it as a startup script.
Step 4. Install VMware Tools¶
CentOS¶
# yum install open-vm-tools
Debian/Ubuntu¶
# apt-get install open-vm-tools
Windows¶
In vCenter open the VM menu, go to “Guest OS” section, click in “Install VMware Tools...” and follow the instructions.
Step 5. Power Off the Machine and Save it¶
These are the steps needed to finish the preparation and import it to OpenNebula:
- Power off the machine so it is in a consistent state the next time it boots
- Make sure that you take out any installation media used in the previous steps
- Remove the network interfaces from the VM
- Convert the VM into a Template
- Import the template in OpenNebula
Alternatively use the instantiate as persistent functionality for this step, that will create the new VM Template as soon as you terminate the VM.