Merge "Update deprecated version of novaclient"

This commit is contained in:
Jenkins 2015-08-21 09:54:57 +00:00 committed by Gerrit Code Review
commit fdcc2278a0
2 changed files with 10 additions and 8 deletions

View File

@ -20,9 +20,9 @@ Handles all requests to Nova.
from novaclient import exceptions as nova_exceptions
from novaclient import extension
from novaclient import service_catalog
from novaclient.v1_1 import client as nova_client
from novaclient.v1_1.contrib import assisted_volume_snapshots
from novaclient.v1_1.contrib import list_extensions
from novaclient.v2 import client as nova_client
from novaclient.v2.contrib import assisted_volume_snapshots
from novaclient.v2.contrib import list_extensions
from oslo_config import cfg
from oslo_log import log as logging
from requests import exceptions as request_exceptions
@ -180,6 +180,7 @@ class API(base.Base):
def create_volume_snapshot(self, context, volume_id, create_info):
nova = novaclient(context, admin_endpoint=True, privileged_user=True)
# pylint: disable-msg=E1101
nova.assisted_volume_snapshots.create(
volume_id,
create_info=create_info)
@ -187,6 +188,7 @@ class API(base.Base):
def delete_volume_snapshot(self, context, snapshot_id, delete_info):
nova = novaclient(context, admin_endpoint=True, privileged_user=True)
# pylint: disable-msg=E1101
nova.assisted_volume_snapshots.delete(
snapshot_id,
delete_info=delete_info)

View File

@ -38,7 +38,7 @@ class NovaClientTestCase(test.TestCase):
self.override_config('os_privileged_user_name', 'adminuser')
self.override_config('os_privileged_user_password', 'strongpassword')
@mock.patch('novaclient.v1_1.client.Client')
@mock.patch('novaclient.v2.client.Client')
def test_nova_client_regular(self, p_client):
nova.novaclient(self.ctx)
p_client.assert_called_once_with(
@ -47,7 +47,7 @@ class NovaClientTestCase(test.TestCase):
insecure=False, endpoint_type='publicURL', cacert=None,
timeout=None, extensions=nova.nova_extensions)
@mock.patch('novaclient.v1_1.client.Client')
@mock.patch('novaclient.v2.client.Client')
def test_nova_client_admin_endpoint(self, p_client):
nova.novaclient(self.ctx, admin_endpoint=True)
p_client.assert_called_once_with(
@ -56,7 +56,7 @@ class NovaClientTestCase(test.TestCase):
insecure=False, endpoint_type='adminURL', cacert=None,
timeout=None, extensions=nova.nova_extensions)
@mock.patch('novaclient.v1_1.client.Client')
@mock.patch('novaclient.v2.client.Client')
def test_nova_client_privileged_user(self, p_client):
nova.novaclient(self.ctx, privileged_user=True)
p_client.assert_called_once_with(
@ -65,7 +65,7 @@ class NovaClientTestCase(test.TestCase):
insecure=False, endpoint_type='publicURL', cacert=None,
timeout=None, extensions=nova.nova_extensions)
@mock.patch('novaclient.v1_1.client.Client')
@mock.patch('novaclient.v2.client.Client')
def test_nova_client_privileged_user_custom_auth_url(self, p_client):
self.override_config('os_privileged_user_auth_url',
'http://privatekeystonehost:5000/v2.0')
@ -76,7 +76,7 @@ class NovaClientTestCase(test.TestCase):
insecure=False, endpoint_type='publicURL', cacert=None,
timeout=None, extensions=nova.nova_extensions)
@mock.patch('novaclient.v1_1.client.Client')
@mock.patch('novaclient.v2.client.Client')
def test_nova_client_custom_region(self, p_client):
self.override_config('os_region_name', 'farfaraway')
nova.novaclient(self.ctx)