]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: monitor: Remove unused qemuMonitorAddDrive/qemuMonitorDriveDel
authorPeter Krempa <pkrempa@redhat.com>
Thu, 21 Jul 2022 12:52:51 +0000 (14:52 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 11 Aug 2022 13:23:21 +0000 (15:23 +0200)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_text.c
src/qemu/qemu_monitor_text.h

index 0ccaad472b7992e1cd471b1c3cd16c9ae6215e9b..4739810c9b0d0d1d6891c5775badec9bb92f1312 100644 (file)
@@ -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)
 {
index 2750395efe101777f6fe65b8a2bdd3d38cddece0..78e2ebf0bd86c5c233460f28e34137590513b628 100644 (file)
@@ -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);
 
index 65785f1dae052a1a3262dc32dad36ac027ca4379..8e70b8f78d28cf232e46813b196b7c984d5a8abb 100644 (file)
 
 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)
index d959fc8889b9289454fda0c3fde8f7bc97d2ff65..27d0f061d373d4636cc5de29efb1b91107bd15f6 100644 (file)
 
 #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);