1
0

conf: Format thread IDs optionally

This will be used later when we want to format emulator scheduler parameters
which don't apply for multiple threads.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Martin Kletzander 2019-04-15 10:48:07 +02:00
parent 0c010cd103
commit 3217bcc535

View File

@ -27205,22 +27205,25 @@ static void
virDomainSchedulerFormat(virBufferPtr buf, virDomainSchedulerFormat(virBufferPtr buf,
const char *name, const char *name,
virDomainThreadSchedParamPtr sched, virDomainThreadSchedParamPtr sched,
size_t id) size_t id,
bool multiple_threads)
{ {
switch (sched->policy) { switch (sched->policy) {
case VIR_PROC_POLICY_BATCH: case VIR_PROC_POLICY_BATCH:
case VIR_PROC_POLICY_IDLE: case VIR_PROC_POLICY_IDLE:
virBufferAsprintf(buf, "<%ssched " virBufferAsprintf(buf, "<%ssched", name);
"%ss='%zu' scheduler='%s'/>\n", if (multiple_threads)
name, name, id, virBufferAsprintf(buf, " %ss='%zu'", name, id);
virBufferAsprintf(buf, " scheduler='%s'/>\n",
virProcessSchedPolicyTypeToString(sched->policy)); virProcessSchedPolicyTypeToString(sched->policy));
break; break;
case VIR_PROC_POLICY_RR: case VIR_PROC_POLICY_RR:
case VIR_PROC_POLICY_FIFO: case VIR_PROC_POLICY_FIFO:
virBufferAsprintf(buf, "<%ssched " virBufferAsprintf(buf, "<%ssched", name);
"%ss='%zu' scheduler='%s' priority='%d'/>\n", if (multiple_threads)
name, name, id, virBufferAsprintf(buf, " %ss='%zu'", name, id);
virBufferAsprintf(buf, " scheduler='%s' priority='%d'/>\n",
virProcessSchedPolicyTypeToString(sched->policy), virProcessSchedPolicyTypeToString(sched->policy),
sched->priority); sched->priority);
break; break;
@ -27489,13 +27492,14 @@ virDomainCputuneDefFormat(virBufferPtr buf,
for (i = 0; i < def->maxvcpus; i++) { for (i = 0; i < def->maxvcpus; i++) {
virDomainSchedulerFormat(&childrenBuf, "vcpu", virDomainSchedulerFormat(&childrenBuf, "vcpu",
&def->vcpus[i]->sched, i); &def->vcpus[i]->sched, i, true);
} }
for (i = 0; i < def->niothreadids; i++) { for (i = 0; i < def->niothreadids; i++) {
virDomainSchedulerFormat(&childrenBuf, "iothread", virDomainSchedulerFormat(&childrenBuf, "iothread",
&def->iothreadids[i]->sched, &def->iothreadids[i]->sched,
def->iothreadids[i]->iothread_id); def->iothreadids[i]->iothread_id,
true);
} }
for (i = 0; i < def->nresctrls; i++) for (i = 0; i < def->nresctrls; i++)