Re: [libvirt] [PATCHv2 37/62] qemu: process: Setup disk io throttling?for -blockdev

2023-10-16 Thread Peter Krempa
On Mon, Oct 16, 2023 at 14:19:08 +, Chun Feng Wu wrote:
> Thanks for your info! Currently, the iotune in libvirt’s xml indeed works 
> well, BTW, is there any plan for such “re-engineering”?

No, there are no plans, as the current approach covers the vast majority
of use cases. Spending significant engineering resources on something
which will not get much use is not in the interest of the comunity. 



RE: [libvirt] [PATCHv2 37/62] qemu: process: Setup disk io throttling for -blockdev

2023-10-16 Thread Chun Feng Wu
Thanks for your info! Currently, the iotune in libvirt’s xml indeed works well, 
BTW, is there any plan for such “re-engineering”?

From: Peter Krempa 
Date: Monday, October 16, 2023 at 21:53
To: Chun Feng Wu 
Cc: libvir-list@redhat.com 
Subject: [EXTERNAL] Re: [libvirt] [PATCHv2 37/62] qemu: process: Setup disk io 
throttling for -blockdev
On Mon, Oct 16, 2023 at 13:36:42 +, Chun Feng Wu wrote:
> Does this libvirt throttling support “chained throttle filters” for single 
> disk described in QEMU doc: 
> https://github.com/qemu/qemu/blob/master/docs/throttle.txt  (“The 'throttle' 
> block filter”)

No, libvirt currently still uses the older approach by using
'block_set_io_throttle' QMP command. This was used at the beginning
because the 'throttle' layer was not yet ready at the point when libvirt
adopted -blockdev.

It is sufficient for the throttling options that are currently
configurable via libvirt's XML.

Note that to use the full potential of the throttle groups and
hierarchical throttling will require significant re-engineering of the
XML configuration of throttling.


Re: [libvirt] [PATCHv2 37/62] qemu: process: Setup disk io throttling for -blockdev

2023-10-16 Thread Peter Krempa
On Mon, Oct 16, 2023 at 13:36:42 +, Chun Feng Wu wrote:
> Does this libvirt throttling support “chained throttle filters” for single 
> disk described in QEMU doc: 
> https://github.com/qemu/qemu/blob/master/docs/throttle.txt (“The 'throttle' 
> block filter”)

No, libvirt currently still uses the older approach by using
'block_set_io_throttle' QMP command. This was used at the beginning
because the 'throttle' layer was not yet ready at the point when libvirt
adopted -blockdev.

It is sufficient for the throttling options that are currently
configurable via libvirt's XML.

Note that to use the full potential of the throttle groups and
hierarchical throttling will require significant re-engineering of the
XML configuration of throttling.



[libvirt] [PATCHv2 37/62] qemu: process: Setup disk io throttling for -blockdev

2023-10-16 Thread Chun Feng Wu
Does this libvirt throttling support “chained throttle filters” for single disk 
described in QEMU doc: 
https://github.com/qemu/qemu/blob/master/docs/throttle.txt (“The 'throttle' 
block filter”)


Re: [libvirt] [PATCHv2 37/62] qemu: process: Setup disk io throttling for -blockdev

2018-08-16 Thread Ján Tomko

On Mon, Aug 13, 2018 at 06:00:11PM +0200, Peter Krempa wrote:

The proper way to do this would be to use the 'throttle' driver but
unfortunately it can't change the 'throttle_group' so we can't provide
feature parity. This hack uses the block_set_io_throttle command to do
so until we can properly replace it.

Signed-off-by: Peter Krempa 
---
src/qemu/qemu_process.c | 50 +
1 file changed, 50 insertions(+)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCHv2 37/62] qemu: process: Setup disk io throttling for -blockdev

2018-08-13 Thread Peter Krempa
The proper way to do this would be to use the 'throttle' driver but
unfortunately it can't change the 'throttle_group' so we can't provide
feature parity. This hack uses the block_set_io_throttle command to do
so until we can properly replace it.

Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_process.c | 50 +
 1 file changed, 50 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 0bf8245173..3495733041 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6230,6 +6230,53 @@ qemuProcessGenID(virDomainObjPtr vm,
 }


+/**
+ * qemuProcessSetupDiskThrottlingBlockdev:
+ *
+ * Sets up disk trottling for -blockdev via block_set_io_throttle monitor
+ * command. This hack should be replaced by proper use of the 'throttle'
+ * blockdev driver in qemu once it will support changing of the throttle group.
+ */
+static int
+qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriverPtr driver,
+   virDomainObjPtr vm,
+   qemuDomainAsyncJob asyncJob)
+{
+qemuDomainObjPrivatePtr priv = vm->privateData;
+size_t i;
+int ret = -1;
+
+if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV))
+return 0;
+
+VIR_DEBUG("Setting up disk throttling for -blockdev via 
block_set_io_throttle");
+
+if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+return -1;
+
+for (i = 0; i < vm->def->ndisks; i++) {
+virDomainDiskDefPtr disk = vm->def->disks[i];
+qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
+
+if (!qemuDiskConfigBlkdeviotuneEnabled(disk))
+continue;
+
+if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), NULL,
+  diskPriv->backendQomName,
+  >blkdeviotune,
+  true, true, true) < 0)
+goto cleanup;
+}
+
+ret = 0;
+
+ cleanup:
+if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ret = -1;
+return ret;
+}
+
+
 /**
  * qemuProcessLaunch:
  *
@@ -6548,6 +6595,9 @@ qemuProcessLaunch(virConnectPtr conn,
 if (qemuProcessSetupBalloon(driver, vm, asyncJob) < 0)
 goto cleanup;

+if (qemuProcessSetupDiskThrottlingBlockdev(driver, vm, asyncJob) < 0)
+goto cleanup;
+
 /* Since CPUs were not started yet, the balloon could not return the memory
  * to the host and thus cur_balloon needs to be updated so that GetXMLdesc
  * and friends return the correct size in case they can't grab the job */
-- 
2.16.2

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