This is not always installed by default. When run, it will bring up a full console window that shows all virtuals running on a system, similar to the top command.
The main controller for virt-lib. The basic format of the command is
virsh command parameters
. man virsh or simply virsh –help are your friends.
Some common commands are:
virsh net-list --all virsh net-destroy br1 virsh net-undefine br1 virsh net-list --all
virsh -c xen:/// domxml-to-native --format xen-xl \ /path/to/libvirt/vm.domxml.cfg > vm.xenxl.cfg
I messed up and did not use virtio as the bus for one of my setups, which resulted in horrible disk I/O. I could have rebuilt the virtual (it was a simple install and I had not gone very far), but I decided to learn how to do it the “right way”. The trick here is to detach the disk, then re-attach it with the proper parameters.
Warning Linux (and FreeBSD) have the virtio drivers built in, but Microsoft products do not. Read the section on Microsoft products if you are trying to do this with Windows.
In my case, I wanted to reconfigure the boot drive, so I needed the machine down. It was running under the scsi bus, and I wanted virtio. Note that his is using LVM2 as the back end.
# get a list of all the block devices virsh domblklist router # detach the first drive (sda) from the domain router virsh detach-disk router sda --config # reattach it using the virtio bus. virsh attach-disk router /dev/vg/lvname sda --config --targetbus=virtio
Normally, you attach/detach disks from a running system. The –config parameter allows you to do it on an inactive domain; it just erases the entry, then rebuilds it.
For Windows, you need to have the correct device drivers installed before you change the disk. This assumes the domain is running
cd /media/virtstorage && wget https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
virsh attach-disk domainname /media/virtstorage/stable-virtio/virtio-win.iso hdc --type cdrom --mode readonly
virsh attach-disk domainname /path/to/disk/image sdb --targetbus=virtio
# get a list of all the block devices virsh domblklist router # detach the first drive (sda) from the domain router virsh detach-disk domainname sda --config # reattach it using the virtio bus. virsh attach-disk domainname /dev/vg/lvname sda --config --targetbus=virtio
I did this with a Windows 10 installation on my workstation. Prior to using virtio, it would take, literally, 5-7 minutes after boot before I could do anything, and it was very sluggish after that. Once I used virtio, it was almost bare hardware speeds.