3.4.2 Using the Messaging Channel

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. 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.4.3, “Oracle VM Virtual Machine Messaging (ovm_vmmessage)”.

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

The message from the guest can also be retrieved via the ovm_vmmessage utility. 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 version. 
Connected. 
VM : 'MyVM02' has status :  Running. 
Querying for key 'key1. 
Query successful. 
Query for Key : 'key1' returned value 'value1'. 
Key set 7 minutes ago.

Example 3.7 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 version. 
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"}