Oracle VM Manager CLI and Web Services API

For the last several months we have been working on a web services api (wsdl) and a command line interface (cli) for Oracle VM Manager. The cli uses the web services interface and is written in python so it can run on any platform where python is installed. The API exposes all the interfaces that the Oracle VM Manager UI components call, such as : manage server pools, servers, virtual machines, templates,...

It is now very easy to manage your Oracle VM server pools and virtual machines from a shell prompt. I was playing with this yesterday and figured I would take this opportunity to post an example.

In this example below, I had installed Oracle VM Manager (but not yet logged into it) and installed the cli scripts on one system and then I had installed Oracle VM server on another machine. On the Oracle VM server I had actually locally downloaded (manually) an Oracle VM template and created my own virtual machine without using the manager at all. So I actually create a new serverpool in Oracle VM Manager using the cli shell. I register my existing virtual machine and at the end show the list of commands we expose through the cli and through the webservices API. I think this is going to be very useful for many Oracle VM users.

configure the location of the Manager instance

wcoekaer@aldebaran-pc ~]$ ovm config
This is a wizard to help you start running the Oracle VM Command Line Manager.
Ctrl-C to exit.
Enter the host to connect:aldebaran-pc
Enter the port to connect:8888
Enter the deploy path (blank to default):
Enter the path of the vncviewer (blank to skip):
Would you like to enable WS-Security support? (Y/n)n
Configuration finish.
Please run the Oracle VM Command Line Manager again.

Starting up the cli in shell mode

[wcoekaer@aldebaran-pc ~]$ ovm -u admin shell
Enter Login Password:
Welcome to the Oracle VM Manager Shell. Type "help" for a list of commands.

I want to create a server pool but forgot the syntax

ovm> help serverpool_create
usage: ovm serverpool_create [options]
-h, --help show this help message and exit
(Required) Server Host/IP
(Required) Server Pool Name
-a, --ha_enabled Enable High Availability
Agent Password
(Required) Utility Server Username
Utility Server Password
Server Location

create my server pool, the Oracle VM server name is wcoekaer-srv4

ovm>serverpool_create -s mypool -A ****** -H wcoekaer-srv4 -U root -P ****** -L myoffice -D something
ServerPool "mypool" has been created

you can see it shows as the only pool (mypool)

ovm> serverpool_list
Server Pool Name Status HA
mypool Active Disabled

there are no images imported yet so lets import the virtual machine I had already created

ovm> image_list
Name Size(MB) ServerPoolName Status CreationTime

ovm> image_register -s mypool -n dom1 -u root -p ******* -c ****** -o "Oracle Enterprise Linux 5" -d mydom1
Registering, please check the status.

as you can see, it now shows up

ovm> image_list
Name Size(MB) ServerPoolName Status CreationTime
dom1 6229.0 mypool Pending 2009-05-05

but ! need to approve it of course

ovm> image_approve -s mypool -n dom1
VM Image "dom1" has been successfully approved.

and here it is, it shows that it's stil up and running because I did not shut down the virtual machine, no need to

ovm> vm_list
Name ImageSize Mem VCPUs Status ServerPoolName
dom1 6229.0 256 1 Running mypool

a list of all the options

ovm> help
Usage: ovm [options] subcommand [suboptions]
Oracle VM Command Line Manager.
ovm full list of subcommands:
agent_version --- Get an agent version
config --- Start a configuration wizard
group_create --- Create a User Group.
group_list --- List of all the groups.
help --- Show help
image_approve --- Approve a VM Image
image_del --- Delete a VM image
image_discover --- List all of the Discoverable VM images
image_import --- Import an Image from an External Source
image_list --- Get a list of VM images
image_register --- Register a Discoverable VM image
image_status --- Show the Image status
iso_approve --- Approve an ISO image
iso_del --- Delete an ISO image
iso_discover --- List all of the Discoverable ISOs
iso_import --- Import an ISO from External Source
iso_list --- Get a list of ISO images
iso_register --- Register a Discoverable ISO image
iso_status --- Show the ISO status
os_list --- List all the available Operating Systems
server_add --- Add a Server to the ServerPool
server_config --- Config a Virtual Server
server_del --- Delete a Server from the ServerPool
server_info --- Get a VM Server info
server_list --- Get a list of VM Servers
server_poweroff --- Poweroff a VM Server
server_restart --- Reboot a VM Server
server_status --- Show the server status
serverpool_config --- Config a ServerPool
serverpool_create --- Create a ServerPool
serverpool_del --- Delete a ServerPool
serverpool_info --- Get a ServerPool info
serverpool_list --- Get a list of ServerPools
serverpool_refresh --- Refresh all of the ServerPools
serverpool_restore --- Restore a ServerPool
serverpool_status --- Get a ServerPool status
shareddisk_create --- Create and Register a Shared Virtual Disk
shareddisk_del --- Delete a Shared Virtual Disk
shareddisk_list --- Get a list of Shared Virtual Disks
shell --- Launch an interactive shell
template_approve --- Approve a Template
template_del --- Delete a Template
template_discover --- List all of the Discoverable Templates
template_import --- Import a Template from an External Source
template_list --- Get a list of Templates
template_register --- Register a Discoverable Template
template_status --- Show the template status
use --- Sepcify a ServerPool to use
user_assign_group --- Assign a user to the Group.
user_assign_serverpool --- Assign a user to the ServerPool.
user_create --- Create a User Account.
user_list --- List of all the users.
vm_add_disk --- Create and Add a disk to the VM
vm_add_nic --- Create and Add a nic to the VM
vm_as_template --- Save a VirtualMachine as template
vm_attach_cdrom --- Attach a CDROM to the VM
vm_attach_shareddisk --- Attach a Shared Virtual Disk to the VM
vm_clone --- Clone a VirtualMachine
vm_config --- Config a VirtualMachine
vm_create --- Create a VM
vm_del --- Delete a VirtualMachine
vm_del_disk --- Remove a disk from the VM
vm_del_nic --- Remove a nic from the VM
vm_deploy --- Deploy a VirtualMachine
vm_detach_cdrom --- Detach CDROMs from the VM
vm_detach_shareddisk --- Detach a Shared Virtual Disk from the VM
vm_info --- Get a VM info
vm_list --- Get a list of VMs
vm_list_cdrom --- List CDROMs of the VM
vm_list_disk --- List Disks of the VM
vm_list_nic --- List Virtual Network Interfaces of the VM
vm_migrate --- Live Migration
vm_migrate_all --- Migrate all the VMs on the server
vm_pause --- Pause a VirtualMachine
vm_poweroff --- Poweroff a VirtualMachine
vm_poweron --- PowerOn a VirtualMachine
vm_reboot --- Restart a VirtualMachine
vm_reset_status --- Reset status of a VirtualMachine
vm_resume --- Resume a VirtualMachine
vm_set_bootdevice --- Set the first BootDevice
vm_set_keyboardlayout --- Set the Keyboard Layout
vm_set_vnc_pwd --- Set the VNC Console Password
vm_status --- Get a VM status
vm_suspend --- Suspend a VirtualMachine
vm_unpause --- Unpause a VirtualMachine
vncviewer --- Start a VNC console.


So when will this api be available? It sounds useful to me. Currently I've been using Apple's Safari for getting into OVM Manager. ANd there's something in Safari (or the OVM Manager form) that logs me out at a random time. So having a cli api might be a bit easier. The next question that I have is, will the cli integrate with typical `xm ` commands on the OVM Servers themselves. In other words, if I run into a situation where OVM Manager isn't available (lets say it crashed), would this api be available to talk directly to the OVM Servers? VMWare does this currently. If Virtual Center goes away, you can still manage your VMs directly through the ESX host.

Posted by Joe Hoot on May 06, 2009 at 06:46 PM PDT #

This is a nice interface for managing VM's. Can we expect this to be checked into a main release of Oracle VM Manager soon?

Posted by Matthew Sacks on May 08, 2009 at 01:48 AM PDT #

When is the CLI available for customers?

Posted by guest on May 14, 2009 at 03:15 AM PDT #

Wim- This is fantastic news. Is this available in OVM 2.1? Does it get installed automatically when setting up an OVS or is it necessary to install an external rpm? Is there anywhere that I can get more information about this, roadmap, additional features etc? Thanks mj

Posted by Mark Johnston on May 27, 2009 at 04:03 AM PDT #

Wim, You may want to mention to the nice people out there that the CLI hasn't been released yet... whereas the web services api has been released in 2.1.5 Gavin

Posted by Gavin on June 17, 2009 at 03:09 PM PDT #

Hello I tried to use Oracle VM Manager webservices to write some scripts but it wasn't a pleased experience. The problem is that the api that is exported by the wsdl differs from the api shown on the website. For example method VirtualMachineService.getVmByName in the wsdl file gets a GetVMByNameElement parameter and on the website, a (String serverPoolName, String vmName) one. I also posted the problem on the oracle forum:� If you have any ideas, please send a mail or reply to that post. Thanks, Razvan

Posted by Razvan Dobre on July 29, 2009 at 11:01 PM PDT #

Razvan, I sent it on to the folks in the dev team to look at as soon as possible.

Posted by Wim Coekaerts on July 30, 2009 at 06:19 AM PDT #

I see that, as of release 1.0-1, the subcommands are different than those listed on May 6, 2009. Anyone planning to write scripts using the OVM CLI should make sure they are using the correct subcommands! Thanks for the info. Great stuff! LOVE the CLI! (I'm not a big fan of GUIs.) ;-)

Posted by Michael Skurka on September 16, 2009 at 06:20 AM PDT #

yeah I had used an earlier version to show off :) out of excitement but we went through a cleanup of the cli to group things better so the actual product release is a little different but same concept :) it's been very popular ! thanks

Posted by wim.coekaerts on September 16, 2009 at 06:24 AM PDT #

Ok, I post here because I am experimenting some troubles with oracle forum right now... Is there any oracle vm manager ws ( real ) documentation available anywhere? And I saw a Java API reference, any java proxy available for download?

Posted by Jean-Michel Guillaume on November 24, 2009 at 06:40 PM PST #

it's on our todo list to improve the documentation a lot and add to it, we're working it !

Posted by wim.coekaerts on December 13, 2009 at 07:21 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Wim Coekaerts is the Senior Vice President of Linux and Virtualization Engineering for Oracle. He is responsible for Oracle's complete desktop to data center virtualization product line and the Oracle Linux support program.

You can follow him on Twitter at @wimcoekaerts


« April 2014