Chapter 15. Managing Virtual Machines with virsh

Chapter 15. Managing Virtual Machines with virsh

Chapter 15. Managing Virtual Machines with virsh

15.1. Connecting to a Hypervisor
15.2. Creating a Virtual Machine
15.3. Configuring an XML Dump
15.4. Suspending a Virtual Machine
15.5. Resuming a Virtual Machine
15.6. Saving a Virtual Machine
15.7. Restoring a Virtual Machine
15.8. Shutting Down a Virtual Machine
15.9. Rebooting a Virtual Machine
15.10. Terminating a Domain
15.11. Converting a Domain Name to a Domain ID
15.12. Converting a Domain ID to a Domain Name
15.13. Converting a Domain Name to a UUID
15.14. Displaying Virtual Machine Information
15.15. Displaying Node Information
15.16. Displaying the Virtual Machines
15.17. Displaying Virtual CPU Information
15.18. Configuring Virtual CPU Affinity
15.19. Configuring Virtual CPU Count
15.20. Configuring Memory Allocation
15.21. Configuring Maximum Memory

You can use the virsh application to manage virtual machines. This utility is built around the libvirt management API and operates as an alternative to the xm tool or the graphical Virtual Machine Manager. Unprivileged users can employ this utility for read-only operations. If you plan on running xend/qemu, you should enable xend/qemu to run as a service. After modifying the respective configuration file, reboot the system, and xend/qemu will run as a service. You can use virsh to script vm work. Like the xm tool, you run virsh from the command line.

15.1. Connecting to a Hypervisor

You can use virsh to initiate a hypervisor session:

virsh connect <name> 

Where <name> is the machine name of the hypervisor. If you want to initiate a read—only connection, append the above command with —readonly.