Virt: use flavor object and not flavor dict
The the hardware methods a flavor object is passed to the methods so we should use the dot notation. TrivailFix Change-Id: I32f7ac6ba6ffa278ed6abf01ef9611199c41f85e
This commit is contained in:
parent
6a24bbeecd
commit
0a24c39d40
|
@ -884,7 +884,7 @@ def _numa_get_constraints_manual(nodes, flavor, image_meta):
|
||||||
cells = []
|
cells = []
|
||||||
totalmem = 0
|
totalmem = 0
|
||||||
|
|
||||||
availcpus = set(range(flavor['vcpus']))
|
availcpus = set(range(flavor.vcpus))
|
||||||
|
|
||||||
for node in range(nodes):
|
for node in range(nodes):
|
||||||
cpus = _numa_get_flavor_or_image_prop(
|
cpus = _numa_get_flavor_or_image_prop(
|
||||||
|
@ -901,9 +901,9 @@ def _numa_get_constraints_manual(nodes, flavor, image_meta):
|
||||||
cpuset = parse_cpu_spec(cpus)
|
cpuset = parse_cpu_spec(cpus)
|
||||||
|
|
||||||
for cpu in cpuset:
|
for cpu in cpuset:
|
||||||
if cpu > (flavor['vcpus'] - 1):
|
if cpu > (flavor.vcpus - 1):
|
||||||
raise exception.ImageNUMATopologyCPUOutOfRange(
|
raise exception.ImageNUMATopologyCPUOutOfRange(
|
||||||
cpunum=cpu, cpumax=(flavor['vcpus'] - 1))
|
cpunum=cpu, cpumax=(flavor.vcpus - 1))
|
||||||
|
|
||||||
if cpu not in availcpus:
|
if cpu not in availcpus:
|
||||||
raise exception.ImageNUMATopologyCPUDuplicates(
|
raise exception.ImageNUMATopologyCPUDuplicates(
|
||||||
|
@ -919,17 +919,17 @@ def _numa_get_constraints_manual(nodes, flavor, image_meta):
|
||||||
raise exception.ImageNUMATopologyCPUsUnassigned(
|
raise exception.ImageNUMATopologyCPUsUnassigned(
|
||||||
cpuset=str(availcpus))
|
cpuset=str(availcpus))
|
||||||
|
|
||||||
if totalmem != flavor['memory_mb']:
|
if totalmem != flavor.memory_mb:
|
||||||
raise exception.ImageNUMATopologyMemoryOutOfRange(
|
raise exception.ImageNUMATopologyMemoryOutOfRange(
|
||||||
memsize=totalmem,
|
memsize=totalmem,
|
||||||
memtotal=flavor['memory_mb'])
|
memtotal=flavor.memory_mb)
|
||||||
|
|
||||||
return objects.InstanceNUMATopology(cells=cells)
|
return objects.InstanceNUMATopology(cells=cells)
|
||||||
|
|
||||||
|
|
||||||
def _numa_get_constraints_auto(nodes, flavor, image_meta):
|
def _numa_get_constraints_auto(nodes, flavor, image_meta):
|
||||||
if ((flavor['vcpus'] % nodes) > 0 or
|
if ((flavor.vcpus % nodes) > 0 or
|
||||||
(flavor['memory_mb'] % nodes) > 0):
|
(flavor.memory_mb % nodes) > 0):
|
||||||
raise exception.ImageNUMATopologyAsymmetric()
|
raise exception.ImageNUMATopologyAsymmetric()
|
||||||
|
|
||||||
cells = []
|
cells = []
|
||||||
|
@ -944,8 +944,8 @@ def _numa_get_constraints_auto(nodes, flavor, image_meta):
|
||||||
if cpus is not None or mem is not None:
|
if cpus is not None or mem is not None:
|
||||||
raise exception.ImageNUMATopologyIncomplete()
|
raise exception.ImageNUMATopologyIncomplete()
|
||||||
|
|
||||||
ncpus = int(flavor['vcpus'] / nodes)
|
ncpus = int(flavor.vcpus / nodes)
|
||||||
mem = int(flavor['memory_mb'] / nodes)
|
mem = int(flavor.memory_mb / nodes)
|
||||||
start = node * ncpus
|
start = node * ncpus
|
||||||
cpuset = set(range(start, start + ncpus))
|
cpuset = set(range(start, start + ncpus))
|
||||||
|
|
||||||
|
@ -979,8 +979,8 @@ def _add_cpu_pinning_constraint(flavor, image_meta, numa_topology):
|
||||||
else:
|
else:
|
||||||
single_cell = objects.InstanceNUMACell(
|
single_cell = objects.InstanceNUMACell(
|
||||||
id=0,
|
id=0,
|
||||||
cpuset=set(range(flavor['vcpus'])),
|
cpuset=set(range(flavor.vcpus)),
|
||||||
memory=flavor['memory_mb'],
|
memory=flavor.memory_mb,
|
||||||
cpu_pinning={})
|
cpu_pinning={})
|
||||||
numa_topology = objects.InstanceNUMATopology(cells=[single_cell])
|
numa_topology = objects.InstanceNUMATopology(cells=[single_cell])
|
||||||
return numa_topology
|
return numa_topology
|
||||||
|
|
Loading…
Reference in New Issue