if (!(device = qemuAliasDiskDriveFromDisk(disk)))
goto endjob;
qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorGetBlockIoThrottle(priv->mon, device, &reply);
+ ret = qemuMonitorGetBlockIoThrottle(priv->mon, device, NULL, &reply);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto endjob;
if (ret < 0)
int
qemuMonitorGetBlockIoThrottle(qemuMonitorPtr mon,
- const char *device,
+ const char *drivealias,
+ const char *qdevid,
virDomainBlockIoTuneInfoPtr reply)
{
- VIR_DEBUG("device=%p, reply=%p", device, reply);
+ VIR_DEBUG("drivealias=%s, qdevid=%s, reply=%p",
+ NULLSTR(drivealias), NULLSTR(qdevid), reply);
QEMU_CHECK_MONITOR(mon);
- return qemuMonitorJSONGetBlockIoThrottle(mon, device, reply);
+ return qemuMonitorJSONGetBlockIoThrottle(mon, drivealias, qdevid, reply);
}
}
static int
qemuMonitorJSONBlockIoThrottleInfo(virJSONValuePtr io_throttle,
- const char *device,
+ const char *drivealias,
+ const char *qdevid,
virDomainBlockIoTuneInfoPtr reply)
{
int ret = -1;
for (i = 0; i < virJSONValueArraySize(io_throttle); i++) {
virJSONValuePtr temp_dev = virJSONValueArrayGet(io_throttle, i);
virJSONValuePtr inserted;
- const char *current_dev;
+ const char *current_drive;
+ const char *current_qdev;
if (!temp_dev || virJSONValueGetType(temp_dev) != VIR_JSON_TYPE_OBJECT) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
goto cleanup;
}
- if (!(current_dev = virJSONValueObjectGetString(temp_dev, "device"))) {
+ current_qdev = virJSONValueObjectGetString(temp_dev, "qdev");
+ current_drive = virJSONValueObjectGetString(temp_dev, "device");
+
+ if (!current_drive && !current_qdev) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("block_io_throttle device entry "
"was not in expected format"));
goto cleanup;
}
- if (STRNEQ(current_dev, device))
+ if ((drivealias && STRNEQ(current_drive, drivealias)) ||
+ (qdevid && STRNEQ(current_qdev, qdevid)))
continue;
found = true;
if (!found) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find throttling info for device '%s'"),
- device);
+ drivealias ? drivealias : qdevid);
goto cleanup;
}
ret = 0;
}
int qemuMonitorJSONGetBlockIoThrottle(qemuMonitorPtr mon,
- const char *device,
+ const char *drivealias,
+ const char *qdevid,
virDomainBlockIoTuneInfoPtr reply)
{
int ret = -1;
if (!(devices = qemuMonitorJSONQueryBlock(mon)))
return -1;
- ret = qemuMonitorJSONBlockIoThrottleInfo(devices, device, reply);
+ ret = qemuMonitorJSONBlockIoThrottleInfo(devices, drivealias, qdevid, reply);
virJSONValueFree(devices);
return ret;
}