Virsh , short for Virtual Shell, is use for managing VMs (Virtual Machine).

http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/index.jsp?topic=%2Fliaai%2Fxen%2Frhel%2Fliaaixenvirshshutdown.htm

usage :

virsh [command][args]

we can use two mode of virsh , Direct Model and Interactive Model.

Direct Model like virsh create vm_name , it should need parameters or variable.

virsh with nothing, comes Interactive Model, it looks like IRB.

Commands :

help : show help .

quit : stop “Interactive Model”, comes back to shell.

connect : connect to a VM, virsh connect winking_vm.

create : create a new VM

destroy : delete a VM

start : start defined VM

define : defined a VM from XML

undefine : remove defined VM

dumpxml : move setting of VM

list : list all the VMs

reboot : reboot vm

save : save status of vm

restore : turn back to the status of VM

suspend : Pause the work of VM

resume : make VM work again

dump : move kernel of VM

shutdown : shutdown VM

setmem : change Memory’s amount of VM

setmaxmen : schange VM’s max memory

setvcups : set the number of virtual cpus

check Domain info

domid : check the number of VM

domname : check the name of VM

domuuid : check UUID

domstate : check status

dominfo : check inf

for example :

virsh domname 3

save the status of VM , Dump

virsh dumpxml Domain

Domain is the one we want to dump.

for example :

root@linux ~# virsh dumpxml system1 ?①

system1 8f35e0d3f9d011f7c0a530bd84228549 /usr/bin/pygrub linux /var/lib/xen/vmlinuz.39zui7 /var/lib/xen/initrd.bTaKXX ro root=LABEL=/ 512000 1 destroy restart restart blog comments powered by Disqus

Published

19 June 2012

Tags