libvirt "Permission denied" 创建后备文件后

libvirt "Permission denied" after creating backingfile

我用 wirt-manager 创建了一个 VM,在启动时安装了带有 iso 的 Win10。几次重启,安装软件。 一切都很好。创建一个叠加层,从叠加层开始。一切都很好。 在上面创建第二个叠加层。 "Permission denied" 在基本图像上 (W_64_10_v1.img)。其他覆盖较少但权限相同的机器工作正常。

为什么我无法启动机器? / 哪个进程缺少它的权利?

图像和备份链可能是正确的,因为我可以从 sudo qemu-system ... 开始图像。

virsh # 开始W_64_10_v1

error: Failed to start domain W_64_10_v1
error: internal error: process exited while connecting to monitor:
2018-06-06T12:55:42.062395Z qemu-system-x86_64: 
-drive file=/media/img/SharedImages/qemu18/W_64_10_v1_daemon.ovl,
format=qcow2,if=none,id=drive-ide0-1-0: 
Could not open backing file: Could not open backing file: 
Could not open '/media/img/SharedImages/qemu18/W_64_10_v1.img': 
Permission denied

virsh 版本

Compiled against library: libvirt 4.0.0
Using library: libvirt 4.0.0
Using API: QEMU 4.0.0
Running hypervisor: QEMU 2.11.1

/etc/libvirt/qemu.conf(提取)

dynamic_ownership = 1
user = "root"
group = "root"

文件权限:(将所有权利添加到文件...不起作用)

-rwxrwxrwx 1 root root 193K Jun  6 14:41 W_64_10_v1_daemon.ovl
-rwxrwxrwx 1 root root 193K Jun  6 14:41 W_64_10_v1_daemon.ovl.backup
-rwxrwxrwx 1 root root 135M Jun  6 14:41 W_64_10_v1_F.ovl
-rwxrwxrwx 1 root root  51G Jun  6 14:41 W_64_10_v1.img

原因:创建错误backingfile/overlay。 在创建过程中我没有使用 -F 开关。

Base.img        (ok - Win 10 Installation starting)
FirstFloor.ovl  (ok - Win 10 Installation starting)
SecondFloor.ovl (permission denied -> Base.img) => assumed Bug
Roof.ovl        (permission denied -> Base.img) => assumed Bug

创建喜欢(如何创建错误)

qemu-img create -f qcow2 Base.img 50G
qemu-img create -f qcow2 -b Base.img FirstFloor.ovl
qemu-img create -f qcow2 -b FirstFloor.ovl SecondFloor.ovl
qemu-img create -f qcow2 -b SecondFloor.ovl Roof.ovl

这是可行的,因为假设是 RAW,这会导致错误。

你应该怎么做:

qemu-img create -f qcow2 Base.img 50G
qemu-img create -f qcow2 -F qcow2 -b Base.img FirstFloor.ovl
qemu-img create -f qcow2 -F qcow2 -b FirstFloor.ovl SecondFloor.ovl
qemu-img create -f qcow2 -F qcow2 -b SecondFloor.ovl Roof.ovl

你如何解决已经存在的问题

qemu-img rebase -f qcow2 -b Base.img -F qcow2 FirstFloor.ovl
qemu-img rebase -f qcow2 -b FirstFloor.ovl -F qcow2 SecondFloor.ovl
qemu-img rebase -f qcow2 -b SecondFloor.ovl -F qcow2 Roof.ovl

感谢支持:Peter Krempa (redhat) 相关错误请求:https://bugzilla.redhat.com/show_bug.cgi?id=1588373