Require nova_client.api_version >= 2.56
The [nova_client]/api_version defaults to 2.56 since change Idd6ebc94f81ad5d65256c80885f2addc1aaeaae1. There is compatibility code for that change but if 2.56 is not available watcher_non_live_migrate_instance will still fail if a destination host is used. Since 2.56 has been available since the Queens version of nova it should be reasonable to require at least that version of nova is running for using Watcher. This adds code which enforces the minimum version along with a release note and "watcher-status upgrade check" check method. Note that it's kind of weird for watcher to have a config option like nova_client.api_version since compute API microversions are per API request even though novaclient is constructed with the single configured version. It should really be something the client (watcher in this case) determines using version discovery and gracefully enables features if the required nova API version is available, but that's a bigger change. Change-Id: Id34938c7bb8a5ca934d997e52cac3b365414c006
This commit is contained in:
@@ -26,6 +26,7 @@ from monascaclient.v2_0 import client as monclient_v2
|
||||
from neutronclient.neutron import client as netclient
|
||||
from neutronclient.v2_0 import client as netclient_v2
|
||||
from novaclient import client as nvclient
|
||||
import six
|
||||
|
||||
from watcher.common import clients
|
||||
from watcher import conf
|
||||
@@ -125,11 +126,20 @@ class TestClients(base.TestCase):
|
||||
|
||||
@mock.patch.object(clients.OpenStackClients, 'session')
|
||||
def test_clients_nova_diff_vers(self, mock_session):
|
||||
CONF.set_override('api_version', '2.3', group='nova_client')
|
||||
CONF.set_override('api_version', '2.60', group='nova_client')
|
||||
osc = clients.OpenStackClients()
|
||||
osc._nova = None
|
||||
osc.nova()
|
||||
self.assertEqual('2.3', osc.nova().api_version.get_string())
|
||||
self.assertEqual('2.60', osc.nova().api_version.get_string())
|
||||
|
||||
@mock.patch.object(clients.OpenStackClients, 'session')
|
||||
def test_clients_nova_bad_min_version(self, mock_session):
|
||||
CONF.set_override('api_version', '2.47', group='nova_client')
|
||||
osc = clients.OpenStackClients()
|
||||
osc._nova = None
|
||||
ex = self.assertRaises(ValueError, osc.nova)
|
||||
self.assertIn('Invalid nova_client.api_version 2.47',
|
||||
six.text_type(ex))
|
||||
|
||||
@mock.patch.object(clients.OpenStackClients, 'session')
|
||||
def test_clients_nova_diff_endpoint(self, mock_session):
|
||||
|
||||
Reference in New Issue
Block a user