virDomainDiskDef *conf_disk = NULL;
virDomainDiskDef *disk;
qemuBlockIoTuneSetFlags set_fields = 0;
- bool supportMaxOptions = true;
- bool supportGroupNameOption = true;
- bool supportMaxLengthOptions = true;
g_autoptr(virQEMUDriverConfig) cfg = NULL;
virObjectEvent *event = NULL;
virTypedParameterPtr eventParams = NULL;
virDomainBlockIoTuneInfoCopy(&info, &conf_info);
if (def) {
- supportMaxOptions = virQEMUCapsGet(priv->qemuCaps,
- QEMU_CAPS_DRIVE_IOTUNE_MAX);
- supportGroupNameOption = virQEMUCapsGet(priv->qemuCaps,
- QEMU_CAPS_DRIVE_IOTUNE_GROUP);
- supportMaxLengthOptions =
- virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH);
-
- if (!supportMaxOptions &&
- (set_fields & (QEMU_BLOCK_IOTUNE_SET_BYTES_MAX |
- QEMU_BLOCK_IOTUNE_SET_IOPS_MAX |
- QEMU_BLOCK_IOTUNE_SET_SIZE_IOPS))) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("a block I/O throttling parameter is not "
- "supported with this QEMU binary"));
- goto endjob;
- }
-
- if (!supportGroupNameOption &&
- (set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("the block I/O throttling group parameter is not "
- "supported with this QEMU binary"));
- goto endjob;
- }
-
- if (!supportMaxLengthOptions &&
- (set_fields & (QEMU_BLOCK_IOTUNE_SET_BYTES_MAX_LENGTH |
- QEMU_BLOCK_IOTUNE_SET_IOPS_MAX_LENGTH))) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("a block I/O throttling length parameter is not "
- "supported with this QEMU binary"));
- goto endjob;
- }
-
if (!(disk = qemuDomainDiskByName(def, path)))
goto endjob;
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid,
- &info, supportMaxOptions,
+ &info, true,
set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME,
- supportMaxLengthOptions);
+ true);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1;
if (ret < 0)
if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
goto endjob;
- if (def) {
- /* If the VM is running, we can check if the current VM can use
- * optional parameters or not. */
- maxparams = QEMU_NB_BLOCK_IO_TUNE_BASE_PARAMS;
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX))
- maxparams += QEMU_NB_BLOCK_IO_TUNE_MAX_PARAMS;
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP))
- maxparams += QEMU_NB_BLOCK_IO_TUNE_GROUP_PARAMS;
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH))
- maxparams += QEMU_NB_BLOCK_IO_TUNE_LENGTH_PARAMS;
- } else {
- maxparams = QEMU_NB_BLOCK_IO_TUNE_ALL_PARAMS;
- }
+ maxparams = QEMU_NB_BLOCK_IO_TUNE_ALL_PARAMS;
if (*nparams == 0) {
*nparams = maxparams;
/**
* qemuValidateDomainDeviceDefDiskBlkdeviotune:
* @disk: disk configuration
- * @qemuCaps: qemu capabilities, NULL if checking cold-configuration
*
* Checks whether block io tuning settings make sense. Returns -1 on error and
* reports a proper libvirt error.
*/
static int
qemuValidateDomainDeviceDefDiskBlkdeviotune(const virDomainDiskDef *disk,
- const virDomainDef *def,
- virQEMUCaps *qemuCaps)
+ const virDomainDef *def)
{
/* group_name by itself is ignored by qemu */
if (disk->blkdeviotune.group_name &&
return -1;
}
- /* block I/O throttling 1.7 */
- if (virDomainBlockIoTuneInfoHasMax(&disk->blkdeviotune) &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("there are some block I/O throttling parameters "
- "that are not supported with this QEMU binary"));
- return -1;
- }
-
- /* block I/O group 2.4 */
- if (disk->blkdeviotune.group_name &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("the block I/O throttling group parameter is "
- "not supported with this QEMU binary"));
- return -1;
- }
-
- /* block I/O throttling length 2.6 */
- if (virDomainBlockIoTuneInfoHasMaxLength(&disk->blkdeviotune) &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("there are some block I/O throttling length parameters "
- "that are not supported with this QEMU binary"));
- return -1;
- }
-
return 0;
}
if (qemuValidateDomainDeviceDefDiskFrontend(disk, def, qemuCaps) < 0)
return -1;
- if (qemuValidateDomainDeviceDefDiskBlkdeviotune(disk, def, qemuCaps) < 0)
+ if (qemuValidateDomainDeviceDefDiskBlkdeviotune(disk, def) < 0)
return -1;
if (qemuValidateDomainDeviceDefDiskTransient(disk, qemuCaps) < 0)