8.6 Using the Oracle VM Guest Additions (ovmd)

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.

In previous releases you could use the ovmd utility to send key/value messages to a virtual machine. This feature is now included directly in Oracle VM Manager. Although this section mentions the options available to send messages to a virtual machine using ovmd, you should instead use the Oracle VM Manager Web Interface or Oracle VM Manager Command Line Interface to send key/value messages. The virtual machine must have the Oracle VM Guest Additions daemon installed and running. See Send VM Messages in the Oracle VM Manager User's Guide, or the Oracle VM Manager Command Line Interface User's Guide for more information.

Used in conjunction with the ovm-template-config script, the ovmd utility can be used to remotely configure system and application configuration parameters within a virtual machine as it boots. See Section 8.8, “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 Oracle VM Manager Web Interface when displaying detailed virtual machine information. See Virtual Machine 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.

Note

On Oracle Solaris, the command options and script names may differ from those presented for Oracle Linux. For details, please refer to the ovmd(1M) man page, which is installed along with the ovm-guest-additions package on Oracle Solaris.

Syntax

ovmd [ { -p | --set-param= } param ] [ { -g | --get-param= } key ] [ { -r | --delete-param= } key ] [ { -x | --delete-params } ] [ { -l | --list-params } ] [ { -e | --event= } event ] [ { -s | --script= } script ] [ { -d | --debug= } { 0 | 1 | 2 } ] [ { -f | --pid-file= } filename ] [ { -t | --time-period= } seconds ] [ { -v | --version } ] [ { -h | --help } ]

Options

The following table shows the available options for this command:

Option

Description

{ -p | --set-param= } param

Set a parameter in the format of key=value.

{ -g | --get-param= } key

Get the value of the parameter by key name.

{ -r | --delete-param= } key

Delete the parameter by key name.

{ -x | --delete-params }

Delete all parameters.

{ -l | --list-params }

List all parameters.

{ -e | --event= } event

Inject an event.

{ -s | --script= } script

Run a script on the virtual machine.

{ -d | --debug= } { 0 | 1 | 2 }

Set the debug level. 0 is DEBUG_OFF, 1 is DEBUG_STDERR, and 2 is DEBUG_SYSLOG. The default is 2.

{ -f | --pid-file= } filename

Set the path name of the process ID (PID) file.

{ -t | --time-period= } seconds

Set the period for daemon mode. The default is 10 seconds.

{ -v | --version }

Show the ovmd script version number and exit.

{ -h | --help }

Show help on the ovmd command options.

Examples

Example 8.1 Showing the ovmd script version

# ovmd -v

Example 8.2 Running a script on a virtual machine

# ovmd --script=/scripts/cleanup

Example 8.3 Sending a message from a virtual machine to Oracle VM Manager

# ovmd -p key1=value1

See Section 8.6.2, “Sending Messages to Virtual Machines” for more information on sending and receiving messages using the ovmd script.


Example 8.4 Listing messages sent from Oracle VM Manager on a virtual machine

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

Example 8.5 Deleting a message on a virtual machine

# ovmd -r key1

8.6.1 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 can enable a first-boot configuration. This configuration causes the virtual machine to behave as if it is booting for the first time each time it boots. As a result, the virtual machine prompts 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 acts as if it is performing a first-time boot.

If you have configured ovmd to run as a service, you can configure it remotely using the messaging facility and the ovm-template-config script.

See the example Section 8.6.2, “Sending Messages to Virtual Machines” for more information on using the messaging channel. Also see Section 8.8, “The Oracle VM Template Configuration Script and Modules” for information about the ovm-template-config script.

8.6.2 Sending Messages to Virtual Machines

This section gives an example of a message exchange between Oracle VM Manager and a running Oracle Linux virtual machine with Oracle VM Guest Additions installed.

Example 8.6 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.


Example 8.7 Sending a message from Oracle VM Manager to a virtual machine

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"}

8.6.3 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:

# service ovmd start

When configured as a service, ovmd listens for message requests sent from Oracle VM Manager.