spdk-基于spdk vhost qemu启动虚机

qemu启动虚机,driver使用基于spdk的vhost-user-scsi技术, bdev backend为ceph rbd

创建vhost device (上文创建rbd dev名称为Ceph0)

virtio-blk
1
2
#scripts/rpc.py vhost_create_blk_controller --cpumask 0x1 vhost.1 Ceph1
#scripts/rpc.py bdev_virtio_attach_controller --dev-type blk --trtype user --traddr /opt/tmp/vhost.1 --vq-count 2 --vq-size 512 VirtioBlk1
virtio-scsi
1
2
3
#scripts/rpc.py vhost_create_scsi_controller --cpumask 0x1 vhost.0
#scripts/rpc.py vhost_scsi_controller_add_target vhost.0 0 Ceph0

启动虚拟机
1
2
3
4
5
6
7
8
9
qemu-system-x86_64 \
--enable-kvm \
-cpu host -smp 2 \
-m 1G -object memory-backend-file,id=mem0,size=1G,mem-path=/dev/hugepages,share=on -numa node,memdev=mem0 \
-drive file=/opt/a0c4f799-aecf-4ebd-af51-03b2f2f14c5a.qcow2,if=none,id=disk \
-device ide-hd,drive=disk,bootindex=0 \
-chardev socket,id=spdk_vhost_scsi0,path=/opt/tmp/vhost.0 \
-device vhost-user-scsi-pci,id=scsi0,chardev=spdk_vhost_scsi0 \
-vnc 10.224.130.52:3

Troubleshooting

1
2
qemu 使用 4.2.0