From 912b717207d4ea193843dcc5c00515f3ca2b7eb9 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 31 Aug 2020 17:17:32 +0100 Subject: [PATCH] virt: Remove 'get_console_pool_info' API This is no longer used by any in-tree virt drivers and can be removed. The equivalent RPC API now always raises 'NotImplementedError', which was the behavior with virt drivers that didn't support the feature. Change-Id: Iab881ef4f52eff4815e781f10204497968f8a06b Signed-off-by: Stephen Finucane --- nova/compute/manager.py | 2 +- nova/compute/rpcapi.py | 1 + nova/tests/unit/virt/test_virt_drivers.py | 8 -------- nova/virt/driver.py | 6 ------ nova/virt/fake.py | 5 ----- nova/virt/libvirt/driver.py | 8 -------- 6 files changed, 2 insertions(+), 28 deletions(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 60d7c92b305d..8aeefa65d265 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1578,7 +1578,7 @@ class ComputeManager(manager.Manager): # TODO(stephenfin): Remove this once we bump the compute API to v6.0 @wrap_exception() def get_console_pool_info(self, context, console_type): - return self.driver.get_console_pool_info(console_type) + raise NotImplementedError() # TODO(stephenfin): Remove this as it's nova-network only @wrap_exception() diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index c2dee603ebea..660fd2ef8df3 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -780,6 +780,7 @@ class ComputeAPI(object): return cctxt.call(ctxt, 'get_console_output', instance=instance, tail_length=tail_length) + # TODO(stephenfin): This is no longer used and can be removed in v6.0 def get_console_pool_info(self, ctxt, host, console_type): version = '5.0' cctxt = self.router.client(ctxt).prepare( diff --git a/nova/tests/unit/virt/test_virt_drivers.py b/nova/tests/unit/virt/test_virt_drivers.py index f14d6f60df73..6c582ff0a5c5 100644 --- a/nova/tests/unit/virt/test_virt_drivers.py +++ b/nova/tests/unit/virt/test_virt_drivers.py @@ -576,14 +576,6 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase): instance_ref) self.assertIsInstance(mks_console, ctype.ConsoleMKS) - @catch_notimplementederror - def test_get_console_pool_info(self): - instance_ref, network_info = self._get_running_instance() - console_pool = self.connection.get_console_pool_info(instance_ref) - self.assertIn('address', console_pool) - self.assertIn('username', console_pool) - self.assertIn('password', console_pool) - @mock.patch( 'nova.tests.unit.virt.libvirt.fakelibvirt.Domain.jobStats', new=mock.Mock(return_value={ diff --git a/nova/virt/driver.py b/nova/virt/driver.py index 86db4b8bd07d..a5d71dd882df 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -459,12 +459,6 @@ class ComputeDriver(object): """ raise NotImplementedError() - # TODO(stephenfin): This was only implemented (properly) for XenAPI and - # should be removed. - def get_console_pool_info(self, console_type): - # TODO(Vek): Need to pass context in for access to auth_token - raise NotImplementedError() - def get_console_output(self, context, instance): """Get console output for an instance diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 4265591b484a..f50acdd90647 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -488,11 +488,6 @@ class FakeDriver(driver.ComputeDriver): host='fakemksconsole.com', port=6969) - def get_console_pool_info(self, console_type): - return {'address': '127.0.0.1', - 'username': 'fakeuser', - 'password': 'fakepassword'} - def get_available_resource(self, nodename): """Updates compute manager resource info on ComputeNode table. diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index fa22e55c8370..6462c07aca6c 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -7719,14 +7719,6 @@ class LibvirtDriver(driver.ComputeDriver): 'Cannot get block stats for device', instance.name, instance=instance) - def get_console_pool_info(self, console_type): - # TODO(mdragon): console proxy should be implemented for libvirt, - # in case someone wants to use it with kvm or - # such. For now return fake data. - return {'address': '127.0.0.1', - 'username': 'fakeuser', - 'password': 'fakepassword'} - def update_provider_tree(self, provider_tree, nodename, allocations=None): """Update a ProviderTree object with current resource provider, inventory information and CPU traits.