Fix missing the cpu_pinning request
When boot instance with dedicated cpu_policy, the cpu_pinning field of InstanceNUMATopology is '{}'. But the function 'instance_topology_from_instance' just missed that fields when convert instance numa topology dict back to object. That leads to the cpu_pinning just ignored. This patch fixed that. Change-Id: I8711cdc59c7455b3c8f94c68ab7f38d96ce168c4 Closes-Bug: #1436823
This commit is contained in:
parent
1fb09cc821
commit
58256b6a39
|
@ -22,6 +22,7 @@ from nova import context
|
||||||
from nova import exception
|
from nova import exception
|
||||||
from nova import objects
|
from nova import objects
|
||||||
from nova.objects import base as base_obj
|
from nova.objects import base as base_obj
|
||||||
|
from nova.objects import instance as instance_obj
|
||||||
from nova.pci import stats
|
from nova.pci import stats
|
||||||
from nova import test
|
from nova import test
|
||||||
from nova.virt import hardware as hw
|
from nova.virt import hardware as hw
|
||||||
|
@ -1524,9 +1525,11 @@ class HelperMethodsTestCase(test.NoDBTestCase):
|
||||||
instance_uuid='fake-uuid',
|
instance_uuid='fake-uuid',
|
||||||
cells=[
|
cells=[
|
||||||
objects.InstanceNUMACell(
|
objects.InstanceNUMACell(
|
||||||
id=0, cpuset=set([0, 1]), memory=256, pagesize=2048),
|
id=0, cpuset=set([0, 1]), memory=256, pagesize=2048,
|
||||||
|
cpu_pinning={1: 3, 0: 4}),
|
||||||
objects.InstanceNUMACell(
|
objects.InstanceNUMACell(
|
||||||
id=1, cpuset=set([2]), memory=256, pagesize=2048),
|
id=1, cpuset=set([2]), memory=256, pagesize=2048,
|
||||||
|
cpu_pinning={2: 5}),
|
||||||
])
|
])
|
||||||
self.context = context.RequestContext('fake-user',
|
self.context = context.RequestContext('fake-user',
|
||||||
'fake-project')
|
'fake-project')
|
||||||
|
@ -1651,6 +1654,18 @@ class HelperMethodsTestCase(test.NoDBTestCase):
|
||||||
self.assertIsInstance(res, objects.NUMATopology)
|
self.assertIsInstance(res, objects.NUMATopology)
|
||||||
self._check_usage(res)
|
self._check_usage(res)
|
||||||
|
|
||||||
|
def test_dict_numa_topology_to_obj(self):
|
||||||
|
fake_uuid = str(uuid.uuid4())
|
||||||
|
instance = objects.Instance(context=self.context, id=1, uuid=fake_uuid,
|
||||||
|
numa_topology=self.instancetopo)
|
||||||
|
instance_dict = instance_obj.compat_instance(instance)
|
||||||
|
instance_numa_topo = hw.instance_topology_from_instance(instance_dict)
|
||||||
|
for expected_cell, actual_cell in zip(self.instancetopo.cells,
|
||||||
|
instance_numa_topo.cells):
|
||||||
|
for k in expected_cell.fields:
|
||||||
|
self.assertEqual(getattr(expected_cell, k),
|
||||||
|
getattr(actual_cell, k))
|
||||||
|
|
||||||
|
|
||||||
class VirtMemoryPagesTestCase(test.NoDBTestCase):
|
class VirtMemoryPagesTestCase(test.NoDBTestCase):
|
||||||
def test_cell_instance_pagesize(self):
|
def test_cell_instance_pagesize(self):
|
||||||
|
|
|
@ -1151,7 +1151,8 @@ def instance_topology_from_instance(instance):
|
||||||
id=cell['id'],
|
id=cell['id'],
|
||||||
cpuset=set(cell['cpuset']),
|
cpuset=set(cell['cpuset']),
|
||||||
memory=cell['memory'],
|
memory=cell['memory'],
|
||||||
pagesize=cell.get('pagesize'))
|
pagesize=cell.get('pagesize'),
|
||||||
|
cpu_pinning=cell.get('cpu_pinning_raw'))
|
||||||
for cell in dict_cells]
|
for cell in dict_cells]
|
||||||
instance_numa_topology = objects.InstanceNUMATopology(
|
instance_numa_topology = objects.InstanceNUMATopology(
|
||||||
cells=cells)
|
cells=cells)
|
||||||
|
|
Loading…
Reference in New Issue