Merge "update workload_balance strategy"

This commit is contained in:
Zuul 2019-08-12 02:15:57 +00:00 committed by Gerrit Code Review
commit 5fe32a62e0
3 changed files with 6 additions and 6 deletions

View File

@ -205,9 +205,9 @@ class WorkloadBalance(base.WorkloadStabilizationBaseStrategy):
# calculate the available resources
cores_used, mem_used, disk_used = self.calculate_used_resource(
host)
cores_available = host.vcpus - cores_used
disk_available = host.disk - disk_used
mem_available = host.memory - mem_used
cores_available = host.vcpu_capacity - cores_used
disk_available = host.disk_gb_capacity - disk_used
mem_available = host.memory_mb_capacity - mem_used
if (cores_available >= required_cores and
mem_available >= required_mem and
disk_available >= required_disk):

View File

@ -1,3 +1,3 @@
<ModelRoot>
<ComputeNode name="" uuid="Node_0" status="enabled" state="up" id="0" hostname="hostname_0" vcpus="1" disk="1" disk_capacity="1" memory="1"/>
<ComputeNode name="" uuid="Node_0" status="enabled" state="up" id="0" hostname="hostname_0" vcpus="1" vcpu_reserved="0" vcpu_ratio="1" disk="1" disk_gb_reserved="0" disk_ratio="1" disk_capacity="1" memory="1" memory_mb_reserved="0" memory_ratio="1"/>
</ModelRoot>

View File

@ -1,9 +1,9 @@
<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="" uuid="73b09e16-35b7-4922-804e-e8f5d9b740fc" vcpus="10" disk="20" disk_capacity="20" memory="32" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
<Instance watcher_exclude="False" state="active" name="" uuid="INSTANCE_1" vcpus="10" disk="20" disk_capacity="20" memory="32" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
</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="" uuid="INSTANCE_3" vcpus="10" disk="20" disk_capacity="20" memory="32" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
<Instance watcher_exclude="False" state="active" name="" uuid="INSTANCE_4" vcpus="10" disk="20" disk_capacity="20" memory="32" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
</ComputeNode>