volume信息:
1 2 3 4 |
# virsh vol-list test Name Path ------------------------------------------------------------------------------ test.qcow2 /virt/test.qcow2 |
虚拟机disk配置:
1 2 3 4 5 6 7 8 9 |
# virsh dumpxml Test ... <disk type='volume' device='disk'> <driver name='qemu' type='qcow2'/> <source pool='test' volume='test.qcow2'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> ... |
启动虚拟机:
1 2 3 |
# virsh start Test error: Failed to start domain Test error: internal error: process exited while connecting to monitor: 2019-02-06T12:54:47.722297Z qemu-system-x86_64: -drive file=/virt/test.qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/virt/test.qcow2': Permission denied |
查看syslog:
1 2 3 4 |
# cat /var/log/syslog ... kernel: [ 6551.331932] audit: type=1400 audit(1549457961.800:209): apparmor="DENIED" operation="open" profile="libvirt-5831a051-78ee-43b4-a15d-6e520b1b3ab7" name="/virt/test.qcow2" pid=27204 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=0 ouid=0 ... |
似乎没找比较好的方法解决此问题。 一个选择是弃用type=’volume’,改成type=’file’。 另一种选择是关闭apparmor:
1 2 3 4 5 |
# vim /etc/libvirt/qemu.conf ... security_driver = "none" ... # systemctl restart libvirtd |
&n […]