mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: Use 'niothreadids' instead of 'iothreads'
Although theoretically both should be the same value, the niothreadids should be used in favor of iothreads when performing comparisons. This leaves the iothreads as a purely numeric value to be saved in the config file. The one exception to the rule is virDomainIOThreadIDDefArrayInit where the iothreadids are being generated from the iothreads count since iothreadids were added after initial iothreads support.
This commit is contained in:
parent
4ceaa7491e
commit
4f8e888714
@ -886,8 +886,8 @@ virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
|
|||||||
virDomainAuditMemory(vm, 0, virDomainDefGetMemoryActual(vm->def),
|
virDomainAuditMemory(vm, 0, virDomainDefGetMemoryActual(vm->def),
|
||||||
"start", true);
|
"start", true);
|
||||||
virDomainAuditVcpu(vm, 0, vm->def->vcpus, "start", true);
|
virDomainAuditVcpu(vm, 0, vm->def->vcpus, "start", true);
|
||||||
if (vm->def->iothreads)
|
if (vm->def->niothreadids)
|
||||||
virDomainAuditIOThread(vm, 0, vm->def->iothreads, "start", true);
|
virDomainAuditIOThread(vm, 0, vm->def->niothreadids, "start", true);
|
||||||
|
|
||||||
virDomainAuditLifecycle(vm, "start", reason, success);
|
virDomainAuditLifecycle(vm, "start", reason, success);
|
||||||
}
|
}
|
||||||
|
@ -15220,7 +15220,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (n) {
|
if (n) {
|
||||||
if (n > def->iothreads) {
|
if (n > def->niothreadids) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("too many iothreadsched nodes in cputune"));
|
_("too many iothreadsched nodes in cputune"));
|
||||||
goto error;
|
goto error;
|
||||||
@ -21729,7 +21729,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||||||
virBufferAsprintf(buf, " current='%u'", def->vcpus);
|
virBufferAsprintf(buf, " current='%u'", def->vcpus);
|
||||||
virBufferAsprintf(buf, ">%u</vcpu>\n", def->maxvcpus);
|
virBufferAsprintf(buf, ">%u</vcpu>\n", def->maxvcpus);
|
||||||
|
|
||||||
if (def->iothreads > 0) {
|
if (def->niothreadids > 0) {
|
||||||
virBufferAsprintf(buf, "<iothreads>%u</iothreads>\n",
|
virBufferAsprintf(buf, "<iothreads>%u</iothreads>\n",
|
||||||
def->iothreads);
|
def->iothreads);
|
||||||
/* Only print out iothreadids if we read at least one */
|
/* Only print out iothreadids if we read at least one */
|
||||||
|
@ -9462,7 +9462,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
virCommandAddArg(cmd, smp);
|
virCommandAddArg(cmd, smp);
|
||||||
VIR_FREE(smp);
|
VIR_FREE(smp);
|
||||||
|
|
||||||
if (def->iothreads > 0 &&
|
if (def->niothreadids > 0 &&
|
||||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
|
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
|
||||||
/* Create iothread objects using the defined iothreadids list
|
/* Create iothread objects using the defined iothreadids list
|
||||||
* and the defined id and name from the list. These may be used
|
* and the defined id and name from the list. These may be used
|
||||||
|
@ -5671,13 +5671,13 @@ qemuDomainGetIOThreadsConfig(virDomainDefPtr targetDef,
|
|||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (targetDef->iothreads == 0)
|
if (targetDef->niothreadids == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((hostcpus = nodeGetCPUCount(NULL)) < 0)
|
if ((hostcpus = nodeGetCPUCount(NULL)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(info_ret, targetDef->iothreads) < 0)
|
if (VIR_ALLOC_N(info_ret, targetDef->niothreadids) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < targetDef->niothreadids; i++) {
|
for (i = 0; i < targetDef->niothreadids; i++) {
|
||||||
@ -5707,11 +5707,11 @@ qemuDomainGetIOThreadsConfig(virDomainDefPtr targetDef,
|
|||||||
|
|
||||||
*info = info_ret;
|
*info = info_ret;
|
||||||
info_ret = NULL;
|
info_ret = NULL;
|
||||||
ret = targetDef->iothreads;
|
ret = targetDef->niothreadids;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (info_ret) {
|
if (info_ret) {
|
||||||
for (i = 0; i < targetDef->iothreads; i++)
|
for (i = 0; i < targetDef->niothreadids; i++)
|
||||||
virDomainIOThreadInfoFree(info_ret[i]);
|
virDomainIOThreadInfoFree(info_ret[i]);
|
||||||
VIR_FREE(info_ret);
|
VIR_FREE(info_ret);
|
||||||
}
|
}
|
||||||
@ -5910,8 +5910,8 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver,
|
|||||||
size_t idx;
|
size_t idx;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
unsigned int orig_niothreads = vm->def->iothreads;
|
unsigned int orig_niothreads = vm->def->niothreadids;
|
||||||
unsigned int exp_niothreads = vm->def->iothreads;
|
unsigned int exp_niothreads = vm->def->niothreadids;
|
||||||
int new_niothreads = 0;
|
int new_niothreads = 0;
|
||||||
qemuMonitorIOThreadInfoPtr *new_iothreads = NULL;
|
qemuMonitorIOThreadInfoPtr *new_iothreads = NULL;
|
||||||
virCgroupPtr cgroup_iothread = NULL;
|
virCgroupPtr cgroup_iothread = NULL;
|
||||||
@ -6039,8 +6039,8 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver,
|
|||||||
char *alias = NULL;
|
char *alias = NULL;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
unsigned int orig_niothreads = vm->def->iothreads;
|
unsigned int orig_niothreads = vm->def->niothreadids;
|
||||||
unsigned int exp_niothreads = vm->def->iothreads;
|
unsigned int exp_niothreads = vm->def->niothreadids;
|
||||||
int new_niothreads = 0;
|
int new_niothreads = 0;
|
||||||
qemuMonitorIOThreadInfoPtr *new_iothreads = NULL;
|
qemuMonitorIOThreadInfoPtr *new_iothreads = NULL;
|
||||||
|
|
||||||
|
@ -2308,11 +2308,11 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver,
|
|||||||
if (niothreads < 0)
|
if (niothreads < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (niothreads != vm->def->iothreads) {
|
if (niothreads != vm->def->niothreadids) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("got wrong number of IOThread pids from QEMU monitor. "
|
_("got wrong number of IOThread pids from QEMU monitor. "
|
||||||
"got %d, wanted %d"),
|
"got %d, wanted %zu"),
|
||||||
niothreads, vm->def->iothreads);
|
niothreads, vm->def->niothreadids);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user