mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Allow setting affinity to fail and don't report error
This is just a clean-up of commit 3791f29b085c using the new parameter of virProcessSetAffinity() introduced in commit 9514e24984ee so that there is no error reported in the logs. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9514e24984
commit
f5b486daea
@ -2569,8 +2569,6 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpumapToSet &&
|
|
||||||
virProcessSetAffinity(vm->pid, cpumapToSet, false) < 0) {
|
|
||||||
/*
|
/*
|
||||||
* We only want to error out if we failed to set the affinity to
|
* 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
|
* user-requested mapping. If we are just trying to reset the affinity
|
||||||
@ -2578,14 +2576,13 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
|
|||||||
* 1) libvirtd does not have CAP_SYS_NICE
|
* 1) libvirtd does not have CAP_SYS_NICE
|
||||||
* 2) libvirtd does not run on all CPUs
|
* 2) libvirtd does not run on all CPUs
|
||||||
*
|
*
|
||||||
* This scenario can easily occurr when libvirtd is run inside a
|
* This scenario can easily occur when libvirtd is run inside a
|
||||||
* container with restrictive permissions and CPU pinning.
|
* container with restrictive permissions and CPU pinning.
|
||||||
*
|
*
|
||||||
* See also: https://bugzilla.redhat.com/1819801#c2
|
* See also: https://bugzilla.redhat.com/1819801#c2
|
||||||
*/
|
*/
|
||||||
if (settingAll)
|
if (cpumapToSet &&
|
||||||
virResetLastError();
|
virProcessSetAffinity(vm->pid, cpumapToSet, settingAll) < 0) {
|
||||||
else
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2739,24 +2736,22 @@ qemuProcessSetupPid(virDomainObjPtr vm,
|
|||||||
if (!affinity_cpumask)
|
if (!affinity_cpumask)
|
||||||
affinity_cpumask = use_cpumask;
|
affinity_cpumask = use_cpumask;
|
||||||
|
|
||||||
/* Setup legacy affinity. */
|
/* Setup legacy affinity.
|
||||||
if (affinity_cpumask &&
|
*
|
||||||
virProcessSetAffinity(pid, affinity_cpumask, false) < 0) {
|
|
||||||
/*
|
|
||||||
* We only want to error out if we failed to set the affinity to
|
* 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
|
* user-requested mapping. If we are just trying to reset the affinity
|
||||||
* to all CPUs and this fails it can only be an issue if:
|
* to all CPUs and this fails it can only be an issue if:
|
||||||
* 1) libvirtd does not have CAP_SYS_NICE
|
* 1) libvirtd does not have CAP_SYS_NICE
|
||||||
* 2) libvirtd does not run on all CPUs
|
* 2) libvirtd does not run on all CPUs
|
||||||
*
|
*
|
||||||
* This scenario can easily occurr when libvirtd is run inside a
|
* This scenario can easily occur when libvirtd is run inside a
|
||||||
* container with restrictive permissions and CPU pinning.
|
* container with restrictive permissions and CPU pinning.
|
||||||
*
|
*
|
||||||
* See also: https://bugzilla.redhat.com/1819801#c2
|
* See also: https://bugzilla.redhat.com/1819801#c2
|
||||||
*/
|
*/
|
||||||
if (affinity_cpumask == hostcpumap)
|
if (affinity_cpumask &&
|
||||||
virResetLastError();
|
virProcessSetAffinity(pid, affinity_cpumask,
|
||||||
else
|
affinity_cpumask == hostcpumap) < 0) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user