[PATCH 2/5] domain_conf: Format iothread IDs more often

Michal Privoznik mprivozn at redhat.com
Fri Jul 8 07:55:11 UTC 2022


When formatting IOThreads (in virDomainDefIOThreadsFormat()), we
may only output the number of IOThreads, or the full list of IOThreads too:

  <iothreads>4</iothreads>
  <iothreadids>
    <iothread id='1' thread_pool_max='10'/>
    <iothread id='2' thread_pool_min='2' thread_pool_max='10'/>
    <iothread id='3'/>
    <iothread id='4'/>
  </iothreadids>

Now, the deciding factor here is whether those individual
IOThreads were so called 'autofill-ed' or user provided. Well, we
need to take another factor in: if an IOThread has pool size
limit set, then we ought to format the full list.

But how can we get into a situation when a thread is autofilled
(i.e. not provided by user in the XML) and yet it has pool size
limit set? virDomainSetIOThreadParams() is the answer.

Sure, we could also unset the autofill flag whenever a pool size
limit is being set. But this approach allows us to not format
anything if the limits are reset (we don't lose the autofill
information).

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/conf/domain_conf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 24f17a8b91..e80616fe7b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -26314,7 +26314,9 @@ virDomainDefIothreadShouldFormat(const virDomainDef *def)
     size_t i;
 
     for (i = 0; i < def->niothreadids; i++) {
-        if (!def->iothreadids[i]->autofill)
+        if (!def->iothreadids[i]->autofill ||
+            def->iothreadids[i]->thread_pool_min >= 0 ||
+            def->iothreadids[i]->thread_pool_max >= 0)
             return true;
     }
 
-- 
2.35.1



More information about the libvir-list mailing list