There are two ways to communicate through the APIs, a quick and easy one and a more comprehensive one.
The quick and easy method of just sending and receiving messages.
# ssh admin@localhost -p 10000 admin@localhost's password: OVM> sendVmMessage Vm name=ol6u3apitest key=foo message=bar log=no Command: sendVmMessage Vm name=ol6u3apitest key=foo message=bar log=no Status: Success Time: 2012-12-27 09:04:29,890 PST
or
# ./ovm_vmmessage -u admin -p ######## -h localhost -v ol6u3apitest -k foo -V bar Oracle VM VM Message utility 0.5.2. Connected. VM : 'ol6u3apitest' has status : Running. Sending message. Message sent successfully.
so both of the examples send a key/value pair of foo=bar to the VM.
Inside the VM, you can use the ovmd executable to retrieve and send messages back.
# ovmd -l
lists all currently set key/value pairs
# ovmd -g keyget a value from inside the VM
# ovmd -r keydelete a key out of the current cache
# ovmd -xdelete the key/value values currently set in the cache
so in the case of the message sent through the manager above, you can see it in the VM :
# ovmd -l {"foo":"bar"} {"mykey":"myvalue"} # ovmd -g mykey myvalue # ovmd -r mykey # ovmd -l {"foo":"bar"}
# ovmd -p key=valueset a key/value pair inside the VM
# ovmd -p newkey=newvalue # ovmd -l {"foo":"bar"} {"newkey":"newvalue"}
use ovm_vmmessage to query the value of a key, use the -q option with the key to query to retrieve a set value.
ovm_vmmessage will also return when this key was set inside the VM.
# ./ovm_vmmessage -u admin -p Manager1 -h localhost -v ol6u3apitest -q newkey Oracle VM VM Message utility 0.5.2. Connected. VM : 'ol6u3apitest' has status : Running. Querying for key 'newkey'. Query successful. Query for Key : 'newkey' returned value 'newvalue'. Key set 2 minutes ago.
So with just these simple tools it's possible to set up a model where you send message from your application outside of a VM to the VM through the OVMAPI and also send messages from an application inside a VM back. You can write your own daemon process that runs and queries for values or just do it manually. A recommendation would be to create a naming convention for your product. For instance, for the Oracle VM template configuration we use com.oracle.linux.[values]. You could consider something similar or just have [application].[key] or whatever you want. The maximum size of the total message is 8Kb.
Next up will be extending template config for your own application.