2.3 Using Oracle VM Virtual Machine Control

2.3.1 Command Line Options and Parameters of ovm_vmcontrol
2.3.2 Examples of ovm_vmcontrol Usage

The ovm_vmcontrol utility operates on a virtual machine (VM). It passes basic virtual machine control commands from the command line to Oracle VM Manager. It allows you to start, stop, suspend, resume, kill, restart a VM. It is also possible to simply query the status of the virtual machine (Running, Stopped), and retrieve essential VM information such as memory, server pool, number of virtual CPUs and so on.

2.3.1 Command Line Options and Parameters of ovm_vmcontrol

The ovm_vmcontrol utility has the following command line options:

  • -u user name of an Oracle VM Manager admin user (required)

  • -p password corresponding with the admin user name (required)

  • -h host name of the server running Oracle VM Manager (required)

  • -X use SSL to connect to Oracle VM Manager

  • -v virtual machine name

  • -U virtual machine UUID

  • -t name of target Oracle VM Server for migration of a virtual machine (use together with -c migrate)

  • -s comma separated list of physical thread numbers to bind virtual CPUs to (use together with -c vcpuset).

  • -T tag list, a comma separated list of strings to be associated with a virtual machine as metadata (use together with -c settags)

  • -F force the virtual disks associated with a virtual machine to be deleted (use together with -c delete)

  • -A acknowledge virtual machine events (use together with -c events)

  • -C change a virtual machine's on_crash setting (use together with -c setoncrash). Options include: preserve, restart, none.

  • -c console command (required)

    [commands: start, stop, suspend, resume, status, restart, kill, delete, info, fixcfg, events, lock, vcpuset, vcpuget, migrate, settags, gettags, list, setoncrash, getoncrash]

Note

As you can see, the ovm_vmcontrol console command list contains a lock command. This special command allows you to lock a virtual machine for a certain period of time. When a virtual machine is locked by the utility, it is not possible for other tools or users (through the Oracle VM Manager user interface) to perform operations on that specific VM. This is particularly useful if you are an administrator and need to make a VM backup while the VM is stopped: you want to prevent anyone starting the VM before the backup finishes.

The list command does not need a VM name or UUID argument. It lists every VM and its status.

The fixcfg command verifies the vm.cfg file of the virtual machine and attempts to correct invalid entries. For example, an entry for vncpasswd will be cleared with this command, because the virtual machine console does not support this setting.

The vcpuset command hard-binds or pins virtual CPUs to threads. For example, -c vcpuset -s (0,1,2) physically binds vcpu0 to thread0, vcpu1 to thread1, vcpu2 to thread2. Use the vcpuget command to retrieve information about pinned vCPUs for the selected virtual machine.

The settags and gettags commands are used to manage tag metadata for a given virtual machine.

2.3.2 Examples of ovm_vmcontrol Usage

Below are examples of ovm_vmcontrol commands and their respective output.

  • Display detailed information of a particular virtual machine:

    # ./ovm_vmcontrol -u admin -p password -h localhost -v MyVM02 -c info
    Oracle VM VM Control utility 0.5.2.
    Connected.
    Command : info
    Virtual Machine : MyVM02
            Status : Running
            Memory : 1024
            Uptime : 83 Minutes
            Server : OVS_01
            Pool   : MyServerPool1
            HA Mode: false
            VCPU   : 2
            Type   : Xen HVM
            OS     : Oracle Linux 6
    vminfo 'MyVM02' completed.
  • Check the status of a particular virtual machine:

    # ./ovm_vmcontrol -u admin -p password -h localhost -v MyVM02 -c status 
    Oracle VM VM Control utility 0.5.2. 
    Connected. 
    Command : status 
    Virtual Machine : 'MyVM02' status : 'Running' on server 'OVS_01' serverpool : 'MyServerPool1'.
  • Stop a particular virtual machine:

    # ./ovm_vmcontrol -u admin -p password -h localhost -v MyVM01 -c stop 
    Oracle VM VM Control utility 0.5.2. 
    Connected. 
    Command : stop 
    stopvm 'MyVM01' completed. 
  • Start a particular virtual machine:

    # ./ovm_vmcontrol -u admin -p password -h localhost -v MyVM01 -c start 
    Oracle VM VM Control utility 0.5.2.
    Connected. 
    Command : start 
    startvm 'MyVM01' completed.
  • Lock a particular virtual machine:

    # ./ovm_vmcontrol -u admin -p password -h localhost -v MyVM01 -c lock 
    Oracle VM VM Control utility 0.5.2. 
    Connected. 
    Command : lock 
    Locking VM 'MyVM01' 
    Press Ctrl-C to unlock. 

    The lock command will sleep until you press Ctrl+C to release the lock. If the ovm_control utility is killed, the VM would be unlocked as well.