diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 96bb9cfbed89cfa5a7a3edd994bdd0b6d3dc3dfa..ffc792007c41410c29258e5d81ca200c972d59da 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 c6e391cf7b2173b3da1f3b2bb5459d325068cdc2..79063619e7bf35c240051898c6292022f45a0e97 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -674,12 +674,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 3129427f48982eba540248f013e9010297d6ba48..ea3cbf02338bd03c942c35450a29e62e6a10986e 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -2210,104 +2210,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 44a53308ac14c10d21a97b90042a202676f3516d..287a8518b92531d40f7495f8aa6f6020a30749f7 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);