Thursday 31 July 2014

Xen commnads

Xen Daemons
For the Xen server to function properly, the below daemons must be running on the VM server.
xend : This is the Xen server control daemon. This daemon must be running to start and manage thevirtual machines. The administrative interface of xend is “xm”. The xend daemon can be customized using the configuration file /etc/xen/xend-config.sxp.
xendomains : This daemon helps on starting the guests automatically when the host server boots up. The Xen guest config file has to be placed in /etc/xen/auto/ for the xendomains to pickup and boot the guests when the server boots up.
libvirtd: This daemon allows the administrators to access the hypervisors and the virtual machinesusing management tools like “virsh” and “virt-install”.
Here are some more xm and virsh commands for creating, managing, and troubleshooting xen virtual machines.
List the guest domains:  The command “xm list” displays the information of all running domains. The “–long” option displays full information on running guests.
[root@unixfoo-xen-adm01 ~]# xm list
Name                                ID   Mem  VCPUs    State   Time(s)
Domain-0                            0   2048     8     r—–  45645.8
guest04                             4   4096     2     -b—-    343.4
guest05                             5   4096     2     -b—-    896.4
guest06                             3   4096     2     r—–   2244.1
[root@unixfoo-xen-adm01 ~]#
In the output of “xm list”
·         Name – represents the domU guest VM name
·         ID -represents the domain ID
·         Mem – represents the amount of memory allotted to the guest domain (in MB)
·         VCPUs – represents the number of virtual CPUs assigned to a domain.
·         State – represents the running state of the guest OS.
o    r – running. The domain is currently running on a CPU.
o    b – blocked. The domain is currently not running.
o    p – paused. The domain is paused using “xm pause” command.
o    c – crashed . The domain has crashed and terminated abruptly
o    d – dying . The domain is the process of shutdown or crash.
·         Time – represents the total runtime of the domain as accounted by the Xen server.
Starting a guest domain: The command “xm  create” is used to startup a Xen guest.  This command creates a guest based on the configuration file storage in /etc/xen.
[root@unixfoo-xen-adm01 ~]# xm create guest06
Using config file “/etc/xen/guest06?.
Started domain guest06
[root@unixfoo-xen-adm01 ~]#
If the Xen configuration file is not stored in /etc/xen, the file name with full path should be specified in “xm create” command.
Shutdown a guest: The command “xm shutdown” is used to shutdown an Xen guest gracefully.
[root@unixfoo-xen-adm01 ~]# xm shutdown guest06
[root@unixfoo-xen-adm01 ~]# xm list
Name                                ID   Mem  VCPUs    State   Time(s)
Domain-0                            0   2048     8     r—–  45645.8
guest04                             4   4096     2     -b—-    343.4
guest05                             5   4096     2     -b—-    896.4
[root@unixfoo-xen-adm01 ~]#
Rebooting a guest: The command “xm reboot” is used to reboot a Xen domU guest.
Terminate a guest: The command “xm destroy” is used to immediately terminate an Xen domU guest virtual machine.
Status monitoring
·         xm uptime        – Displays uptime for a domain
·         xm top            – Monitors a host and its domains in real time
·         xm list             – Displays domain information
·         xm info            – Displays host information
·         xm vcpu-list     – Lists domain virtual processors
·         xm network-list – List virtual network interfaces for a domain.
·         virsh nodeinfo   – Gives basic information about the node.
·         virsh cpuinfo
Troubleshooting
·         xm console     – Attaches to a domain console
·         xm dump-core – Dumps core of a specific domain
·         xm dmesg       – Reads and/or clears the xend daemon’s message buffer
·         xm log            – Gives Xend log
·         virsh dominfo   – Returns basic information about the domain
·         virsh dumpxml  – Gives domain informations as an XML.
Xen Performance tuning
·         xm mem-max – Sets the maximum amount of memory for a domain
·         xm mem-set  – Sets the current memory usage for a domain
·         xm vcpu-set  – Sets the number of active processors for a domain
Other commands
·         xm rename   – Renames a domain
·         xm sysrq      – Sends a system request to a domain
·         xm block-list – Lists virtual block devices for a domain

No comments:

Post a Comment