コード例 #1
0
    def testResetAffinityWhenConfigured(self):
        taskset.set(os.getpid(), self.CPU_SET)
        self.assertEqual(taskset.get(os.getpid()), self.CPU_SET)

        proc = commands.start((EXT_SLEEP, '30s'))
        try:
            self.assertEqual(taskset.get(proc.pid), online_cpus())
        finally:
            proc.kill()
コード例 #2
0
    def testKeepAffinity(self):
        taskset.set(os.getpid(), self.CPU_SET)
        self.assertEqual(taskset.get(os.getpid()), self.CPU_SET)

        proc = commands.start((EXT_SLEEP, '30s'), reset_cpu_affinity=False)
        try:
            self.assertEqual(taskset.get(proc.pid), self.CPU_SET)
        finally:
            proc.kill()
コード例 #3
0
ファイル: utilsTests.py プロジェクト: yingyun001/vdsm
    def testResetAffinityWhenConfigured(self):
        taskset.set(os.getpid(), self.CPU_SET)
        self.assertEquals(taskset.get(os.getpid()), self.CPU_SET)

        try:
            proc = commands.execCmd((EXT_SLEEP, '30s'), sync=False)

            self.assertEquals(taskset.get(proc.pid), online_cpus())
        finally:
            proc.kill()
コード例 #4
0
    def testResetAffinityWhenConfigured(self):
        taskset.set(os.getpid(), self.CPU_SET)
        self.assertEquals(taskset.get(os.getpid()), self.CPU_SET)

        try:
            proc = utils.execCmd((EXT_SLEEP, '30s'), sync=False)

            self.assertEquals(taskset.get(proc.pid), online_cpus())
        finally:
            proc.kill()
コード例 #5
0
ファイル: taskset_test.py プロジェクト: rollandf/vdsm
    def test_set_from_parent(self, cpu_set):

        validate_running_with_enough_cpus(cpu_set)

        self.proc = multiprocessing.Process(target=self._run_child)
        self.proc.start()
        if not self.running.wait(0.5):
            raise RuntimeError("helper child process not running!")

        taskset.set(self.proc.pid, cpu_set)
        self.assertEqual(taskset.get(self.proc.pid), cpu_set)
コード例 #6
0
ファイル: tasksetTests.py プロジェクト: germanovm/vdsm
    def test_set_from_parent(self, cpu_set):

        validate_running_with_enough_cpus(cpu_set)

        self.proc = multiprocessing.Process(target=self._run_child)
        self.proc.start()
        if not self.running.wait(0.5):
            raise RuntimeError("helper child process not running!")

        taskset.set(self.proc.pid, cpu_set)
        self.assertEqual(taskset.get(self.proc.pid), cpu_set)
コード例 #7
0
ファイル: utilsTests.py プロジェクト: yingyun001/vdsm
    def testKeepAffinity(self):
        taskset.set(os.getpid(), self.CPU_SET)
        self.assertEquals(taskset.get(os.getpid()), self.CPU_SET)

        try:
            proc = commands.execCmd((EXT_SLEEP, '30s'),
                                    sync=False,
                                    resetCpuAffinity=False)

            self.assertEquals(taskset.get(proc.pid), self.CPU_SET)
        finally:
            proc.kill()
コード例 #8
0
    def testKeepAffinity(self):
        taskset.set(os.getpid(), self.CPU_SET)
        self.assertEquals(taskset.get(os.getpid()), self.CPU_SET)

        try:
            proc = utils.execCmd((EXT_SLEEP, '30s'),
                                 sync=False,
                                 resetCpuAffinity=False)

            self.assertEquals(taskset.get(proc.pid), self.CPU_SET)
        finally:
            proc.kill()
コード例 #9
0
ファイル: vdsmd.py プロジェクト: kkoojjyy/vdsm
def __set_cpu_affinity():
    cpu_affinity = config.get('vars', 'cpu_affinity')
    if cpu_affinity == "":
        return

    online_cpus = taskset.online_cpus()

    log = logging.getLogger('vds')

    if len(online_cpus) == 1:
        log.debug('Only one cpu detected: affinity disabled')
        return

    if cpu_affinity.lower() == taskset.AUTOMATIC:
        cpu_set = frozenset((taskset.pick_cpu(online_cpus), ))
    else:
        cpu_set = frozenset(
            int(cpu.strip()) for cpu in cpu_affinity.split(","))

    log.info('VDSM will run with cpu affinity: %s', cpu_set)
    taskset.set(os.getpid(), cpu_set, all_tasks=True)
コード例 #10
0
ファイル: vdsmd.py プロジェクト: nirs/vdsm
def __set_cpu_affinity():
    cpu_affinity = config.get('vars', 'cpu_affinity')
    if cpu_affinity == "":
        return

    online_cpus = taskset.online_cpus()

    log = logging.getLogger('vds')

    if len(online_cpus) == 1:
        log.debug('Only one cpu detected: affinity disabled')
        return

    if cpu_affinity.lower() == taskset.AUTOMATIC:
        cpu_set = frozenset((taskset.pick_cpu(online_cpus),))
    else:
        cpu_set = frozenset(int(cpu.strip())
                            for cpu in cpu_affinity.split(","))

    log.info('VDSM will run with cpu affinity: %s', cpu_set)
    taskset.set(os.getpid(), cpu_set, all_tasks=True)
コード例 #11
0
ファイル: taskset_test.py プロジェクト: rollandf/vdsm
 def _run_child(self, cpu_set=None):
     if cpu_set:
         taskset.set(os.getpid(), cpu_set)
     self.running.set()
     self.stop.wait()
コード例 #12
0
ファイル: tasksetTests.py プロジェクト: germanovm/vdsm
 def _run_child(self, cpu_set=None):
     if cpu_set:
         taskset.set(os.getpid(), cpu_set)
     self.running.set()
     self.stop.wait()