[libvirt] [PATCHv2 36/62] qemu: command: Add helper to check if disk throttling is enabled

Peter Krempa posted 62 patches 7 years, 5 months ago
[libvirt] [PATCHv2 36/62] qemu: command: Add helper to check if disk throttling is enabled
Posted by Peter Krempa 7 years, 5 months ago
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 4a3dda28fe..613e4742af 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 283bf3120d..13c5508ae8 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -180,6 +180,9 @@ int qemuGetDriveSourceString(virStorageSourcePtr src,
                              qemuDomainSecretInfoPtr secinfo,
                              char **source);

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

-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2 36/62] qemu: command: Add helper to check if disk throttling is enabled
Posted by Ján Tomko 7 years, 5 months ago
On Mon, Aug 13, 2018 at 06:00:10PM +0200, Peter Krempa wrote:
>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(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list