qemu-img commit 的链为什么必须完整?-d 参数又是什么
qemu-img commit 的链必须是完整的,虽然 commit 的是 head,看起来和底层几级镜像没关系,但实际还是需要。commit 链的关系还可以是临时的,-d 参数决定 commit 后是否清空文件。 现象 qemu-img commit 的链,必须是完整的。 虽然你 commit 的是 head,看起来和底层几级的镜像没有关系,但实际还是需要的: root@host:~/tmp# qemu-img commit -f qcow2 /root/tmp/vm-example_tmp.img qemu-img: Could not open '/root/tmp/vm-example_tmp.img': Could not open backing file: Could not open backing file: Could not open '/root/tmp/focal1x64a': No such file or directory 排查 commit 链的关系还可以是临时的 下面命令不会改变 /dev/vg2/vm-example_lss-sjjgi703 的 backing file,但是确可以提交数据到其他链上,非常方便: qemu-img commit --image-opts file.filename=/dev/vg2/vm-example_lss-sjjgi703,backing.file.filename=/root/tmp/vm-example.img 底层链有 nbd 镜像也会失败 如果底层的链中有 nbd 镜像,那么即便 commit 没到 nbd img,也会失败: 2024-12-09 18:08:26,809 INFO -139636383823616- commit_snap command is [qemu-img commit -f qcow2 -d /data/container/vm-example/vm-example.resize_tmp.img] ret is [(1, '', u"qemu-img: Block format 'nbd' used by node '#block817' does not support reopening files")] 如果底层的链中有 nbd 镜像,那么即便 commit 没到 nbd img,也会失败。 ...