Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1517001 - Commands running as root from supervdsm use taskset to reset cpu affinity
Summary: Commands running as root from supervdsm use taskset to reset cpu affinity
Status: NEW
Alias: None
Product: vdsm
Classification: oVirt
Component: Core
Version: 4.20.15
Hardware: Unspecified
OS: Unspecified
low vote
Target Milestone: ovirt-4.4.0
: ---
Assignee: Marcin Sobczyk
QA Contact: Lukas Svaty
Depends On:
TreeView+ depends on / blocked
Reported: 2017-11-23 20:21 UTC by Nir Soffer
Modified: 2019-01-15 08:29 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:
oVirt Team: Infra
rule-engine: ovirt-4.3+
rule-engine: ovirt-4.4+

Attachments (Terms of Use)

Description Nir Soffer 2017-11-23 20:21:29 UTC
Description of problem:

Vdsm is pinned to one cpu by default, so it run other commands via taskset,
resetting the cpu affinity to all cpus. supervdsmd is not pinned to any cpu, 
so using taskset is pointless.

Version-Release number of selected component (if applicable):
Since 3.5.8.

How reproducible:

Steps to Reproduce:
1. Look in supervdsm log

Actual results:
Commands run via taskset:

    MainProcess|jsonrpc/5::DEBUG::2017-02-20 16:19:30,391::commands::69::storage.HBA::(execCmd) /usr/bin/taskset --cpu-list 0-7 /usr/libexec/vdsm/fc-scan (cwd None)

Expected results:
Commands run directly

    MainProcess|jsonrpc/5::DEBUG::2017-02-20 16:19:30,391::commands::69::storage.HBA::(execCmd) /usr/libexec/vdsm/fc-scan (cwd None)

The root cause is:

1. In cmdutils we keep this flag:

    _USING_CPU_AFFINITY = config.get('vars', 'cpu_affinity') != ""

if the flag is set, we run commands via taskset.

2. supervdsmd and vdsmd shared the same config file
3. supervdsmd does not pin itself to any cpu.

When commands run from supervdsm, it uses the same cmdutils module, assuming that
the process is using cpu affinity.

Possible fix:

1. Create new vdsm.common.cpuaffinity
2. Move the to the new module
3. If we set cpu affinity, set a flag in the new module
   (e.g. cpuaffinity.enabled)
4. Check the flag in cmdutils.wrap_command

Note You need to log in before you can comment on or make changes to this bug.