mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: remove redundant iothreads variable
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
2b5dcda7a9
commit
875b77821f
@ -2559,7 +2559,8 @@ virDomainIOThreadIDDefArrayFree(virDomainIOThreadIDDefPtr *def,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainIOThreadIDDefArrayInit(virDomainDefPtr def)
|
virDomainIOThreadIDDefArrayInit(virDomainDefPtr def,
|
||||||
|
unsigned int iothreads)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -2570,11 +2571,11 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def)
|
|||||||
/* Same value (either 0 or some number), then we have none to fill in or
|
/* Same value (either 0 or some number), then we have none to fill in or
|
||||||
* the iothreadid array was filled from the XML
|
* the iothreadid array was filled from the XML
|
||||||
*/
|
*/
|
||||||
if (def->iothreads == def->niothreadids)
|
if (iothreads == def->niothreadids)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* iothread's are numbered starting at 1, account for that */
|
/* iothread's are numbered starting at 1, account for that */
|
||||||
if (!(thrmap = virBitmapNew(def->iothreads + 1)))
|
if (!(thrmap = virBitmapNew(iothreads + 1)))
|
||||||
goto error;
|
goto error;
|
||||||
virBitmapSetAll(thrmap);
|
virBitmapSetAll(thrmap);
|
||||||
|
|
||||||
@ -2586,11 +2587,11 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def)
|
|||||||
def->iothreadids[i]->iothread_id));
|
def->iothreadids[i]->iothread_id));
|
||||||
|
|
||||||
/* resize array */
|
/* resize array */
|
||||||
if (VIR_REALLOC_N(def->iothreadids, def->iothreads) < 0)
|
if (VIR_REALLOC_N(def->iothreadids, iothreads) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Populate iothreadids[] using the set bit number from thrmap */
|
/* Populate iothreadids[] using the set bit number from thrmap */
|
||||||
while (def->niothreadids < def->iothreads) {
|
while (def->niothreadids < iothreads) {
|
||||||
if ((nxt = virBitmapNextSetBit(thrmap, nxt)) < 0) {
|
if ((nxt = virBitmapNextSetBit(thrmap, nxt)) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("failed to populate iothreadids"));
|
_("failed to populate iothreadids"));
|
||||||
@ -16433,6 +16434,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
bool usb_other = false;
|
bool usb_other = false;
|
||||||
bool usb_master = false;
|
bool usb_master = false;
|
||||||
char *netprefix = NULL;
|
char *netprefix = NULL;
|
||||||
|
unsigned int iothreads = 0;
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA) {
|
if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA) {
|
||||||
char *schema = virFileFindResource("domain.rng",
|
char *schema = virFileFindResource("domain.rng",
|
||||||
@ -16762,7 +16764,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
|
|
||||||
/* Optional - iothreads */
|
/* Optional - iothreads */
|
||||||
tmp = virXPathString("string(./iothreads[1])", ctxt);
|
tmp = virXPathString("string(./iothreads[1])", ctxt);
|
||||||
if (tmp && virStrToLong_uip(tmp, NULL, 10, &def->iothreads) < 0) {
|
if (tmp && virStrToLong_uip(tmp, NULL, 10, &iothreads) < 0) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("invalid iothreads count '%s'"), tmp);
|
_("invalid iothreads count '%s'"), tmp);
|
||||||
goto error;
|
goto error;
|
||||||
@ -16773,8 +16775,8 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
if ((n = virXPathNodeSet("./iothreadids/iothread", ctxt, &nodes)) < 0)
|
if ((n = virXPathNodeSet("./iothreadids/iothread", ctxt, &nodes)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (n > def->iothreads)
|
if (n > iothreads)
|
||||||
def->iothreads = n;
|
iothreads = n;
|
||||||
|
|
||||||
if (n && VIR_ALLOC_N(def->iothreadids, n) < 0)
|
if (n && VIR_ALLOC_N(def->iothreadids, n) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -16795,7 +16797,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
}
|
}
|
||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
|
|
||||||
if (virDomainIOThreadIDDefArrayInit(def) < 0)
|
if (virDomainIOThreadIDDefArrayInit(def, iothreads) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Extract cpu tunables. */
|
/* Extract cpu tunables. */
|
||||||
@ -19493,11 +19495,11 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr src,
|
|||||||
if (!virDomainDefVcpuCheckAbiStability(src, dst))
|
if (!virDomainDefVcpuCheckAbiStability(src, dst))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (src->iothreads != dst->iothreads) {
|
if (src->niothreadids != dst->niothreadids) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Target domain iothreads count %u does not "
|
_("Target domain iothreads count %lu does not "
|
||||||
"match source %u"),
|
"match source %lu"),
|
||||||
dst->iothreads, src->iothreads);
|
dst->niothreadids, src->niothreadids);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23828,8 +23830,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (def->niothreadids > 0) {
|
if (def->niothreadids > 0) {
|
||||||
virBufferAsprintf(buf, "<iothreads>%u</iothreads>\n",
|
virBufferAsprintf(buf, "<iothreads>%lu</iothreads>\n",
|
||||||
def->iothreads);
|
def->niothreadids);
|
||||||
/* Only print out iothreadids if we read at least one */
|
/* Only print out iothreadids if we read at least one */
|
||||||
for (i = 0; i < def->niothreadids; i++) {
|
for (i = 0; i < def->niothreadids; i++) {
|
||||||
if (!def->iothreadids[i]->autofill)
|
if (!def->iothreadids[i]->autofill)
|
||||||
|
@ -2211,7 +2211,6 @@ struct _virDomainDef {
|
|||||||
int placement_mode;
|
int placement_mode;
|
||||||
virBitmapPtr cpumask;
|
virBitmapPtr cpumask;
|
||||||
|
|
||||||
unsigned int iothreads;
|
|
||||||
size_t niothreadids;
|
size_t niothreadids;
|
||||||
virDomainIOThreadIDDefPtr *iothreadids;
|
virDomainIOThreadIDDefPtr *iothreadids;
|
||||||
|
|
||||||
|
@ -5617,10 +5617,8 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver,
|
|||||||
_("got wrong number of IOThread ids from QEMU monitor. "
|
_("got wrong number of IOThread ids from QEMU monitor. "
|
||||||
"got %d, wanted %d"),
|
"got %d, wanted %d"),
|
||||||
new_niothreads, exp_niothreads);
|
new_niothreads, exp_niothreads);
|
||||||
vm->def->iothreads = new_niothreads;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
vm->def->iothreads = exp_niothreads;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we've successfully added an IOThread, find out where we added it
|
* If we've successfully added an IOThread, find out where we added it
|
||||||
@ -5716,10 +5714,8 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver,
|
|||||||
_("got wrong number of IOThread ids from QEMU monitor. "
|
_("got wrong number of IOThread ids from QEMU monitor. "
|
||||||
"got %d, wanted %d"),
|
"got %d, wanted %d"),
|
||||||
new_niothreads, exp_niothreads);
|
new_niothreads, exp_niothreads);
|
||||||
vm->def->iothreads = new_niothreads;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
vm->def->iothreads = exp_niothreads;
|
|
||||||
|
|
||||||
virDomainIOThreadIDDel(vm->def, iothread_id);
|
virDomainIOThreadIDDel(vm->def, iothread_id);
|
||||||
|
|
||||||
@ -5798,7 +5794,6 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver,
|
|||||||
if (!virDomainIOThreadIDAdd(persistentDef, iothread_id))
|
if (!virDomainIOThreadIDAdd(persistentDef, iothread_id))
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
persistentDef->iothreads++;
|
|
||||||
} else {
|
} else {
|
||||||
virDomainIOThreadIDDefPtr iothrid;
|
virDomainIOThreadIDDefPtr iothrid;
|
||||||
if (!(iothrid = virDomainIOThreadIDFind(persistentDef,
|
if (!(iothrid = virDomainIOThreadIDFind(persistentDef,
|
||||||
@ -5811,7 +5806,6 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
virDomainIOThreadIDDel(persistentDef, iothread_id);
|
virDomainIOThreadIDDel(persistentDef, iothread_id);
|
||||||
persistentDef->iothreads--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainSaveConfig(cfg->configDir, driver->caps,
|
if (virDomainSaveConfig(cfg->configDir, driver->caps,
|
||||||
|
@ -2123,7 +2123,6 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver,
|
|||||||
/* Remove any trace */
|
/* Remove any trace */
|
||||||
VIR_FREE(vm->def->iothreadids);
|
VIR_FREE(vm->def->iothreadids);
|
||||||
vm->def->niothreadids = 0;
|
vm->def->niothreadids = 0;
|
||||||
vm->def->iothreads = 0;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user