NOVA_API_VERSION = 2
nova_extensions = [ext for ext in nova_client.discover_extensions(2)
- if ext.name == "assisted_volume_snapshots"]
+ if ext.name in ("assisted_volume_snapshots",
+ "list_extensions")]
def novaclient(context, admin_endpoint=False, privileged_user=False,
def has_extension(self, context, extension, timeout=None):
try:
- nova_exts = nova_client.discover_extensions(NOVA_API_VERSION)
+ nova_exts = novaclient(context).list_extensions.show_all()
except request_exceptions.Timeout:
raise exception.APITimeout(service='Nova')
return extension in [e.name for e in nova_exts]
def __init__(self, ext_srv_attr=True):
self.servers = FakeNovaClient.ServerManager()
- self.discover_extensions = FakeNovaClient.ListExtManager(
+ self.list_extensions = FakeNovaClient.ListExtManager(
ext_srv_attr=ext_srv_attr)
def test_same_host(self, _mock_novaclient, fake_extensions):
_mock_novaclient.return_value = fakes.FakeNovaClient()
fake_extensions.return_value = (
- fakes.FakeNovaClient().discover_extensions.show_all())
+ fakes.FakeNovaClient().list_extensions.show_all())
filt_cls = self.class_map['InstanceLocalityFilter']()
host = fakes.FakeHostState('host1', {})
uuid = nova.novaclient().servers.create('host1')
def test_different_host(self, _mock_novaclient, fake_extensions):
_mock_novaclient.return_value = fakes.FakeNovaClient()
fake_extensions.return_value = (
- fakes.FakeNovaClient().discover_extensions.show_all())
+ fakes.FakeNovaClient().list_extensions.show_all())
filt_cls = self.class_map['InstanceLocalityFilter']()
host = fakes.FakeHostState('host1', {})
uuid = nova.novaclient().servers.create('host2')
# Simulate a HTTP timeout
_mock_request.side_effect = request_exceptions.Timeout
fake_extensions.return_value = (
- fakes.FakeNovaClient().discover_extensions.show_all())
+ fakes.FakeNovaClient().list_extensions.show_all())
filt_cls = self.class_map['InstanceLocalityFilter']()
host = fakes.FakeHostState('host1', {})