qemu won't ever add those functions directly to QMP. They will be
replaced with 'blockdev-add' and 'blockdev-del' eventually. At this time
there's no need to keep the stubs around.
Additionally the drive_del stub in JSON contained dead code in the
attempt to report errors. (VIR_ERR_OPERATION_UNSUPPORTED was never
reported). Since the text impl does have the same message it is reported
anyways.
---
src/qemu/qemu_monitor.c | 19 +++++++++++--------
src/qemu/qemu_monitor_json.c | 29 -----------------------------
src/qemu/qemu_monitor_json.h | 6 ------
src/qemu/qemu_monitor_text.c | 4 +---
4 files changed, 12 insertions(+), 46 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 3d4443d..56df969 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2796,6 +2796,13 @@ qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon,
}
+/**
+ * qemuMonitorDriveDel:
+ * @mon: monitor object
+ * @drivestr: identifier of drive to delete.
+ *
+ * Attempts to remove a host drive.
+ * Returns 1 if unsupported, 0 if ok, and -1 on other failure */
int
qemuMonitorDriveDel(qemuMonitorPtr mon,
const char *drivestr)
@@ -2804,10 +2811,8 @@ qemuMonitorDriveDel(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR(mon);
- if (mon->json)
- return qemuMonitorJSONDriveDel(mon, drivestr);
- else
- return qemuMonitorTextDriveDel(mon, drivestr);
+ /* there won't be a direct replacement for drive_del in QMP */
+ return qemuMonitorTextDriveDel(mon, drivestr);
}
@@ -2910,10 +2915,8 @@ qemuMonitorAddDrive(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR(mon);
- if (mon->json)
- return qemuMonitorJSONAddDrive(mon, drivestr);
- else
- return qemuMonitorTextAddDrive(mon, drivestr);
+ /* there won't ever be a direct QMP replacement for this function */
+ return qemuMonitorTextAddDrive(mon, drivestr);
}
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 8352e53..fad948f 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3592,35 +3592,6 @@ int qemuMonitorJSONDelObject(qemuMonitorPtr mon,
}
-int qemuMonitorJSONAddDrive(qemuMonitorPtr mon,
- const char *drivestr)
-{
- /* XXX Update to use QMP, if QMP ever adds support for drive_add */
- VIR_DEBUG("drive_add command not found, trying HMP");
- return qemuMonitorTextAddDrive(mon, drivestr);
-}
-
-
-int qemuMonitorJSONDriveDel(qemuMonitorPtr mon,
- const char *drivestr)
-{
- int ret;
-
- /* XXX Update to use QMP, if QMP ever adds support for drive_del */
- VIR_DEBUG("drive_del command not found, trying HMP");
- if ((ret = qemuMonitorTextDriveDel(mon, drivestr)) < 0) {
- virErrorPtr err = virGetLastError();
- if (err && err->code == VIR_ERR_OPERATION_UNSUPPORTED) {
- VIR_ERROR("%s",
- _("deleting disk is not supported. "
- "This may leak data if disk is reassigned"));
- ret = 1;
- virResetLastError();
- }
- }
- return ret;
-}
-
int qemuMonitorJSONSetDrivePassphrase(qemuMonitorPtr mon,
const char *alias,
const char *passphrase)
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 4068187..0b4916b 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -230,12 +230,6 @@ int qemuMonitorJSONAddObject(qemuMonitorPtr mon,
int qemuMonitorJSONDelObject(qemuMonitorPtr mon,
const char *objalias);
-int qemuMonitorJSONAddDrive(qemuMonitorPtr mon,
- const char *drivestr);
-
-int qemuMonitorJSONDriveDel(qemuMonitorPtr mon,
- const char *drivestr);
-
int qemuMonitorJSONSetDrivePassphrase(qemuMonitorPtr mon,
const char *alias,
const char *passphrase);
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 9703e36..7ec50e2 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -2457,8 +2457,7 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
return ret;
}
-/* Attempts to remove a host drive.
- * Returns 1 if unsupported, 0 if ok, and -1 on other failure */
+
int qemuMonitorTextDriveDel(qemuMonitorPtr mon,
const char *drivestr)
{
@@ -2466,7 +2465,6 @@ int qemuMonitorTextDriveDel(qemuMonitorPtr mon,
char *reply = NULL;
char *safedev;
int ret = -1;
- VIR_DEBUG("TextDriveDel drivestr=%s", drivestr);
if (!(safedev = qemuMonitorEscapeArg(drivestr)))
goto cleanup;
--
2.7.3