hyperv: report disk_available_least field

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
This commit is contained in:
Claudiu Belu 2017-09-18 13:19:59 +03:00
parent bd12ddf55e
commit 6479f5539d
2 changed files with 7 additions and 0 deletions

View File

@ -170,11 +170,17 @@ class HostOps(object):
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(),

View File

@ -203,6 +203,7 @@ class HostOpsTestCase(test_base.HyperVBaseTestCase):
'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',