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
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)
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)
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(
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(
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(
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')
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)