10.4. Using KVM virtio Drivers for Existing Devices
You can modify an existing hard disk device attached to the guest to use the
virtiodriver instead of the virtualized IDE driver. The example shown in this section edits libvirt configuration files. Note that the guest virtual machine does not need to be shut down to perform these steps, however the change will not be applied until the guest is completely shut down and rebooted.
Procedure 10.4. Using KVM virtio drivers for existing devices
- Ensure that you have installed the appropriate driver (
viostor), as described in Section 10.1, “Installing the KVM Windows virtio Drivers”, before continuing with this procedure.
- Run the
virsh edit <guestname>command as root to edit the XML configuration file for your device. For example,
virsh edit guest1. The configuration files are located in
- Below is a file-based block device using the virtualized IDE driver. This is a typical entry for a virtual machine not using the virtio drivers.
<disk type='file' device='disk'> <source file='/var/lib/libvirt/images/disk1.img'/> <target dev='hda' bus='ide'/> </disk>
- Change the entry to use the virtio device by modifying the bus= entry to
virtio. Note that if the disk was previously IDE it will have a target similar to hda, hdb, or hdc and so on. When changing to bus=virtio the target needs to be changed to vda, vdb, or vdc accordingly.
<disk type='file' device='disk'> <source file='/var/lib/libvirt/images/disk1.img'/> <target dev='vda' bus='virtio'/> </disk>
- Remove the address tag inside the disk tags. This must be done for this procedure to work. Libvirt will regenerate the address tag appropriately the next time the virtual machine is started.
virsh attach-interfacecan add a new device using the virtio drivers.
Refer to the libvirt website for more details on using Virtio: http://www.linux-kvm.org/page/Virtio