diff --git a/nova/tests/unit/virt/hyperv/test_hostops.py b/nova/tests/unit/virt/hyperv/test_hostops.py index 378d252594b6..73bb5d8955fe 100644 --- a/nova/tests/unit/virt/hyperv/test_hostops.py +++ b/nova/tests/unit/virt/hyperv/test_hostops.py @@ -197,6 +197,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', diff --git a/nova/virt/hyperv/hostops.py b/nova/virt/hyperv/hostops.py index ca5fe19a3e1c..0ab1c05a7b0a 100644 --- a/nova/virt/hyperv/hostops.py +++ b/nova/virt/hyperv/hostops.py @@ -158,11 +158,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': platform.node(),