How to hot plugin a new vhost-user-blk-pci device to running VM?

梁朝军 jesonliang040705 at hotmail.com
Sat Jun 5 08:30:29 UTC 2021


Thanks a lot.  Peter . BTW, one more question, recently sometimes we often hit another issue that vm can’t boot from disk stuck in black screen show “Guest has not initialized the display (yet).”
Our QEMU command line parameter like below.

/usr/bin/qemu-system-x86_64 -name guest=testvm_j5ei9x2a,debug-threads=on -S \
-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-46-testvm_j5ei9x2a/master-key.aes \
-machine pc-i440fx-5.1,accel=kvm,usb=off,dump-guest-core=off,mem-merge=off \
-m 8192 -mem-prealloc -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 \
-uuid 44b984dd-e1c7-45c8-b235-6c9ce3a8b86c -smbios type=0,vendor=phegda -smbios type=1,manufacturer=phegda.com,product=hippo -no-user-config \
-nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-46-testvm_j5ei9x2a/monitor.sock,server,nowait \
-mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -boot strict=on \
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 \
-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 \
-drive if=none,id=drive-ide0-0-0,readonly=on \
-device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-drive file=/dev/disk/by-id/pbdx-vol-88663c6a-c5cb-11eb-9c3b-001b21bc1e4e,format=raw,if=none,id=drive-scsi0-0-0-0,cache=writethrough,werror=report,rerror=report \
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \
-drive file=/dev/disk/by-id/pbdx-vol-d8596026-862c-47cf-9fa5-8a16f337d02a,format=raw,if=none,id=drive-scsi0-0-0-1,cache=none,werror=report,rerror=report \
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1 \
-netdev tap,fd=29,id=hostnet0,vhost=on,vhostfd=32 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=e6:8e:42:c8:47:dd,bus=pci.0,addr=0x8 \
-netdev tap,fd=33,id=hostnet1,vhost=on,vhostfd=34 \
-device virtio-net-pci,netdev=hostnet1,id=net1,mac=e6:8e:fe:99:0f:63,bus=pci.0,addr=0x9 \
-chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 \
-chardev socket,id=charchannel0,path=/var/hippo/channel/44b984dd-e1c7-45c8-b235-6c9ce3a8b86c.channel,server,nowait \
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=cn.com.pbdata.hippo.0 \
-chardev socket,id=charchannel1,path=/var/hippo/channel/testvm_j5ei9x2a.44b984dd-e1c7-45c8-b235-6c9ce3a8b86c.channel,server,nowait \
-device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=cn.com.pbdata.hippo.1 \
-vnc 0.0.0.0:2 -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pci.0,addr=0x2 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 \
-msg timestamp=on

Is it related with that QEMU vesion higher for libvirt? 

Thanks 


> 在 2021年6月4日,下午7:31,Peter Krempa <pkrempa at redhat.com> 写道:
> 
> On Fri, Jun 04, 2021 at 19:22:31 +0800, 梁朝军 wrote:
>> Hi Guys:
>> 
>> Who can help me ? What does this issue mean?  When I attach a network I hit this issue.
>> 
>> libvirt: QEMU Driver error : internal error: unable to execute QEMU command 'netdev_add': Invalid parameter type for 'vhost', expected: boolean
> 
> Your qemu is too-new for libvirt. the 'netdev_add' command was converted
> to a strict description by QMP schema and libvirt wasn't ready for that.
> 
> commit b6738ffc9f8be5a2a61236cd9bef7fd317982f01
> Author: Peter Krempa <pkrempa at redhat.com>
> Date:   Thu May 14 22:50:59 2020 +0200
> 
>    qemu: command: Generate -netdev command line via JSON->cmdline conversion
> 
>    The 'netdev_add' command was recently formally described in qemu via the
>    QMP schema. This means that it also requires the arguments to be
>    properly formatted. Our current approach is to generate the command line
>    and then use qemuMonitorJSONKeywordStringToJSON to get the JSON
>    properties for the monitor. This will not work if we need to pass some
>    fields as numbers or booleans.
> 
>    In this step we re-do internals of qemuBuildHostNetStr to format a JSON
>    object which is converted back via virQEMUBuildNetdevCommandlineFromJSON
>    to the equivalent command line. This will later allow fixing of the
>    monitor code to use the JSON object directly rather than rely on the
>    conversion.
> 
> v6.3.0-139-gb6738ffc9f
> 
> Thus you need at least libvirt 6.4.0 with that qemu.
> 





More information about the libvirt-users mailing list