Deprecate non-update_provider_tree compat code
With all in-tree virt drivers now implementing the update_provider_tree interface, we can deprecate the compatibility code in the ResourceTracker. This change simply logs a warning if the driver does not implement the upt interface and sets the timer for removal in the U release at the earliest. The resource tracker unit tests will need to be cleaned up but that can happen in a separate change so it does not slow down this deprecation. Change-Id: I1eae47bce08f6292d38e893a2122289bcd6f4b58
This commit is contained in:
parent
154334b4b2
commit
c76f3bd7bc
@ -983,6 +983,13 @@ class ResourceTracker(object):
|
||||
traits = self._get_traits(nodename, provider_tree=prov_tree)
|
||||
prov_tree.update_traits(nodename, traits)
|
||||
except NotImplementedError:
|
||||
# TODO(mriedem): Remove the compatibility code in the U release.
|
||||
LOG.warning('Compute driver "%s" does not implement the '
|
||||
'"update_provider_tree" interface. Compatibility for '
|
||||
'non-update_provider_tree interfaces will be removed '
|
||||
'in a future release and result in an error to report '
|
||||
'inventory for this compute service.',
|
||||
CONF.compute_driver)
|
||||
# update_provider_tree isn't implemented yet - try get_inventory
|
||||
try:
|
||||
inv_data = self.driver.get_inventory(nodename)
|
||||
|
@ -445,6 +445,7 @@ def setup_rt(hostname, virt_resources=_VIRT_DRIVER_AVAIL_RESOURCES,
|
||||
virt_resources = copy.deepcopy(virt_resources)
|
||||
vd.get_available_resource.return_value = virt_resources
|
||||
vd.get_inventory.side_effect = NotImplementedError
|
||||
# TODO(mriedem): Need to make this mocked virt driver implement upt.
|
||||
vd.update_provider_tree.side_effect = NotImplementedError
|
||||
vd.get_host_ip_addr.return_value = _NODENAME
|
||||
vd.estimate_instance_overhead.side_effect = estimate_overhead
|
||||
@ -1413,6 +1414,11 @@ class TestUpdateComputeNode(BaseTestCase):
|
||||
self.rt._update(mock.sentinel.ctx, new_compute)
|
||||
save_mock.assert_called_once_with()
|
||||
norm_mock.assert_called_once_with(mock.sentinel.inv_data, new_compute)
|
||||
# Assert a warning was logged about using a virt driver that does not
|
||||
# implement update_provider_tree.
|
||||
self.assertIn('Compute driver "%s" does not implement the '
|
||||
'"update_provider_tree" interface.' %
|
||||
CONF.compute_driver, self.stdlog.logger.output)
|
||||
|
||||
def test_existing_node_capabilities_as_traits(self):
|
||||
"""The capabilities_as_traits() driver method returns traits
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
Compatibility code for compute drivers that do not implement the
|
||||
`update_provider_tree`__ interface is deprecated and will be removed
|
||||
in a future release.
|
||||
|
||||
__ https://docs.openstack.org/nova/latest/reference/update-provider-tree.html
|
Loading…
x
Reference in New Issue
Block a user