mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
conf: Refactor the iothreadid initialization
Create a separate local API that will fill in the iothreadid array entries that were not defined by <iothread id='#'> entries in the XML. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
0331da65ed
commit
897c972a96
@ -2329,6 +2329,35 @@ virDomainIOThreadIDDefArrayFree(virDomainIOThreadIDDefPtr *def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
virDomainIOThreadIDDefArrayInit(virDomainDefPtr def)
|
||||||
|
{
|
||||||
|
unsigned int iothread_id = 1;
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
/* Same value (either 0 or some number), then we have none to fill in or
|
||||||
|
* the iothreadid array was filled from the XML
|
||||||
|
*/
|
||||||
|
if (def->iothreads == def->niothreadids)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
while (def->niothreadids != def->iothreads) {
|
||||||
|
if (!virDomainIOThreadIDFind(def, iothread_id)) {
|
||||||
|
virDomainIOThreadIDDefPtr iothrid;
|
||||||
|
|
||||||
|
if (!(iothrid = virDomainIOThreadIDAdd(def, iothread_id)))
|
||||||
|
goto error;
|
||||||
|
iothrid->autofill = true;
|
||||||
|
}
|
||||||
|
iothread_id++;
|
||||||
|
}
|
||||||
|
retval = 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
virDomainPinDefFree(virDomainPinDefPtr def)
|
virDomainPinDefFree(virDomainPinDefPtr def)
|
||||||
{
|
{
|
||||||
@ -14979,22 +15008,8 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
}
|
}
|
||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
|
|
||||||
/* If no iothreadid's or not fully populated, let's finish the job
|
if (virDomainIOThreadIDDefArrayInit(def) < 0)
|
||||||
* here rather than in PostParseCallback
|
goto error;
|
||||||
*/
|
|
||||||
if (def->iothreads && def->iothreads != def->niothreadids) {
|
|
||||||
unsigned int iothread_id = 1;
|
|
||||||
while (def->niothreadids != def->iothreads) {
|
|
||||||
if (!virDomainIOThreadIDFind(def, iothread_id)) {
|
|
||||||
virDomainIOThreadIDDefPtr iothrid;
|
|
||||||
|
|
||||||
if (!(iothrid = virDomainIOThreadIDAdd(def, iothread_id)))
|
|
||||||
goto error;
|
|
||||||
iothrid->autofill = true;
|
|
||||||
}
|
|
||||||
iothread_id++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Extract cpu tunables. */
|
/* Extract cpu tunables. */
|
||||||
if ((n = virXPathULong("string(./cputune/shares[1])", ctxt,
|
if ((n = virXPathULong("string(./cputune/shares[1])", ctxt,
|
||||||
|
Loading…
Reference in New Issue
Block a user