Skip to content

Commit aa338cb

Browse files
Vineeth Pillaibryteise
authored andcommitted
ch_process: refactor Thread information processing
Consolidate all the thread processing into one function which could be used by the watcher thread. Signed-off-by: Vineeth Pillai <viremana@linux.microsoft.com>
1 parent 0075e74 commit aa338cb

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

src/ch/ch_process.c

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,29 @@ virCHProcessSetupVcpus(virDomainObjPtr vm)
415415
return 0;
416416
}
417417

418+
static int virCHProcessSetupThreads(virDomainObjPtr vm)
419+
{
420+
virCHDomainObjPrivatePtr priv = vm->privateData;
421+
int ret;
422+
423+
virCHMonitorRefreshThreadInfo(priv->monitor);
424+
425+
VIR_DEBUG("Setting emulator tuning/settings");
426+
ret = virCHProcessSetupEmulatorThreads(vm);
427+
428+
if (!ret) {
429+
VIR_DEBUG("Setting iothread tuning/settings");
430+
ret = virCHProcessSetupIOThreads(vm);
431+
}
432+
433+
if (!ret) {
434+
VIR_DEBUG("Setting vCPU tuning/settings");
435+
ret = virCHProcessSetupVcpus(vm);
436+
}
437+
438+
return ret;
439+
}
440+
418441
/**
419442
* chProcessNetworkPrepareDevices
420443
*/
@@ -563,22 +586,13 @@ int virCHProcessStart(virCHDriverPtr driver,
563586

564587
virCHMonitorRefreshThreadInfo(priv->monitor);
565588

566-
VIR_DEBUG("Setting emulator tuning/settings");
567-
if (virCHProcessSetupEmulatorThreads(vm) < 0)
568-
goto cleanup;
569-
570-
VIR_DEBUG("Setting iothread tuning/settings");
571-
if (virCHProcessSetupIOThreads(vm) < 0)
589+
if (virCHProcessSetupThreads(vm) < 0)
572590
goto cleanup;
573591

574592
VIR_DEBUG("Setting global CPU cgroup (if required)");
575593
if (chSetupGlobalCpuCgroup(vm) < 0)
576594
goto cleanup;
577595

578-
VIR_DEBUG("Setting vCPU tuning/settings");
579-
if (virCHProcessSetupVcpus(vm) < 0)
580-
goto cleanup;
581-
582596
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
583597

584598
return 0;

0 commit comments

Comments
 (0)