goto cleanup;
}
- if (virProcessSetAffinity(qemuDomainGetVcpuPid(vm, vcpu), cpumap) < 0)
+ if (virProcessSetAffinity(qemuDomainGetVcpuPid(vm, vcpu),
+ cpumap, false) < 0)
goto cleanup;
}
}
}
- if (virProcessSetAffinity(vm->pid, pcpumap) < 0)
+ if (virProcessSetAffinity(vm->pid, pcpumap, false) < 0)
goto endjob;
virBitmapFree(def->cputune.emulatorpin);
}
}
- if (virProcessSetAffinity(iothrid->thread_id, pcpumap) < 0)
+ if (virProcessSetAffinity(iothrid->thread_id, pcpumap, false) < 0)
goto endjob;
if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
}
if (cpumapToSet &&
- virProcessSetAffinity(vm->pid, cpumapToSet) < 0) {
+ virProcessSetAffinity(vm->pid, cpumapToSet, false) < 0) {
/*
* We only want to error out if we failed to set the affinity to
* user-requested mapping. If we are just trying to reset the affinity
affinity_cpumask = use_cpumask;
/* Setup legacy affinity. */
- if (affinity_cpumask && virProcessSetAffinity(pid, affinity_cpumask) < 0) {
+ if (affinity_cpumask &&
+ virProcessSetAffinity(pid, affinity_cpumask, false) < 0) {
/*
* We only want to error out if we failed to set the affinity to
* user-requested mapping. If we are just trying to reset the affinity
#if WITH_SCHED_GETAFFINITY
-int virProcessSetAffinity(pid_t pid, virBitmapPtr map)
+int virProcessSetAffinity(pid_t pid, virBitmapPtr map, bool quiet)
{
size_t i;
int numcpus = 1024;
numcpus = numcpus << 2;
goto realloc;
}
- virReportSystemError(errno,
- _("cannot set CPU affinity on process %d"), pid);
- return -1;
+ if (quiet) {
+ VIR_DEBUG("cannot set CPU affinity on process %d: %s",
+ pid, g_strerror(errno));
+ } else {
+ virReportSystemError(errno,
+ _("cannot set CPU affinity on process %d"), pid);
+ return -1;
+ }
}
CPU_FREE(mask);
#elif defined(WITH_BSD_CPU_AFFINITY)
int virProcessSetAffinity(pid_t pid,
- virBitmapPtr map)
+ virBitmapPtr map,
+ bool quiet)
{
size_t i;
cpuset_t mask;
if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, pid,
sizeof(mask), &mask) != 0) {
- virReportSystemError(errno,
- _("cannot set CPU affinity on process %d"), pid);
- return -1;
+ if (quiet) {
+ VIR_DEBUG("cannot set CPU affinity on process %d: %s",
+ pid, g_strerror(errno));
+ } else {
+ virReportSystemError(errno,
+ _("cannot set CPU affinity on process %d"), pid);
+ return -1;
+ }
}
return 0;
#else /* WITH_SCHED_GETAFFINITY */
int virProcessSetAffinity(pid_t pid G_GNUC_UNUSED,
- virBitmapPtr map G_GNUC_UNUSED)
+ virBitmapPtr map G_GNUC_UNUSED,
+ bool quiet G_GNUC_UNUSED)
{
+ /* The @quiet parameter is ignored here, it is used only for silencing
+ * actual failures. */
virReportSystemError(ENOSYS, "%s",
_("Process CPU affinity is not supported on this platform"));
return -1;