Skip to content

Commit df065e9

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "allow upgrade of pre-victoria InstanceNUMACells" into unmaintained/2023.1
2 parents f0d01fd + 4c9267c commit df065e9

File tree

3 files changed

+33
-17
lines changed

3 files changed

+33
-17
lines changed

nova/objects/instance_numa.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import itertools
1616

17+
from oslo_log import log as logging
1718
from oslo_serialization import jsonutils
1819
from oslo_utils import versionutils
1920

@@ -24,6 +25,8 @@
2425
from nova.objects import fields as obj_fields
2526
from nova.virt import hardware
2627

28+
LOG = logging.getLogger(__name__)
29+
2730

2831
# TODO(berrange): Remove NovaObjectDictCompat
2932
@base.NovaObjectRegistry.register
@@ -61,6 +64,11 @@ def obj_make_compatible(self, primitive, target_version):
6164
obj_fields.CPUAllocationPolicy.DEDICATED):
6265
primitive['cpuset'] = primitive['pcpuset']
6366
primitive.pop('pcpuset', None)
67+
LOG.warning(
68+
f'Downgrading InstanceNUMACell to version {target_version} '
69+
f'may cause the loss of pinned CPUs if mixing different '
70+
f'verisons of nova on different hosts. This should not '
71+
f'happen on any supported version after Victoria.')
6472

6573
if target_version < (1, 4):
6674
primitive.pop('cpuset_reserved', None)
@@ -191,17 +199,15 @@ def _migrate_legacy_dedicated_instance_cpuset(cls, obj):
191199
if len(cell.cpuset) == 0:
192200
continue
193201

194-
if cell.cpu_policy != obj_fields.CPUAllocationPolicy.DEDICATED:
195-
# FIXME(sean-k-mooney): we should be setting the pcpuset
196-
# to an empty set here
197-
# if not 'pcpuset' in cell:
198-
# cell.pcpuset = set()
199-
# update_db = True
200-
continue
202+
if cell.cpu_policy == obj_fields.CPUAllocationPolicy.DEDICATED:
203+
cell.pcpuset = cell.cpuset
204+
cell.cpuset = set()
205+
update_db = True
206+
else:
207+
if 'pcpuset' not in cell:
208+
cell.pcpuset = set()
209+
update_db = True
201210

202-
cell.pcpuset = cell.cpuset
203-
cell.cpuset = set()
204-
update_db = True
205211
return update_db
206212

207213
# TODO(huaqiang): Remove after Yoga once we are sure these objects have

nova/tests/unit/objects/test_instance_numa.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,7 @@ def test_obj_from_db_obj_no_pinning(self):
409409
numa_topology.cells,
410410
fake_topo_obj_w_cell_v1_4['cells']):
411411
self.assertEqual(topo_cell.cpuset, obj_cell.cpuset)
412-
# 'pcpuset' should be an empty set however
413-
# obj_from_db_obj() or more specifically
414-
# _migrate_legacy_dedicated_instance_cpuset() does not set
415-
# 'pcpuset' to an empty set when it is not in the json data.
416-
# self.assertEqual(set(), obj_cell.pcpuset)
417-
self.assertRaises(
418-
NotImplementedError, getattr, obj_cell, 'pcpuset')
412+
self.assertEqual(set(), obj_cell.pcpuset)
419413

420414

421415
class TestInstanceNUMATopology(
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
upgrade:
3+
- |
4+
In the victoria release, the instance_numa_topology object
5+
was extended to enabled mix cpus (pinned and unpinned cpus)
6+
in the same instance. This change added a new field pcpuset
7+
to the instance_numa_topology object. While the change included
8+
object conversion code to handle the upgrade, it did not account
9+
for instances that have a numa_topology but were not pinned.
10+
i.e. a flavor with hw:mem_page_size or hw:numa_nodes set but
11+
without hw:cpu_policy set to dedicated. As a result, instances
12+
created between liberty and victoria releases with such a flavor
13+
cannot be started after upgrade to victoria. This has now
14+
been fixed. instances created post victoria are not affected by
15+
this issue. see: https://bugs.launchpad.net/nova/+bug/2080556
16+
for more details.

0 commit comments

Comments
 (0)