Merge "PowerVM upt parity for reshaper, DISK_GB reserved"
This commit is contained in:
commit
5a101e1417
@ -146,7 +146,7 @@ class TestPowerVMDriver(test.NoDBTestCase):
|
|||||||
self.assertEqual('sys', self.drv.host_wrapper)
|
self.assertEqual('sys', self.drv.host_wrapper)
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def _update_provider_tree(self):
|
def _update_provider_tree(self, allocations=None):
|
||||||
"""Host resource dict gets converted properly to provider tree inv."""
|
"""Host resource dict gets converted properly to provider tree inv."""
|
||||||
|
|
||||||
with mock.patch('nova.virt.powervm.host.'
|
with mock.patch('nova.virt.powervm.host.'
|
||||||
@ -182,7 +182,8 @@ class TestPowerVMDriver(test.NoDBTestCase):
|
|||||||
ptree.new_root('compute_host', uuids.cn)
|
ptree.new_root('compute_host', uuids.cn)
|
||||||
# Let the caller muck with these
|
# Let the caller muck with these
|
||||||
yield ptree, exp_inv
|
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)
|
self.assertEqual(exp_inv, ptree.data('compute_host').inventory)
|
||||||
mock_bhrfm.assert_called_once_with('host_wrapper')
|
mock_bhrfm.assert_called_once_with('host_wrapper')
|
||||||
|
|
||||||
@ -192,6 +193,10 @@ class TestPowerVMDriver(test.NoDBTestCase):
|
|||||||
with self._update_provider_tree():
|
with self._update_provider_tree():
|
||||||
pass
|
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):
|
def test_update_provider_tree_conf_overrides(self):
|
||||||
# Non-default CONF values for allocation ratios and reserved.
|
# Non-default CONF values for allocation ratios and reserved.
|
||||||
self.flags(cpu_allocation_ratio=12.3,
|
self.flags(cpu_allocation_ratio=12.3,
|
||||||
|
@ -29,7 +29,6 @@ import six
|
|||||||
from taskflow.patterns import linear_flow as tf_lf
|
from taskflow.patterns import linear_flow as tf_lf
|
||||||
|
|
||||||
from nova.compute import task_states
|
from nova.compute import task_states
|
||||||
from nova.compute import utils as compute_utils
|
|
||||||
from nova import conf as cfg
|
from nova import conf as cfg
|
||||||
from nova.console import type as console_type
|
from nova.console import type as console_type
|
||||||
from nova import exception as exc
|
from nova import exception as exc
|
||||||
@ -170,7 +169,7 @@ class PowerVMDriver(driver.ComputeDriver):
|
|||||||
|
|
||||||
return data
|
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.
|
"""Update a ProviderTree with current provider and inventory data.
|
||||||
|
|
||||||
:param nova.compute.provider_tree.ProviderTree provider_tree:
|
:param nova.compute.provider_tree.ProviderTree provider_tree:
|
||||||
@ -184,6 +183,7 @@ class PowerVMDriver(driver.ComputeDriver):
|
|||||||
String name of the compute node (i.e.
|
String name of the compute node (i.e.
|
||||||
ComputeNode.hypervisor_hostname) for which the caller is requesting
|
ComputeNode.hypervisor_hostname) for which the caller is requesting
|
||||||
updated provider information.
|
updated provider information.
|
||||||
|
:param allocations: Currently ignored by this driver.
|
||||||
"""
|
"""
|
||||||
# Get (legacy) resource information. Same as get_available_resource,
|
# Get (legacy) resource information. Same as get_available_resource,
|
||||||
# but we don't need to refresh self.host_wrapper as it was *just*
|
# but we don't need to refresh self.host_wrapper as it was *just*
|
||||||
@ -200,8 +200,7 @@ class PowerVMDriver(driver.ComputeDriver):
|
|||||||
mem_alloc_ratio = CONF.ram_allocation_ratio or 1.5
|
mem_alloc_ratio = CONF.ram_allocation_ratio or 1.5
|
||||||
mem_reserved = CONF.reserved_host_memory_mb
|
mem_reserved = CONF.reserved_host_memory_mb
|
||||||
disk_alloc_ratio = CONF.disk_allocation_ratio or 1.0
|
disk_alloc_ratio = CONF.disk_allocation_ratio or 1.0
|
||||||
disk_reserved = compute_utils.convert_mb_to_ceil_gb(
|
disk_reserved = self._get_reserved_host_disk_gb_from_config()
|
||||||
CONF.reserved_host_disk_mb)
|
|
||||||
|
|
||||||
inventory = {
|
inventory = {
|
||||||
rc_fields.ResourceClass.VCPU: {
|
rc_fields.ResourceClass.VCPU: {
|
||||||
|
Loading…
Reference in New Issue
Block a user