Bump to Nova V2.1

Nova V2.1 API has been available since Kilo, and the API is CURRENT.
Neutron is using Nova API via novaclient and the used Nova API is
V2.1 on the gate as the default Nova endpoint. So this patch doesn't
change the used Nova API actually, but current novaclient skips checking
expected API version in a response from Nova API.
This patch will be helpful to avoid an issue when enabling this check
on novaclient side.

NOTE: Cinder is using Nova v2.1 API with the similar patch as
      Iadd3363265be6c5a8ed46704a712da6c15e2b046

Change-Id: Ie3a10f7078f4213da77be522e3866f82b5e8683c
This commit is contained in:
Ken'ichi Ohmichi 2017-03-03 11:23:53 -08:00
parent 9ea1fd034a
commit 551ba9580b
2 changed files with 14 additions and 12 deletions

View File

@ -17,6 +17,7 @@ from keystoneauth1 import loading as ks_loading
from neutron_lib import constants
from neutron_lib import exceptions as exc
from neutron_lib.plugins import directory
from novaclient import api_versions
from novaclient import client as nova_client
from novaclient import exceptions as nova_exceptions
from oslo_config import cfg
@ -40,7 +41,7 @@ VIF_DELETED = 'network-vif-deleted'
NEUTRON_NOVA_EVENT_STATUS_MAP = {constants.PORT_STATUS_ACTIVE: 'completed',
constants.PORT_STATUS_ERROR: 'failed',
constants.PORT_STATUS_DOWN: 'completed'}
NOVA_API_VERSION = "2"
NOVA_API_VERSION = "2.1"
class Notifier(object):
@ -66,7 +67,7 @@ class Notifier(object):
only_contrib=True)
if ext.name == "server_external_events"]
self.nclient = nova_client.Client(
NOVA_API_VERSION,
api_versions.APIVersion(NOVA_API_VERSION),
session=session,
region_name=cfg.CONF.nova.region_name,
endpoint_type=cfg.CONF.nova.endpoint_type,

View File

@ -18,6 +18,7 @@ import mock
from neutron_lib import constants as n_const
from neutron_lib import exceptions as n_exc
from neutron_lib.plugins import directory
from novaclient import api_versions
from novaclient import exceptions as nova_exceptions
from oslo_config import cfg
from oslo_utils import uuidutils
@ -342,21 +343,21 @@ class TestNovaNotify(base.BaseTestCase):
def test_endpoint_types(self, mock_client):
nova.Notifier()
mock_client.assert_called_once_with(
nova.NOVA_API_VERSION,
session=mock.ANY,
region_name=cfg.CONF.nova.region_name,
endpoint_type='public',
extensions=mock.ANY)
api_versions.APIVersion(nova.NOVA_API_VERSION),
session=mock.ANY,
region_name=cfg.CONF.nova.region_name,
endpoint_type='public',
extensions=mock.ANY)
mock_client.reset_mock()
cfg.CONF.set_override('endpoint_type', 'internal', 'nova')
nova.Notifier()
mock_client.assert_called_once_with(
nova.NOVA_API_VERSION,
session=mock.ANY,
region_name=cfg.CONF.nova.region_name,
endpoint_type='internal',
extensions=mock.ANY)
api_versions.APIVersion(nova.NOVA_API_VERSION),
session=mock.ANY,
region_name=cfg.CONF.nova.region_name,
endpoint_type='internal',
extensions=mock.ANY)
def test_notify_port_active_direct(self):
device_id = '32102d7b-1cf4-404d-b50a-97aae1f55f87'