def testVmNumaNodeRuntimeInfo(self): VM_PARAMS = {'guestNumaNodes': [{'cpus': '0,1', 'memory': '1024', 'nodeIndex': 0}, {'cpus': '2,3', 'memory': '1024', 'nodeIndex': 1}]} with fake.VM(VM_PARAMS) as testvm: testvm._vmStats = FakeVmStatsThread(testvm) expectedResult = {'0': [0, 1], '1': [0, 1]} vmNumaNodeRuntimeMap = numaUtils.getVmNumaNodeRuntimeInfo(testvm) self.assertEqual(expectedResult, vmNumaNodeRuntimeMap)
def testVmNumaNodeRuntimeInfo(self): VM_PARAMS = {'guestNumaNodes': [{'cpus': '0,1', 'memory': '1024', 'nodeIndex': 0}, {'cpus': '2,3', 'memory': '1024', 'nodeIndex': 1}]} with vmTests.FakeVM(VM_PARAMS) as fake: fake._vmStats = FakeVmStatsThread(fake) expectedResult = {'0': [0, 1], '1': [0, 1]} vmNumaNodeRuntimeMap = numaUtils.getVmNumaNodeRuntimeInfo(fake) self.assertEqual(expectedResult, vmNumaNodeRuntimeMap)
def testVmNumaNodeRuntimeInfo(self): VM_PARAMS = {'guestNumaNodes': [{'cpus': '0,1', 'memory': '1024', 'nodeIndex': 0}, {'cpus': '2,3', 'memory': '1024', 'nodeIndex': 1}]} with fake.VM(VM_PARAMS) as testvm: expectedResult = {'0': [0, 1], '1': [0, 1]} self.assertTrue(testvm.hasGuestNumaNode) sample = [(0, 1, 19590000000, 1), (1, 1, 10710000000, 1), (2, 1, 19590000000, 0), (3, 1, 19590000000, 2)] with MonkeyPatchScope([(numaUtils, "_get_vcpu_positioning", lambda vm: sample)]): vm_numa_info = numaUtils.getVmNumaNodeRuntimeInfo(testvm) self.assertEqual(expectedResult, vm_numa_info)
def testVmNumaNodeRuntimeInfo(self): VM_PARAMS = {'guestNumaNodes': [{'cpus': '0,1', 'memory': '1024', 'nodeIndex': 0}, {'cpus': '2,3', 'memory': '1024', 'nodeIndex': 1}]} with fake.VM(VM_PARAMS) as testvm: expectedResult = {'0': [0, 1], '1': [0, 1]} self.assertTrue(testvm.hasGuestNumaNode) sample = [(0, 1, 19590000000L, 1), (1, 1, 10710000000L, 1), (2, 1, 19590000000L, 0), (3, 1, 19590000000L, 2)] with MonkeyPatchScope([(numaUtils, "_get_vcpu_positioning", lambda vm: sample)]): vm_numa_info = numaUtils.getVmNumaNodeRuntimeInfo(testvm) self.assertEqual(expectedResult, vm_numa_info)