Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

oracle vm messages

$
0
0
Using the Oracle VM Message API for your own applications...

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.

  • Sending messages using ovm_utils or using the Oracle VM CLI to the VM
  • # 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.

  • Receiving messages on the VM side using ovmd
  • 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 key 
    get a value from inside the VM

    # ovmd -r key
    delete a key out of the current cache

    # ovmd -x
    delete 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"}

  • Setting key/value pairs inside the VM and retrieve through the manager
  • # ovmd -p key=value
    set 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.


    Viewing all articles
    Browse latest Browse all 19780

    Trending Articles



    <script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>