Peter Krempa
2021-May-13 14:25 UTC
How to hot plugin a new vhost-user-blk-pci device to running VM?
On Thu, May 13, 2021 at 15:25:23 +0800, ??? wrote:> Hi Guy, > > Does anyone clear how to hot plugin a new vhost-user-blk-pci device to a > running VM? > > Before staring vm , I pass the disk through QEMU command line like below. > > <qemu:commandline> > <qemu:arg value='-object'/> > <qemu:arg > value='memory-backend-file,id=mem0,size=4G,mem-path=/dev/hugepages,share=on'/> > <qemu:arg value='-numa'/> > <qemu:arg value='node,memdev=mem0'/> > <qemu:arg value='-chardev'/> > <qemu:arg > value='socket,id=spdk_vhost_blk721ea46a-b306-11eb-a280-525400a98761,path=/var/tmp/vhost.721ea46a-b306-11eb-a280-525400a98761,reconnect=1'/> > <qemu:arg value='-device'/> > <qemu:arg > value='vhost-user-blk-pci,chardev=spdk_vhost_blk721ea46a-b306-11eb-a280-525400a98761,bootindex=1,num-queues=4'/> > <qemu:arg value='-chardev'/> > <qemu:arg > value='socket,id=spdk_vhost_blk2f699c58-d222-4629-9fdc-400c3aadc55e,path=/var/tmp/vhost.2f699c58-d222-4629-9fdc-400c3aadc55e,reconnect=1'/> > <qemu:arg value='-device'/> > <qemu:arg > value='vhost-user-blk-pci,chardev=spdk_vhost_blk2f699c58-d222-4629-9fdc-400c3aadc55e,num-queues=4'/> > </qemu:commandline> > > But I don**t know how to live add a vhost-user-blk-pci device on running > VM even with calling attachDevice API now.You need to use the proper and supported way to use vhost-user-blk: <disk type='vhostuser' device='disk'> <driver name='qemu' type='raw'/> <source type='unix' path='/tmp/vhost-blk.sock'> <reconnect enabled='yes' timeout='10'/> </source> <target dev='vdf' bus='virtio'/> </disk> That works also with attachDevice.> OS: redhat 7.4 Libvirt version: 3.4This is obviously way too old for it. You'll need at least libvirt-7.1 for that.
Liang Chaojun
2021-May-13 15:11 UTC
How to hot plugin a new vhost-user-blk-pci device to running VM?
Thanks Peter for your quickly response. Is there any workaround to do that?As you know we must take care the risk of using latest version in product environment. Thanks a lot!> ? 2021?5?13??22:25?Peter Krempa <pkrempa at redhat.com> ??? > > ?On Thu, May 13, 2021 at 15:25:23 +0800, ??? wrote: >> Hi Guy, >> >> Does anyone clear how to hot plugin a new vhost-user-blk-pci device to a >> running VM? >> >> Before staring vm , I pass the disk through QEMU command line like below. >> >> <qemu:commandline> >> <qemu:arg value='-object'/> >> <qemu:arg >> value='memory-backend-file,id=mem0,size=4G,mem-path=/dev/hugepages,share=on'/> >> <qemu:arg value='-numa'/> >> <qemu:arg value='node,memdev=mem0'/> >> <qemu:arg value='-chardev'/> >> <qemu:arg >> value='socket,id=spdk_vhost_blk721ea46a-b306-11eb-a280-525400a98761,path=/var/tmp/vhost.721ea46a-b306-11eb-a280-525400a98761,reconnect=1'/> >> <qemu:arg value='-device'/> >> <qemu:arg >> value='vhost-user-blk-pci,chardev=spdk_vhost_blk721ea46a-b306-11eb-a280-525400a98761,bootindex=1,num-queues=4'/> >> <qemu:arg value='-chardev'/> >> <qemu:arg >> value='socket,id=spdk_vhost_blk2f699c58-d222-4629-9fdc-400c3aadc55e,path=/var/tmp/vhost.2f699c58-d222-4629-9fdc-400c3aadc55e,reconnect=1'/> >> <qemu:arg value='-device'/> >> <qemu:arg >> value='vhost-user-blk-pci,chardev=spdk_vhost_blk2f699c58-d222-4629-9fdc-400c3aadc55e,num-queues=4'/> >> </qemu:commandline> >> >> But I don**t know how to live add a vhost-user-blk-pci device on running >> VM even with calling attachDevice API now. > > You need to use the proper and supported way to use vhost-user-blk: > > <disk type='vhostuser' device='disk'> > <driver name='qemu' type='raw'/> > <source type='unix' path='/tmp/vhost-blk.sock'> > <reconnect enabled='yes' timeout='10'/> > </source> > <target dev='vdf' bus='virtio'/> > </disk> > > That works also with attachDevice. > > >> OS: redhat 7.4 Libvirt version: 3.4 > > This is obviously way too old for it. You'll need at least libvirt-7.1 > for that. >