1 # ############################################################################
2 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 # ############################################################################
10 from __future__ import print_function
11 from __future__ import absolute_import
15 from yardstick.benchmark.scenarios import base
17 LOG = logging.getLogger(__name__)
20 class CheckNumaInfo(base.Scenario):
22 Execute a live migration for two hosts
26 __scenario_type__ = "CheckNumaInfo"
28 def __init__(self, scenario_cfg, context_cfg):
29 self.scenario_cfg = scenario_cfg
30 self.context_cfg = context_cfg
32 self.options = self.scenario_cfg.get('options', {})
34 self.cpu_set = self.options.get('cpu_set', '1,2,3,4,5,6')
36 def run(self, result):
37 info1 = self.options.get('info1')
38 info2 = self.options.get('info2')
39 LOG.debug('Origin numa info: %s', info1)
40 LOG.debug('Current numa info: %s', info2)
41 status = self._check_vm2_status(info1, info2)
43 keys = self.scenario_cfg.get('output', '').split()
45 return self._push_to_outputs(keys, values)
47 def _check_vm2_status(self, info1, info2):
48 if len(info1['pinning']) != 1 or len(info2['pinning']) != 1:
51 for i in info1['vcpupin']:
52 for j in i['cpuset'].split(','):
53 if j not in self.cpu_set.split(','):
56 for i in info2['vcpupin']:
57 for j in i['cpuset'].split(','):
58 if j not in self.cpu_set.split(','):