[PATCH v5 01/18] schema: Add new domain elements to support multiple throttle groups

Harikumar R posted 18 patches 1 year, 2 months ago
There is a newer version of this series
[PATCH v5 01/18] schema: Add new domain elements to support multiple throttle groups
Posted by Harikumar R 1 year, 2 months ago
From: Chun Feng Wu <danielwuwy@163.com>

Introduce schema for defining '<throttlegroups>' element which
configures throttling groups which can be configured for multiple
disks.

* Refactor "diskIoTune" to extract common schema "iotune"
* Add new elements '<throttlegroups>'
* <ThrottleGroups> contains <ThrottleGroup> defintion, which references
  "iotune"

Signed-off-by: Chun Feng Wu <danielwuwy@163.com>
---
 docs/formatdomain.rst             |  26 +++
 src/conf/schemas/domaincommon.rng | 274 ++++++++++++++++--------------
 2 files changed, 174 insertions(+), 126 deletions(-)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index f0b79d5f8d..5b7f18b2f0 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -1964,6 +1964,32 @@ advertisements to the guest OS. (NB: Only qemu driver support)
    the guest OS itself can choose to circumvent the unavailability of the sleep
    states (e.g. S4 by turning off completely).
 
+Disk Throttle Group Management
+------------------------------
+
+:since:`Since 10.7.0` it is possible to create multiple named throttle groups
+and then reference them within ``throttlefilters``(sub-element of ``disk`` element)
+to form filter chain in QEMU for specific disk. The limits(throttlegroups) are
+shared within domain, hence the same group can be referenced by different filters.
+
+::
+
+   <domain>
+     ...
+     <throttlegroups>
+       <throttlegroup>
+         <group_name>limit0</group_name>
+         <total_bytes_sec>10000000</total_bytes_sec>
+         <read_iops_sec>400000</read_iops_sec>
+         <write_iops_sec>100000</write_iops_sec>
+       </throttlegroup>
+     </throttlegroups>
+     ...
+   </domain>
+
+``throttlegroup``
+   It has the same sub-elements as ``iotune`` (See `Hard drives, floppy disks, CDROMs`_),
+   The difference is that <group_name> is required.
 
 Hypervisor features
 -------------------
diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng
index bfd0044805..6f08ac4da5 100644
--- a/src/conf/schemas/domaincommon.rng
+++ b/src/conf/schemas/domaincommon.rng
@@ -51,6 +51,7 @@
       </zeroOrMore>
       <ref name="os"/>
       <ref name="clock"/>
+      <ref name="throttlegroups"/>
       <ref name="resources"/>
       <ref name="features"/>
       <ref name="events"/>
@@ -6822,6 +6823,23 @@
       </interleave>
     </element>
   </define>
+  <define name="throttlegroup">
+    <element name="throttlegroup">
+      <ref name="iotune"/>
+    </element>
+  </define>
+  <!--
+      A set of optional throttlegroups
+    -->
+  <define name="throttlegroups">
+    <optional>
+      <element name="throttlegroups">
+        <zeroOrMore>
+          <ref name="throttlegroup"/>
+        </zeroOrMore>
+      </element>
+    </optional>
+  </define>
   <!--
       A set of optional features: PAE, APIC, ACPI, GIC, TCG,
       HyperV Enlightenment, KVM features, paravirtual spinlocks and HAP support
@@ -7789,134 +7807,138 @@
     </element>
   </define>
 
+  <define name="iotune">
+    <interleave>
+      <choice>
+        <element name="total_bytes_sec">
+          <data type="unsignedLong"/>
+        </element>
+        <group>
+          <interleave>
+            <optional>
+              <element name="read_bytes_sec">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+            <optional>
+              <element name="write_bytes_sec">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+          </interleave>
+        </group>
+      </choice>
+      <choice>
+        <element name="total_iops_sec">
+          <data type="unsignedLong"/>
+        </element>
+        <group>
+          <interleave>
+            <optional>
+              <element name="read_iops_sec">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+            <optional>
+              <element name="write_iops_sec">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+          </interleave>
+        </group>
+      </choice>
+      <choice>
+        <element name="total_bytes_sec_max">
+          <data type="unsignedLong"/>
+        </element>
+        <group>
+          <interleave>
+            <optional>
+              <element name="read_bytes_sec_max">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+            <optional>
+              <element name="write_bytes_sec_max">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+          </interleave>
+        </group>
+      </choice>
+      <choice>
+        <element name="total_iops_sec_max">
+          <data type="unsignedLong"/>
+        </element>
+        <group>
+          <interleave>
+            <optional>
+              <element name="read_iops_sec_max">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+            <optional>
+              <element name="write_iops_sec_max">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+          </interleave>
+        </group>
+      </choice>
+      <optional>
+        <element name="size_iops_sec">
+          <data type="unsignedLong"/>
+        </element>
+      </optional>
+      <optional>
+        <element name="group_name">
+          <text/>
+        </element>
+      </optional>
+      <choice>
+        <element name="total_bytes_sec_max_length">
+          <data type="unsignedLong"/>
+        </element>
+        <group>
+          <interleave>
+            <optional>
+              <element name="read_bytes_sec_max_length">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+            <optional>
+              <element name="write_bytes_sec_max_length">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+          </interleave>
+        </group>
+      </choice>
+      <choice>
+        <element name="total_iops_sec_max_length">
+          <data type="unsignedLong"/>
+        </element>
+        <group>
+          <interleave>
+            <optional>
+              <element name="read_iops_sec_max_length">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+            <optional>
+              <element name="write_iops_sec_max_length">
+                <data type="unsignedLong"/>
+              </element>
+            </optional>
+          </interleave>
+        </group>
+      </choice>
+    </interleave>
+  </define>
+
   <define name="diskIoTune">
     <element name="iotune">
-      <interleave>
-        <choice>
-          <element name="total_bytes_sec">
-            <data type="unsignedLong"/>
-          </element>
-          <group>
-            <interleave>
-              <optional>
-                <element name="read_bytes_sec">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-              <optional>
-                <element name="write_bytes_sec">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-            </interleave>
-          </group>
-        </choice>
-        <choice>
-          <element name="total_iops_sec">
-            <data type="unsignedLong"/>
-          </element>
-          <group>
-            <interleave>
-              <optional>
-                <element name="read_iops_sec">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-              <optional>
-                <element name="write_iops_sec">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-            </interleave>
-          </group>
-        </choice>
-        <choice>
-          <element name="total_bytes_sec_max">
-            <data type="unsignedLong"/>
-          </element>
-          <group>
-            <interleave>
-              <optional>
-                <element name="read_bytes_sec_max">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-              <optional>
-                <element name="write_bytes_sec_max">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-            </interleave>
-          </group>
-        </choice>
-        <choice>
-          <element name="total_iops_sec_max">
-            <data type="unsignedLong"/>
-          </element>
-          <group>
-            <interleave>
-              <optional>
-                <element name="read_iops_sec_max">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-              <optional>
-                <element name="write_iops_sec_max">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-            </interleave>
-          </group>
-        </choice>
-        <optional>
-          <element name="size_iops_sec">
-            <data type="unsignedLong"/>
-          </element>
-        </optional>
-        <optional>
-          <element name="group_name">
-            <text/>
-          </element>
-        </optional>
-        <choice>
-          <element name="total_bytes_sec_max_length">
-            <data type="unsignedLong"/>
-          </element>
-          <group>
-            <interleave>
-              <optional>
-                <element name="read_bytes_sec_max_length">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-              <optional>
-                <element name="write_bytes_sec_max_length">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-            </interleave>
-          </group>
-        </choice>
-        <choice>
-          <element name="total_iops_sec_max_length">
-            <data type="unsignedLong"/>
-          </element>
-          <group>
-            <interleave>
-              <optional>
-                <element name="read_iops_sec_max_length">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-              <optional>
-                <element name="write_iops_sec_max_length">
-                  <data type="unsignedLong"/>
-                </element>
-              </optional>
-            </interleave>
-          </group>
-        </choice>
-      </interleave>
+      <ref name="iotune"/>
     </element>
   </define>
 
-- 
2.39.5 (Apple Git-154)
Re: [PATCH v5 01/18] schema: Add new domain elements to support multiple throttle groups
Posted by Peter Krempa 1 year, 2 months ago
On Mon, Nov 18, 2024 at 19:24:09 +0530, Harikumar R wrote:
> From: Chun Feng Wu <danielwuwy@163.com>
> 
> Introduce schema for defining '<throttlegroups>' element which
> configures throttling groups which can be configured for multiple
> disks.
> 
> * Refactor "diskIoTune" to extract common schema "iotune"
> * Add new elements '<throttlegroups>'
> * <ThrottleGroups> contains <ThrottleGroup> defintion, which references
>   "iotune"
> 
> Signed-off-by: Chun Feng Wu <danielwuwy@163.com>
> ---
>  docs/formatdomain.rst             |  26 +++
>  src/conf/schemas/domaincommon.rng | 274 ++++++++++++++++--------------
>  2 files changed, 174 insertions(+), 126 deletions(-)
> 
> diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
> index f0b79d5f8d..5b7f18b2f0 100644
> --- a/docs/formatdomain.rst
> +++ b/docs/formatdomain.rst
> @@ -1964,6 +1964,32 @@ advertisements to the guest OS. (NB: Only qemu driver support)
>     the guest OS itself can choose to circumvent the unavailability of the sleep
>     states (e.g. S4 by turning off completely).
>  
> +Disk Throttle Group Management
> +------------------------------
> +
> +:since:`Since 10.7.0` it is possible to create multiple named throttle groups

This will need to become 11.0.0

> +and then reference them within ``throttlefilters``(sub-element of ``disk`` element)
> +to form filter chain in QEMU for specific disk. The limits(throttlegroups) are
> +shared within domain, hence the same group can be referenced by different filters.
> +
> +::
> +
> +   <domain>
> +     ...
> +     <throttlegroups>

I wanted to suggest renaming this to 'diskthrottlegroups' but I guess
this name will not collide in the future.

> +       <throttlegroup>
> +         <group_name>limit0</group_name>
> +         <total_bytes_sec>10000000</total_bytes_sec>
> +         <read_iops_sec>400000</read_iops_sec>
> +         <write_iops_sec>100000</write_iops_sec>
> +       </throttlegroup>
> +     </throttlegroups>
> +     ...
> +   </domain>
> +
> +``throttlegroup``
> +   It has the same sub-elements as ``iotune`` (See `Hard drives, floppy disks, CDROMs`_),
> +   The difference is that <group_name> is required.

With the changes above:

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Re: [PATCH v5 01/18] schema: Add new domain elements to support multiple throttle groups
Posted by Peter Krempa 1 year ago
On Fri, Nov 29, 2024 at 14:10:00 +0100, Peter Krempa wrote:
> On Mon, Nov 18, 2024 at 19:24:09 +0530, Harikumar R wrote:
> > From: Chun Feng Wu <danielwuwy@163.com>
> > 
> > Introduce schema for defining '<throttlegroups>' element which
> > configures throttling groups which can be configured for multiple
> > disks.
> > 
> > * Refactor "diskIoTune" to extract common schema "iotune"
> > * Add new elements '<throttlegroups>'
> > * <ThrottleGroups> contains <ThrottleGroup> defintion, which references
> >   "iotune"
> > 
> > Signed-off-by: Chun Feng Wu <danielwuwy@163.com>
> > ---
> >  docs/formatdomain.rst             |  26 +++
> >  src/conf/schemas/domaincommon.rng | 274 ++++++++++++++++--------------
> >  2 files changed, 174 insertions(+), 126 deletions(-)
> > 
> > diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
> > index f0b79d5f8d..5b7f18b2f0 100644
> > --- a/docs/formatdomain.rst
> > +++ b/docs/formatdomain.rst
> > @@ -1964,6 +1964,32 @@ advertisements to the guest OS. (NB: Only qemu driver support)
> >     the guest OS itself can choose to circumvent the unavailability of the sleep
> >     states (e.g. S4 by turning off completely).
> >  
> > +Disk Throttle Group Management
> > +------------------------------
> > +
> > +:since:`Since 10.7.0` it is possible to create multiple named throttle groups
> 
> This will need to become 11.0.0

11.1.0 at this point.