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
#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
10
/usr/local/qemu42/bin/qemu-system-x86_64    --enable-kvm   \
-cpu host -smp 4,sockets=4,cores=1,threads=1 \
-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,bootindex=1 \
-vnc 0.0.0.0:3 \
-device virtio-net-pci,netdev=net0 -netdev tap,id=net0,ifname=tap0,script=no,downscript=no

Troubleshooting

1
2
libvirt 貌似只支持管理qemu vhost-user-blk方式,不支持vhost-user-scsi方式

cinder

1
2
cinder type-create sata_high_io
cinder type-key sata_high_io set volume_backend_name=rbd-1