Hello Dan Kenigsberg,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/48787
to review the following change.
Change subject: daemon: enable cpu affinity by default
......................................................................
daemon: enable cpu affinity by default
To run VDSM with CPU affinity enabled provided only
(huge) benefits in the tests performed so far, so let's
enable it by default.
Also, fix a few tests that don't expect taskset
to be enabled by default.
Change-Id: I9a00926926bb4075e17b69f633bf31b5389eefc1
Bug-Url: https://bugzilla.redhat.com/1279431
Backport-To: 3.6
Signed-off-by: Francesco Romani <[email protected]>
Reviewed-on: https://gerrit.ovirt.org/48296
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <[email protected]>
---
M lib/vdsm/config.py.in
M tests/miscTests.py
M tests/utilsTests.py
3 files changed, 20 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/48787/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 3c53e5f..9b8ab83 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -208,10 +208,10 @@
('connection_stats_timeout', '3600',
'Time in seconds defining how frequently we log transport stats'),
- ('cpu_affinity', '',
+ ('cpu_affinity', '1',
'Comma separated whitelist of CPU cores on which VDSM is allowed '
- 'to run. The default is "", meaning VDSM can be scheduled by '
- ' the OS to run on any core. '
+ 'to run. The default is "1", meaning VDSM can be scheduled by '
+ ' the OS to run on the second core of the system. '
'Valid examples: "1", "0,1", "0,2,3"'),
('ssl_implementation', '@SSL_IMPLEMENTATION@',
diff --git a/tests/miscTests.py b/tests/miscTests.py
index 37f0ea0..97a20e3 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -34,11 +34,14 @@
from testlib import permutations, expandPermutations
from testlib import TEMPDIR
import inspect
+from vdsm import cmdutils
from vdsm import utils
import storage.outOfProcess as oop
import storage.misc as misc
import storage.fileUtils as fileUtils
+
+from monkeypatch import MonkeyPatch
from testValidation import checkSudo
EXT_CHMOD = "/bin/chmod"
@@ -1019,7 +1022,13 @@
self.assertEquals(ret, 0)
- def testNoCommand(self):
+ @MonkeyPatch(cmdutils, "_USING_CPU_AFFINITY", True)
+ def testNoCommandWithAffinity(self):
+ rc, _, _ = utils.execCmd(["I.DONT.EXIST"])
+ self.assertNotEqual(rc, 0)
+
+ @MonkeyPatch(cmdutils, "_USING_CPU_AFFINITY", False)
+ def testNoCommandWithoutAffinity(self):
self.assertRaises(OSError, utils.execCmd, ["I.DONT.EXIST"])
def testStdOut(self):
diff --git a/tests/utilsTests.py b/tests/utilsTests.py
index 11adfec..f8e2213 100644
--- a/tests/utilsTests.py
+++ b/tests/utilsTests.py
@@ -78,7 +78,9 @@
class PidStatTests(TestCaseBase):
- def test(self):
+
+ @MonkeyPatch(cmdutils, "_USING_CPU_AFFINITY", False)
+ def test_without_affinity(self):
args = ["sleep", "3"]
sproc = utils.execCmd(args, sync=False)
stats = utils.pidStat(sproc.pid)
@@ -113,7 +115,10 @@
args = [EXT_SLEEP, "4"]
sproc = utils.execCmd(args, sync=False)
try:
- self.assertEquals(utils.getCmdArgs(sproc.pid), tuple(args))
+ cmd_args = utils.getCmdArgs(sproc.pid)
+ # let's ignore optional taskset at the beginning
+ self.assertEquals(cmd_args[-len(args):],
+ tuple(args))
finally:
sproc.kill()
sproc.wait()
--
To view, visit https://gerrit.ovirt.org/48787
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a00926926bb4075e17b69f633bf31b5389eefc1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Francesco Romani <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches