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=<int32>          -  (default: -1)
```
This commit is contained in:
Yousong Zhou
2020-12-17 19:00:41 +08:00
parent d4093e2155
commit 52c3e93af7
+1 -1
View File
@@ -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 "\<speed="
if [ "$?" -eq "0" ]; then
echo ",speed=$1"
fi