mirror of https://gitee.com/openkylin/libvirt.git
qemu: Move qemuDiskConfigBlkdeviotuneHas* to conf
And introduce virDomainBlockIoTuneInfoHasAny. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
9dbf6871e6
commit
67ebd6ac26
|
@ -31712,3 +31712,49 @@ virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
virDomainBlockIoTuneInfoHasBasic(const virDomainBlockIoTuneInfo *iotune)
|
||||||
|
{
|
||||||
|
return iotune->total_bytes_sec ||
|
||||||
|
iotune->read_bytes_sec ||
|
||||||
|
iotune->write_bytes_sec ||
|
||||||
|
iotune->total_iops_sec ||
|
||||||
|
iotune->read_iops_sec ||
|
||||||
|
iotune->write_iops_sec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
virDomainBlockIoTuneInfoHasMax(const virDomainBlockIoTuneInfo *iotune)
|
||||||
|
{
|
||||||
|
return iotune->total_bytes_sec_max ||
|
||||||
|
iotune->read_bytes_sec_max ||
|
||||||
|
iotune->write_bytes_sec_max ||
|
||||||
|
iotune->total_iops_sec_max ||
|
||||||
|
iotune->read_iops_sec_max ||
|
||||||
|
iotune->write_iops_sec_max ||
|
||||||
|
iotune->size_iops_sec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
virDomainBlockIoTuneInfoHasMaxLength(const virDomainBlockIoTuneInfo *iotune)
|
||||||
|
{
|
||||||
|
return iotune->total_bytes_sec_max_length ||
|
||||||
|
iotune->read_bytes_sec_max_length ||
|
||||||
|
iotune->write_bytes_sec_max_length ||
|
||||||
|
iotune->total_iops_sec_max_length ||
|
||||||
|
iotune->read_iops_sec_max_length ||
|
||||||
|
iotune->write_iops_sec_max_length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
virDomainBlockIoTuneInfoHasAny(const virDomainBlockIoTuneInfo *iotune)
|
||||||
|
{
|
||||||
|
return virDomainBlockIoTuneInfoHasBasic(iotune) ||
|
||||||
|
virDomainBlockIoTuneInfoHasMax(iotune) ||
|
||||||
|
virDomainBlockIoTuneInfoHasMaxLength(iotune);
|
||||||
|
}
|
||||||
|
|
|
@ -3698,3 +3698,15 @@ virDomainGraphicsGetRenderNode(const virDomainGraphicsDef *graphics);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics);
|
virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics);
|
||||||
|
|
||||||
|
bool
|
||||||
|
virDomainBlockIoTuneInfoHasBasic(const virDomainBlockIoTuneInfo *iotune);
|
||||||
|
|
||||||
|
bool
|
||||||
|
virDomainBlockIoTuneInfoHasMax(const virDomainBlockIoTuneInfo *iotune);
|
||||||
|
|
||||||
|
bool
|
||||||
|
virDomainBlockIoTuneInfoHasMaxLength(const virDomainBlockIoTuneInfo *iotune);
|
||||||
|
|
||||||
|
bool
|
||||||
|
virDomainBlockIoTuneInfoHasAny(const virDomainBlockIoTuneInfo *iotune);
|
||||||
|
|
|
@ -226,6 +226,10 @@ virDomainActualNetDefFree;
|
||||||
virDomainActualNetDefValidate;
|
virDomainActualNetDefValidate;
|
||||||
virDomainBlockedReasonTypeFromString;
|
virDomainBlockedReasonTypeFromString;
|
||||||
virDomainBlockedReasonTypeToString;
|
virDomainBlockedReasonTypeToString;
|
||||||
|
virDomainBlockIoTuneInfoHasAny;
|
||||||
|
virDomainBlockIoTuneInfoHasBasic;
|
||||||
|
virDomainBlockIoTuneInfoHasMax;
|
||||||
|
virDomainBlockIoTuneInfoHasMaxLength;
|
||||||
virDomainBootTypeFromString;
|
virDomainBootTypeFromString;
|
||||||
virDomainBootTypeToString;
|
virDomainBootTypeToString;
|
||||||
virDomainCapabilitiesPolicyTypeToString;
|
virDomainCapabilitiesPolicyTypeToString;
|
||||||
|
|
|
@ -1137,50 +1137,11 @@ qemuGetDriveSourceString(virStorageSourcePtr src,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
|
||||||
qemuDiskConfigBlkdeviotuneHasBasic(virDomainDiskDefPtr disk)
|
|
||||||
{
|
|
||||||
return disk->blkdeviotune.total_bytes_sec ||
|
|
||||||
disk->blkdeviotune.read_bytes_sec ||
|
|
||||||
disk->blkdeviotune.write_bytes_sec ||
|
|
||||||
disk->blkdeviotune.total_iops_sec ||
|
|
||||||
disk->blkdeviotune.read_iops_sec ||
|
|
||||||
disk->blkdeviotune.write_iops_sec;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static bool
|
|
||||||
qemuDiskConfigBlkdeviotuneHasMax(virDomainDiskDefPtr disk)
|
|
||||||
{
|
|
||||||
return disk->blkdeviotune.total_bytes_sec_max ||
|
|
||||||
disk->blkdeviotune.read_bytes_sec_max ||
|
|
||||||
disk->blkdeviotune.write_bytes_sec_max ||
|
|
||||||
disk->blkdeviotune.total_iops_sec_max ||
|
|
||||||
disk->blkdeviotune.read_iops_sec_max ||
|
|
||||||
disk->blkdeviotune.write_iops_sec_max ||
|
|
||||||
disk->blkdeviotune.size_iops_sec;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static bool
|
|
||||||
qemuDiskConfigBlkdeviotuneHasMaxLength(virDomainDiskDefPtr disk)
|
|
||||||
{
|
|
||||||
return disk->blkdeviotune.total_bytes_sec_max_length ||
|
|
||||||
disk->blkdeviotune.read_bytes_sec_max_length ||
|
|
||||||
disk->blkdeviotune.write_bytes_sec_max_length ||
|
|
||||||
disk->blkdeviotune.total_iops_sec_max_length ||
|
|
||||||
disk->blkdeviotune.read_iops_sec_max_length ||
|
|
||||||
disk->blkdeviotune.write_iops_sec_max_length;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk)
|
qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk)
|
||||||
{
|
{
|
||||||
return !!disk->blkdeviotune.group_name ||
|
return !!disk->blkdeviotune.group_name ||
|
||||||
qemuDiskConfigBlkdeviotuneHasBasic(disk) ||
|
virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune);
|
||||||
qemuDiskConfigBlkdeviotuneHasMax(disk) ||
|
|
||||||
qemuDiskConfigBlkdeviotuneHasMaxLength(disk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1198,9 +1159,7 @@ qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr disk,
|
||||||
{
|
{
|
||||||
/* group_name by itself is ignored by qemu */
|
/* group_name by itself is ignored by qemu */
|
||||||
if (disk->blkdeviotune.group_name &&
|
if (disk->blkdeviotune.group_name &&
|
||||||
!qemuDiskConfigBlkdeviotuneHasBasic(disk) &&
|
!virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune)) {
|
||||||
!qemuDiskConfigBlkdeviotuneHasMax(disk) &&
|
|
||||||
!qemuDiskConfigBlkdeviotuneHasMaxLength(disk)) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("group_name can be configured only together with "
|
_("group_name can be configured only together with "
|
||||||
"settings"));
|
"settings"));
|
||||||
|
@ -1228,7 +1187,7 @@ qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr disk,
|
||||||
|
|
||||||
if (qemuCaps) {
|
if (qemuCaps) {
|
||||||
/* block I/O throttling 1.7 */
|
/* block I/O throttling 1.7 */
|
||||||
if (qemuDiskConfigBlkdeviotuneHasMax(disk) &&
|
if (virDomainBlockIoTuneInfoHasMax(&disk->blkdeviotune) &&
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) {
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("there are some block I/O throttling parameters "
|
_("there are some block I/O throttling parameters "
|
||||||
|
@ -1246,7 +1205,7 @@ qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr disk,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* block I/O throttling length 2.6 */
|
/* block I/O throttling length 2.6 */
|
||||||
if (qemuDiskConfigBlkdeviotuneHasMaxLength(disk) &&
|
if (virDomainBlockIoTuneInfoHasMaxLength(&disk->blkdeviotune) &&
|
||||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH)) {
|
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("there are some block I/O throttling length parameters "
|
_("there are some block I/O throttling length parameters "
|
||||||
|
|
Loading…
Reference in New Issue