]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: monitor: Remove JSON impls of drive_add and drive_del
authorPeter Krempa <pkrempa@redhat.com>
Fri, 11 Mar 2016 15:33:03 +0000 (16:33 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 29 Mar 2016 13:25:16 +0000 (15:25 +0200)
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
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
src/qemu/qemu_monitor_text.c

index ffc792007c41410c29258e5d81ca200c972d59da..10a6713c06ad36e2055f8144fba00b78630971e5 100644 (file)
@@ -2797,6 +2797,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)
@@ -2805,10 +2812,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);
 }
 
 
@@ -2911,10 +2916,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);
 }
 
 
index 57c34f0b168840a389deb3938d79bcecf0430d63..e140d0eeb03bcd602fd5126a75ead1a9092d33e8 100644 (file)
@@ -3583,35 +3583,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)
index 486e660a7ac4103bbb2d4a699673bb270cb0c9a5..d155f52e5a2b0bf3da3933a82c4ceb46fb44ee3a 100644 (file)
@@ -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);
index ea3cbf02338bd03c942c35450a29e62e6a10986e..ccae02f99cf4d0bcab36c83f3da4db5ab43bbe4d 100644 (file)
@@ -2454,8 +2454,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)
 {
@@ -2463,7 +2462,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;