Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
hyperv: report disk_available_least field
Browse files Browse the repository at this point in the history
Reporting the disk_available_least field can help in making sure
the scheduler doesn't pick a host that cannot fit a specific flavor's
disk.

The reported local_gb_used is calculated based on the instances spawned
by nova on a certain compute node, and might not reflect the actual
reality, especially on shared storage scenarios.

Change-Id: I20992acef119f11f6584094438043a760fc4a287
Closes-Bug: #1717892
(cherry picked from commit 6479f55)
  • Loading branch information
claudiubelu committed Sep 19, 2017
1 parent b9063f3 commit 47c6e67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compute_hyperv/nova/hostops.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,17 @@ def get_available_resource(self):
cpu_topology['cores'] *
cpu_topology['threads'])

# NOTE(claudiub): free_hdd_gb only refers to the currently free
# physical storage, it doesn't take into consideration the virtual
# sizes of the VMs' dynamic disks. This means that the VMs' disks can
# expand beyond the free_hdd_gb's value, and instances will still be
# scheduled to this compute node.
dic = {'vcpus': vcpus,
'memory_mb': total_mem_mb,
'memory_mb_used': used_mem_mb,
'local_gb': total_hdd_gb,
'local_gb_used': used_hdd_gb,
'disk_available_least': free_hdd_gb,
'hypervisor_type': "hyperv",
'hypervisor_version': self._get_hypervisor_version(),
'hypervisor_hostname': self.get_hostname(),
Expand Down
1 change: 1 addition & 0 deletions compute_hyperv/tests/unit/test_hostops.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def test_get_available_resource(self, mock_node,
'memory_mb_used': mock.sentinel.MEMORY_MB_USED,
'local_gb': mock.sentinel.LOCAL_GB,
'local_gb_used': mock.sentinel.LOCAL_GB_USED,
'disk_available_least': mock.sentinel.LOCAL_GB_FREE,
'vcpus': self.FAKE_NUM_CPUS,
'vcpus_used': 0,
'hypervisor_type': 'hyperv',
Expand Down

0 comments on commit 47c6e67

Please sign in to comment.