VMs appear as powered off in VM manager but are still running

If your VMs appear as powered off in VM Manager but still you can see them running.

if from command line you type "xm list", try to "xm shutdown" or "xm destroy" them. When you don’t have them anymore in "xm list", open VM Manager interface, click on "server pools" tab and click "restore". This will reset the agents on your VM Server(s) and you should be able to power on the VMs again.

xm command quick reference

xm command quick reference

Basic management options

The following are basic and commonly used xm commands:

xm help [–long]: view available options and help text.

use the xm list command to list active domains:

# xm list
Name ID Mem VCPUs State Time(s)
1741_drackodb2 1 12000 4 -b—- 19949.9
175_drackodbdev1 12 8000 3 -b—- 14883.8
1807_drackoprod1 21 18000 8 -b—- 68267.1

xm create [-c] DomainName/ID: start a virtual machine. If the -c option is used, the start up process will attach to the guest’s console.

xm console DomainName/ID: attach to a virtual machine’s console.

xm destroy DomainName/ID: terminates a virtual machine , similar to a power off.

xm reboot DomainName/ID: reboot a virtual machine, runs through the normal system shut down and start up process.

xm shutdown DomainName/ID: shut down a virtual machine, runs a normal system shut down procedure.

xm pause

xm unpause

xm save

xm restore

xm migrate

Resource management options

Use the following xm commands to manage resources:

xm mem-set

use the xm vcpu-list to list virtualized CPU affinities:

# xm vcpu-list
Name ID VCPU CPU State Time(s) CPU Affinity
1741_drackodb2 1 0 21 -b- 6738.3 any cpu
1741_drackodb2 1 1 22 -b- 4899.6 any cpu
1741_drackodb2 1 2 20 -b- 4188.6 any cpu
1741_drackodb2 1 3 20 -b- 4118.4 any cpu
175_drackodbdev1 12 0 19 -b- 6624.8 any cpu
175_drackodbdev1 12 1 18 -b- 4214.2 any cpu
175_drackodbdev1 12 2 13 -b- 4038.7 any cpu
1807_drackoprod1 21 0 15 -b- 10531.6 any cpu
1807_drackoprod1 21 1 16 -b- 5632.0 any cpu
1807_drackoprod1 21 2 9 -b- 5636.9 any cpu
1807_drackoprod1 21 3 1 -b- 9478.2 any cpu
1807_drackoprod1 21 4 2 -b- 9311.5 any cpu
1807_drackoprod1 21 5 22 -b- 9225.9 any cpu
1807_drackoprod1 21 6 0 -b- 9284.2 any cpu
1807_drackoprod1 21 7 2 -b- 9149.1 any cpu

xm vcpu-pin

xm vcpu-set

use the xm sched-credit command to display scheduler parameters for a given domain:

# xm sched-credit -d 0
{‘cap’: 0, ‘weight’: 256}
# xm sched-credit -d 13
{‘cap’: 25, ‘weight’: 256}

Monitoring and troubleshooting options

Use the following xm commands for monitoring and troubleshooting:

xm top

xm dmesg

xm info

xm log

use the xm uptime to display the uptime of guests and hosts:

# xm uptime
Name ID Uptime
1741_drackodb2 1 6 days, 12:19:16
175_drackodbdev1 12 6 days, 9:28:55
1807_drackoprod1 21 6 days, 7:22:40
Domain-0 0 6 days, 12:26:08

xm sysrq

xm dump-core

xm rename

xm domid

xm domname

Currently unsupported options

The xm vnet-list is currently unsupported, and produces no usable output.

#xm vnet-list

Managing Xen using the xm Command-line Tool

Managing Xen using the xm Command-line Tool

xm Command-line vs xm Shell

The xm options covered in this chapter may be invoked individually as command-line arguments to xm or used with xm in shell mode.

To use the options as command-line arguments, use them at a Terminal command prompt as shown in the following example:

xm list

To run commands in the xm shell, run the following command:

# xm shell
The Xen Master. Type "help" for a list of functions.

At the xm prompt enter the options you wish to run, for example:

]# xm shell
The Xen Master. Type "help" for a list of functions.
xm> list
Name ID Mem VCPUs State Time(s)
1741_drackodb2 1 12000 4 -b—- 19968.7
175_drackodbdev1 12 8000 3 -b—- 14901.0
1807_drackoprod1 21 18000 8 -b—- 68357.1
Domain-0 0 2048 24 r—– 58168.4

Listing Guest System Status

The status of the host and guest systems may be viewed at any time using the list option of the xm tool. For example:

# xm list
Name ID Mem VCPUs State Time(s)
1741_drackodb2 1 12000 4 -b—- 19971.2
175_drackodbdev1 12 8000 3 -b—- 14903.9
1807_drackoprod1 21 18000 8 -b—- 68369.0
Domain-0 0 2048 24 r—– 58181.9

The state column uses a single character to specify the current state of the corresponding guest. These are as follows:

r – running – The domain is currently running and healthy

b – blocked – The domain is blocked, and not running or runnable. This can be caused because the domain is waiting on IO (a traditional wait state) or has gone to sleep because there was nothing else for it to do.

p – paused – The domain has been paused, typically as a result of the administrator running the xm pause command. When in a paused state the domain will still consume allocated resources like memory, but will not be eligible for scheduling by the Xen hypervisor.

s – shutdown – The guest has requested to be shutdown, rebooted or suspended, and the domain is in the process of being destroyed in response.

c – crashed – The domain has crashed. Usually this state can only occur if the domain has been configured not to restart on crash.

d – dying – The domain is in process of dying, but hasn’t completely shutdown or crashed.

Starting a Xen Guest System

A guest operating system can be started using the xm tool combined with the start option followed by the name of the guest operating system to be launched. For example:

# xm start myGuestOS

Connecting to a Running Xen Guest System

Once the guest operating system has started, a connection to the guest may be established using either the vncviewer tool or the virt-manager console. To use virt-manager, select Applications->System Tools->Virtual Machine Manager, select the desired system and click Open.

To connect using vncviewer enter the following command in Terminal window:


When prompted for a server enter localhost:5900. A VNC window will subsequently appear containing the running guest system.
Shutting Down a Guest System

The shutdown option of the xm tool is used to shutdown a guest operating system:

# xm shutdown guestName

where guestName is the name of the guest system, to be shutdown.

Note that the shutdown option allows the guest operating system to perform an orderly shutdown when it receives the shutdown instruction. To instantly stop a guest operating system the destroy option may be used (with all the attendant risks of filesystem damage and data loss):

# xm destroy myGuestOS

Pausing and Resuming a Guest System

A guest system can be paused and resumed using the xm tool’s pause and restore options. For example, to pause a specific system named myXenGuest:

# xm pause myXenGuest

Similarly, to resume the paused system:

# xm resume myXenGuest

Note that a paused session will be lost if the host system is rebooted. Also, be aware that a paused system continues to reside in memory. To save a session such that it no longer takes up memory and can be restored to its exact state after a reboot, it is necessary to either suspend and resume or save and restore the guest.
Suspending and Resuming a Guest OS

A running guest operating system can be suspended and resumed using the xm utility. When suspended, the current status of the guest operating system is written to disk and removed from system memory. A suspended system may subsequently be restored at any time (including after a host system reboot):

To suspend a guest OS named myGuestOS:

# xm suspend myGuestOS

To restore a suspended guest OS:

# xm resume myGuestOS

Saving and Restoring Xen Guest Systems

Saving and restoring of a Xen guest operating system is similar to suspending with the exception that the file used to contain the suspended operating system memory image can be specified by the user:

To save a guest:

xm save myGuestOS path_to_save_file

To restore a saved guest operating system session:

# xm restore path_to_save_file

Rebooting a Guest System

To reboot a guest operating system:

# xm reboot myGuestOS

Configuring the Memory Assigned to a Xen Guest OS

To configure the memory assigned to a guest OS, use the mem-set option of the xm command. For example, the following command reduces the memory allocated to a guest system named myGuestOS to 256Mb:

# xm mem-set myGuestOS 256

Note that acceptable memory settings must fall within the memory available to the current Domain. This may be increased using the mem-max option to xm.
Migrating a Domain to a Different Host

The migrate option allows a Xen managed domain to be migrated to a different physical server.

In order to use migrate, Xend must already be running on other host machine, and must be running the same version of Xen as the local host system. In addition, the remote host system must have the migration TCP port open and accepting connections from the source host. Finally, there must be sufficient resources for the domain to run (memory, disk space, etc).

# xm migrate domainName host

Optional flags available with this command are:

-l, --live Use live migration.
-p=portnum, --port=portnum
Use specified port for migration.
-r=MBIT, --resource=MBIT
Set level of resource usage for migration.

C-states should be disabled in the BIOS of each Oracle VM Server

This one bit me really bad. Oracle support could not not figure it out but thanks to Roddy Rodstein’s Oracle cloud cookbook, we fixed the problem

C-states allow an idle processor to turn off unused components to save power. Some of the components that C-states turns off include the processor clock and interrupts. Under certain conditions, when C-states turns off unused CPU components the Oracle VM OCFS2 heartbeat mechanism will trigger.

To validate if C-states is enabled, as root log into the to an Oracle VM Server and type:

# xenpm get-cpuidle-states | grep total | uniq
total C-states : 2

If the "total C-states" is greater than 2, then C-states is enabled in the server’s BIOS.

Public yum server for Oracle Linux

Public yum server for Oracle Linux

Download the appropriate yum configuration file:

Oracle Linux 4, Update 6 or Newer

# cd /etc/yum.repos.d
# mv Oracle-Base.repo Oracle-Base.repo.disabled
# wget http://public-yum.oracle.com/public-yum-el4.repo

Oracle Linux 5

# cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-el5.repo

Oracle Linux 6

# cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-ol6.repo

Oracle VM 2

# cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-ovm2.repo

Enable the appropriate repository by editing the yum configuration file

Open the yum configuration file in a text editor
Locate the section in the file for the repository you plan to update from, e.g.
and change enabled=0 to enabled=1

Begin using yum, for example:

yum list

yum install your-program