PowerVM upt parity for reshaper, DISK_GB reserved
bp reshape-provider-tree patch introduced the 'allocations' kwarg [1] and another patch provided a ComputeDriver helper method for calculating the reserved value for the DISK_GB resource from config [2]. This brings PowerVM's update_provider_tree method up to scratch with those changes. [1] Ic062446e5c620c89aec3065b34bcdc6bf5966275 [2] I72c83a95dabd581998470edb9543079acb6536a5 Change-Id: I89ad36f19672368a1f795e1f29c5af6368ccfeec
This commit is contained in:
parent
00a9526314
commit
bfec94277f
|
@ -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,
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Reference in New Issue