提交 44f68729 编写于 作者: D Daniel P. Berrange

Fix detection of errors in QEMU device_add command

The code assumed that 'device_add' returned an empty string upon
success. This is not true, it sometimes prints random debug info.
THus we need to check for an explicit fail string

* src/qemu/qemu_monitor_text.c: Fix error checking of the device_add
  monitor command
上级 a8464c51
...@@ -2123,9 +2123,11 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon, ...@@ -2123,9 +2123,11 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
goto cleanup; goto cleanup;
} }
if (STRNEQ(reply, "")) { /* If the command failed qemu prints:
* Could not add ... */
if (strstr(reply, "Could not add ")) {
qemuReportError(VIR_ERR_OPERATION_FAILED, qemuReportError(VIR_ERR_OPERATION_FAILED,
_("adding %s device failed: %s"), devicestr, reply); _("adding %s device failed"), devicestr);
goto cleanup; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册