[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 32/55] qemu: command: Add helper to check if disk throttling is enabled



Add a helper which will use a collection of other helpers to determine
whether a disk requires throttling to be enabled.

Signed-off-by: Peter Krempa <pkrempa redhat com>
---
 src/qemu/qemu_command.c | 10 ++++++++++
 src/qemu/qemu_command.h |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3cce1bb05e..35cef61720 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1031,6 +1031,16 @@ qemuDiskConfigBlkdeviotuneHasMaxLength(virDomainDiskDefPtr disk)
 }


+bool
+qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk)
+{
+    return !!disk->blkdeviotune.group_name ||
+           qemuDiskConfigBlkdeviotuneHasBasic(disk) ||
+           qemuDiskConfigBlkdeviotuneHasMax(disk) ||
+           qemuDiskConfigBlkdeviotuneHasMaxLength(disk);
+}
+
+
 /**
  * qemuCheckDiskConfigBlkdeviotune:
  * @disk: disk configuration
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index cf17dc1ede..b8fbbbb92a 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -181,6 +181,9 @@ int qemuGetDriveSourceString(virStorageSourcePtr src,
                              qemuDomainSecretInfoPtr secinfo,
                              char **source);

+bool
+qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDefPtr disk);
+
 int qemuCheckDiskConfig(virDomainDiskDefPtr disk,
                         virQEMUCapsPtr qemuCaps);

-- 
2.16.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]