Virsh

From PrgmrWiki

Virsh is RedHat's xm replacement, designed with the idea of using one tool to control all available virtualization technologies. It's got a different usage model, but can easily reproduce the capabilities of xm. Here are brief notes on basic use of virsh to manage domains.

First, virsh uses an XML syntax for domain definitions. (Xen can also use an XML syntax.) Virsh can create xml dumps from running Xen domains:

# virsh dumpxml chris > chris.xml

We can then create a domain from the XML, stopping the original domain instance first:

# xm shutdown -w chris && virsh create chris.xml

Virsh has other expected commands:

# virsh list
# virsh dominfo chris
# virsh console chris
# virsh shutdown chris
# virsh reboot chris
# virsh destroy chris


Most of xm's less-used commands also have equivalents. Note that I haven't tested any of these:

# virsh setmem chris 131072
# virsh setvcpus chris 2
# virsh attach-disk chris /dev/vg/lv /dev/xvdc --driver phy --mode readonly