为什么 NBD 要嵌套 NBD?qcow2 镜像链解析原理
创建 NBD 镜像时,为什么要把 backing 的所有镜像全部设置为 NBD? 因为镜像链的解析是 qemu driver 负责的,NBD 和本地 file 都只是独立的块设备,没有解析能力。 现象 创建 NBD 镜像时报错: cmd [qemu-img create -f qcow2 -b nbd://10.0.0.10:54195 -F qcow2 /dev/qbd/vol/vol-example.img] on [local] failed: ret[1] out[] err[qemu-img: /dev/qbd/vol/vol-example.img: Could not open backing file: Could not open '/data/image/centos79x64a': No such file or directory Could not open backing image.]. exec_time is [0.093]s 怪不得创建 NBD 镜像的时候,会把 backing 的所有镜像全部设置为 NBD。之前很费解。 有一个误区 以为通过 NBD 找到 nbd://10.0.0.10:54195 head 镜像,那么 NBD 镜像的 backing 镜像,自然通过 NBD head 链接一起使用了。 ...