a1c947
From 711cf329b9847c4d42994389d89a7e7b83c71596 Mon Sep 17 00:00:00 2001
a1c947
Message-Id: <711cf329b9847c4d42994389d89a7e7b83c71596@dist-git>
a1c947
From: Michal Privoznik <mprivozn@redhat.com>
a1c947
Date: Thu, 7 Jul 2022 16:29:33 +0200
a1c947
Subject: [PATCH] domain_conf: Format iothread IDs more often
a1c947
MIME-Version: 1.0
a1c947
Content-Type: text/plain; charset=UTF-8
a1c947
Content-Transfer-Encoding: 8bit
a1c947
a1c947
When formatting IOThreads (in virDomainDefIOThreadsFormat()), we
a1c947
may only output the number of IOThreads, or the full list of IOThreads too:
a1c947
a1c947
  <iothreads>4</iothreads>
a1c947
  <iothreadids>
a1c947
    <iothread id='1' thread_pool_max='10'/>
a1c947
    <iothread id='2' thread_pool_min='2' thread_pool_max='10'/>
a1c947
    <iothread id='3'/>
a1c947
    <iothread id='4'/>
a1c947
  </iothreadids>
a1c947
a1c947
Now, the deciding factor here is whether those individual
a1c947
IOThreads were so called 'autofill-ed' or user provided. Well, we
a1c947
need to take another factor in: if an IOThread has pool size
a1c947
limit set, then we ought to format the full list.
a1c947
a1c947
But how can we get into a situation when a thread is autofilled
a1c947
(i.e. not provided by user in the XML) and yet it has pool size
a1c947
limit set? virDomainSetIOThreadParams() is the answer.
a1c947
a1c947
Sure, we could also unset the autofill flag whenever a pool size
a1c947
limit is being set. But this approach allows us to not format
a1c947
anything if the limits are reset (we don't lose the autofill
a1c947
information).
a1c947
a1c947
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
a1c947
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a1c947
(cherry picked from commit 5aa24958546c94a48fb8f8d6022213ca7c07c8a7)
a1c947
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
a1c947
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
a1c947
---
a1c947
 src/conf/domain_conf.c | 4 +++-
a1c947
 1 file changed, 3 insertions(+), 1 deletion(-)
a1c947
a1c947
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
a1c947
index 207a45d9ae..fbc285d981 100644
a1c947
--- a/src/conf/domain_conf.c
a1c947
+++ b/src/conf/domain_conf.c
a1c947
@@ -27728,7 +27728,9 @@ virDomainDefIothreadShouldFormat(const virDomainDef *def)
a1c947
     size_t i;
a1c947
 
a1c947
     for (i = 0; i < def->niothreadids; i++) {
a1c947
-        if (!def->iothreadids[i]->autofill)
a1c947
+        if (!def->iothreadids[i]->autofill ||
a1c947
+            def->iothreadids[i]->thread_pool_min >= 0 ||
a1c947
+            def->iothreadids[i]->thread_pool_max >= 0)
a1c947
             return true;
a1c947
     }
a1c947
 
a1c947
-- 
a1c947
2.35.1
a1c947