[PATCH 2/7] qemu: monitor: Drop qemuMonitorAttachDrive and leaves in call tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



After the refactor in the previous patch, the functions are no longer
required.
---
 src/qemu/qemu_hotplug.c      |  1 -
 src/qemu/qemu_monitor.c      | 16 --------
 src/qemu/qemu_monitor.h      |  6 ---
 src/qemu/qemu_monitor_text.c | 98 --------------------------------------------
 src/qemu/qemu_monitor_text.h |  5 ---
 5 files changed, 126 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index ac359da..bc2336a 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -562,7 +562,6 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn,
                          virDomainObjPtr vm,
                          virDomainDiskDefPtr disk)
 {
-    size_t i;
     qemuDomainObjPrivatePtr priv = vm->privateData;
     char *drivestr = NULL;
     char *devstr = NULL;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index ace3bb4..3d4443d 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2782,22 +2782,6 @@ qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,


 int
-qemuMonitorAttachDrive(qemuMonitorPtr mon,
-                       const char *drivestr,
-                       virDevicePCIAddress *controllerAddr,
-                       virDomainDeviceDriveAddress *driveAddr)
-{
-    VIR_DEBUG("drivestr=%s domain=%d bus=%d slot=%d function=%d",
-              drivestr, controllerAddr->domain, controllerAddr->bus,
-              controllerAddr->slot, controllerAddr->function);
-
-    QEMU_CHECK_MONITOR_JSON(mon);
-
-    return qemuMonitorTextAttachDrive(mon, drivestr, controllerAddr, driveAddr);
-}
-
-
-int
 qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon,
                               qemuMonitorPCIAddress **addrs)
 {
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 4467a41..b752a98 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -672,12 +672,6 @@ int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
                                        const char *bus,
                                        virDevicePCIAddress *guestAddr);

-int qemuMonitorAttachDrive(qemuMonitorPtr mon,
-                           const char *drivestr,
-                           virDevicePCIAddress *controllerAddr,
-                           virDomainDeviceDriveAddress *driveAddr);
-
-
 typedef struct _qemuMonitorPCIAddress qemuMonitorPCIAddress;
 struct _qemuMonitorPCIAddress {
     unsigned int vendor;
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index bb87397..9703e36 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -2213,104 +2213,6 @@ int qemuMonitorTextAttachPCIDiskController(qemuMonitorPtr mon,
 }


-static int
-qemuParseDriveAddReply(const char *reply,
-                       virDomainDeviceDriveAddressPtr addr)
-{
-    char *s, *e;
-
-    /* If the command succeeds qemu prints:
-     * OK bus X, unit Y
-     */
-
-    if (!(s = strstr(reply, "OK ")))
-        return -1;
-
-    s += 3;
-
-    if (STRPREFIX(s, "bus ")) {
-        s += strlen("bus ");
-
-        if (virStrToLong_ui(s, &e, 10, &addr->bus) == -1) {
-            VIR_WARN("Unable to parse bus '%s'", s);
-            return -1;
-        }
-
-        if (!STRPREFIX(e, ", ")) {
-            VIR_WARN("Expected ', ' parsing drive_add reply '%s'", s);
-            return -1;
-        }
-        s = e + 2;
-    }
-
-    if (!STRPREFIX(s, "unit ")) {
-        VIR_WARN("Expected 'unit ' parsing drive_add reply '%s'", s);
-        return -1;
-    }
-    s += strlen("bus ");
-
-    if (virStrToLong_ui(s, &e, 10, &addr->unit) == -1) {
-        VIR_WARN("Unable to parse unit number '%s'", s);
-        return -1;
-    }
-
-    return 0;
-}
-
-
-int qemuMonitorTextAttachDrive(qemuMonitorPtr mon,
-                               const char *drivestr,
-                               virDevicePCIAddress *controllerAddr,
-                               virDomainDeviceDriveAddress *driveAddr)
-{
-    char *cmd = NULL;
-    char *reply = NULL;
-    int ret = -1;
-    char *safe_str;
-    bool tryOldSyntax = false;
-
-    safe_str = qemuMonitorEscapeArg(drivestr);
-    if (!safe_str)
-        return -1;
-
- try_command:
-    if (virAsprintf(&cmd, "drive_add %s%.2x:%.2x:%.2x %s",
-                    (tryOldSyntax ? "" : "pci_addr="),
-                    controllerAddr->domain, controllerAddr->bus,
-                    controllerAddr->slot, safe_str) < 0)
-        goto cleanup;
-
-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (strstr(reply, "unknown command:")) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("drive hotplug is not supported"));
-        goto cleanup;
-    }
-
-    if (qemuParseDriveAddReply(reply, driveAddr) < 0) {
-        if (!tryOldSyntax && strstr(reply, "invalid char in expression")) {
-            VIR_FREE(reply);
-            VIR_FREE(cmd);
-            tryOldSyntax = true;
-            goto try_command;
-        }
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("adding %s disk failed: %s"), drivestr, reply);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(cmd);
-    VIR_FREE(reply);
-    VIR_FREE(safe_str);
-    return ret;
-}
-
-
 /*
  * The format we're after looks like this
  *
diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h
index 44a5330..287a851 100644
--- a/src/qemu/qemu_monitor_text.h
+++ b/src/qemu/qemu_monitor_text.h
@@ -173,11 +173,6 @@ int qemuMonitorTextAttachPCIDiskController(qemuMonitorPtr mon,
                                            const char *bus,
                                            virDevicePCIAddress *guestAddr);

-int qemuMonitorTextAttachDrive(qemuMonitorPtr mon,
-                               const char *drivestr,
-                               virDevicePCIAddress *controllerAddr,
-                               virDomainDeviceDriveAddress *driveAddr);
-
 int qemuMonitorTextGetAllPCIAddresses(qemuMonitorPtr mon,
                                       qemuMonitorPCIAddress **addrs);

-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]