2010/2/1 Daniel P. Berrange <berrange(a)redhat.com>:
The way QEMU is started has been changed to use '-device'
and
the new style '-drive' syntax. This needs to be mirrored in
the hotplug code, requiring addition of two new APIs.
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Define APIs
qemuMonitorAddDevice() and qemuMonitorAddDrive()
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
Implement the new monitor APIs
---
diff --git a/src/qemu/qemu_monitor_text.c
b/src/qemu/qemu_monitor_text.c
index 380bcdc..b2a0c53 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -2029,3 +2029,80 @@ error:
+int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
+ const char *drivestr)
+{
+ char *cmd = NULL;
+ char *reply = NULL;
+ int ret = -1;
+ char *safe_str;
+
+ safe_str = qemuMonitorEscapeArg(drivestr);
+ if (!safe_str) {
+ virReportOOMError(NULL);
+ return -1;
+ }
+
+ ret = virAsprintf(&cmd, "drive_add dummy %s", safe_str);
dummy looks like a leftover from debugging to me, or does it belong there?
+ if (ret == -1) {
+ virReportOOMError(NULL);
+ goto cleanup;
+ }
+
+ if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
+ _("failed to close fd in qemu with '%s'"),
cmd);
+ goto cleanup;
+ }
+
+ ret = 0;
+
+cleanup:
+ VIR_FREE(cmd);
+ VIR_FREE(reply);
+ VIR_FREE(safe_str);
+ return ret;
+}
+
ACK
Matthias