Created attachment 824 [details] 创建vhd虚拟机失败 Description of problem: 使用vhd镜像:anolis_23_arm64_20G_alibase_20230703.vhd 和anolis_23_x64_20G_alibase_20230703.vhd, 并使用virt-install --name lyq_vhd_vhd --memory 4096 --vcpus=8 --disk path=/disk1/anolis_23_arm64_20G_alibase_20230703.vhd,format=vpc,bus=virtio --import --network bridge=virbr0 --os-type generic --gra phics vnc,listen=0.0.0.0,port=5990 --noautoconsole 命令创建虚拟机,创建失败,报错为: ERROR internal error: process exited while connecting to monitor: 2023-07-06T05:29:28.758128Z qemu-kvm: -blockdev {"node-name":"libvirt-1-format","read-only":false,"driver":"vpc","file":"libvirt-1-storage"}: Driver 'vpc' can only be used for read-only devices Domain installation does not appear to have been successful. If it was, you can restart your domain by running: virsh --connect qemu:///system start lyq_vhd_vhd otherwise, please restart your installation. 在修改format=vpc为format=qcow2,path为qcow2文件后,qcow2可以正常创建 Steps to Reproduce: 1.wget下载vhd镜像 2.执行命令创建虚拟机 anolis_23_x64_20G_alibase_20230703.vhd,并使用virt-install --name lyq_vhd_vhd --memory 4096 --vcpus=8 --disk path=/disk1/anolis_23_arm64_20G_alibase_20230703.vhd,format=vpc,bus=virtio --import --network bridge=virbr0 --os-type generic --gra phics vnc,listen=0.0.0.0,port=5990 --noautoconsole Actual results: 使用vhd镜像创建虚拟机失败 Expected results: 使用vhd镜像可以正常创建并登录虚拟机 Additional info:
该问题属于 bydesigne 类型。是由于测试环境的机器上安装的 qemu 增加了对设备的读取白名单限制,通过控制选项 block-drv-rw-whitelist 和 block-drv-ro-whitelist 来定义设备的读取限制,其中 block-drv-rw-whitelist 是读写白名单,支持读写两种功能,而 block-drv-ro-whitelist 是属于只读方式,即限制不能从这些文件类型中创建虚拟机。 该方式在 redhat 系列的所有 OS 版本里都是如此设计的,可以通过查看源码得知: %global block_drivers_rw_list qcow2,raw,file,host_device,nbd,iscsi,rbd,blkdebug,luks,null-co,nvme,copy-on-read,throttle,compress,virtio-blk-vdpa-blk,virtio-blk-vfio-pci,virtio-blk-vhost-user,io_uring,nvme-io_uring %global block_drivers_ro_list vdi,vmdk,vhdx,vpc,https run_configure \ %if %{defined target_list} --target-list="%{target_list}" \ %endif %if %{defined block_drivers_rw_list} --block-drv-rw-whitelist=%{block_drivers_rw_list} \ %endif %if %{defined block_drivers_ro_list} --block-drv-ro-whitelist=%{block_drivers_ro_list} \ %endif