mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 06:25:19 +00:00
conf: display all iothread ids in the XML if one of them is not generated
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
3fc6512a3d
commit
a4a1ad2066
@ -23658,6 +23658,20 @@ virDomainCpuDefFormat(virBufferPtr buf,
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
virDomainDefIothreadShouldFormat(virDomainDefPtr def)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < def->niothreadids; i++) {
|
||||
if (!def->iothreadids[i]->autofill)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* This internal version appends to an existing buffer
|
||||
* (possibly with auto-indent), rather than flattening
|
||||
* to string.
|
||||
@ -23851,17 +23865,10 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
if (def->niothreadids > 0) {
|
||||
virBufferAsprintf(buf, "<iothreads>%lu</iothreads>\n",
|
||||
def->niothreadids);
|
||||
/* Only print out iothreadids if we read at least one */
|
||||
for (i = 0; i < def->niothreadids; i++) {
|
||||
if (!def->iothreadids[i]->autofill)
|
||||
break;
|
||||
}
|
||||
if (i < def->niothreadids) {
|
||||
if (virDomainDefIothreadShouldFormat(def)) {
|
||||
virBufferAddLit(buf, "<iothreadids>\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
for (i = 0; i < def->niothreadids; i++) {
|
||||
if (def->iothreadids[i]->autofill)
|
||||
continue;
|
||||
virBufferAsprintf(buf, "<iothread id='%u'/>\n",
|
||||
def->iothreadids[i]->iothread_id);
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
<iothreadids>
|
||||
<iothread id='5'/>
|
||||
<iothread id='6'/>
|
||||
<iothread id='1'/>
|
||||
<iothread id='2'/>
|
||||
</iothreadids>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
|
Loading…
Reference in New Issue
Block a user