domain_conf: Format <defaultiothread/> more often

The <defaultiothread/> element is formatted inside
virDomainDefaultIOThreadDefFormat() which is called only from
virDomainDefIOThreadsFormat() (so that IOThread related stuff is
formatted calling one function). However, when there are no
<iothreadids/> defined (or only autoallocated ones are present),
then the outer formatting function exits early never calling the
<defaultiothread/> formatter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2022-07-07 16:29:18 +02:00
parent 430ab88ab1
commit 24fa7004e4

View File

@ -26349,17 +26349,14 @@ static void
virDomainDefIOThreadsFormat(virBuffer *buf, virDomainDefIOThreadsFormat(virBuffer *buf,
const virDomainDef *def) const virDomainDef *def)
{ {
g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf); if (def->niothreadids > 0) {
size_t i;
if (def->niothreadids == 0)
return;
virBufferAsprintf(buf, "<iothreads>%zu</iothreads>\n", virBufferAsprintf(buf, "<iothreads>%zu</iothreads>\n",
def->niothreadids); def->niothreadids);
}
if (!virDomainDefIothreadShouldFormat(def)) if (virDomainDefIothreadShouldFormat(def)) {
return; g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
size_t i;
for (i = 0; i < def->niothreadids; i++) { for (i = 0; i < def->niothreadids; i++) {
virDomainIOThreadIDDef *iothread = def->iothreadids[i]; virDomainIOThreadIDDef *iothread = def->iothreadids[i];
@ -26382,6 +26379,7 @@ virDomainDefIOThreadsFormat(virBuffer *buf,
} }
virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf); virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf);
}
virDomainDefaultIOThreadDefFormat(buf, def); virDomainDefaultIOThreadDefFormat(buf, def);
} }