* via the JSON error code from the block_set_io_throttle call */
qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorSetBlockIoThrottle(priv->mon, device,
+ ret = qemuMonitorSetBlockIoThrottle(priv->mon, device, NULL,
&info, supportMaxOptions,
set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME,
supportMaxLengthOptions);
int
qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
- const char *device,
+ const char *drivealias,
+ const char *qomid,
virDomainBlockIoTuneInfoPtr info,
bool supportMaxOptions,
bool supportGroupNameOption,
bool supportMaxLengthOptions)
{
- VIR_DEBUG("device=%p, info=%p", device, info);
+ VIR_DEBUG("drivealias=%s, qomid=%s, info=%p",
+ NULLSTR(drivealias), NULLSTR(qomid), info);
QEMU_CHECK_MONITOR(mon);
- return qemuMonitorJSONSetBlockIoThrottle(mon, device, info,
+ return qemuMonitorJSONSetBlockIoThrottle(mon, drivealias, qomid, info,
supportMaxOptions,
supportGroupNameOption,
supportMaxLengthOptions);
bool skipauth);
int qemuMonitorSetBlockIoThrottle(qemuMonitorPtr mon,
- const char *device,
+ const char *drivealias,
+ const char *qomid,
virDomainBlockIoTuneInfoPtr info,
bool supportMaxOptions,
bool supportGroupNameOption,
#undef GET_THROTTLE_STATS_OPTIONAL
int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon,
- const char *device,
+ const char *drivealias,
+ const char *qomid,
virDomainBlockIoTuneInfoPtr info,
bool supportMaxOptions,
bool supportGroupNameOption,
virJSONValuePtr cmd = NULL;
virJSONValuePtr result = NULL;
virJSONValuePtr args = NULL;
+ const char *errdev = drivealias;
+
+ if (!errdev)
+ errdev = qomid;
if (!(cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle", NULL)))
return -1;
if (virJSONValueObjectCreate(&args,
- "s:device", device,
+ "S:device", drivealias,
+ "S:id", qomid,
"U:bps", info->total_bytes_sec,
"U:bps_rd", info->read_bytes_sec,
"U:bps_wr", info->write_bytes_sec,
if (virJSONValueObjectHasKey(result, "error")) {
if (qemuMonitorJSONHasError(result, "DeviceNotActive")) {
virReportError(VIR_ERR_OPERATION_INVALID,
- _("No active operation on device: %s"), device);
+ _("No active operation on device: %s"), errdev);
} else if (qemuMonitorJSONHasError(result, "NotSupported")) {
virReportError(VIR_ERR_OPERATION_INVALID,
- _("Operation is not supported for device: %s"), device);
+ _("Operation is not supported for device: %s"), errdev);
} else {
virJSONValuePtr error = virJSONValueObjectGet(result, "error");
virReportError(VIR_ERR_INTERNAL_ERROR,
bool skipauth);
int qemuMonitorJSONSetBlockIoThrottle(qemuMonitorPtr mon,
- const char *device,
+ const char *drivealias,
+ const char *qomid,
virDomainBlockIoTuneInfoPtr info,
bool supportMaxOptions,
bool supportGroupNameOption,
goto cleanup;
if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test),
- "drive-virtio-disk1", &info, true,
+ "drive-virtio-disk1", NULL, &info, true,
true, true) < 0)
goto cleanup;