Remove resource used fields from ComputeNode

The node resource(vcpu, memory and disk) used infomation need
to change when creating or deleting instances. Now Placement do
not send notifications, so there is not a good way to capture
the change. We remove these fields and leave the process to strategy.

Partially Implements: blueprint improve-compute-data-model

Change-Id: I3f9a3279a26f3df444117d9265e74cca57b38d6e
This commit is contained in:
licanwei
2019-08-09 10:28:40 +08:00
parent 152af02bf1
commit 4e4cfc959b
4 changed files with 2 additions and 66 deletions

View File

@@ -341,23 +341,6 @@ class NovaModelBuilder(base.BaseModelBuilder):
disk_gb_reserved = 0
disk_ratio = 1.0
usages = self.placement_helper.get_usages_for_resource_provider(
node.id)
if usages and orc.VCPU in usages:
vcpus_used = usages[orc.VCPU]
else:
vcpus_used = node.vcpus_used
if usages and orc.MEMORY_MB in usages:
memory_used = usages[orc.MEMORY_MB]
else:
memory_used = node.memory_mb_used
if usages and orc.DISK_GB in usages:
disk_used = usages[orc.DISK_GB]
else:
disk_used = node.local_gb_used
# build up the compute node.
node_attributes = {
# The id of the hypervisor as a UUID from version 2.53.
@@ -366,7 +349,6 @@ class NovaModelBuilder(base.BaseModelBuilder):
"memory": memory_mb,
"memory_ratio": memory_ratio,
"memory_mb_reserved": memory_mb_reserved,
"memory_mb_used": memory_used,
# The node.free_disk_gb does not take allocation ratios used
# for overcommit into account so this value may be negative.
# We do not need this field and plan to set disk to total disk
@@ -374,13 +356,11 @@ class NovaModelBuilder(base.BaseModelBuilder):
"disk": disk_capacity,
# TODO(licanwei): remove and replace by disk field
"disk_capacity": disk_capacity,
"disk_gb_used": disk_used,
"disk_gb_reserved": disk_gb_reserved,
"disk_ratio": disk_ratio,
"vcpus": vcpus,
"vcpu_reserved": vcpu_reserved,
"vcpu_ratio": vcpu_ratio,
"vcpus_used": vcpus_used,
"state": node.state,
"status": node.status,
"disabled_reason": node.service["disabled_reason"]}