diff --git a/README.rst b/README.rst index 4b8b8bb25..a7edf8707 100644 --- a/README.rst +++ b/README.rst @@ -46,7 +46,7 @@ and the version of the API with ``--os-compute-api-version``. Or set them as an environment variables as well:: export OS_AUTH_URL=http://example.com:8774/v1.1/ - export OS_COMPUTE_API_VERSION=1.1 + export OS_COMPUTE_API_VERSION=2 If you are using Keystone, you need to set the OS_AUTH_URL to the keystone endpoint:: @@ -69,7 +69,7 @@ There's also a complete Python API, but it has not yet been documented. To use with nova, with keystone as the authentication system:: # use v2.0 auth with http://example.com:5000/v2.0/") - >>> from novaclient.v1_1 import client + >>> from novaclient.v2 import client >>> nt = client.Client(USER, PASS, TENANT, AUTH_URL, service_type="compute") >>> nt.flavors.list() [...] diff --git a/doc/source/api.rst b/doc/source/api.rst index e53f2a14f..9db817246 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -60,5 +60,4 @@ For more information, see the reference: :maxdepth: 2 ref/index - ref/v1_1/index - ref/v3/index + ref/v2/index diff --git a/doc/source/conf.py b/doc/source/conf.py index d33aea267..61437fd78 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -71,17 +71,13 @@ def gen_ref(ver, title, names): "pkg": pkg, "name": name}) gen_ref(None, "Exceptions", ["exceptions"]) -gen_ref("v1_1", "Version 1.1, Version 2 API Reference", +gen_ref("v2", "Version 1.1, Version 2 API Reference, Version 3 API Reference", ["flavors", "images", "servers", "hosts", "agents", "aggregates", "availability_zones", "certs", "fixed_ips", "floating_ip_pools", "floating_ips", "hypervisors", "keypairs", "limits", "networks", "quota_classes", "quotas", "security_group_rules", "security_groups", "services", "virtual_interfaces", "volume_snapshots", "volumes", "volume_types"]) -gen_ref("v3", "Version 3 API Reference", - ["flavors", "hosts", "agents", "aggregates", "availability_zones", - "certs", "hypervisors", "images", "keypairs", "quotas", - "quotas_classes", "servers", "services"]) # -- General configuration ---------------------------------------------------- diff --git a/doc/source/index.rst b/doc/source/index.rst index eb551e1ae..9bd302bcc 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -25,8 +25,7 @@ Contents: shell api ref/index - ref/v1_1/index - ref/v3/index + ref/v2/index releases Contributing diff --git a/doc/source/shell.rst b/doc/source/shell.rst index f02c1597e..52bcfb49d 100644 --- a/doc/source/shell.rst +++ b/doc/source/shell.rst @@ -41,7 +41,7 @@ For example, in Bash you'd use:: export OS_PASSWORD=yadayadayada export OS_TENANT_NAME=myproject export OS_AUTH_URL=http://... - export OS_COMPUTE_API_VERSION=1.1 + export OS_COMPUTE_API_VERSION=2 From there, all shell commands take the form:: diff --git a/novaclient/client.py b/novaclient/client.py index a44ade03c..200d75c73 100644 --- a/novaclient/client.py +++ b/novaclient/client.py @@ -773,9 +773,9 @@ def _construct_http_client(username=None, password=None, project_id=None, def get_client_class(version): version_map = { - '1.1': 'novaclient.v1_1.client.Client', - '2': 'novaclient.v1_1.client.Client', - '3': 'novaclient.v1_1.client.Client', + '1.1': 'novaclient.v2.client.Client', + '2': 'novaclient.v2.client.Client', + '3': 'novaclient.v2.client.Client', } try: client_path = version_map[str(version)] diff --git a/novaclient/shell.py b/novaclient/shell.py index 0cc6b43c7..940a01e08 100644 --- a/novaclient/shell.py +++ b/novaclient/shell.py @@ -55,9 +55,9 @@ import novaclient.extension from novaclient.i18n import _ from novaclient.openstack.common import cliutils from novaclient import utils -from novaclient.v1_1 import shell as shell_v1_1 +from novaclient.v2 import shell as shell_v2 -DEFAULT_OS_COMPUTE_API_VERSION = "1.1" +DEFAULT_OS_COMPUTE_API_VERSION = "2" DEFAULT_NOVA_ENDPOINT_TYPE = 'publicURL' # NOTE(cyeoh): Having the service type dependent on the API version # is pretty ugly, but we have to do this because traditionally the @@ -446,12 +446,12 @@ class OpenStackComputeShell(object): try: actions_module = { - '1.1': shell_v1_1, - '2': shell_v1_1, - '3': shell_v1_1, + '1.1': shell_v2, + '2': shell_v2, + '3': shell_v2, }[version] except KeyError: - actions_module = shell_v1_1 + actions_module = shell_v2 self._find_actions(subparsers, actions_module) self._find_actions(subparsers, self) @@ -491,6 +491,10 @@ class OpenStackComputeShell(object): def _discover_via_contrib_path(self, version): module_path = os.path.dirname(os.path.abspath(__file__)) version_str = "v%s" % version.replace('.', '_') + # NOTE(akurilin): v1.1, v2 and v3 have one implementation, so + # we should discover contrib modules in one place. + if version_str in ["v1_1", "v3"]: + version_str = "v2" ext_path = os.path.join(module_path, version_str, 'contrib') ext_glob = os.path.join(ext_path, "*.py") diff --git a/novaclient/tests/unit/fixture_data/client.py b/novaclient/tests/unit/fixture_data/client.py index c6ddad3b7..5f933b750 100644 --- a/novaclient/tests/unit/fixture_data/client.py +++ b/novaclient/tests/unit/fixture_data/client.py @@ -15,7 +15,7 @@ from keystoneclient.auth.identity import v2 from keystoneclient import fixture from keystoneclient import session -from novaclient.v1_1 import client as v1_1client +from novaclient.v2 import client as v2client IDENTITY_URL = 'http://identityserver:5000/v2.0' COMPUTE_URL = 'http://compute.host' @@ -51,10 +51,10 @@ class V1(fixtures.Fixture): self.client = self.new_client() def new_client(self): - return v1_1client.Client(username='xx', - api_key='xx', - project_id='xx', - auth_url=self.identity_url) + return v2client.Client(username='xx', + api_key='xx', + project_id='xx', + auth_url=self.identity_url) class SessionV1(V1): @@ -62,4 +62,4 @@ class SessionV1(V1): def new_client(self): self.session = session.Session() self.session.auth = v2.Password(self.identity_url, 'xx', 'xx') - return v1_1client.Client(session=self.session) + return v2client.Client(session=self.session) diff --git a/novaclient/tests/unit/test_auth_plugins.py b/novaclient/tests/unit/test_auth_plugins.py index 992077d0a..675102ca3 100644 --- a/novaclient/tests/unit/test_auth_plugins.py +++ b/novaclient/tests/unit/test_auth_plugins.py @@ -28,7 +28,7 @@ except ImportError: from novaclient import auth_plugin from novaclient import exceptions from novaclient.tests.unit import utils -from novaclient.v1_1 import client +from novaclient.v2 import client def mock_http_request(resp=None): diff --git a/novaclient/tests/unit/test_base.py b/novaclient/tests/unit/test_base.py index d3fc6c756..b7bceb7b8 100644 --- a/novaclient/tests/unit/test_base.py +++ b/novaclient/tests/unit/test_base.py @@ -14,8 +14,8 @@ from novaclient import base from novaclient import exceptions from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes -from novaclient.v1_1 import flavors +from novaclient.tests.unit.v2 import fakes +from novaclient.v2 import flavors cs = fakes.FakeClient() diff --git a/novaclient/tests/unit/test_client.py b/novaclient/tests/unit/test_client.py index f8161156e..2c7f7eaf7 100644 --- a/novaclient/tests/unit/test_client.py +++ b/novaclient/tests/unit/test_client.py @@ -24,7 +24,7 @@ import requests import novaclient.client import novaclient.extension from novaclient.tests.unit import utils -import novaclient.v1_1.client +import novaclient.v2.client class ClientConnectionPoolTest(utils.TestCase): @@ -138,57 +138,57 @@ class ClientTest(utils.TestCase): def test_get_client_class_v3(self): output = novaclient.client.get_client_class('3') - self.assertEqual(output, novaclient.v1_1.client.Client) + self.assertEqual(output, novaclient.v2.client.Client) def test_get_client_class_v2(self): output = novaclient.client.get_client_class('2') - self.assertEqual(output, novaclient.v1_1.client.Client) + self.assertEqual(output, novaclient.v2.client.Client) def test_get_client_class_v2_int(self): output = novaclient.client.get_client_class(2) - self.assertEqual(output, novaclient.v1_1.client.Client) + self.assertEqual(output, novaclient.v2.client.Client) def test_get_client_class_v1_1(self): output = novaclient.client.get_client_class('1.1') - self.assertEqual(output, novaclient.v1_1.client.Client) + self.assertEqual(output, novaclient.v2.client.Client) def test_get_client_class_unknown(self): self.assertRaises(novaclient.exceptions.UnsupportedVersion, novaclient.client.get_client_class, '0') def test_client_with_os_cache_enabled(self): - cs = novaclient.v1_1.client.Client("user", "password", "project_id", - auth_url="foo/v2", os_cache=True) + cs = novaclient.v2.client.Client("user", "password", "project_id", + auth_url="foo/v2", os_cache=True) self.assertEqual(True, cs.os_cache) self.assertEqual(True, cs.client.os_cache) def test_client_with_os_cache_disabled(self): - cs = novaclient.v1_1.client.Client("user", "password", "project_id", - auth_url="foo/v2", os_cache=False) + cs = novaclient.v2.client.Client("user", "password", "project_id", + auth_url="foo/v2", os_cache=False) self.assertEqual(False, cs.os_cache) self.assertEqual(False, cs.client.os_cache) def test_client_with_no_cache_enabled(self): - cs = novaclient.v1_1.client.Client("user", "password", "project_id", - auth_url="foo/v2", no_cache=True) + cs = novaclient.v2.client.Client("user", "password", "project_id", + auth_url="foo/v2", no_cache=True) self.assertEqual(False, cs.os_cache) self.assertEqual(False, cs.client.os_cache) def test_client_with_no_cache_disabled(self): - cs = novaclient.v1_1.client.Client("user", "password", "project_id", - auth_url="foo/v2", no_cache=False) + cs = novaclient.v2.client.Client("user", "password", "project_id", + auth_url="foo/v2", no_cache=False) self.assertEqual(True, cs.os_cache) self.assertEqual(True, cs.client.os_cache) def test_client_set_management_url_v1_1(self): - cs = novaclient.v1_1.client.Client("user", "password", "project_id", - auth_url="foo/v2") + cs = novaclient.v2.client.Client("user", "password", "project_id", + auth_url="foo/v2") cs.set_management_url("blabla") self.assertEqual("blabla", cs.client.management_url) def test_client_get_reset_timings_v1_1(self): - cs = novaclient.v1_1.client.Client("user", "password", "project_id", - auth_url="foo/v2") + cs = novaclient.v2.client.Client("user", "password", "project_id", + auth_url="foo/v2") self.assertEqual(0, len(cs.get_timings())) cs.client.times.append("somevalue") self.assertEqual(1, len(cs.get_timings())) @@ -201,8 +201,8 @@ class ClientTest(utils.TestCase): def test_contextmanager_v1_1(self, mock_http_client): fake_client = mock.Mock() mock_http_client.return_value = fake_client - with novaclient.v1_1.client.Client("user", "password", "project_id", - auth_url="foo/v2"): + with novaclient.v2.client.Client("user", "password", "project_id", + auth_url="foo/v2"): pass self.assertTrue(fake_client.open_session.called) self.assertTrue(fake_client.close_session.called) diff --git a/novaclient/tests/unit/v1_1/__init__.py b/novaclient/tests/unit/v2/__init__.py similarity index 100% rename from novaclient/tests/unit/v1_1/__init__.py rename to novaclient/tests/unit/v2/__init__.py diff --git a/novaclient/tests/unit/v1_1/contrib/__init__.py b/novaclient/tests/unit/v2/contrib/__init__.py similarity index 100% rename from novaclient/tests/unit/v1_1/contrib/__init__.py rename to novaclient/tests/unit/v2/contrib/__init__.py diff --git a/novaclient/tests/unit/v1_1/contrib/fakes.py b/novaclient/tests/unit/v2/contrib/fakes.py similarity index 98% rename from novaclient/tests/unit/v1_1/contrib/fakes.py rename to novaclient/tests/unit/v2/contrib/fakes.py index e961ae100..870339584 100644 --- a/novaclient/tests/unit/v1_1/contrib/fakes.py +++ b/novaclient/tests/unit/v2/contrib/fakes.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from novaclient.tests.unit.v1_1 import fakes -from novaclient.v1_1 import client +from novaclient.tests.unit.v2 import fakes +from novaclient.v2 import client class FakeClient(fakes.FakeClient): diff --git a/novaclient/tests/unit/v1_1/contrib/test_assisted_volume_snapshots.py b/novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py similarity index 90% rename from novaclient/tests/unit/v1_1/contrib/test_assisted_volume_snapshots.py rename to novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py index 37f584ce7..8ab732aed 100644 --- a/novaclient/tests/unit/v1_1/contrib/test_assisted_volume_snapshots.py +++ b/novaclient/tests/unit/v2/contrib/test_assisted_volume_snapshots.py @@ -18,8 +18,8 @@ Assisted volume snapshots - to be used by Cinder and not end users. from novaclient import extension from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1.contrib import fakes -from novaclient.v1_1.contrib import assisted_volume_snapshots as assisted_snaps +from novaclient.tests.unit.v2.contrib import fakes +from novaclient.v2.contrib import assisted_volume_snapshots as assisted_snaps extensions = [ diff --git a/novaclient/tests/unit/v1_1/contrib/test_baremetal.py b/novaclient/tests/unit/v2/contrib/test_baremetal.py similarity index 95% rename from novaclient/tests/unit/v1_1/contrib/test_baremetal.py rename to novaclient/tests/unit/v2/contrib/test_baremetal.py index 1866eea6e..a5ee41467 100644 --- a/novaclient/tests/unit/v1_1/contrib/test_baremetal.py +++ b/novaclient/tests/unit/v2/contrib/test_baremetal.py @@ -16,8 +16,8 @@ from novaclient import extension from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1.contrib import fakes -from novaclient.v1_1.contrib import baremetal +from novaclient.tests.unit.v2.contrib import fakes +from novaclient.v2.contrib import baremetal extensions = [ diff --git a/novaclient/tests/unit/v1_1/contrib/test_cells.py b/novaclient/tests/unit/v2/contrib/test_cells.py similarity index 93% rename from novaclient/tests/unit/v1_1/contrib/test_cells.py rename to novaclient/tests/unit/v2/contrib/test_cells.py index ccdcd375d..e411502bc 100644 --- a/novaclient/tests/unit/v1_1/contrib/test_cells.py +++ b/novaclient/tests/unit/v2/contrib/test_cells.py @@ -15,8 +15,8 @@ from novaclient import extension from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1.contrib import fakes -from novaclient.v1_1.contrib import cells +from novaclient.tests.unit.v2.contrib import fakes +from novaclient.v2.contrib import cells extensions = [ diff --git a/novaclient/tests/unit/v1_1/contrib/test_instance_actions.py b/novaclient/tests/unit/v2/contrib/test_instance_actions.py similarity index 93% rename from novaclient/tests/unit/v1_1/contrib/test_instance_actions.py rename to novaclient/tests/unit/v2/contrib/test_instance_actions.py index 66dbb418c..0b0400a29 100644 --- a/novaclient/tests/unit/v1_1/contrib/test_instance_actions.py +++ b/novaclient/tests/unit/v2/contrib/test_instance_actions.py @@ -15,8 +15,8 @@ from novaclient import extension from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1.contrib import fakes -from novaclient.v1_1.contrib import instance_action +from novaclient.tests.unit.v2.contrib import fakes +from novaclient.v2.contrib import instance_action extensions = [ diff --git a/novaclient/tests/unit/v1_1/contrib/test_list_extensions.py b/novaclient/tests/unit/v2/contrib/test_list_extensions.py similarity index 91% rename from novaclient/tests/unit/v1_1/contrib/test_list_extensions.py rename to novaclient/tests/unit/v2/contrib/test_list_extensions.py index dfb742ebd..3fa5253ba 100644 --- a/novaclient/tests/unit/v1_1/contrib/test_list_extensions.py +++ b/novaclient/tests/unit/v2/contrib/test_list_extensions.py @@ -13,8 +13,8 @@ from novaclient import extension from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes -from novaclient.v1_1.contrib import list_extensions +from novaclient.tests.unit.v2 import fakes +from novaclient.v2.contrib import list_extensions extensions = [ diff --git a/novaclient/tests/unit/v1_1/contrib/test_migrations.py b/novaclient/tests/unit/v2/contrib/test_migrations.py similarity index 93% rename from novaclient/tests/unit/v1_1/contrib/test_migrations.py rename to novaclient/tests/unit/v2/contrib/test_migrations.py index 5fe5c8f07..881fd1e50 100644 --- a/novaclient/tests/unit/v1_1/contrib/test_migrations.py +++ b/novaclient/tests/unit/v2/contrib/test_migrations.py @@ -12,8 +12,8 @@ from novaclient import extension from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes -from novaclient.v1_1.contrib import migrations +from novaclient.tests.unit.v2 import fakes +from novaclient.v2.contrib import migrations extensions = [ extension.Extension(migrations.__name__.split(".")[-1], diff --git a/novaclient/tests/unit/v1_1/contrib/test_server_external_events.py b/novaclient/tests/unit/v2/contrib/test_server_external_events.py similarity index 92% rename from novaclient/tests/unit/v1_1/contrib/test_server_external_events.py rename to novaclient/tests/unit/v2/contrib/test_server_external_events.py index a933ad89f..1b941c9d6 100644 --- a/novaclient/tests/unit/v1_1/contrib/test_server_external_events.py +++ b/novaclient/tests/unit/v2/contrib/test_server_external_events.py @@ -18,8 +18,8 @@ External event triggering for servers, not to be used by users. from novaclient import extension from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1.contrib import fakes -from novaclient.v1_1.contrib import server_external_events as ext_events +from novaclient.tests.unit.v2.contrib import fakes +from novaclient.v2.contrib import server_external_events as ext_events extensions = [ diff --git a/novaclient/tests/unit/v1_1/contrib/test_tenant_networks.py b/novaclient/tests/unit/v2/contrib/test_tenant_networks.py similarity index 93% rename from novaclient/tests/unit/v1_1/contrib/test_tenant_networks.py rename to novaclient/tests/unit/v2/contrib/test_tenant_networks.py index a1a76cee3..13159ce5f 100644 --- a/novaclient/tests/unit/v1_1/contrib/test_tenant_networks.py +++ b/novaclient/tests/unit/v2/contrib/test_tenant_networks.py @@ -15,8 +15,8 @@ from novaclient import extension from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1.contrib import fakes -from novaclient.v1_1.contrib import tenant_networks +from novaclient.tests.unit.v2.contrib import fakes +from novaclient.v2.contrib import tenant_networks extensions = [ diff --git a/novaclient/tests/unit/v1_1/fakes.py b/novaclient/tests/unit/v2/fakes.py similarity index 99% rename from novaclient/tests/unit/v1_1/fakes.py rename to novaclient/tests/unit/v2/fakes.py index 7e659cb3d..68322a176 100644 --- a/novaclient/tests/unit/v1_1/fakes.py +++ b/novaclient/tests/unit/v2/fakes.py @@ -25,7 +25,7 @@ from novaclient import client as base_client from novaclient import exceptions from novaclient.tests.unit import fakes from novaclient.tests.unit import utils -from novaclient.v1_1 import client +from novaclient.v2 import client class FakeClient(fakes.FakeClient, client.Client): diff --git a/novaclient/tests/unit/v1_1/test_agents.py b/novaclient/tests/unit/v2/test_agents.py similarity index 99% rename from novaclient/tests/unit/v1_1/test_agents.py rename to novaclient/tests/unit/v2/test_agents.py index a269b322a..e7fa7d6ed 100644 --- a/novaclient/tests/unit/v1_1/test_agents.py +++ b/novaclient/tests/unit/v2/test_agents.py @@ -16,7 +16,7 @@ from novaclient.tests.unit.fixture_data import agents as data from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit import utils -from novaclient.v1_1 import agents +from novaclient.v2 import agents class AgentsTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_aggregates.py b/novaclient/tests/unit/v2/test_aggregates.py similarity index 99% rename from novaclient/tests/unit/v1_1/test_aggregates.py rename to novaclient/tests/unit/v2/test_aggregates.py index 40cc7d922..97a3ffc2b 100644 --- a/novaclient/tests/unit/v1_1/test_aggregates.py +++ b/novaclient/tests/unit/v2/test_aggregates.py @@ -16,7 +16,7 @@ from novaclient.tests.unit.fixture_data import aggregates as data from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit import utils -from novaclient.v1_1 import aggregates +from novaclient.v2 import aggregates class AggregatesTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_auth.py b/novaclient/tests/unit/v2/test_auth.py similarity index 99% rename from novaclient/tests/unit/v1_1/test_auth.py rename to novaclient/tests/unit/v2/test_auth.py index 65715e54d..95e96ded1 100644 --- a/novaclient/tests/unit/v1_1/test_auth.py +++ b/novaclient/tests/unit/v2/test_auth.py @@ -20,7 +20,7 @@ import requests from novaclient import exceptions from novaclient.tests.unit import utils -from novaclient.v1_1 import client +from novaclient.v2 import client class AuthenticateAgainstKeystoneTests(utils.TestCase): diff --git a/novaclient/tests/unit/v1_1/test_availability_zone.py b/novaclient/tests/unit/v2/test_availability_zone.py similarity index 97% rename from novaclient/tests/unit/v1_1/test_availability_zone.py rename to novaclient/tests/unit/v2/test_availability_zone.py index fda4764a1..a7d6d82e2 100644 --- a/novaclient/tests/unit/v1_1/test_availability_zone.py +++ b/novaclient/tests/unit/v2/test_availability_zone.py @@ -19,13 +19,13 @@ import six from novaclient.tests.unit.fixture_data import availability_zones as data from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit import utils -from novaclient.v1_1 import availability_zones +from novaclient.v2 import availability_zones class AvailabilityZoneTest(utils.FixturedTestCase): # NOTE(cyeoh): import shell here so the V3 version of # this class can inherit off the v3 version of shell - from novaclient.v1_1 import shell # noqa + from novaclient.v2 import shell # noqa data_fixture_class = data.V1 diff --git a/novaclient/tests/unit/v1_1/test_certs.py b/novaclient/tests/unit/v2/test_certs.py similarity index 97% rename from novaclient/tests/unit/v1_1/test_certs.py rename to novaclient/tests/unit/v2/test_certs.py index 39eac06f7..6ec2258fc 100644 --- a/novaclient/tests/unit/v1_1/test_certs.py +++ b/novaclient/tests/unit/v2/test_certs.py @@ -14,7 +14,7 @@ from novaclient.tests.unit.fixture_data import certs as data from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit import utils -from novaclient.v1_1 import certs +from novaclient.v2 import certs class CertsTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_client.py b/novaclient/tests/unit/v2/test_client.py similarity index 97% rename from novaclient/tests/unit/v1_1/test_client.py rename to novaclient/tests/unit/v2/test_client.py index fbc98f7cb..b4c59ce38 100644 --- a/novaclient/tests/unit/v1_1/test_client.py +++ b/novaclient/tests/unit/v2/test_client.py @@ -15,7 +15,7 @@ import uuid from keystoneclient import session from novaclient.tests.unit import utils -from novaclient.v1_1 import client +from novaclient.v2 import client class ClientTest(utils.TestCase): diff --git a/novaclient/tests/unit/v1_1/test_cloudpipe.py b/novaclient/tests/unit/v2/test_cloudpipe.py similarity index 97% rename from novaclient/tests/unit/v1_1/test_cloudpipe.py rename to novaclient/tests/unit/v2/test_cloudpipe.py index 0a40db68d..3ef9533cd 100644 --- a/novaclient/tests/unit/v1_1/test_cloudpipe.py +++ b/novaclient/tests/unit/v2/test_cloudpipe.py @@ -16,7 +16,7 @@ import six from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import cloudpipe as data from novaclient.tests.unit import utils -from novaclient.v1_1 import cloudpipe +from novaclient.v2 import cloudpipe class CloudpipeTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_fixed_ips.py b/novaclient/tests/unit/v2/test_fixed_ips.py similarity index 100% rename from novaclient/tests/unit/v1_1/test_fixed_ips.py rename to novaclient/tests/unit/v2/test_fixed_ips.py diff --git a/novaclient/tests/unit/v1_1/test_flavor_access.py b/novaclient/tests/unit/v2/test_flavor_access.py similarity index 96% rename from novaclient/tests/unit/v1_1/test_flavor_access.py rename to novaclient/tests/unit/v2/test_flavor_access.py index 08677ad4e..109f177e6 100644 --- a/novaclient/tests/unit/v1_1/test_flavor_access.py +++ b/novaclient/tests/unit/v2/test_flavor_access.py @@ -14,8 +14,8 @@ # under the License. from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes -from novaclient.v1_1 import flavor_access +from novaclient.tests.unit.v2 import fakes +from novaclient.v2 import flavor_access cs = fakes.FakeClient() diff --git a/novaclient/tests/unit/v1_1/test_flavors.py b/novaclient/tests/unit/v2/test_flavors.py similarity index 99% rename from novaclient/tests/unit/v1_1/test_flavors.py rename to novaclient/tests/unit/v2/test_flavors.py index 90f7eb1d9..27b77c068 100644 --- a/novaclient/tests/unit/v1_1/test_flavors.py +++ b/novaclient/tests/unit/v2/test_flavors.py @@ -17,8 +17,8 @@ import mock from novaclient import exceptions from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes -from novaclient.v1_1 import flavors +from novaclient.tests.unit.v2 import fakes +from novaclient.v2 import flavors class FlavorsTest(utils.TestCase): diff --git a/novaclient/tests/unit/v1_1/test_floating_ip_dns.py b/novaclient/tests/unit/v2/test_floating_ip_dns.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_floating_ip_dns.py rename to novaclient/tests/unit/v2/test_floating_ip_dns.py index 36f900ced..ec20e56c5 100644 --- a/novaclient/tests/unit/v1_1/test_floating_ip_dns.py +++ b/novaclient/tests/unit/v2/test_floating_ip_dns.py @@ -14,7 +14,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import floatingips as data from novaclient.tests.unit import utils -from novaclient.v1_1 import floating_ip_dns +from novaclient.v2 import floating_ip_dns class FloatingIPDNSDomainTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_floating_ip_pools.py b/novaclient/tests/unit/v2/test_floating_ip_pools.py similarity index 96% rename from novaclient/tests/unit/v1_1/test_floating_ip_pools.py rename to novaclient/tests/unit/v2/test_floating_ip_pools.py index 55470daed..a138fc285 100644 --- a/novaclient/tests/unit/v1_1/test_floating_ip_pools.py +++ b/novaclient/tests/unit/v2/test_floating_ip_pools.py @@ -17,7 +17,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import floatingips as data from novaclient.tests.unit import utils -from novaclient.v1_1 import floating_ip_pools +from novaclient.v2 import floating_ip_pools class TestFloatingIPPools(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_floating_ips.py b/novaclient/tests/unit/v2/test_floating_ips.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_floating_ips.py rename to novaclient/tests/unit/v2/test_floating_ips.py index 7deb2b65b..2b091a516 100644 --- a/novaclient/tests/unit/v1_1/test_floating_ips.py +++ b/novaclient/tests/unit/v2/test_floating_ips.py @@ -17,7 +17,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import floatingips as data from novaclient.tests.unit import utils -from novaclient.v1_1 import floating_ips +from novaclient.v2 import floating_ips class FloatingIPsTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_floating_ips_bulk.py b/novaclient/tests/unit/v2/test_floating_ips_bulk.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_floating_ips_bulk.py rename to novaclient/tests/unit/v2/test_floating_ips_bulk.py index c53e453de..69b553f24 100644 --- a/novaclient/tests/unit/v1_1/test_floating_ips_bulk.py +++ b/novaclient/tests/unit/v2/test_floating_ips_bulk.py @@ -16,7 +16,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import floatingips as data from novaclient.tests.unit import utils -from novaclient.v1_1 import floating_ips_bulk +from novaclient.v2 import floating_ips_bulk class FloatingIPsBulkTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_fping.py b/novaclient/tests/unit/v2/test_fping.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_fping.py rename to novaclient/tests/unit/v2/test_fping.py index 7fe54bc89..b9ecc3991 100644 --- a/novaclient/tests/unit/v1_1/test_fping.py +++ b/novaclient/tests/unit/v2/test_fping.py @@ -16,7 +16,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import fping as data from novaclient.tests.unit import utils -from novaclient.v1_1 import fping +from novaclient.v2 import fping class FpingTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_hosts.py b/novaclient/tests/unit/v2/test_hosts.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_hosts.py rename to novaclient/tests/unit/v2/test_hosts.py index b51ab0718..029964b6b 100644 --- a/novaclient/tests/unit/v1_1/test_hosts.py +++ b/novaclient/tests/unit/v2/test_hosts.py @@ -14,7 +14,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import hosts as data from novaclient.tests.unit import utils -from novaclient.v1_1 import hosts +from novaclient.v2 import hosts class HostsTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_hypervisors.py b/novaclient/tests/unit/v2/test_hypervisors.py similarity index 100% rename from novaclient/tests/unit/v1_1/test_hypervisors.py rename to novaclient/tests/unit/v2/test_hypervisors.py diff --git a/novaclient/tests/unit/v1_1/test_images.py b/novaclient/tests/unit/v2/test_images.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_images.py rename to novaclient/tests/unit/v2/test_images.py index 4f7d55372..1f8104edb 100644 --- a/novaclient/tests/unit/v1_1/test_images.py +++ b/novaclient/tests/unit/v2/test_images.py @@ -14,7 +14,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import images as data from novaclient.tests.unit import utils -from novaclient.v1_1 import images +from novaclient.v2 import images class ImagesTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_keypairs.py b/novaclient/tests/unit/v2/test_keypairs.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_keypairs.py rename to novaclient/tests/unit/v2/test_keypairs.py index a5cf25913..91c249f82 100644 --- a/novaclient/tests/unit/v1_1/test_keypairs.py +++ b/novaclient/tests/unit/v2/test_keypairs.py @@ -14,7 +14,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import keypairs as data from novaclient.tests.unit import utils -from novaclient.v1_1 import keypairs +from novaclient.v2 import keypairs class KeypairsTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_limits.py b/novaclient/tests/unit/v2/test_limits.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_limits.py rename to novaclient/tests/unit/v2/test_limits.py index 598c38a0f..94a62c5c0 100644 --- a/novaclient/tests/unit/v1_1/test_limits.py +++ b/novaclient/tests/unit/v2/test_limits.py @@ -14,7 +14,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import limits as data from novaclient.tests.unit import utils -from novaclient.v1_1 import limits +from novaclient.v2 import limits class LimitsTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_networks.py b/novaclient/tests/unit/v2/test_networks.py similarity index 99% rename from novaclient/tests/unit/v1_1/test_networks.py rename to novaclient/tests/unit/v2/test_networks.py index 4e57c2b6f..a45ba80dc 100644 --- a/novaclient/tests/unit/v1_1/test_networks.py +++ b/novaclient/tests/unit/v2/test_networks.py @@ -14,7 +14,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import networks as data from novaclient.tests.unit import utils -from novaclient.v1_1 import networks +from novaclient.v2 import networks class NetworksTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_quota_classes.py b/novaclient/tests/unit/v2/test_quota_classes.py similarity index 96% rename from novaclient/tests/unit/v1_1/test_quota_classes.py rename to novaclient/tests/unit/v2/test_quota_classes.py index 8e651baea..467ff830d 100644 --- a/novaclient/tests/unit/v1_1/test_quota_classes.py +++ b/novaclient/tests/unit/v2/test_quota_classes.py @@ -14,7 +14,7 @@ # under the License. from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes +from novaclient.tests.unit.v2 import fakes cs = fakes.FakeClient() diff --git a/novaclient/tests/unit/v1_1/test_quotas.py b/novaclient/tests/unit/v2/test_quotas.py similarity index 100% rename from novaclient/tests/unit/v1_1/test_quotas.py rename to novaclient/tests/unit/v2/test_quotas.py diff --git a/novaclient/tests/unit/v1_1/test_security_group_rules.py b/novaclient/tests/unit/v2/test_security_group_rules.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_security_group_rules.py rename to novaclient/tests/unit/v2/test_security_group_rules.py index af5b81d4c..837519821 100644 --- a/novaclient/tests/unit/v1_1/test_security_group_rules.py +++ b/novaclient/tests/unit/v2/test_security_group_rules.py @@ -15,7 +15,7 @@ from novaclient import exceptions from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import security_group_rules as data from novaclient.tests.unit import utils -from novaclient.v1_1 import security_group_rules +from novaclient.v2 import security_group_rules class SecurityGroupRulesTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_security_groups.py b/novaclient/tests/unit/v2/test_security_groups.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_security_groups.py rename to novaclient/tests/unit/v2/test_security_groups.py index 91c9ef3f8..9aeb8dde8 100644 --- a/novaclient/tests/unit/v1_1/test_security_groups.py +++ b/novaclient/tests/unit/v2/test_security_groups.py @@ -14,7 +14,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import security_groups as data from novaclient.tests.unit import utils -from novaclient.v1_1 import security_groups +from novaclient.v2 import security_groups class SecurityGroupsTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_server_groups.py b/novaclient/tests/unit/v2/test_server_groups.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_server_groups.py rename to novaclient/tests/unit/v2/test_server_groups.py index eecd71d41..fcda2dec7 100644 --- a/novaclient/tests/unit/v1_1/test_server_groups.py +++ b/novaclient/tests/unit/v2/test_server_groups.py @@ -16,7 +16,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import server_groups as data from novaclient.tests.unit import utils -from novaclient.v1_1 import server_groups +from novaclient.v2 import server_groups class ServerGroupsTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_servers.py b/novaclient/tests/unit/v2/test_servers.py similarity index 99% rename from novaclient/tests/unit/v1_1/test_servers.py rename to novaclient/tests/unit/v2/test_servers.py index 214f394ee..c9b15f30a 100644 --- a/novaclient/tests/unit/v1_1/test_servers.py +++ b/novaclient/tests/unit/v2/test_servers.py @@ -21,7 +21,7 @@ from novaclient.tests.unit.fixture_data import client from novaclient.tests.unit.fixture_data import floatingips from novaclient.tests.unit.fixture_data import servers as data from novaclient.tests.unit import utils -from novaclient.v1_1 import servers +from novaclient.v2 import servers class ServersTest(utils.FixturedTestCase): diff --git a/novaclient/tests/unit/v1_1/test_services.py b/novaclient/tests/unit/v2/test_services.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_services.py rename to novaclient/tests/unit/v2/test_services.py index 61cbd67f1..2724342d4 100644 --- a/novaclient/tests/unit/v1_1/test_services.py +++ b/novaclient/tests/unit/v2/test_services.py @@ -14,8 +14,8 @@ # under the License. from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes -from novaclient.v1_1 import services +from novaclient.tests.unit.v2 import fakes +from novaclient.v2 import services class ServicesTest(utils.TestCase): diff --git a/novaclient/tests/unit/v1_1/test_shell.py b/novaclient/tests/unit/v2/test_shell.py similarity index 98% rename from novaclient/tests/unit/v1_1/test_shell.py rename to novaclient/tests/unit/v2/test_shell.py index cca5d6685..49e1581aa 100644 --- a/novaclient/tests/unit/v1_1/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -30,8 +30,8 @@ import novaclient.client from novaclient import exceptions import novaclient.shell from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes -import novaclient.v1_1.shell +from novaclient.tests.unit.v2 import fakes +import novaclient.v2.shell class ShellFixture(fixtures.Fixture): @@ -54,7 +54,7 @@ class ShellTest(utils.TestCase): 'NOVA_USERNAME': 'username', 'NOVA_PASSWORD': 'password', 'NOVA_PROJECT_ID': 'project_id', - 'OS_COMPUTE_API_VERSION': '1.1', + 'OS_COMPUTE_API_VERSION': '2', 'NOVA_URL': 'http://no.where', 'OS_AUTH_URL': 'http://no.where/v2.0', } @@ -644,7 +644,7 @@ class ShellTest(utils.TestCase): cmd = 'boot --image 1 --flavor 1 --min-count 3 --max-count 1 serv' self.assertRaises(exceptions.CommandError, self.run_command, cmd) - @mock.patch('novaclient.v1_1.shell._poll_for_status') + @mock.patch('novaclient.v2.shell._poll_for_status') def test_boot_with_poll(self, poll_method): self.run_command('boot --flavor 1 --image 1 some-server --poll') self.assert_called_anytime( @@ -1088,7 +1088,7 @@ class ShellTest(utils.TestCase): self.assertRaises(exceptions.CommandError, self.run_command, 'show xxx') - @mock.patch('novaclient.v1_1.shell.utils.print_dict') + @mock.patch('novaclient.v2.shell.utils.print_dict') def test_print_server(self, mock_print_dict): self.run_command('show 5678') args, kwargs = mock_print_dict.call_args @@ -2225,7 +2225,7 @@ class ShellTest(utils.TestCase): '/os-migrations?cell_name=child1&host=host1' '&status=finished') - @mock.patch('novaclient.v1_1.shell._find_server') + @mock.patch('novaclient.v2.shell._find_server') @mock.patch('os.system') def test_ssh(self, mock_system, mock_find_server): class FakeResources(object): @@ -2273,7 +2273,7 @@ class ShellTest(utils.TestCase): mock_system.assert_called_with("ssh -6 -p22 " "root@2607:f0d0:1002::4 -1") - @mock.patch('novaclient.v1_1.shell._find_server') + @mock.patch('novaclient.v2.shell._find_server') @mock.patch('os.system') def test_ssh_multinet(self, mock_system, mock_find_server): class FakeResources(object): @@ -2338,6 +2338,28 @@ class ShellTest(utils.TestCase): self.assert_called('DELETE', '/os-server-groups/12345', pos=-2) +class ShellTestV11(ShellTest): + FAKE_ENV = { + 'NOVA_USERNAME': 'username', + 'NOVA_PASSWORD': 'password', + 'NOVA_PROJECT_ID': 'project_id', + 'OS_COMPUTE_API_VERSION': '1.1', + 'NOVA_URL': 'http://no.where', + 'OS_AUTH_URL': 'http://no.where/v2.0', + } + + +class ShellTestV3(ShellTest): + FAKE_ENV = { + 'NOVA_USERNAME': 'username', + 'NOVA_PASSWORD': 'password', + 'NOVA_PROJECT_ID': 'project_id', + 'OS_COMPUTE_API_VERSION': '3', + 'NOVA_URL': 'http://no.where', + 'OS_AUTH_URL': 'http://no.where/v2.0', + } + + class ShellWithSessionClientTest(ShellTest): def setUp(self): @@ -2354,7 +2376,7 @@ class GetSecgroupTest(utils.TestCase): 'security_groups.get.return_value': 'sec_group', 'security_groups.list.return_value': [], }) - result = novaclient.v1_1.shell._get_secgroup(cs, '1') + result = novaclient.v2.shell._get_secgroup(cs, '1') self.assertEqual('sec_group', result) cs.security_groups.get.assert_called_once_with('1') @@ -2363,7 +2385,7 @@ class GetSecgroupTest(utils.TestCase): 'security_groups.get.return_value': 'sec_group', 'security_groups.list.return_value': [], }) - result = novaclient.v1_1.shell._get_secgroup( + result = novaclient.v2.shell._get_secgroup( cs, 'c0c32459-dc5f-44dc-9a0a-473b28bac831') self.assertEqual('sec_group', result) cs.security_groups.get.assert_called_once_with( @@ -2375,7 +2397,7 @@ class GetSecgroupTest(utils.TestCase): 'security_groups.list.return_value': [], }) self.assertRaises(exceptions.CommandError, - novaclient.v1_1.shell._get_secgroup, + novaclient.v2.shell._get_secgroup, cs, 'abc') @@ -2387,7 +2409,7 @@ class GetSecgroupTest(utils.TestCase): 'security_groups.list.return_value': [group_one, group_one], }) self.assertRaises(exceptions.NoUniqueMatch, - novaclient.v1_1.shell._get_secgroup, + novaclient.v2.shell._get_secgroup, cs, 'group_one') @@ -2396,7 +2418,7 @@ class GetFirstEndpointTest(utils.TestCase): def test_only_one_endpoint(self): """If there is only one endpoint, it is returned.""" endpoint = {"url": "test"} - result = novaclient.v1_1.shell._get_first_endpoint([endpoint], "XYZ") + result = novaclient.v2.shell._get_first_endpoint([endpoint], "XYZ") self.assertEqual(endpoint, result) def test_multiple_endpoints(self): @@ -2409,7 +2431,7 @@ class GetFirstEndpointTest(utils.TestCase): {"region": "ORD", "number": 1}, {"region": "ORD", "number": 2} ] - result = novaclient.v1_1.shell._get_first_endpoint(endpoints, "ORD") + result = novaclient.v2.shell._get_first_endpoint(endpoints, "ORD") self.assertEqual(endpoints[1], result) def test_multiple_endpoints_but_none_suitable(self): @@ -2423,11 +2445,11 @@ class GetFirstEndpointTest(utils.TestCase): {"region": "STU"} ] self.assertRaises(LookupError, - novaclient.v1_1.shell._get_first_endpoint, + novaclient.v2.shell._get_first_endpoint, endpoints, "ORD") def test_no_endpoints(self): """If there are no endpoints available, an exception is raised.""" self.assertRaises(LookupError, - novaclient.v1_1.shell._get_first_endpoint, + novaclient.v2.shell._get_first_endpoint, [], "ORD") diff --git a/novaclient/tests/unit/v1_1/test_usage.py b/novaclient/tests/unit/v2/test_usage.py similarity index 95% rename from novaclient/tests/unit/v1_1/test_usage.py rename to novaclient/tests/unit/v2/test_usage.py index 2f52706dc..a92be0e0d 100644 --- a/novaclient/tests/unit/v1_1/test_usage.py +++ b/novaclient/tests/unit/v2/test_usage.py @@ -14,8 +14,8 @@ import datetime from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes -from novaclient.v1_1 import usage +from novaclient.tests.unit.v2 import fakes +from novaclient.v2 import usage class UsageTest(utils.TestCase): diff --git a/novaclient/tests/unit/v1_1/test_volumes.py b/novaclient/tests/unit/v2/test_volumes.py similarity index 97% rename from novaclient/tests/unit/v1_1/test_volumes.py rename to novaclient/tests/unit/v2/test_volumes.py index 432b80532..52b81ab6a 100644 --- a/novaclient/tests/unit/v1_1/test_volumes.py +++ b/novaclient/tests/unit/v2/test_volumes.py @@ -14,8 +14,8 @@ # under the License. from novaclient.tests.unit import utils -from novaclient.tests.unit.v1_1 import fakes -from novaclient.v1_1 import volumes +from novaclient.tests.unit.v2 import fakes +from novaclient.v2 import volumes cs = fakes.FakeClient() diff --git a/novaclient/tests/unit/v1_1/testfile.txt b/novaclient/tests/unit/v2/testfile.txt similarity index 100% rename from novaclient/tests/unit/v1_1/testfile.txt rename to novaclient/tests/unit/v2/testfile.txt diff --git a/novaclient/tests/unit/v1_1/utils.py b/novaclient/tests/unit/v2/utils.py similarity index 100% rename from novaclient/tests/unit/v1_1/utils.py rename to novaclient/tests/unit/v2/utils.py diff --git a/novaclient/v1_1/__init__.py b/novaclient/v1_1/__init__.py index 19712285f..9da768172 100644 --- a/novaclient/v1_1/__init__.py +++ b/novaclient/v1_1/__init__.py @@ -1,4 +1,3 @@ -# Copyright (c) 2012 OpenStack Foundation # # All Rights Reserved. # @@ -14,4 +13,31 @@ # License for the specific language governing permissions and limitations # under the License. -from novaclient.v1_1.client import Client # noqa +# NOTE(akurilin): This module is left for backward compatibility. Feel free to +# remove it, when openstack project will use correct way to +# obtain novaclient object. +# Known problems: +# * python-openstackclient - +# https://bugs.launchpad.net/python-openstackclient/+bug/1418024 +# * neutron - https://bugs.launchpad.net/neutron/+bug/1418017 + + +import sys +import warnings + +from novaclient import v2 + +warnings.warn("Module novaclient.v1_1 is deprecated (taken as a basis for " + "novaclient.v2). " + "The preferable way to get client class or object you can find " + "in novaclient.client module.") + + +class MovedModule(object): + def __init__(self, new_module): + self.new_module = new_module + + def __getattr__(self, attr): + return getattr(self.new_module, attr) + +sys.modules["novaclient.v1_1"] = MovedModule(v2) diff --git a/novaclient/v2/__init__.py b/novaclient/v2/__init__.py new file mode 100644 index 000000000..21d7c4fcc --- /dev/null +++ b/novaclient/v2/__init__.py @@ -0,0 +1,16 @@ +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from novaclient.v2.client import Client # noqa diff --git a/novaclient/v1_1/agents.py b/novaclient/v2/agents.py similarity index 100% rename from novaclient/v1_1/agents.py rename to novaclient/v2/agents.py diff --git a/novaclient/v1_1/aggregates.py b/novaclient/v2/aggregates.py similarity index 100% rename from novaclient/v1_1/aggregates.py rename to novaclient/v2/aggregates.py diff --git a/novaclient/v1_1/availability_zones.py b/novaclient/v2/availability_zones.py similarity index 100% rename from novaclient/v1_1/availability_zones.py rename to novaclient/v2/availability_zones.py diff --git a/novaclient/v1_1/certs.py b/novaclient/v2/certs.py similarity index 100% rename from novaclient/v1_1/certs.py rename to novaclient/v2/certs.py diff --git a/novaclient/v1_1/client.py b/novaclient/v2/client.py similarity index 86% rename from novaclient/v1_1/client.py rename to novaclient/v2/client.py index 83789aa6b..386c649f9 100644 --- a/novaclient/v1_1/client.py +++ b/novaclient/v2/client.py @@ -14,39 +14,39 @@ # under the License. from novaclient import client -from novaclient.v1_1 import agents -from novaclient.v1_1 import aggregates -from novaclient.v1_1 import availability_zones -from novaclient.v1_1 import certs -from novaclient.v1_1 import cloudpipe -from novaclient.v1_1 import fixed_ips -from novaclient.v1_1 import flavor_access -from novaclient.v1_1 import flavors -from novaclient.v1_1 import floating_ip_dns -from novaclient.v1_1 import floating_ip_pools -from novaclient.v1_1 import floating_ips -from novaclient.v1_1 import floating_ips_bulk -from novaclient.v1_1 import fping -from novaclient.v1_1 import hosts -from novaclient.v1_1 import hypervisors -from novaclient.v1_1 import images -from novaclient.v1_1 import keypairs -from novaclient.v1_1 import limits -from novaclient.v1_1 import networks -from novaclient.v1_1 import quota_classes -from novaclient.v1_1 import quotas -from novaclient.v1_1 import security_group_default_rules -from novaclient.v1_1 import security_group_rules -from novaclient.v1_1 import security_groups -from novaclient.v1_1 import server_groups -from novaclient.v1_1 import servers -from novaclient.v1_1 import services -from novaclient.v1_1 import usage -from novaclient.v1_1 import versions -from novaclient.v1_1 import virtual_interfaces -from novaclient.v1_1 import volume_snapshots -from novaclient.v1_1 import volume_types -from novaclient.v1_1 import volumes +from novaclient.v2 import agents +from novaclient.v2 import aggregates +from novaclient.v2 import availability_zones +from novaclient.v2 import certs +from novaclient.v2 import cloudpipe +from novaclient.v2 import fixed_ips +from novaclient.v2 import flavor_access +from novaclient.v2 import flavors +from novaclient.v2 import floating_ip_dns +from novaclient.v2 import floating_ip_pools +from novaclient.v2 import floating_ips +from novaclient.v2 import floating_ips_bulk +from novaclient.v2 import fping +from novaclient.v2 import hosts +from novaclient.v2 import hypervisors +from novaclient.v2 import images +from novaclient.v2 import keypairs +from novaclient.v2 import limits +from novaclient.v2 import networks +from novaclient.v2 import quota_classes +from novaclient.v2 import quotas +from novaclient.v2 import security_group_default_rules +from novaclient.v2 import security_group_rules +from novaclient.v2 import security_groups +from novaclient.v2 import server_groups +from novaclient.v2 import servers +from novaclient.v2 import services +from novaclient.v2 import usage +from novaclient.v2 import versions +from novaclient.v2 import virtual_interfaces +from novaclient.v2 import volume_snapshots +from novaclient.v2 import volume_types +from novaclient.v2 import volumes class Client(object): diff --git a/novaclient/v1_1/cloudpipe.py b/novaclient/v2/cloudpipe.py similarity index 100% rename from novaclient/v1_1/cloudpipe.py rename to novaclient/v2/cloudpipe.py diff --git a/novaclient/v1_1/contrib/__init__.py b/novaclient/v2/contrib/__init__.py similarity index 100% rename from novaclient/v1_1/contrib/__init__.py rename to novaclient/v2/contrib/__init__.py diff --git a/novaclient/v1_1/contrib/assisted_volume_snapshots.py b/novaclient/v2/contrib/assisted_volume_snapshots.py similarity index 100% rename from novaclient/v1_1/contrib/assisted_volume_snapshots.py rename to novaclient/v2/contrib/assisted_volume_snapshots.py diff --git a/novaclient/v1_1/contrib/baremetal.py b/novaclient/v2/contrib/baremetal.py similarity index 100% rename from novaclient/v1_1/contrib/baremetal.py rename to novaclient/v2/contrib/baremetal.py diff --git a/novaclient/v1_1/contrib/cells.py b/novaclient/v2/contrib/cells.py similarity index 100% rename from novaclient/v1_1/contrib/cells.py rename to novaclient/v2/contrib/cells.py diff --git a/novaclient/v1_1/contrib/deferred_delete.py b/novaclient/v2/contrib/deferred_delete.py similarity index 100% rename from novaclient/v1_1/contrib/deferred_delete.py rename to novaclient/v2/contrib/deferred_delete.py diff --git a/novaclient/v1_1/contrib/host_evacuate.py b/novaclient/v2/contrib/host_evacuate.py similarity index 100% rename from novaclient/v1_1/contrib/host_evacuate.py rename to novaclient/v2/contrib/host_evacuate.py diff --git a/novaclient/v1_1/contrib/host_evacuate_live.py b/novaclient/v2/contrib/host_evacuate_live.py similarity index 100% rename from novaclient/v1_1/contrib/host_evacuate_live.py rename to novaclient/v2/contrib/host_evacuate_live.py diff --git a/novaclient/v1_1/contrib/host_servers_migrate.py b/novaclient/v2/contrib/host_servers_migrate.py similarity index 100% rename from novaclient/v1_1/contrib/host_servers_migrate.py rename to novaclient/v2/contrib/host_servers_migrate.py diff --git a/novaclient/v1_1/contrib/instance_action.py b/novaclient/v2/contrib/instance_action.py similarity index 100% rename from novaclient/v1_1/contrib/instance_action.py rename to novaclient/v2/contrib/instance_action.py diff --git a/novaclient/v1_1/contrib/list_extensions.py b/novaclient/v2/contrib/list_extensions.py similarity index 100% rename from novaclient/v1_1/contrib/list_extensions.py rename to novaclient/v2/contrib/list_extensions.py diff --git a/novaclient/v1_1/contrib/metadata_extensions.py b/novaclient/v2/contrib/metadata_extensions.py similarity index 97% rename from novaclient/v1_1/contrib/metadata_extensions.py rename to novaclient/v2/contrib/metadata_extensions.py index 36bef9abb..ad843b746 100644 --- a/novaclient/v1_1/contrib/metadata_extensions.py +++ b/novaclient/v2/contrib/metadata_extensions.py @@ -15,7 +15,7 @@ from novaclient.i18n import _ from novaclient.openstack.common import cliutils -from novaclient.v1_1 import shell +from novaclient.v2 import shell @cliutils.arg( diff --git a/novaclient/v1_1/contrib/migrations.py b/novaclient/v2/contrib/migrations.py similarity index 100% rename from novaclient/v1_1/contrib/migrations.py rename to novaclient/v2/contrib/migrations.py diff --git a/novaclient/v1_1/contrib/server_external_events.py b/novaclient/v2/contrib/server_external_events.py similarity index 100% rename from novaclient/v1_1/contrib/server_external_events.py rename to novaclient/v2/contrib/server_external_events.py diff --git a/novaclient/v1_1/contrib/tenant_networks.py b/novaclient/v2/contrib/tenant_networks.py similarity index 100% rename from novaclient/v1_1/contrib/tenant_networks.py rename to novaclient/v2/contrib/tenant_networks.py diff --git a/novaclient/v1_1/fixed_ips.py b/novaclient/v2/fixed_ips.py similarity index 100% rename from novaclient/v1_1/fixed_ips.py rename to novaclient/v2/fixed_ips.py diff --git a/novaclient/v1_1/flavor_access.py b/novaclient/v2/flavor_access.py similarity index 100% rename from novaclient/v1_1/flavor_access.py rename to novaclient/v2/flavor_access.py diff --git a/novaclient/v1_1/flavors.py b/novaclient/v2/flavors.py similarity index 100% rename from novaclient/v1_1/flavors.py rename to novaclient/v2/flavors.py diff --git a/novaclient/v1_1/floating_ip_dns.py b/novaclient/v2/floating_ip_dns.py similarity index 100% rename from novaclient/v1_1/floating_ip_dns.py rename to novaclient/v2/floating_ip_dns.py diff --git a/novaclient/v1_1/floating_ip_pools.py b/novaclient/v2/floating_ip_pools.py similarity index 100% rename from novaclient/v1_1/floating_ip_pools.py rename to novaclient/v2/floating_ip_pools.py diff --git a/novaclient/v1_1/floating_ips.py b/novaclient/v2/floating_ips.py similarity index 100% rename from novaclient/v1_1/floating_ips.py rename to novaclient/v2/floating_ips.py diff --git a/novaclient/v1_1/floating_ips_bulk.py b/novaclient/v2/floating_ips_bulk.py similarity index 100% rename from novaclient/v1_1/floating_ips_bulk.py rename to novaclient/v2/floating_ips_bulk.py diff --git a/novaclient/v1_1/fping.py b/novaclient/v2/fping.py similarity index 100% rename from novaclient/v1_1/fping.py rename to novaclient/v2/fping.py diff --git a/novaclient/v1_1/hosts.py b/novaclient/v2/hosts.py similarity index 100% rename from novaclient/v1_1/hosts.py rename to novaclient/v2/hosts.py diff --git a/novaclient/v1_1/hypervisors.py b/novaclient/v2/hypervisors.py similarity index 100% rename from novaclient/v1_1/hypervisors.py rename to novaclient/v2/hypervisors.py diff --git a/novaclient/v1_1/images.py b/novaclient/v2/images.py similarity index 100% rename from novaclient/v1_1/images.py rename to novaclient/v2/images.py diff --git a/novaclient/v1_1/keypairs.py b/novaclient/v2/keypairs.py similarity index 100% rename from novaclient/v1_1/keypairs.py rename to novaclient/v2/keypairs.py diff --git a/novaclient/v1_1/limits.py b/novaclient/v2/limits.py similarity index 100% rename from novaclient/v1_1/limits.py rename to novaclient/v2/limits.py diff --git a/novaclient/v1_1/networks.py b/novaclient/v2/networks.py similarity index 100% rename from novaclient/v1_1/networks.py rename to novaclient/v2/networks.py diff --git a/novaclient/v1_1/quota_classes.py b/novaclient/v2/quota_classes.py similarity index 100% rename from novaclient/v1_1/quota_classes.py rename to novaclient/v2/quota_classes.py diff --git a/novaclient/v1_1/quotas.py b/novaclient/v2/quotas.py similarity index 100% rename from novaclient/v1_1/quotas.py rename to novaclient/v2/quotas.py diff --git a/novaclient/v1_1/security_group_default_rules.py b/novaclient/v2/security_group_default_rules.py similarity index 100% rename from novaclient/v1_1/security_group_default_rules.py rename to novaclient/v2/security_group_default_rules.py diff --git a/novaclient/v1_1/security_group_rules.py b/novaclient/v2/security_group_rules.py similarity index 100% rename from novaclient/v1_1/security_group_rules.py rename to novaclient/v2/security_group_rules.py diff --git a/novaclient/v1_1/security_groups.py b/novaclient/v2/security_groups.py similarity index 100% rename from novaclient/v1_1/security_groups.py rename to novaclient/v2/security_groups.py diff --git a/novaclient/v1_1/server_groups.py b/novaclient/v2/server_groups.py similarity index 100% rename from novaclient/v1_1/server_groups.py rename to novaclient/v2/server_groups.py diff --git a/novaclient/v1_1/servers.py b/novaclient/v2/servers.py similarity index 99% rename from novaclient/v1_1/servers.py rename to novaclient/v2/servers.py index ef3974fba..36de45b7f 100644 --- a/novaclient/v1_1/servers.py +++ b/novaclient/v2/servers.py @@ -28,7 +28,7 @@ from six.moves.urllib import parse from novaclient import base from novaclient import crypto from novaclient.i18n import _ -from novaclient.v1_1 import security_groups +from novaclient.v2 import security_groups REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD' diff --git a/novaclient/v1_1/services.py b/novaclient/v2/services.py similarity index 100% rename from novaclient/v1_1/services.py rename to novaclient/v2/services.py diff --git a/novaclient/v1_1/shell.py b/novaclient/v2/shell.py similarity index 99% rename from novaclient/v1_1/shell.py rename to novaclient/v2/shell.py index b6f78d85e..190d07fe3 100644 --- a/novaclient/v1_1/shell.py +++ b/novaclient/v2/shell.py @@ -39,9 +39,9 @@ from novaclient.i18n import _ from novaclient.openstack.common import cliutils from novaclient.openstack.common import uuidutils from novaclient import utils -from novaclient.v1_1 import availability_zones -from novaclient.v1_1 import quotas -from novaclient.v1_1 import servers +from novaclient.v2 import availability_zones +from novaclient.v2 import quotas +from novaclient.v2 import servers logger = logging.getLogger(__name__) diff --git a/novaclient/v1_1/usage.py b/novaclient/v2/usage.py similarity index 100% rename from novaclient/v1_1/usage.py rename to novaclient/v2/usage.py diff --git a/novaclient/v1_1/versions.py b/novaclient/v2/versions.py similarity index 100% rename from novaclient/v1_1/versions.py rename to novaclient/v2/versions.py diff --git a/novaclient/v1_1/virtual_interfaces.py b/novaclient/v2/virtual_interfaces.py similarity index 100% rename from novaclient/v1_1/virtual_interfaces.py rename to novaclient/v2/virtual_interfaces.py diff --git a/novaclient/v1_1/volume_snapshots.py b/novaclient/v2/volume_snapshots.py similarity index 100% rename from novaclient/v1_1/volume_snapshots.py rename to novaclient/v2/volume_snapshots.py diff --git a/novaclient/v1_1/volume_types.py b/novaclient/v2/volume_types.py similarity index 100% rename from novaclient/v1_1/volume_types.py rename to novaclient/v2/volume_types.py diff --git a/novaclient/v1_1/volumes.py b/novaclient/v2/volumes.py similarity index 100% rename from novaclient/v1_1/volumes.py rename to novaclient/v2/volumes.py