Restrict users access to particular VM (libvirt)

kvm-virtualizationlibvirtvirshvirtualization

I have a linux host (SLES12) and bunch of VMs on up of it via libvirt (KVM hypervisor). I assigned one GPU per each VM, and would like to be able to restrict each users access to particular VMs (e.g. user 'A' can only restart VM 'Z' and 'Y' or can only connect to VM 'Y'). So, is there any way to do this type of user management via virsh or other tools?

Best Answer

It is possible to do this with libvirt's access control framework, using polkit rules

http://libvirt.org/aclpolkit.html

There is an example config in libvirt GIT tree:

http://libvirt.org/git/?p=libvirt.git;a=blob;f=examples/polkit/libvirt-acl.rules;hb=HEAD

This access control system applies all apps that connect to libvirtd (virsh, virt-manager, virt-install, etc)