diff --git a/nova_powervm/tests/virt/powervm/test_driver.py b/nova_powervm/tests/virt/powervm/test_driver.py index 7fc10713..98f1aca8 100644 --- a/nova_powervm/tests/virt/powervm/test_driver.py +++ b/nova_powervm/tests/virt/powervm/test_driver.py @@ -1596,7 +1596,7 @@ class TestPowerVMDriver(test.NoDBTestCase): self.assertIsNotNone(value) @contextlib.contextmanager - def _update_provider_tree(self): + def _update_provider_tree(self, allocations=None): """Host resource dict gets converted properly to provider tree inv.""" with mock.patch('nova_powervm.virt.powervm.host.' @@ -1632,7 +1632,8 @@ class TestPowerVMDriver(test.NoDBTestCase): ptree.new_root('compute_host', uuids.cn) # Let the caller muck with these yield ptree, exp_inv - self.drv.update_provider_tree(ptree, 'compute_host') + self.drv.update_provider_tree(ptree, 'compute_host', + allocations=allocations) self.assertEqual(exp_inv, ptree.data('compute_host').inventory) mock_bhrfm.assert_called_once_with('host_wrapper') @@ -1642,6 +1643,10 @@ class TestPowerVMDriver(test.NoDBTestCase): with self._update_provider_tree(): pass + def test_update_provider_tree_ignore_allocations(self): + with self._update_provider_tree(allocations="This is ignored"): + pass + def test_update_provider_tree_conf_overrides(self): # Non-default CONF values for allocation ratios and reserved. self.flags(cpu_allocation_ratio=12.3, diff --git a/nova_powervm/virt/powervm/driver.py b/nova_powervm/virt/powervm/driver.py index a6c88570..c642ff51 100644 --- a/nova_powervm/virt/powervm/driver.py +++ b/nova_powervm/virt/powervm/driver.py @@ -987,7 +987,7 @@ class PowerVMDriver(driver.ComputeDriver): return data - def update_provider_tree(self, provider_tree, nodename): + def update_provider_tree(self, provider_tree, nodename, allocations=None): """Update a ProviderTree with current provider and inventory data. :param nova.compute.provider_tree.ProviderTree provider_tree: @@ -1001,6 +1001,7 @@ class PowerVMDriver(driver.ComputeDriver): String name of the compute node (i.e. ComputeNode.hypervisor_hostname) for which the caller is requesting updated provider information. + :param allocations: Currently ignored by this driver. """ # Get (legacy) resource information. Same as get_available_resource, # but we don't need to refresh self.host_wrapper as it was *just* @@ -1017,8 +1018,7 @@ class PowerVMDriver(driver.ComputeDriver): mem_alloc_ratio = CONF.ram_allocation_ratio or 1.5 mem_reserved = CONF.reserved_host_memory_mb disk_alloc_ratio = CONF.disk_allocation_ratio or 1.0 - disk_reserved = compute_utils.convert_mb_to_ceil_gb( - CONF.reserved_host_disk_mb) + disk_reserved = self._get_reserved_host_disk_gb_from_config() inventory = { rc_fields.ResourceClass.VCPU: {