update noisy_neighbor 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: I4f041ad25353d575c276fce87fe13c5e6705754f
This commit is contained in:
@@ -229,9 +229,9 @@ class NoisyNeighbor(base.NoisyNeighborBaseStrategy):
|
||||
dest_servers = []
|
||||
for host in hosts:
|
||||
cores_used, mem_used, disk_used = self.calc_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 disk_available >=
|
||||
required_disk and mem_available >= required_memory):
|
||||
dest_servers.append(host)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<ModelRoot>
|
||||
<ComputeNode uuid="Node_0" status="enabled" state="up" id="0" hostname="hostname_0" vcpus="50" disk="250" disk_capacity="250" memory="132">
|
||||
<ComputeNode uuid="Node_0" status="enabled" state="up" id="0" hostname="hostname_0" vcpus="50" 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="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}, "watcher-priority": "8"}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||
<Instance watcher_exclude="False" state="active" name="" uuid="cae81432-1631-4d4e-b29c-6f3acdcde906" vcpus="15" disk="20" disk_capacity="20" memory="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}, "watcher-priority": "4"}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||
</ComputeNode>
|
||||
<ComputeNode uuid="Node_1" status="enabled" state="up" id="1" hostname="hostname_1" vcpus="50" disk="250" disk_capacity="250" memory="132">
|
||||
<ComputeNode uuid="Node_1" status="enabled" state="up" id="1" hostname="hostname_1" vcpus="50" 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="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}, "watcher-priority": "1"}' 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="2" metadata='{"optimize": true,"top": "floor", "nested": {"x": "y"}, "watcher-priority": "9"}' project_id="91FFFE30-78A0-4152-ACD2-8310FF274DC9"/>
|
||||
</ComputeNode>
|
||||
|
||||
Reference in New Issue
Block a user