Merge "Compute HA: Remove workaround for Newton and older"

This commit is contained in:
Zuul 2021-08-10 15:53:23 +00:00 committed by Gerrit Code Review
commit 363b5791e1
1 changed files with 5 additions and 35 deletions

View File

@ -119,41 +119,11 @@ def create_nova_connection(options):
region = None
nova_versions = [ "2.23", "2" ]
for version in nova_versions:
clientargs = inspect.getargspec(client.Client).varargs
# Some versions of Openstack prior to Ocata only
# supported positional arguments for username,
# password, and tenant.
#
# Versions since Ocata only support named arguments.
#
# So we need to use introspection to figure out how to
# create a Nova client.
#
# Happy days
#
if clientargs:
# OSP < Ocata
# ArgSpec(args=['version', 'username', 'password', 'project_id', 'auth_url'],
# varargs=None,
# keywords='kwargs', defaults=(None, None, None, None))
nova = client.Client(version,
None, # User
None, # Password
None, # Tenant
None, # Auth URL
insecure=options["insecure"],
region_name=region,
session=keystone_session, auth=keystone_auth,
http_log_debug="verbose" in options,
endpoint_type=nova_endpoint_type)
else:
# OSP >= Ocata
# ArgSpec(args=['version'], varargs='args', keywords='kwargs', defaults=None)
nova = client.Client(version,
region_name=region,
session=keystone_session, auth=keystone_auth,
http_log_debug="verbose" in options,
endpoint_type=nova_endpoint_type)
nova = client.Client(version,
region_name=region,
session=keystone_session, auth=keystone_auth,
http_log_debug="verbose" in options,
endpoint_type=nova_endpoint_type)
try:
nova.hypervisors.list()