Merge "set disk field to disk capacity"

This commit is contained in:
Zuul
2019-07-27 03:05:43 +00:00
committed by Gerrit Code Review
3 changed files with 13 additions and 3 deletions

View File

@@ -356,7 +356,12 @@ class NovaModelBuilder(base.BaseModelBuilder):
"memory_ratio": memory_ratio,
"memory_mb_reserved": memory_mb_reserved,
"memory_mb_used": memory_used,
"disk": node.free_disk_gb,
# 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
# capacity and then remove disk_capacity.
"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,

View File

@@ -133,7 +133,12 @@ class NovaNotification(base.NotificationEndpoint):
status=_node.status,
memory=_node.memory_mb,
vcpus=_node.vcpus,
disk=_node.free_disk_gb,
# 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
# capacity and then remove disk_capacity.
disk=_node.local_gb,
# TODO(licanwei): remove and replace by disk field
disk_capacity=_node.local_gb,
)
self.cluster_data_model.add_node(node)

View File

@@ -313,7 +313,7 @@ class TestNovaNotifications(NotificationTestCase):
node_2 = compute_model.get_node_by_name('Node_2')
self.assertEqual(7777, node_2.memory)
self.assertEqual(42, node_2.vcpus)
self.assertEqual(974, node_2.disk)
self.assertEqual(1337, node_2.disk)
self.assertEqual(1337, node_2.disk_capacity)
@mock.patch.object(nova_helper, "NovaHelper")