libvirt dynamic file ownership

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
Hi,
 
I am trying to understand libvirt dynamic ownership behavior. I have a VM that uses a qcow2 image with the following permissions:
 
$ ll t257kvxg-10-20-101-40.qcow2
-rw-r--r-- 1 jmuro libvirt 2279079936 Mar 20 11:10 t257kvxg-10-20-101-40.qcow2
 
When I start the domain the permissions are changed:
 
$ virsh start t257kvxg-10-20-101-40
Domain t257kvxg-10-20-101-40 started
$ ll t257kvxg-10-20-101-40.qcow2
-rw-r--r-- 1 libvirt-qemu libvirt 2279079936 Mar 20 11:18 t257kvxg-10-20-101-40.qcow2
 
This is expected behavior based on the settings in /etc/libvirt/qemu.conf:
 
user = "libvirt-qemu"
group = "libvirt"
# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.
# Set to 0 to disable file ownership changes.
#dynamic_ownership = 1
 
However, when I shutdown the domain, the file permissions revert to root.
 
$ ll t257kvxg-10-20-101-40.qcow2
-rw-r--r-- 1 root root 2282749952 Mar 20 11:20 t257kvxg-10-20-101-40.qcow2
 
I expect libvirt to revert the file permissions back to the original. Otherwise, a regular user would lose ownership of the image file. FWIW: I am starting the domain as a non-root user under qemu:///system
 
I am running on Ubuntu 20.04 LTS (Focal Fossa) with the following libvirt level:
 
libvirt-clients/focal,now 6.0.0-0ubuntu5 s390x [installed]
libvirt-daemon-driver-qemu/focal,now 6.0.0-0ubuntu5 s390x [installed,automatic]
libvirt-daemon-driver-storage-rbd/focal,now 6.0.0-0ubuntu5 s390x [installed,automatic]
libvirt-daemon-system-systemd/focal,now 6.0.0-0ubuntu5 s390x [installed,automatic]
libvirt-daemon-system/focal,now 6.0.0-0ubuntu5 s390x [installed]
libvirt-daemon/focal,now 6.0.0-0ubuntu5 s390x [installed]
libvirt-glib-1.0-0/focal,now 2.0.0-2 s390x [installed,automatic]
libvirt0/focal,now 6.0.0-0ubuntu5 s390x [installed,automatic]
python3-libvirt/focal,now 6.0.0-0ubuntu3 s390x [installed]
 
Thanks
 
-Joe


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux