}
+/**
+ * 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)
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);
}
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);
}
}
-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)
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);
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)
{
char *reply = NULL;
char *safedev;
int ret = -1;
- VIR_DEBUG("TextDriveDel drivestr=%s", drivestr);
if (!(safedev = qemuMonitorEscapeArg(drivestr)))
goto cleanup;