Merge "Bump to Nova V2.1"

This commit is contained in:
Jenkins 2017-03-06 05:27:32 +00:00 committed by Gerrit Code Review
commit 5691f29e8f
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'