diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 0ccaad472b..4739810c9b 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2555,26 +2555,6 @@ qemuMonitorGetChardevInfo(qemuMonitor *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(qemuMonitor *mon, - const char *drivestr) -{ - VIR_DEBUG("drivestr=%s", drivestr); - - QEMU_CHECK_MONITOR(mon); - - /* there won't be a direct replacement for drive_del in QMP */ - return qemuMonitorTextDriveDel(mon, drivestr); -} - - /** * @mon: monitor object * @devalias: alias of the device to detach @@ -2746,19 +2726,6 @@ qemuMonitorDelObject(qemuMonitor *mon, } -int -qemuMonitorAddDrive(qemuMonitor *mon, - const char *drivestr) -{ - VIR_DEBUG("drive=%s", drivestr); - - QEMU_CHECK_MONITOR(mon); - - /* there won't ever be a direct QMP replacement for this function */ - return qemuMonitorTextAddDrive(mon, drivestr); -} - - int qemuMonitorCreateSnapshot(qemuMonitor *mon, const char *name) { diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 2750395efe..78e2ebf0bd 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -951,12 +951,6 @@ int qemuMonitorDelObject(qemuMonitor *mon, const char *objalias, bool report_error); -int qemuMonitorAddDrive(qemuMonitor *mon, - const char *drivestr); - -int qemuMonitorDriveDel(qemuMonitor *mon, - const char *drivestr); - int qemuMonitorCreateSnapshot(qemuMonitor *mon, const char *name); int qemuMonitorDeleteSnapshot(qemuMonitor *mon, const char *name); diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 65785f1dae..8e70b8f78d 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -31,88 +31,6 @@ VIR_LOG_INIT("qemu.qemu_monitor_text"); -int qemuMonitorTextAddDrive(qemuMonitor *mon, - const char *drivestr) -{ - g_autofree char *cmd = NULL; - g_autofree char *reply = NULL; - - /* 'dummy' here is just a placeholder since there is no PCI - * address required when attaching drives to a controller */ - cmd = g_strdup_printf("drive_add dummy %s", drivestr); - - if (qemuMonitorJSONHumanCommand(mon, cmd, -1, &reply) < 0) - return -1; - - if (strstr(reply, "unknown command:")) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("drive hotplug is not supported")); - return -1; - } - - if (strstr(reply, "could not open disk image")) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("open disk image file failed")); - return -1; - } - - if (strstr(reply, "Could not open")) { - size_t len = strlen(reply); - if (reply[len - 1] == '\n') - reply[len - 1] = '\0'; - - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - reply); - return -1; - } - - if (strstr(reply, "Image is not in")) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("Incorrect disk format")); - return -1; - } - - if (strstr(reply, "IOMMU") || - strstr(reply, "VFIO")) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - reply); - return -1; - } - - return 0; -} - - -int qemuMonitorTextDriveDel(qemuMonitor *mon, - const char *drivestr) -{ - g_autofree char *cmd = NULL; - g_autofree char *reply = NULL; - - cmd = g_strdup_printf("drive_del %s", drivestr); - - if (qemuMonitorJSONHumanCommand(mon, cmd, -1, &reply) < 0) - return -1; - - if (strstr(reply, "unknown command:")) { - VIR_ERROR(_("deleting drive is not supported. " - "This may leak data if disk is reassigned")); - return 1; - - /* (qemu) drive_del wark - * Device 'wark' not found */ - } else if (strstr(reply, "Device '") && strstr(reply, "not found")) { - /* NB: device not found errors mean the drive was auto-deleted and we - * ignore the error */ - } else if (STRNEQ(reply, "")) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("deleting %s drive failed: %s"), drivestr, reply); - return -1; - } - - return 0; -} - int qemuMonitorTextCreateSnapshot(qemuMonitor *mon, const char *name) diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h index d959fc8889..27d0f061d3 100644 --- a/src/qemu/qemu_monitor_text.h +++ b/src/qemu/qemu_monitor_text.h @@ -25,11 +25,5 @@ #include "qemu_monitor.h" -int qemuMonitorTextAddDrive(qemuMonitor *mon, - const char *drivestr); - -int qemuMonitorTextDriveDel(qemuMonitor *mon, - const char *drivestr); - int qemuMonitorTextCreateSnapshot(qemuMonitor *mon, const char *name); int qemuMonitorTextDeleteSnapshot(qemuMonitor *mon, const char *name);