[PATCH 8/8] qemu: monitor: drop now unused hmp monitor commands

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

 



Basically all wrappers for these hmp commands:

- usb_add
- pci_add
- pci_del
- drive_add
- info pci
---
 src/qemu/qemu_monitor.c      | 161 ------------
 src/qemu/qemu_monitor.h      |  49 ----
 src/qemu/qemu_monitor_json.c |  88 -------
 src/qemu/qemu_monitor_json.h |  33 ---
 src/qemu/qemu_monitor_text.c | 601 -------------------------------------------
 src/qemu/qemu_monitor_text.h |  39 ---
 6 files changed, 971 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 6fd08b6..a62e4b0 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2368,120 +2368,6 @@ qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
 
 
 int
-qemuMonitorAddUSBDisk(qemuMonitorPtr mon,
-                      const char *path)
-{
-    VIR_DEBUG("path=%s", path);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAddUSBDisk(mon, path);
-    else
-        return qemuMonitorTextAddUSBDisk(mon, path);
-}
-
-
-int
-qemuMonitorAddUSBDeviceExact(qemuMonitorPtr mon,
-                             int bus,
-                             int dev)
-{
-    VIR_DEBUG("bus=%d dev=%d", bus, dev);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAddUSBDeviceExact(mon, bus, dev);
-    else
-        return qemuMonitorTextAddUSBDeviceExact(mon, bus, dev);
-}
-
-
-int
-qemuMonitorAddUSBDeviceMatch(qemuMonitorPtr mon,
-                             int vendor,
-                             int product)
-{
-    VIR_DEBUG("vendor=%d product=%d", vendor, product);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAddUSBDeviceMatch(mon, vendor, product);
-    else
-        return qemuMonitorTextAddUSBDeviceMatch(mon, vendor, product);
-}
-
-
-int
-qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon,
-                            virDevicePCIAddress *hostAddr,
-                            virDevicePCIAddress *guestAddr)
-{
-    VIR_DEBUG("domain=%d bus=%d slot=%d function=%d",
-              hostAddr->domain, hostAddr->bus, hostAddr->slot, hostAddr->function);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAddPCIHostDevice(mon, hostAddr, guestAddr);
-    else
-        return qemuMonitorTextAddPCIHostDevice(mon, hostAddr, guestAddr);
-}
-
-
-int
-qemuMonitorAddPCIDisk(qemuMonitorPtr mon,
-                      const char *path,
-                      const char *bus,
-                      virDevicePCIAddress *guestAddr)
-{
-    VIR_DEBUG("path=%s bus=%s", path, bus);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAddPCIDisk(mon, path, bus, guestAddr);
-    else
-        return qemuMonitorTextAddPCIDisk(mon, path, bus, guestAddr);
-}
-
-
-int
-qemuMonitorAddPCINetwork(qemuMonitorPtr mon,
-                         const char *nicstr,
-                         virDevicePCIAddress *guestAddr)
-{
-    VIR_DEBUG("nicstr=%s", nicstr);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAddPCINetwork(mon, nicstr, guestAddr);
-    else
-        return qemuMonitorTextAddPCINetwork(mon, nicstr, guestAddr);
-}
-
-
-int
-qemuMonitorRemovePCIDevice(qemuMonitorPtr mon,
-                           virDevicePCIAddress *guestAddr)
-{
-    VIR_DEBUG("domain=%d bus=%d slot=%d function=%d",
-              guestAddr->domain, guestAddr->bus, guestAddr->slot,
-              guestAddr->function);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONRemovePCIDevice(mon, guestAddr);
-    else
-        return qemuMonitorTextRemovePCIDevice(mon, guestAddr);
-}
-
-
-int
 qemuMonitorSendFileHandle(qemuMonitorPtr mon,
                           const char *fdname,
                           int fd)
@@ -2773,53 +2659,6 @@ qemuMonitorGetChardevInfo(qemuMonitorPtr mon,
 
 
 int
-qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon,
-                                   const char *bus,
-                                   virDevicePCIAddress *guestAddr)
-{
-    VIR_DEBUG("type=%s", bus);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONAttachPCIDiskController(mon, bus, guestAddr);
-    else
-        return qemuMonitorTextAttachPCIDiskController(mon, bus, guestAddr);
-}
-
-
-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)
-{
-    VIR_DEBUG("addrs=%p", addrs);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (mon->json)
-        return qemuMonitorJSONGetAllPCIAddresses(mon, addrs);
-    else
-        return qemuMonitorTextGetAllPCIAddresses(mon, addrs);
-}
-
-
-int
 qemuMonitorDriveDel(qemuMonitorPtr mon,
                     const char *drivestr)
 {
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 4193ad2..00a4532 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -589,42 +589,6 @@ int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon,
                                 int tlsPort,
                                 const char *tlsSubject);
 
-/* XXX disk driver type eg,  qcow/etc.
- * XXX cache mode
- */
-int qemuMonitorAddUSBDisk(qemuMonitorPtr mon,
-                          const char *path);
-
-int qemuMonitorAddUSBDeviceExact(qemuMonitorPtr mon,
-                                 int bus,
-                                 int dev);
-int qemuMonitorAddUSBDeviceMatch(qemuMonitorPtr mon,
-                                 int vendor,
-                                 int product);
-
-
-int qemuMonitorAddPCIHostDevice(qemuMonitorPtr mon,
-                                virDevicePCIAddress *hostAddr,
-                                virDevicePCIAddress *guestAddr);
-
-/* XXX disk driver type eg,  qcow/etc.
- * XXX cache mode
- */
-int qemuMonitorAddPCIDisk(qemuMonitorPtr mon,
-                          const char *path,
-                          const char *bus,
-                          virDevicePCIAddress *guestAddr);
-
-/* XXX do we really want to hardcode 'nicstr' as the
- * sendable item here
- */
-int qemuMonitorAddPCINetwork(qemuMonitorPtr mon,
-                             const char *nicstr,
-                             virDevicePCIAddress *guestAddr);
-
-int qemuMonitorRemovePCIDevice(qemuMonitorPtr mon,
-                               virDevicePCIAddress *guestAddr);
-
 
 int qemuMonitorSendFileHandle(qemuMonitorPtr mon,
                               const char *fdname,
@@ -671,16 +635,6 @@ void qemuMonitorChardevInfoFree(void *data, const void *name);
 int qemuMonitorGetChardevInfo(qemuMonitorPtr mon,
                               virHashTablePtr *retinfo);
 
-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;
@@ -688,9 +642,6 @@ struct _qemuMonitorPCIAddress {
     virDevicePCIAddress addr;
 };
 
-int qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon,
-                                  qemuMonitorPCIAddress **addrs);
-
 int qemuMonitorAddDevice(qemuMonitorPtr mon,
                          const char *devicestr);
 
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 077be3a..31b5bb9 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2820,75 +2820,6 @@ int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon,
 }
 
 
-int qemuMonitorJSONAddUSBDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                              const char *path ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("usb_add not supported in JSON mode"));
-    return -1;
-}
-
-
-int qemuMonitorJSONAddUSBDeviceExact(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                     int bus ATTRIBUTE_UNUSED,
-                                     int dev ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("usb_add not supported in JSON mode"));
-    return -1;
-}
-
-
-int qemuMonitorJSONAddUSBDeviceMatch(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                     int vendor ATTRIBUTE_UNUSED,
-                                     int product ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("usb_add not supported in JSON mode"));
-    return -1;
-}
-
-
-int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                    virDevicePCIAddress *hostAddr ATTRIBUTE_UNUSED,
-                                    virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("pci_add not supported in JSON mode"));
-    return -1;
-}
-
-
-int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                              const char *path ATTRIBUTE_UNUSED,
-                              const char *bus ATTRIBUTE_UNUSED,
-                              virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("pci_add not supported in JSON mode"));
-    return -1;
-}
-
-
-int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                 const char *nicstr ATTRIBUTE_UNUSED,
-                                 virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("pci_add not supported in JSON mode"));
-    return -1;
-}
-
-
-int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                   virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("pci_del not supported in JSON mode"));
-    return -1;
-}
-
-
 int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon,
                                   const char *fdname,
                                   int fd)
@@ -3387,25 +3318,6 @@ qemuMonitorJSONGetChardevInfo(qemuMonitorPtr mon,
 }
 
 
-int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                           const char *bus ATTRIBUTE_UNUSED,
-                                           virDevicePCIAddress *guestAddr ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("pci_add not supported in JSON mode"));
-    return -1;
-}
-
-
-int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                      qemuMonitorPCIAddress **addrs ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("query-pci not supported in JSON mode"));
-    return -1;
-}
-
-
 int qemuMonitorJSONDelDevice(qemuMonitorPtr mon,
                              const char *devalias)
 {
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 2c27c6f..c88de62 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -157,32 +157,6 @@ int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon,
                                     int tlsPort,
                                     const char *tlsSubject);
 
-int qemuMonitorJSONAddUSBDisk(qemuMonitorPtr mon,
-                              const char *path);
-
-int qemuMonitorJSONAddUSBDeviceExact(qemuMonitorPtr mon,
-                                     int bus,
-                                     int dev);
-int qemuMonitorJSONAddUSBDeviceMatch(qemuMonitorPtr mon,
-                                     int vendor,
-                                     int product);
-
-
-int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon,
-                                    virDevicePCIAddress *hostAddr,
-                                    virDevicePCIAddress *guestAddr);
-
-int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon,
-                              const char *path,
-                              const char *bus,
-                              virDevicePCIAddress *guestAddr);
-
-int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon,
-                                 const char *nicstr,
-                                 virDevicePCIAddress *guestAddr);
-
-int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon,
-                                   virDevicePCIAddress *guestAddr);
 
 int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon,
                                   const char *fdname,
@@ -206,13 +180,6 @@ int qemuMonitorJSONQueryRxFilter(qemuMonitorPtr mon, const char *alias,
 int qemuMonitorJSONGetChardevInfo(qemuMonitorPtr mon,
                                   virHashTablePtr info);
 
-int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon,
-                                           const char *bus,
-                                           virDevicePCIAddress *guestAddr);
-
-int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon,
-                                      qemuMonitorPCIAddress **addrs);
-
 int qemuMonitorJSONAddDevice(qemuMonitorPtr mon,
                              const char *devicestr);
 
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 316a942..2df2a41 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1575,344 +1575,6 @@ int qemuMonitorTextGraphicsRelocate(qemuMonitorPtr mon,
 }
 
 
-int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
-                              const char *path)
-{
-    char *cmd = NULL;
-    char *safepath;
-    int ret = -1;
-    char *info = NULL;
-
-    safepath = qemuMonitorEscapeArg(path);
-    if (!safepath)
-        return -1;
-
-    if (virAsprintf(&cmd, "usb_add disk:%s", safepath) < 0)
-        goto cleanup;
-
-    if (qemuMonitorHMPCommand(mon, cmd, &info) < 0)
-        goto cleanup;
-
-    /* If the command failed qemu prints:
-     * Could not add ... */
-    if (strstr(info, "Could not add ")) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("unable to add USB disk %s: %s"), path, info);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(cmd);
-    VIR_FREE(safepath);
-    VIR_FREE(info);
-    return ret;
-}
-
-
-static int qemuMonitorTextAddUSBDevice(qemuMonitorPtr mon,
-                                       const char *addr)
-{
-    char *cmd;
-    char *reply = NULL;
-    int ret = -1;
-
-    if (virAsprintf(&cmd, "usb_add %s", addr) < 0)
-        return -1;
-
-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    /* If the command failed qemu prints:
-     * Could not add ... */
-    if (strstr(reply, "Could not add ")) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       "%s", _("adding usb device failed"));
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(cmd);
-    VIR_FREE(reply);
-    return ret;
-}
-
-
-int qemuMonitorTextAddUSBDeviceExact(qemuMonitorPtr mon,
-                                     int bus,
-                                     int dev)
-{
-    int ret;
-    char *addr;
-
-    if (virAsprintf(&addr, "host:%.3d.%.3d", bus, dev) < 0)
-        return -1;
-
-    ret = qemuMonitorTextAddUSBDevice(mon, addr);
-
-    VIR_FREE(addr);
-    return ret;
-}
-
-int qemuMonitorTextAddUSBDeviceMatch(qemuMonitorPtr mon,
-                                     int vendor,
-                                     int product)
-{
-    int ret;
-    char *addr;
-
-    if (virAsprintf(&addr, "host:%.4x:%.4x", vendor, product) < 0)
-        return -1;
-
-    ret = qemuMonitorTextAddUSBDevice(mon, addr);
-
-    VIR_FREE(addr);
-    return ret;
-}
-
-
-static int
-qemuMonitorTextParsePCIAddReply(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
-                                const char *reply,
-                                virDevicePCIAddress *addr)
-{
-    char *s, *e;
-
-    /* If the command succeeds qemu prints:
-     * OK bus 0, slot XXX...
-     * or
-     * OK domain 0, bus 0, slot XXX
-     */
-    if (!(s = strstr(reply, "OK ")))
-        return -1;
-
-    s += 3;
-
-    if (STRPREFIX(s, "domain ")) {
-        s += strlen("domain ");
-
-        if (virStrToLong_ui(s, &e, 10, &addr->domain) == -1) {
-            VIR_WARN("Unable to parse domain number '%s'", s);
-            return -1;
-        }
-
-        if (!STRPREFIX(e, ", ")) {
-            VIR_WARN("Expected ', ' parsing pci_add reply '%s'", s);
-            return -1;
-        }
-        s = e + 2;
-    }
-
-    if (!STRPREFIX(s, "bus ")) {
-        VIR_WARN("Expected 'bus ' parsing pci_add reply '%s'", s);
-        return -1;
-    }
-    s += strlen("bus ");
-
-    if (virStrToLong_ui(s, &e, 10, &addr->bus) == -1) {
-        VIR_WARN("Unable to parse bus number '%s'", s);
-        return -1;
-    }
-
-    if (!STRPREFIX(e, ", ")) {
-        VIR_WARN("Expected ', ' parsing pci_add reply '%s'", s);
-        return -1;
-    }
-    s = e + 2;
-
-    if (!STRPREFIX(s, "slot ")) {
-        VIR_WARN("Expected 'slot ' parsing pci_add reply '%s'", s);
-        return -1;
-    }
-    s += strlen("slot ");
-
-    if (virStrToLong_ui(s, &e, 10, &addr->slot) == -1) {
-        VIR_WARN("Unable to parse slot number '%s'", s);
-        return -1;
-    }
-
-    return 0;
-}
-
-
-int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
-                                    virDevicePCIAddress *hostAddr,
-                                    virDevicePCIAddress *guestAddr)
-{
-    char *cmd;
-    char *reply = NULL;
-    int ret = -1;
-
-    memset(guestAddr, 0, sizeof(*guestAddr));
-
-    if (hostAddr->domain) {
-        /* if domain > 0, the caller has already verified that this qemu
-         * supports specifying domain in pci_add command
-         */
-        if (virAsprintf(&cmd,
-                        "pci_add pci_addr=auto host host=%.4x:%.2x:%.2x.%.1x",
-                        hostAddr->domain, hostAddr->bus,
-                        hostAddr->slot, hostAddr->function) < 0)
-            goto cleanup;
-    } else {
-        if (virAsprintf(&cmd, "pci_add pci_addr=auto host host=%.2x:%.2x.%.1x",
-                        hostAddr->bus, hostAddr->slot, hostAddr->function) < 0)
-            goto cleanup;
-    }
-
-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (strstr(reply, "invalid type: host")) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("PCI device assignment is not supported by this version of qemu"));
-        goto cleanup;
-    }
-
-    if (qemuMonitorTextParsePCIAddReply(mon, reply, guestAddr) < 0) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("parsing pci_add reply failed: %s"), reply);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(cmd);
-    VIR_FREE(reply);
-    return ret;
-}
-
-
-int qemuMonitorTextAddPCIDisk(qemuMonitorPtr mon,
-                              const char *path,
-                              const char *bus,
-                              virDevicePCIAddress *guestAddr)
-{
-    char *cmd = NULL;
-    char *reply = NULL;
-    char *safe_path = NULL;
-    bool tryOldSyntax = false;
-    int ret = -1;
-
-    safe_path = qemuMonitorEscapeArg(path);
-    if (!safe_path)
-        return -1;
-
- try_command:
-    if (virAsprintf(&cmd, "pci_add %s storage file=%s,if=%s",
-                    (tryOldSyntax ? "0": "pci_addr=auto"), safe_path, bus) < 0)
-        goto cleanup;
-
-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (qemuMonitorTextParsePCIAddReply(mon, reply, guestAddr) < 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: %s"), bus, path, reply);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(safe_path);
-    VIR_FREE(cmd);
-    VIR_FREE(reply);
-    return ret;
-}
-
-
-int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
-                                 const char *nicstr,
-                                 virDevicePCIAddress *guestAddr)
-{
-    char *cmd;
-    char *reply = NULL;
-    int ret = -1;
-
-    if (virAsprintf(&cmd, "pci_add pci_addr=auto nic %s", nicstr) < 0)
-        return -1;
-
-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (qemuMonitorTextParsePCIAddReply(mon, reply, guestAddr) < 0) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("parsing pci_add reply failed: %s"), reply);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(reply);
-    VIR_FREE(cmd);
-    return ret;
-}
-
-
-int qemuMonitorTextRemovePCIDevice(qemuMonitorPtr mon,
-                                   virDevicePCIAddress *guestAddr)
-{
-    char *cmd = NULL;
-    char *reply = NULL;
-    bool tryOldSyntax = false;
-    int ret = -1;
-
- try_command:
-    if (tryOldSyntax) {
-        if (virAsprintf(&cmd, "pci_del 0 %.2x", guestAddr->slot) < 0)
-            goto cleanup;
-    } else {
-        /* XXX function ? */
-        if (virAsprintf(&cmd, "pci_del pci_addr=%.4x:%.2x:%.2x",
-                        guestAddr->domain, guestAddr->bus, guestAddr->slot) < 0)
-            goto cleanup;
-    }
-
-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    /* Syntax changed when KVM merged PCI hotplug upstream to QEMU,
-     * so check for an error message from old KVM indicating the
-     * need to try the old syntax */
-    if (!tryOldSyntax &&
-        strstr(reply, "extraneous characters")) {
-        tryOldSyntax = true;
-        VIR_FREE(reply);
-        VIR_FREE(cmd);
-        goto try_command;
-    }
-    /* If the command fails due to a wrong slot qemu prints: invalid slot,
-     * nothing is printed on success */
-    if (strstr(reply, "invalid slot") ||
-        strstr(reply, "Invalid pci address")) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("failed to detach PCI device, invalid address %.4x:%.2x:%.2x: %s"),
-                       guestAddr->domain, guestAddr->bus, guestAddr->slot, reply);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(cmd);
-    VIR_FREE(reply);
-    return ret;
-}
-
-
 int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
                                   const char *fdname,
                                   int fd)
@@ -2174,269 +1836,6 @@ int qemuMonitorTextGetChardevInfo(qemuMonitorPtr mon,
 }
 
 
-int qemuMonitorTextAttachPCIDiskController(qemuMonitorPtr mon,
-                                           const char *bus,
-                                           virDevicePCIAddress *guestAddr)
-{
-    char *cmd = NULL;
-    char *reply = NULL;
-    bool tryOldSyntax = false;
-    int ret = -1;
-
- try_command:
-    if (virAsprintf(&cmd, "pci_add %s storage if=%s",
-                    (tryOldSyntax ? "0": "pci_addr=auto"), bus) < 0)
-        goto cleanup;
-
-    if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0)
-        goto cleanup;
-
-    if (qemuMonitorTextParsePCIAddReply(mon, reply, guestAddr) < 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 controller failed: %s"), bus, reply);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(cmd);
-    VIR_FREE(reply);
-    return ret;
-}
-
-
-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
- *
- *   (qemu) info pci
- *   Bus  0, device   0, function 0:
- *     Host bridge: PCI device 8086:1237
- *       id ""
- *   Bus  0, device   1, function 0:
- *     ISA bridge: PCI device 8086:7000
- *       id ""
- *   Bus  0, device   1, function 1:
- *     IDE controller: PCI device 8086:7010
- *       BAR4: I/O at 0xc000 [0xc00f].
- *       id ""
- *   Bus  0, device   1, function 3:
- *     Bridge: PCI device 8086:7113
- *       IRQ 9.
- *       id ""
- *   Bus  0, device   2, function 0:
- *     VGA controller: PCI device 1013:00b8
- *       BAR0: 32 bit prefetchable memory at 0xf0000000 [0xf1ffffff].
- *       BAR1: 32 bit memory at 0xf2000000 [0xf2000fff].
- *       id ""
- *   Bus  0, device   3, function 0:
- *     Ethernet controller: PCI device 8086:100e
- *      IRQ 11.
- *      BAR0: 32 bit memory at 0xf2020000 [0xf203ffff].
- *      BAR1: I/O at 0xc040 [0xc07f].
- *       id ""
- *
- * Of this, we're interesting in the vendor/product ID
- * and the bus/device/function data.
- */
-#define CHECK_END(p) if (!(p)) break;
-#define SKIP_TO(p, lbl)                                            \
-    (p) = strstr((p), (lbl));                                      \
-    if (p)                                                         \
-        (p) += strlen(lbl);
-#define GET_INT(p, base, val)                                           \
-    if (virStrToLong_ui((p), &(p), (base), &(val)) < 0) {               \
-        virReportError(VIR_ERR_OPERATION_FAILED,                       \
-                       _("cannot parse value for %s"), #val);           \
-        break;                                                          \
-    }
-#define SKIP_SPACE(p)                           \
-    while (*(p) == ' ') (p)++;
-
-int qemuMonitorTextGetAllPCIAddresses(qemuMonitorPtr mon,
-                                      qemuMonitorPCIAddress **retaddrs)
-{
-    char *reply;
-    qemuMonitorPCIAddress *addrs = NULL;
-    int naddrs = 0;
-    char *p;
-
-    *retaddrs = NULL;
-
-    if (qemuMonitorHMPCommand(mon, "info pci", &reply) < 0)
-        return -1;
-
-    p = reply;
-
-
-    while (p) {
-        unsigned int bus, slot, func, vendor, product;
-
-        SKIP_TO(p, "  Bus");
-        CHECK_END(p);
-        SKIP_SPACE(p);
-        GET_INT(p, 10, bus);
-        CHECK_END(p);
-
-        SKIP_TO(p, ", device");
-        CHECK_END(p);
-        SKIP_SPACE(p);
-        GET_INT(p, 10, slot);
-        CHECK_END(p);
-
-        SKIP_TO(p, ", function");
-        CHECK_END(p);
-        SKIP_SPACE(p);
-        GET_INT(p, 10, func);
-        CHECK_END(p);
-
-        SKIP_TO(p, "PCI device");
-        CHECK_END(p);
-        SKIP_SPACE(p);
-        GET_INT(p, 16, vendor);
-        CHECK_END(p);
-
-        if (*p != ':')
-            break;
-        p++;
-        GET_INT(p, 16, product);
-
-        if (VIR_REALLOC_N(addrs, naddrs+1) < 0)
-            goto error;
-
-        addrs[naddrs].addr.domain = 0;
-        addrs[naddrs].addr.bus = bus;
-        addrs[naddrs].addr.slot = slot;
-        addrs[naddrs].addr.function = func;
-        addrs[naddrs].vendor = vendor;
-        addrs[naddrs].product = product;
-        naddrs++;
-
-        VIR_DEBUG("Got dev %d:%d:%d   %x:%x", bus, slot, func, vendor, product);
-    }
-
-    VIR_FREE(reply);
-
-    *retaddrs = addrs;
-
-    return naddrs;
-
- error:
-    VIR_FREE(addrs);
-    VIR_FREE(reply);
-    return -1;
-}
-#undef GET_INT
-#undef SKIP_SPACE
-#undef CHECK_END
-#undef SKIP_TO
-
-
 int qemuMonitorTextDelDevice(qemuMonitorPtr mon,
                              const char *devalias)
 {
diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h
index 44a5330..eeaca52 100644
--- a/src/qemu/qemu_monitor_text.h
+++ b/src/qemu/qemu_monitor_text.h
@@ -119,33 +119,6 @@ int qemuMonitorTextGraphicsRelocate(qemuMonitorPtr mon,
                                     int tlsPort,
                                     const char *tlsSubject);
 
-int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
-                              const char *path);
-
-int qemuMonitorTextAddUSBDeviceExact(qemuMonitorPtr mon,
-                                     int bus,
-                                     int dev);
-int qemuMonitorTextAddUSBDeviceMatch(qemuMonitorPtr mon,
-                                     int vendor,
-                                     int product);
-
-
-int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
-                                    virDevicePCIAddress *hostAddr,
-                                    virDevicePCIAddress *guestAddr);
-
-int qemuMonitorTextAddPCIDisk(qemuMonitorPtr mon,
-                              const char *path,
-                              const char *bus,
-                              virDevicePCIAddress *guestAddr);
-
-int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
-                                 const char *nicstr,
-                                 virDevicePCIAddress *guestAddr);
-
-int qemuMonitorTextRemovePCIDevice(qemuMonitorPtr mon,
-                                   virDevicePCIAddress *guestAddr);
-
 int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
                                   const char *fdname,
                                   int fd);
@@ -169,18 +142,6 @@ int qemuMonitorTextRemoveNetdev(qemuMonitorPtr mon,
 int qemuMonitorTextGetChardevInfo(qemuMonitorPtr mon,
                                   virHashTablePtr info);
 
-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);
-
 int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
                              const char *devicestr);
 
-- 
2.5.0

--
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]