qemu: monitor: Drop qemuMonitorAttachDrive and leaves in call tree

Functions no longer required for attaching SCSI disks since
QEMU_CAPS_DEVICE is expected.
This commit is contained in:
Peter Krempa 2016-03-10 15:34:37 +01:00
parent d4d32005d6
commit 552bf13f45
4 changed files with 0 additions and 125 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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
*

View File

@ -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);