Archive

Archive for August, 2014

adding pci device to vm

August 27th, 2014 8 comments

If you want to use a pci device in a vm, you first have to detach it from the host. List the devices and look for the one you want to use in the vm:

virsh nodedev-list --tree

In my case (CentOS7) I needed to enable iommu in order for this to work. This involves adding a kernel parameter:

kpath=`grubby --default-kernel`
grubby --update-kernel=$kpath --args="intel_iommu=on”
cat /proc/cmdline

After the reboot, /proc/cmdline should now include the iommu flag. Also check whether all the needed modules are loaded, in my case these are:

  • vfio_pci
  • vfio_iommu_type1
  • vfio
  • kvm_intel
  • kvm

You can then detach the pci device:

virsh nodedev-dettach pci_0000_05_00_1

I then used virt-manager, powered off the vm, and added the “Physical Host Device”.

Categories: Uncategorized Tags:

virt-manager as non-root user

August 26th, 2014 No comments

trying to start virt-manager as a normal user will yield a “Unable to open a connection…” message. To fix this, we need to change access permissions for libvirtd.

Edit /etc/libvirt/libvirtd.conf:

echo "unix_sock_group = \"libvirt\"
unix_sock_rw_perms = \"0770\"
auth_unix_rw = \"none\"
">>/etc/libvirt/libvirtd.conf

We also jneed to create the group “libvirt” we just set:

groupadd -g $GID libvirt; usermod -a -G libvirt $USER

Be sure to set $GID and $USER correctly.

A restart of the daemon should then do the trick:

service libvirtd stop; service libvirtd start

if virt-manager the shows only squares instead of letters, install the necessary fonts:

yum -y groupinstall "Fonts"

Categories: Uncategorized Tags: