|
14 | 14 |
|
15 | 15 | import itertools
|
16 | 16 |
|
| 17 | +from oslo_log import log as logging |
17 | 18 | from oslo_serialization import jsonutils
|
18 | 19 | from oslo_utils import versionutils
|
19 | 20 |
|
|
24 | 25 | from nova.objects import fields as obj_fields
|
25 | 26 | from nova.virt import hardware
|
26 | 27 |
|
| 28 | +LOG = logging.getLogger(__name__) |
| 29 | + |
27 | 30 |
|
28 | 31 | # TODO(berrange): Remove NovaObjectDictCompat
|
29 | 32 | @base.NovaObjectRegistry.register
|
@@ -61,6 +64,11 @@ def obj_make_compatible(self, primitive, target_version):
|
61 | 64 | obj_fields.CPUAllocationPolicy.DEDICATED):
|
62 | 65 | primitive['cpuset'] = primitive['pcpuset']
|
63 | 66 | 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.') |
64 | 72 |
|
65 | 73 | if target_version < (1, 4):
|
66 | 74 | primitive.pop('cpuset_reserved', None)
|
@@ -191,17 +199,15 @@ def _migrate_legacy_dedicated_instance_cpuset(cls, obj):
|
191 | 199 | if len(cell.cpuset) == 0:
|
192 | 200 | continue
|
193 | 201 |
|
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 |
201 | 210 |
|
202 |
| - cell.pcpuset = cell.cpuset |
203 |
| - cell.cpuset = set() |
204 |
| - update_db = True |
205 | 211 | return update_db
|
206 | 212 |
|
207 | 213 | # TODO(huaqiang): Remove after Yoga once we are sure these objects have
|
|
0 commit comments