Update Trove to use novaclient v2
Novaclient v1.1 has been deprecated. Time to upgrade to v2. Change-Id: I9b3ade8c324845bb9e62ddb98e86b04b1d37be9e Closes-Bug: #1438247
This commit is contained in:
parent
98734800f6
commit
930c1f090d
@ -30,7 +30,7 @@ except ImportError:
|
||||
|
||||
|
||||
from novaclient.client import HTTPClient
|
||||
from novaclient.v1_1.client import Client
|
||||
from novaclient.v2.client import Client
|
||||
|
||||
LOG = logging.getLogger('rsdns.client.dns_client')
|
||||
|
||||
|
@ -22,7 +22,7 @@ from trove.common.strategies.cluster import strategy
|
||||
from cinderclient.v2 import client as CinderClient
|
||||
from heatclient.v1 import client as HeatClient
|
||||
from keystoneclient.service_catalog import ServiceCatalog
|
||||
from novaclient.v1_1.client import Client
|
||||
from novaclient.v2.client import Client
|
||||
from swiftclient.client import Connection
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -67,7 +67,7 @@ def load_server(context, instance_id, server_id):
|
||||
:type context: trove.common.context.TroveContext
|
||||
:type instance_id: unicode
|
||||
:type server_id: unicode
|
||||
:rtype: novaclient.v1_1.servers.Server
|
||||
:rtype: novaclient.v2.servers.Server
|
||||
"""
|
||||
client = create_nova_client(context)
|
||||
try:
|
||||
@ -539,7 +539,7 @@ class BaseInstance(SimpleInstance):
|
||||
instance at it exists in the db
|
||||
:type context: trove.common.context.TroveContext
|
||||
:type db_info: trove.instance.models.DBInstance
|
||||
:type server: novaclient.v1_1.servers.Server
|
||||
:type server: novaclient.v2.servers.Server
|
||||
:typdatastore_statusus: trove.instance.models.InstanceServiceStatus
|
||||
"""
|
||||
super(BaseInstance, self).__init__(context, db_info, datastore_status)
|
||||
|
@ -19,7 +19,7 @@ from testtools import TestCase
|
||||
from proboscis import test
|
||||
|
||||
from novaclient.exceptions import BadRequest
|
||||
from novaclient.v1_1.servers import Server
|
||||
from novaclient.v2.servers import Server
|
||||
from oslo.messaging._drivers.common import RPCException
|
||||
|
||||
from trove.common.exception import PollTimeOut
|
||||
|
@ -25,7 +25,7 @@ from trove.tests.util import create_dbaas_client
|
||||
from trove.tests.util import test_config
|
||||
from trove.tests.util.users import Requirements
|
||||
|
||||
from novaclient.v1_1.servers import Server
|
||||
from novaclient.v2.servers import Server
|
||||
|
||||
from proboscis import test
|
||||
from proboscis import before_class
|
||||
|
@ -69,7 +69,7 @@ class TestConfig(object):
|
||||
'trove_auth_url': "http://localhost:5000/v2.0/tokens",
|
||||
'dbaas_url': "http://localhost:8775/v1.0/dbaas",
|
||||
'version_url': "http://localhost:8775/",
|
||||
'nova_url': "http://localhost:8774/v1.1",
|
||||
'nova_url': "http://localhost:8774/v2",
|
||||
'dbaas_datastore': "mysql",
|
||||
'dbaas_datastore_id': "a00000a0-00a0-0a00-00a0-000a000000aa",
|
||||
'dbaas_datastore_name_no_versions': "Test_Datastore_1",
|
||||
|
@ -18,9 +18,9 @@ from mock import MagicMock, patch, ANY
|
||||
from testtools import TestCase
|
||||
from testtools.matchers import Equals, Is, Not
|
||||
|
||||
from novaclient.v1_1 import Client
|
||||
from novaclient.v1_1.flavors import FlavorManager, Flavor
|
||||
from novaclient.v1_1.servers import Server, ServerManager
|
||||
from novaclient.v2 import Client
|
||||
from novaclient.v2.flavors import FlavorManager, Flavor
|
||||
from novaclient.v2.servers import Server, ServerManager
|
||||
from oslo.config import cfg
|
||||
from trove.backup.models import Backup
|
||||
from trove.common.context import TroveContext
|
||||
|
@ -18,8 +18,8 @@ from mock import Mock, MagicMock, patch
|
||||
from testtools.matchers import Equals, Is
|
||||
from cinderclient import exceptions as cinder_exceptions
|
||||
from novaclient import exceptions as nova_exceptions
|
||||
import novaclient.v1_1.servers
|
||||
import novaclient.v1_1.flavors
|
||||
import novaclient.v2.servers
|
||||
import novaclient.v2.flavors
|
||||
import cinderclient.v2.client as cinderclient
|
||||
from oslo.utils import timeutils
|
||||
import trove.backup.models
|
||||
@ -533,27 +533,27 @@ class BuiltInstanceTasksTest(testtools.TestCase):
|
||||
|
||||
self.instance_task._guest = MagicMock(spec=trove.guestagent.api.API)
|
||||
self.instance_task._nova_client = MagicMock(
|
||||
spec=novaclient.v1_1.Client)
|
||||
spec=novaclient.v2.Client)
|
||||
self.stub_server_mgr = MagicMock(
|
||||
spec=novaclient.v1_1.servers.ServerManager)
|
||||
spec=novaclient.v2.servers.ServerManager)
|
||||
self.stub_running_server = MagicMock(
|
||||
spec=novaclient.v1_1.servers.Server)
|
||||
spec=novaclient.v2.servers.Server)
|
||||
self.stub_running_server.status = 'ACTIVE'
|
||||
self.stub_running_server.flavor = {'id': 6, 'ram': 512}
|
||||
self.stub_verifying_server = MagicMock(
|
||||
spec=novaclient.v1_1.servers.Server)
|
||||
spec=novaclient.v2.servers.Server)
|
||||
self.stub_verifying_server.status = 'VERIFY_RESIZE'
|
||||
self.stub_verifying_server.flavor = {'id': 8, 'ram': 768}
|
||||
self.stub_server_mgr.get = MagicMock(
|
||||
return_value=self.stub_verifying_server)
|
||||
self.instance_task._nova_client.servers = self.stub_server_mgr
|
||||
stub_flavor_manager = MagicMock(
|
||||
spec=novaclient.v1_1.flavors.FlavorManager)
|
||||
spec=novaclient.v2.flavors.FlavorManager)
|
||||
self.instance_task._nova_client.flavors = stub_flavor_manager
|
||||
|
||||
nova_flavor = novaclient.v1_1.flavors.Flavor(stub_flavor_manager,
|
||||
self.new_flavor,
|
||||
True)
|
||||
nova_flavor = novaclient.v2.flavors.Flavor(stub_flavor_manager,
|
||||
self.new_flavor,
|
||||
True)
|
||||
stub_flavor_manager.get = MagicMock(return_value=nova_flavor)
|
||||
|
||||
answers = (status for status in
|
||||
|
@ -166,7 +166,7 @@ def create_nova_client(user, service_type=None):
|
||||
if test_config.nova_client is None:
|
||||
raise SkipTest("No nova_client info specified in the Test Config "
|
||||
"so this test will be skipped.")
|
||||
from novaclient.v1_1.client import Client
|
||||
from novaclient.v2.client import Client
|
||||
if not service_type:
|
||||
service_type = test_config.nova_client['nova_service_type']
|
||||
openstack = Client(user.auth_user, user.auth_key,
|
||||
|
Loading…
x
Reference in New Issue
Block a user