update host_maintenance strategy
For Compute node, we can use the new property to calculate resource(VCPU, memory and disk). Partially Implements: blueprint improve-compute-data-model Depends-on: I3f9a3279a26f3df444117d9265e74cca57b38d6e Change-Id: I2bb230b5f5a573fb3045261dfdee73f1a8434e0d
This commit is contained in:
@@ -133,9 +133,9 @@ class HostMaintenance(base.HostMaintenanceBaseStrategy):
|
|||||||
:param node: node object
|
:param node: node object
|
||||||
:return: dict(cpu(cores), ram(MB), disk(B))
|
:return: dict(cpu(cores), ram(MB), disk(B))
|
||||||
"""
|
"""
|
||||||
return dict(cpu=node.vcpus,
|
return dict(cpu=node.vcpu_capacity,
|
||||||
ram=node.memory,
|
ram=node.memory_mb_capacity,
|
||||||
disk=node.disk)
|
disk=node.disk_gb_capacity)
|
||||||
|
|
||||||
def get_node_used(self, node):
|
def get_node_used(self, node):
|
||||||
"""Collect cpu, ram and disk used of a node.
|
"""Collect cpu, ram and disk used of a node.
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
<ModelRoot>
|
<ModelRoot>
|
||||||
<ComputeNode uuid="Node_0" status="enabled" state="up" id="0" hostname="hostname_0" vcpus="40" disk="250" disk_capacity="250" memory="132">
|
<ComputeNode uuid="Node_0" status="enabled" state="up" id="0" hostname="hostname_0" vcpus="40" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" memory="132" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" state="active" name="INSTANCE_0" uuid="INSTANCE_0" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" state="active" name="INSTANCE_0" uuid="INSTANCE_0" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
<Instance watcher_exclude="False" state="active" name="INSTANCE_1" uuid="INSTANCE_1" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="26F03131-32CB-4697-9D61-9123F87A8147"/>
|
<Instance watcher_exclude="False" state="active" name="INSTANCE_1" uuid="INSTANCE_1" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="26F03131-32CB-4697-9D61-9123F87A8147"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
<ComputeNode uuid="Node_1" status="enabled" state="up" id="1" hostname="hostname_1" vcpus="40" disk="250" disk_capacity="250" memory="132">
|
<ComputeNode uuid="Node_1" status="enabled" state="up" id="1" hostname="hostname_1" vcpus="40" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" memory="132" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" state="active" name="INSTANCE_2" uuid="INSTANCE_2" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="109F7909-0607-4712-B32C-5CC6D49D2F15"/>
|
<Instance watcher_exclude="False" state="active" name="INSTANCE_2" uuid="INSTANCE_2" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="109F7909-0607-4712-B32C-5CC6D49D2F15"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
<ComputeNode uuid="Node_2" status="enabled" state="up" id="2" hostname="hostname_2" vcpus="40" disk="250" disk_capacity="250" memory="132">
|
<ComputeNode uuid="Node_2" status="enabled" state="up" id="2" hostname="hostname_2" vcpus="40" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" memory="132" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" state="active" name="INSTANCE_3" uuid="INSTANCE_3" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" state="active" name="INSTANCE_3" uuid="INSTANCE_3" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
<Instance watcher_exclude="False" state="active" name="INSTANCE_4" uuid="INSTANCE_4" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" state="active" name="INSTANCE_4" uuid="INSTANCE_4" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
<Instance watcher_exclude="False" state="active" name="INSTANCE_5" uuid="INSTANCE_5" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" state="active" name="INSTANCE_5" uuid="INSTANCE_5" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
<ComputeNode uuid="Node_3" status="enabled" state="up" id="3" hostname="hostname_3" vcpus="40" disk="250" disk_capacity="250" memory="132">
|
<ComputeNode uuid="Node_3" status="enabled" state="up" id="3" hostname="hostname_3" vcpus="40" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" memory="132" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" state="active" name="INSTANCE_6" uuid="INSTANCE_6" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" state="active" name="INSTANCE_6" uuid="INSTANCE_6" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
<ComputeNode uuid="Node_4" status="enabled" state="up" id="4" hostname="hostname_4" vcpus="40" disk="250" disk_capacity="250" memory="132">
|
<ComputeNode uuid="Node_4" status="enabled" state="up" id="4" hostname="hostname_4" vcpus="40" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" memory="132" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" state="active" name="INSTANCE_7" uuid="INSTANCE_7" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" state="active" name="INSTANCE_7" uuid="INSTANCE_7" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
<Instance watcher_exclude="False" state="active" name="INSTANCE_10" uuid="INSTANCE_10" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" state="active" name="INSTANCE_10" uuid="INSTANCE_10" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<ModelRoot>
|
<ModelRoot>
|
||||||
<ComputeNode hostname="hostname_0" uuid="Node_0" id="0" state="up" status="disabled" vcpus="40" disk="250" disk_capacity="250" disabled_reason='watcher_disabled' memory="64">
|
<ComputeNode hostname="hostname_0" uuid="Node_0" id="0" state="up" status="disabled" vcpus="40" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" disabled_reason='watcher_disabled' memory="64" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_0" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_0" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
<ComputeNode hostname="hostname_1" uuid="Node_1" id="1" state="up" status="disabled" vcpus="40" disk="250" disk_capacity="250" disabled_reason='watcher_disabled' memory="64">
|
<ComputeNode hostname="hostname_1" uuid="Node_1" id="1" state="up" status="disabled" vcpus="40" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" disabled_reason='watcher_disabled' memory="64" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_1" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_1" vcpus="10" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
</ModelRoot>
|
</ModelRoot>
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<ModelRoot>
|
<ModelRoot>
|
||||||
<ComputeNode hostname="hostname_0" uuid="Node_0" id="0" state="up" status="enabled" vcpus="16" disk="250" disk_capacity="250" memory="64">
|
<ComputeNode hostname="hostname_0" uuid="Node_0" id="0" state="up" status="enabled" vcpus="16" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" memory="64" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_0" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_0" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_1" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_1" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_2" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_2" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
<ComputeNode hostname="hostname_1" uuid="Node_1" id="1" state="up" status="enabled" vcpus="16" disk="250" disk_capacity="250" memory="64">
|
<ComputeNode hostname="hostname_1" uuid="Node_1" id="1" state="up" status="enabled" vcpus="16" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" memory="64" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_3" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_3" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
<ComputeNode hostname="hostname_2" uuid="Node_2" id="2" state="up" status="enabled" vcpus="16" disk="250" disk_capacity="250" memory="64">
|
<ComputeNode hostname="hostname_2" uuid="Node_2" id="2" state="up" status="enabled" vcpus="16" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" memory="64" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_4" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_4" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
<ComputeNode hostname="hostname_3" uuid="Node_3" id="3" state="up" status="disabled" disabled_reason='watcher_disabled' vcpus="16" disk="250" disk_capacity="250" memory="64">
|
<ComputeNode hostname="hostname_3" uuid="Node_3" id="3" state="up" status="disabled" disabled_reason='watcher_disabled' vcpus="16" vcpu_reserved="0" vcpu_ratio="1" disk="250" disk_gb_reserved="0" disk_ratio="1" disk_capacity="250" memory="64" memory_mb_reserved="0" memory_ratio="1">
|
||||||
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_5" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
<Instance watcher_exclude="False" name="" state="active" uuid="INSTANCE_5" vcpus="2" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||||
</ComputeNode>
|
</ComputeNode>
|
||||||
</ModelRoot>
|
</ModelRoot>
|
||||||
|
|||||||
@@ -82,9 +82,15 @@ class FakerModelCollector(base.BaseClusterDataModelCollector):
|
|||||||
"uuid": node_uuid,
|
"uuid": node_uuid,
|
||||||
"hostname": hostname,
|
"hostname": hostname,
|
||||||
"memory": 132,
|
"memory": 132,
|
||||||
|
"memory_mb_reserved": 0,
|
||||||
|
"memory_ratio": 1,
|
||||||
"disk": 250,
|
"disk": 250,
|
||||||
"disk_capacity": 250,
|
"disk_capacity": 250,
|
||||||
|
"disk_gb_reserved": 0,
|
||||||
|
"disk_ratio": 1,
|
||||||
"vcpus": 40,
|
"vcpus": 40,
|
||||||
|
"vcpu_reserved": 0,
|
||||||
|
"vcpu_ratio": 1,
|
||||||
}
|
}
|
||||||
node = element.ComputeNode(**node_attributes)
|
node = element.ComputeNode(**node_attributes)
|
||||||
model.add_node(node)
|
model.add_node(node)
|
||||||
|
|||||||
Reference in New Issue
Block a user