mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
qemu: monitor: Kill legacy USB monitor code
Code was obsoleted by using -device.
This commit is contained in:
parent
dd3e9a0a7d
commit
c01f4e9e55
@ -2404,53 +2404,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,
|
||||
|
@ -628,20 +628,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);
|
||||
|
@ -3032,35 +3032,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)
|
||||
|
@ -169,17 +169,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);
|
||||
|
@ -1572,105 +1572,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,
|
||||
|
@ -119,17 +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);
|
||||
|
Loading…
Reference in New Issue
Block a user