Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Red Hat Enterprise Linux 9 Essentials Book now available.

Purchase a copy of Red Hat Enterprise Linux 9 (RHEL 9) Essentials

Red Hat Enterprise Linux 9 Essentials Print and eBook (PDF) editions contain 34 chapters and 298 pages

Preview Book

Chapter 21. xm quick reference

The xm command is used to manage your Red Hat Virtualization environment using a CLI interface. Most operations can be performed by the virt-manager application, including a CLI which is part of virt-manager . However, there are a few operations which currently can not be performed using virt-manager . As the xm command is part of the Xen environment a few options available with the xm command will not work in a Red Hat Enterprise Linux 5 environment. The list below provides an overview of command options available (and unavailable) in a Red Hat Enterprise Linux 5 environment. As an alternative to using the xm command one can also use the virsh command which is provided as part of the Red Hat Virtualization. The virsh command is layered on top of the libvirt API which can provide a number of benefits over using the xm command. Namely the ability to use virsh in scripts and the ability to manage other hypervisors as they are integrated into the libvirt API.

Warning

It is advised to use virsh or virt-manager instead of xm. The xm command does not handle error checking or configuration file errors very well and mistakes can lead to system instability or errors in virtual machines. Editing Xen configuration files manually is dangerous and should be avoided. Use this chapter at your own risk.
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(MiB)   VCPUs      State      Time(s)
    Domain-0                            0     520       2         r-----     1275.5
    r5b2-mySQL01                       13     500       1         -b----       16.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 : terminate 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 virtual CPU assignments/placements:
    $ xm vcpu-list
    Name                          ID  VCPUs   CPU State  Time(s)  CPU Affinity
    Domain-0                       0    0      0    r--   708.9    any cpu
    Domain-0                       0    1      1   -b-    572.1    any cpu
    r5b2-mySQL01                  13    0      1   -b-     16.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
    Domain-0                    0  3:42:18
    r5b2-mySQL01               13  0:06:27
    
  • xm sysrq
  • xm dump-core
  • xm rename
  • xm domid
  • xm domname
Currently unsupported options
The xm vnet-list is currently unsupported.

 
 
  Published under the terms of the GNU General Public License Design by Interspire