Bug: We might not be able to use novaclient maximum supported version

When building Fenix into container, we use OpenStack master upper constraints.
We get latest novaclient, but Nova server might not be the latest. To use
latest possible version, we need to figure out the latest version supported by
both server and client.

Change-Id: Iebb07202b7e742d9281ec9a1f6b8b522be0f6715
Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com>
This commit is contained in:
Tomi Juvonen 2018-12-19 12:45:52 +02:00
parent 6898ab2485
commit 7024ee5e3e
1 changed files with 10 additions and 8 deletions

View File

@ -37,14 +37,16 @@ class Workflow(BaseWorkflow):
def __init__(self, conf, session_id, data):
super(Workflow, self).__init__(conf, session_id, data)
nova_version = nova_max_version.get_string()
if float(nova_version) < 2.53:
LOG.error("%s: initialize failed. Nova version %s too old" %
(self.session_id, nova_version))
raise Exception("%s: initialize failed. Nova version too old" %
self.session_id)
self.nova = novaclient.Client(nova_version,
session=self.auth_session)
self.nova = novaclient.Client(2.53, session=self.auth_session)
max_nova_server_ver = float(self.nova.versions.get_current().version)
max_nova_client_ver = float(nova_max_version.get_string())
if max_nova_server_ver > 2.53 and max_nova_client_ver > 2.53:
if max_nova_client_ver <= max_nova_server_ver:
nova_version = max_nova_client_ver
else:
nova_version = max_nova_server_ver
self.nova = novaclient.Client(nova_version,
session=self.auth_session)
self._init_update_hosts()
LOG.info("%s: initialized" % self.session_id)