3.4 The Oracle VM Guest Additions Daemon

3.4.1 Configuring the Oracle VM Guest Additions Daemon to Run as a Service
3.4.2 Using the Oracle VM Guest Additions Daemon to Enable First-Boot Configuration
3.4.3 Using the Messaging Channel

The Oracle VM Guest Additions daemon, ovmd, facilitates a bi-directional messaging channel between Oracle VM Manager and the guest. It allows first-boot installation configuration, and is capable of sending and receiving messages consisting of key-value pairs.

It is possible to send messages via Oracle VM Manager to the Oracle VM Guest Additions daemon running on any guest, using the ovm_vmmessage utility that can be installed on any linux system with access to Oracle VM Manager or on the Oracle VM Manager host itself. See Section 2.5, “Using Oracle VM Virtual Machine Messaging” for more information on using this tool.

It is also possible to use the messaging facility included directly within the Oracle VM Manager user interface to send messages directly to the Oracle VM Guest Additions daemon running on any guest. See Sending Messages to Virtual Machines in the Oracle VM User's Guide for more information.

Used in conjunction with the ovm-template-config script, ovmd can be used to remotely configure system and application configuration parameters within a virtual machine as it boots. See Section 3.6, “The Oracle VM Template Configuration Script and Modules” for more information on this facility.

Oracle VM Manager makes use of ovmd in order to obtain IP addressing information from the guest to include in the the Oracle VM Manager user interface when displaying detailed virtual machine information. See Section 3.5, “Displaying the Guest IP Address”.

You can run ovmd directly from the command line to perform actions outside of ovmd's function as a daemon or system service. Running ovmd using the --help parameter provides you with a breakdown of the options supported when run directly from the command line:

# ovmd --help
usage: ovmd [options]

options:
-p, --set-param=PARAM   Set param in format: key=value.
-g, --get-param=KEY     Get param value.
-r, --delete-param=KEY  Delete param by key name.
-x, --delete-params     Delete all params.
-l, --list-params       List all params.
-e, --event=EVENT       Inject event.
-s, --script=SCRIPT     Run script.
-d, --debug=LEVEL       Set debug level: 0(DEBUG_OFF), 1(DEBUG_STDERR) or 2(DEBUG_SYSLOG). 
                        Default: 2.
-f, --pid-file=FILENAME Set the pathname of the process ID (PID) file.
-t, --time-period=secs  Set the period for daemon mode(default=10 seconds).
-v, --version           Show version number and exit.
-h, --help              Show this help information.  

3.4.1 Configuring the Oracle VM Guest Additions Daemon to Run as a Service

To enable ovmd to run as a service on Oracle Linux, run the chkconfig command as root:

# chkconfig ovmd on

To start the ovmd service, run the following as root:

# /etc/init.d/ovmd start

Once configured as a service, ovmd listens for message requests sent via the Oracle VM Manager.

3.4.2 Using the Oracle VM Guest Additions Daemon to Enable First-Boot Configuration

If you are configuring a virtual machine to act as a template or if you intend to clone it, you may want to set it up so that at next boot it behaves as if it is booting for the first time, thereby prompting for configuration input either by the VM API or on the virtual machine console. This can be achieved by running the following commands as root within the virtual machine:

# ovmd -s cleanup
# service ovmd enable-initial-config
# shutdown -h now

On next boot, the virtual machine will act as if it is performing a first-time boot. If you have configured ovmd to run as a service, you are able to configure it remotely using the messaging facility and the ovm-template-config script.

See Section 3.4.3, “Using the Messaging Channel” for more information on using the messaging channel. Also see Section 3.6, “The Oracle VM Template Configuration Script and Modules” for information about the ovm-template-config script.

3.4.3 Using the Messaging Channel

This section provides an example of a message exchange between Oracle VM Manager and a running Oracle Linux virtual machine with Oracle VM Guest Additions installed. The ovm_vmmessage tool that is included with Oracle VM Utilities is used to communicate with the Oracle Linux guest. More information about the messaging utility can be found in Section 2.5, “Using Oracle VM Virtual Machine Messaging”.

Sending a message from the guest to Oracle VM Manager.

Using ovmd, you send information from within the virtual machine to your Oracle VM Manager using the following syntax:

# ovmd -p key1=value1

The message appears in the Oracle VM Manager user interface, as a Virtual Machine API Incoming Message event for the virtual machine in question. When you expand the event, the description shows the key-value pair and the date and time when the information exchange took place.

The message from the guest can also be retrieved via the Oracle VM Managercommand line utility ovm_vmmessage. To do so, you query the key and the value is returned in the response:

# ./ovm_vmmessage -u admin -p password -h localhost -v MyVM02 -q key1 
Oracle VM VM Message utility 0.5.2. 
Connected. 
VM : 'MyVM02' has status :  Running. 
Querying for key 'key1. 
Query successful. 
Query for Key : 'key1' returned value 'value1'. 
Key set 7 minutes ago.

Sending a message from Oracle VM Manager to a virtual machine.

Using ovm_vmmessage, you send information to a virtual machine using the following syntax:

# ./ovm_vmmessage -u admin -p password -h localhost -v MyVM02 -k key2 -V value2 
Oracle VM VM Message utility 0.5.2. 
Connected. 
VM : 'MyVM02' has status :  Running. 
Sending message. 
Message sent successfully.

Using ovmd from within the guest, you can retrieve the message sent from Oracle VM Manager using the following syntax:

# ovmd --list
{"key1":"value1"}
{"key2":"value2"}

The ovmd --list command retrieves all messages, both sent and received. You can identify the specific message you are looking for by its key. To remove obsolete messages, use the following syntax:

# ovmd -r key1
# ovmd --list
{"key2":"value2"}