And introduce virDomainBlockIoTuneInfoHasAny.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/conf/domain_conf.c | 46 +++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 12 ++++++++++
src/libvirt_private.syms | 4 ++++
src/qemu/qemu_command.c | 49 ++++------------------------------------
4 files changed, 66 insertions(+), 45 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index afa072e17d..abe21a93fd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31621,3 +31621,49 @@ virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef
*graphics)
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);
+}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e012975fca..8b373184ca 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3684,3 +3684,15 @@ virDomainGraphicsGetRenderNode(const virDomainGraphicsDef
*graphics);
bool
virDomainGraphicsNeedsAutoRenderNode(const virDomainGraphicsDef *graphics);
+
+bool
+virDomainBlockIoTuneInfoHasBasic(const virDomainBlockIoTuneInfo *iotune);
+
+bool
+virDomainBlockIoTuneInfoHasMax(const virDomainBlockIoTuneInfo *iotune);
+
+bool
+virDomainBlockIoTuneInfoHasMaxLength(const virDomainBlockIoTuneInfo *iotune);
+
+bool
+virDomainBlockIoTuneInfoHasAny(const virDomainBlockIoTuneInfo *iotune);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a7b1ef23bc..a8dc2c30ea 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -227,6 +227,10 @@ virDomainActualNetDefFree;
virDomainActualNetDefValidate;
virDomainBlockedReasonTypeFromString;
virDomainBlockedReasonTypeToString;
+virDomainBlockIoTuneInfoHasAny;
+virDomainBlockIoTuneInfoHasBasic;
+virDomainBlockIoTuneInfoHasMax;
+virDomainBlockIoTuneInfoHasMaxLength;
virDomainBootTypeFromString;
virDomainBootTypeToString;
virDomainCapabilitiesPolicyTypeToString;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a8137b3a32..29928ac1c8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1138,50 +1138,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
qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk)
{
return !!disk->blkdeviotune.group_name ||
- qemuDiskConfigBlkdeviotuneHasBasic(disk) ||
- qemuDiskConfigBlkdeviotuneHasMax(disk) ||
- qemuDiskConfigBlkdeviotuneHasMaxLength(disk);
+ virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune);
}
@@ -1199,9 +1160,7 @@ qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr disk,
{
/* group_name by itself is ignored by qemu */
if (disk->blkdeviotune.group_name &&
- !qemuDiskConfigBlkdeviotuneHasBasic(disk) &&
- !qemuDiskConfigBlkdeviotuneHasMax(disk) &&
- !qemuDiskConfigBlkdeviotuneHasMaxLength(disk)) {
+ !virDomainBlockIoTuneInfoHasAny(&disk->blkdeviotune)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("group_name can be configured only together with "
"settings"));
@@ -1229,7 +1188,7 @@ qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr disk,
if (qemuCaps) {
/* block I/O throttling 1.7 */
- if (qemuDiskConfigBlkdeviotuneHasMax(disk) &&
+ 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 "
@@ -1247,7 +1206,7 @@ qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr disk,
}
/* block I/O throttling length 2.6 */
- if (qemuDiskConfigBlkdeviotuneHasMaxLength(disk) &&
+ 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
"
--
2.23.0