@@ -1944,9 +1944,6 @@ def numa_get_constraints(flavor, image_meta):
1944
1944
# 'dedicated' policy.
1945
1945
if dedicated_cpus :
1946
1946
raise exception .RequiredMixedInstancePolicy ()
1947
- # But for an instance with 'dedicated' CPU allocation policy, all
1948
- # CPUs are 'dedicated' CPUs, which is 1:1 pinned to a host CPU.
1949
- dedicated_cpus = set (range (flavor .vcpus ))
1950
1947
else : # MIXED
1951
1948
# FIXME(huaqiang): So far, 'mixed' instance is not supported
1952
1949
# and the 'dedicated_cpus' variable is set to 'None' due to being not
@@ -1960,7 +1957,13 @@ def numa_get_constraints(flavor, image_meta):
1960
1957
pagesize = _get_numa_pagesize_constraint (flavor , image_meta )
1961
1958
vpmems = get_vpmems (flavor )
1962
1959
1960
+ # If 'hw:cpu_dedicated_mask' is not found in flavor extra specs, the
1961
+ # 'dedicated_cpus' variable is None, while we hope it being an empty set.
1963
1962
dedicated_cpus = dedicated_cpus or set ()
1963
+ if cpu_policy == fields .CPUAllocationPolicy .DEDICATED :
1964
+ # But for an instance with 'dedicated' CPU allocation policy, all
1965
+ # CPUs are 'dedicated' CPUs, which is 1:1 pinned to a host CPU.
1966
+ dedicated_cpus = set (range (flavor .vcpus ))
1964
1967
1965
1968
# NOTE(stephenfin): There are currently four things that will configure a
1966
1969
# NUMA topology for an instance:
0 commit comments