Merge "Don't support deprecated drivers' vendor_passthru"
This commit is contained in:
commit
102b85bd31
@ -468,25 +468,6 @@ class ConductorManager(periodic_task.PeriodicTasks):
|
||||
|
||||
vendor_iface = task.driver.vendor
|
||||
|
||||
# NOTE(lucasagomes): Before the vendor_passthru() method was
|
||||
# a self-contained method and each driver implemented their own
|
||||
# version of it, now we have a common mechanism that drivers
|
||||
# should use to expose their vendor methods. If a driver still
|
||||
# have their own vendor_passthru() method we call it to be
|
||||
# backward compat. This code should be removed once L opens.
|
||||
if hasattr(vendor_iface, 'vendor_passthru'):
|
||||
LOG.warning(_LW("Drivers implementing their own version "
|
||||
"of vendor_passthru() has been deprecated. "
|
||||
"Please update the code to use the "
|
||||
"@passthru decorator."))
|
||||
vendor_iface.validate(task, method=driver_method,
|
||||
**info)
|
||||
task.spawn_after(self._spawn_worker,
|
||||
vendor_iface.vendor_passthru, task,
|
||||
method=driver_method, **info)
|
||||
# NodeVendorPassthru was always async
|
||||
return (None, True)
|
||||
|
||||
try:
|
||||
vendor_opts = vendor_iface.vendor_routes[driver_method]
|
||||
vendor_func = vendor_opts['func']
|
||||
|
@ -715,30 +715,6 @@ class VendorPassthruTestCase(_ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
# Verify reservation has been cleared.
|
||||
self.assertIsNone(node.reservation)
|
||||
|
||||
@mock.patch.object(task_manager, 'acquire')
|
||||
def test_vendor_passthru_backwards_compat(self, acquire_mock):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||
vendor_passthru_ref = mock.Mock()
|
||||
self._start_service()
|
||||
|
||||
driver = mock.Mock()
|
||||
driver.vendor.vendor_routes = {}
|
||||
driver.vendor.vendor_passthru = vendor_passthru_ref
|
||||
|
||||
task = mock.Mock()
|
||||
task.node = node
|
||||
task.driver = driver
|
||||
|
||||
acquire_mock.return_value.__enter__.return_value = task
|
||||
|
||||
response = self.service.vendor_passthru(
|
||||
self.context, node.uuid, 'test_method', 'POST', {'bar': 'baz'})
|
||||
|
||||
self.assertEqual((None, True), response)
|
||||
task.spawn_after.assert_called_once_with(
|
||||
mock.ANY, vendor_passthru_ref, task, bar='baz',
|
||||
method='test_method')
|
||||
|
||||
def test_get_node_vendor_passthru_methods(self):
|
||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||
fake_routes = {'test_method': {'async': True,
|
||||
|
Loading…
x
Reference in New Issue
Block a user