From 52c3e93af757716897e422b90fcd011226d45e69 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Thu, 17 Dec 2020 18:46:03 +0800 Subject: [PATCH] refactor(host): startvm: for compat QEMU 2.12 outputs device help on stderr in the following style ``` virtio-net-pci.speed=int32 ``` QEMU 5.2.0 outputs it to stdout and in the following format ``` speed= - (default: -1) ``` --- pkg/hostman/guestman/qemu-kvmhelper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/hostman/guestman/qemu-kvmhelper.go b/pkg/hostman/guestman/qemu-kvmhelper.go index eefe152ecb..0bba2aa308 100644 --- a/pkg/hostman/guestman/qemu-kvmhelper.go +++ b/pkg/hostman/guestman/qemu-kvmhelper.go @@ -409,7 +409,7 @@ func (s *SKVMGuestInstance) _generateStartScript(data *jsonutils.JSONDict) (stri // cmd += "fi\n" cmd += ` function nic_speed() { - $QEMU_CMD $QEMU_CMD_KVM_ARG -device virtio-net-pci,? 2>&1 | grep .speed= > /dev/null + $QEMU_CMD $QEMU_CMD_KVM_ARG -device virtio-net-pci,help 2>&1 | grep -q "\