From 68d769bf71f01b3a8b27a7b7632926dc449245b6 Mon Sep 17 00:00:00 2001 From: Masahito Muroi Date: Thu, 16 Feb 2017 18:39:58 +0900 Subject: [PATCH] Migrate climate namespace to blazar Although the Climate project was renamed to Blazar in 2014, the code has still been using the climate namespace. This patch moves all code to the blazar directory and allows users and operators to use the 'blazar' command namespace. The 'climate' namespace remains O release to allow users of Blazar time to move their own code to the blazar namespace, but will be removed in P release development cycle. Change-Id: Icbe6fab1051aae4ac819982a1fa4f323cb0bf2d0 Partial-Bug: #1662734 --- MANIFEST.in | 2 +- README.rst | 2 +- blazar/__init__.py | 5 -- {climate => blazar/api}/__init__.py | 0 {climate => blazar}/api/context.py | 6 +- {climate => blazar}/api/root.py | 2 +- {climate/api => blazar/api/v1}/__init__.py | 0 {climate => blazar}/api/v1/app.py | 26 ++++----- .../v1 => blazar/api/v1/oshosts}/__init__.py | 0 {climate => blazar}/api/v1/oshosts/service.py | 12 ++-- {climate => blazar}/api/v1/oshosts/v1_0.py | 8 +-- {climate => blazar}/api/v1/service.py | 22 ++++---- {climate => blazar}/api/v1/utils.py | 16 +++--- {climate => blazar}/api/v1/v1_0.py | 8 +-- {climate => blazar}/api/v1/validation.py | 4 +- .../v1/oshosts => blazar/api/v2}/__init__.py | 0 {climate => blazar}/api/v2/app.py | 10 ++-- .../api/v2/controllers/__init__.py | 8 +-- .../api/v2/controllers/base.py | 2 +- .../api/v2/controllers/extensions/__init__.py | 0 .../api/v2/controllers/extensions/host.py | 16 +++--- .../api/v2/controllers/extensions/lease.py | 26 ++++----- .../api/v2/controllers/types.py | 2 +- {climate => blazar}/api/v2/hooks.py | 8 +-- .../api/v2/middleware/__init__.py | 12 ++-- {climate/api/v2 => blazar/cmd}/__init__.py | 0 {climate => blazar}/cmd/api.py | 14 ++--- {climate => blazar}/cmd/manager.py | 12 ++-- {climate => blazar}/config.py | 2 +- {climate => blazar}/context.py | 6 +- {climate/cmd => blazar/db}/__init__.py | 0 {climate => blazar}/db/api.py | 8 +-- {climate => blazar}/db/base.py | 2 +- {climate => blazar}/db/exceptions.py | 14 ++--- {climate => blazar}/db/migration/README | 28 +++++----- .../db => blazar/db/migration}/__init__.py | 0 {climate => blazar}/db/migration/alembic.ini | 2 +- .../db/migration/alembic_migrations/env.py | 10 ++-- .../alembic_migrations/script.py.mako | 0 .../versions/0_1_initial.py | 0 .../10e34bba18e8_add_service_name_to_.py | 0 .../1fd6c2eded89_add_trust_id_to_comp.py | 0 .../23d6240b51b2_add_status_to_leases.py | 0 .../2bcfe76b0474_change_tenant_to_project.py | 0 .../alembic_migrations/versions/README | 3 + {climate => blazar}/db/migration/cli.py | 8 +-- .../db/sqlalchemy}/__init__.py | 0 {climate => blazar}/db/sqlalchemy/api.py | 48 ++++++++-------- .../db/sqlalchemy/facade_wrapper.py | 0 .../db/sqlalchemy/model_base.py | 6 +- {climate => blazar}/db/sqlalchemy/models.py | 16 +++--- {climate => blazar}/db/sqlalchemy/types.py | 0 {climate => blazar}/db/sqlalchemy/utils.py | 4 +- {climate => blazar}/db/utils.py | 6 +- {climate => blazar}/exceptions.py | 24 ++++---- {climate => blazar}/i18n.py | 2 +- {climate => blazar}/manager/__init__.py | 6 +- {climate => blazar}/manager/exceptions.py | 42 +++++++------- .../manager/oshosts}/__init__.py | 0 {climate => blazar}/manager/oshosts/rpcapi.py | 8 +-- {climate => blazar}/manager/rpcapi.py | 6 +- {climate => blazar}/manager/service.py | 44 +++++++-------- .../notification}/__init__.py | 0 {climate => blazar}/notification/api.py | 2 +- {climate => blazar}/notification/notifier.py | 4 +- blazar/opts.py | 56 +++++++++++++++++++ .../plugins}/__init__.py | 0 {climate => blazar}/plugins/base.py | 2 +- .../plugins/dummy_vm_plugin.py | 2 +- .../plugins/instances/__init__.py | 0 .../plugins/instances/vm_plugin.py | 16 +++--- .../plugins/oshosts/__init__.py | 0 .../plugins/oshosts/host_plugin.py | 26 ++++----- .../plugins/oshosts/nova_inventory.py | 4 +- .../plugins/oshosts/reservation_pool.py | 26 +++++---- {climate => blazar}/policy.py | 12 ++-- {climate => blazar}/states.py | 10 ++-- {climate => blazar}/tests/__init__.py | 16 +++--- {climate => blazar}/tests/api/__init__.py | 18 +++--- {climate => blazar}/tests/api/test_acl.py | 4 +- {climate => blazar}/tests/api/test_context.py | 10 ++-- {climate => blazar}/tests/api/test_root.py | 2 +- .../tests/api/test_version_selector.py | 8 +-- .../tests/api/v1}/__init__.py | 0 .../tests/api/v1/oshosts}/__init__.py | 0 .../tests/api/v1/oshosts/test_service.py | 4 +- .../tests/api/v1/oshosts/test_v1_0.py | 8 +-- {climate => blazar}/tests/api/v1/test_app.py | 10 ++-- .../tests/api/v1/test_service.py | 4 +- .../tests/api/v1/test_utils.py | 4 +- {climate => blazar}/tests/api/v1/test_v1_0.py | 8 +-- .../tests/api/v1/test_validation.py | 10 ++-- .../tests/api/v2}/__init__.py | 0 .../tests/api/v2/test_hosts.py | 4 +- .../tests/api/v2/test_leases.py | 4 +- .../api/v2 => blazar/tests/db}/__init__.py | 0 .../tests/db/migration/__init__.py | 18 +++--- .../tests/db/migration/test_migrations.conf | 0 .../tests/db/migration/test_migrations.py | 2 +- .../tests/db/sqlalchemy}/__init__.py | 0 .../db/sqlalchemy/test_sqlalchemy_api.py | 52 ++++++++--------- .../tests/db/sqlalchemy/test_utils.py | 6 +- {climate => blazar}/tests/db/test_api.py | 4 +- {climate => blazar}/tests/db/test_utils.py | 2 +- {climate => blazar}/tests/fake_lease.py | 0 {climate => blazar}/tests/fake_policy.py | 22 ++++---- .../tests/manager}/__init__.py | 0 .../tests/manager/test_rpcapi.py | 4 +- .../tests/manager/test_service.py | 46 +++++++-------- .../tests/notification}/__init__.py | 0 .../tests/notification/test_notifier.py | 4 +- .../tests/plugins}/__init__.py | 0 .../tests/plugins/instances}/__init__.py | 0 .../tests/plugins/instances/test_vm_plugin.py | 12 ++-- .../tests/plugins/oshosts}/__init__.py | 0 .../plugins/oshosts/test_nova_inventory.py | 12 ++-- .../plugins/oshosts/test_reservation_pool.py | 24 ++++---- .../plugins/test_physical_host_plugin.py | 36 ++++++------ {climate => blazar}/tests/test_context.py | 12 ++-- {climate => blazar}/tests/test_exceptions.py | 28 +++++----- {climate => blazar}/tests/test_policy.py | 26 ++++----- {climate => blazar}/tests/test_service.py | 4 +- {climate => blazar}/tests/test_states.py | 14 ++--- .../tests/utils}/__init__.py | 0 .../tests/utils/openstack}/__init__.py | 0 .../tests/utils/openstack/test_base.py | 6 +- .../tests/utils/openstack/test_keystone.py | 32 +++++------ .../tests/utils/openstack/test_nova.py | 12 ++-- .../tests/utils/test_trusts.py | 12 ++-- {climate => blazar}/utils/__init__.py | 0 .../utils/openstack/__init__.py | 0 {climate => blazar}/utils/openstack/base.py | 2 +- .../utils/openstack/keystone.py | 10 ++-- {climate => blazar}/utils/openstack/nova.py | 14 ++--- {climate => blazar}/utils/service.py | 10 ++-- {climate => blazar}/utils/trusts.py | 16 +++--- {climate => blazar}/version.py | 2 +- .../alembic_migrations/versions/README | 3 - climate/opts.py | 56 ------------------- climate/utils/openstack/__init__.py | 0 .../cli/{climateclient.py => blazarclient.py} | 6 +- .../test_resource_reservation.py | 26 ++++----- .../tempest/config_resource_reservation.py | 10 ++-- .../scenario/resource_reservation_scenario.py | 5 +- .../scenario/test_instance_reservation.py | 6 +- devstack/plugin.sh | 8 +-- devstack/settings | 2 +- doc/source/conf.py | 6 +- doc/source/restapi/rest_api_v2.rst | 8 +-- doc/source/userdoc/installation.guide.rst | 26 ++++----- etc/blazar/README-blazar.conf.txt | 4 ++ .../blazar-config-generator.conf} | 4 +- etc/climate/README-climate.conf.txt | 4 -- etc/policy.json | 18 +++--- releasenotes/source/conf.py | 2 +- setup.cfg | 41 ++++++++------ tox.ini | 6 +- 157 files changed, 740 insertions(+), 737 deletions(-) rename {climate => blazar/api}/__init__.py (100%) rename {climate => blazar}/api/context.py (92%) rename {climate => blazar}/api/root.py (97%) rename {climate/api => blazar/api/v1}/__init__.py (100%) rename {climate => blazar}/api/v1/app.py (82%) rename {climate/api/v1 => blazar/api/v1/oshosts}/__init__.py (100%) rename {climate => blazar}/api/v1/oshosts/service.py (86%) rename {climate => blazar}/api/v1/oshosts/v1_0.py (92%) rename {climate => blazar}/api/v1/service.py (83%) rename {climate => blazar}/api/v1/utils.py (95%) rename {climate => blazar}/api/v1/v1_0.py (92%) rename {climate => blazar}/api/v1/validation.py (95%) rename {climate/api/v1/oshosts => blazar/api/v2}/__init__.py (100%) rename {climate => blazar}/api/v2/app.py (90%) rename {climate => blazar}/api/v2/controllers/__init__.py (94%) rename {climate => blazar}/api/v2/controllers/base.py (97%) rename {climate => blazar}/api/v2/controllers/extensions/__init__.py (100%) rename {climate => blazar}/api/v2/controllers/extensions/host.py (94%) rename {climate => blazar}/api/v2/controllers/extensions/lease.py (89%) rename {climate => blazar}/api/v2/controllers/types.py (99%) rename {climate => blazar}/api/v2/hooks.py (92%) rename {climate => blazar}/api/v2/middleware/__init__.py (94%) rename {climate/api/v2 => blazar/cmd}/__init__.py (100%) rename {climate => blazar}/cmd/api.py (89%) rename {climate => blazar}/cmd/manager.py (77%) rename {climate => blazar}/config.py (98%) rename {climate => blazar}/context.py (96%) rename {climate/cmd => blazar/db}/__init__.py (100%) rename {climate => blazar}/db/api.py (97%) rename {climate => blazar}/db/base.py (95%) rename {climate => blazar}/db/exceptions.py (75%) rename {climate => blazar}/db/migration/README (72%) rename {climate/db => blazar/db/migration}/__init__.py (100%) rename {climate => blazar}/db/migration/alembic.ini (93%) rename {climate => blazar}/db/migration/alembic_migrations/env.py (90%) rename {climate => blazar}/db/migration/alembic_migrations/script.py.mako (100%) rename {climate => blazar}/db/migration/alembic_migrations/versions/0_1_initial.py (100%) rename {climate => blazar}/db/migration/alembic_migrations/versions/10e34bba18e8_add_service_name_to_.py (100%) rename {climate => blazar}/db/migration/alembic_migrations/versions/1fd6c2eded89_add_trust_id_to_comp.py (100%) rename {climate => blazar}/db/migration/alembic_migrations/versions/23d6240b51b2_add_status_to_leases.py (100%) rename {climate => blazar}/db/migration/alembic_migrations/versions/2bcfe76b0474_change_tenant_to_project.py (100%) create mode 100644 blazar/db/migration/alembic_migrations/versions/README rename {climate => blazar}/db/migration/cli.py (95%) rename {climate/db/migration => blazar/db/sqlalchemy}/__init__.py (100%) rename {climate => blazar}/db/sqlalchemy/api.py (94%) rename {climate => blazar}/db/sqlalchemy/facade_wrapper.py (100%) rename {climate => blazar}/db/sqlalchemy/model_base.py (88%) rename {climate => blazar}/db/sqlalchemy/models.py (95%) rename {climate => blazar}/db/sqlalchemy/types.py (100%) rename {climate => blazar}/db/sqlalchemy/utils.py (98%) rename {climate => blazar}/db/utils.py (94%) rename {climate => blazar}/exceptions.py (83%) rename {climate => blazar}/i18n.py (98%) rename {climate => blazar}/manager/__init__.py (86%) rename {climate => blazar}/manager/exceptions.py (72%) rename {climate/db/sqlalchemy => blazar/manager/oshosts}/__init__.py (100%) rename {climate => blazar}/manager/oshosts/rpcapi.py (90%) rename {climate => blazar}/manager/rpcapi.py (92%) rename {climate => blazar}/manager/service.py (94%) rename {climate/manager/oshosts => blazar/notification}/__init__.py (100%) rename {climate => blazar}/notification/api.py (96%) rename {climate => blazar}/notification/notifier.py (96%) create mode 100644 blazar/opts.py rename {climate/notification => blazar/plugins}/__init__.py (100%) rename {climate => blazar}/plugins/base.py (98%) rename {climate => blazar}/plugins/dummy_vm_plugin.py (97%) rename {climate => blazar}/plugins/instances/__init__.py (100%) rename {climate => blazar}/plugins/instances/vm_plugin.py (90%) rename {climate => blazar}/plugins/oshosts/__init__.py (100%) rename {climate => blazar}/plugins/oshosts/host_plugin.py (96%) rename {climate => blazar}/plugins/oshosts/nova_inventory.py (96%) rename {climate => blazar}/plugins/oshosts/reservation_pool.py (93%) rename {climate => blazar}/policy.py (92%) rename {climate => blazar}/states.py (93%) rename {climate => blazar}/tests/__init__.py (90%) rename {climate => blazar}/tests/api/__init__.py (96%) rename {climate => blazar}/tests/api/test_acl.py (97%) rename {climate => blazar}/tests/api/test_context.py (92%) rename {climate => blazar}/tests/api/test_root.py (98%) rename {climate => blazar}/tests/api/test_version_selector.py (97%) rename {climate/plugins => blazar/tests/api/v1}/__init__.py (100%) rename {climate/tests/api/v1 => blazar/tests/api/v1/oshosts}/__init__.py (100%) rename {climate => blazar}/tests/api/v1/oshosts/test_service.py (94%) rename {climate => blazar}/tests/api/v1/oshosts/test_v1_0.py (92%) rename {climate => blazar}/tests/api/v1/test_app.py (93%) rename {climate => blazar}/tests/api/v1/test_service.py (95%) rename {climate => blazar}/tests/api/v1/test_utils.py (98%) rename {climate => blazar}/tests/api/v1/test_v1_0.py (92%) rename {climate => blazar}/tests/api/v1/test_validation.py (88%) rename {climate/tests/api/v1/oshosts => blazar/tests/api/v2}/__init__.py (100%) rename {climate => blazar}/tests/api/v2/test_hosts.py (99%) rename {climate => blazar}/tests/api/v2/test_leases.py (99%) rename {climate/tests/api/v2 => blazar/tests/db}/__init__.py (100%) rename {climate => blazar}/tests/db/migration/__init__.py (98%) rename {climate => blazar}/tests/db/migration/test_migrations.conf (100%) rename {climate => blazar}/tests/db/migration/test_migrations.py (99%) rename {climate/tests/db => blazar/tests/db/sqlalchemy}/__init__.py (100%) rename {climate => blazar}/tests/db/sqlalchemy/test_sqlalchemy_api.py (95%) rename {climate => blazar}/tests/db/sqlalchemy/test_utils.py (99%) rename {climate => blazar}/tests/db/test_api.py (94%) rename {climate => blazar}/tests/db/test_utils.py (96%) rename {climate => blazar}/tests/fake_lease.py (100%) rename {climate => blazar}/tests/fake_policy.py (60%) rename {climate/tests/db/sqlalchemy => blazar/tests/manager}/__init__.py (100%) rename {climate => blazar}/tests/manager/test_rpcapi.py (96%) rename {climate => blazar}/tests/manager/test_service.py (97%) rename {climate/tests/manager => blazar/tests/notification}/__init__.py (100%) rename {climate => blazar}/tests/notification/test_notifier.py (97%) rename {climate/tests/notification => blazar/tests/plugins}/__init__.py (100%) rename {climate/tests/plugins => blazar/tests/plugins/instances}/__init__.py (100%) rename {climate => blazar}/tests/plugins/instances/test_vm_plugin.py (93%) rename {climate/tests/plugins/instances => blazar/tests/plugins/oshosts}/__init__.py (100%) rename {climate => blazar}/tests/plugins/oshosts/test_nova_inventory.py (95%) rename {climate => blazar}/tests/plugins/oshosts/test_reservation_pool.py (95%) rename {climate => blazar}/tests/plugins/test_physical_host_plugin.py (97%) rename {climate => blazar}/tests/test_context.py (91%) rename {climate => blazar}/tests/test_exceptions.py (70%) rename {climate => blazar}/tests/test_policy.py (82%) rename {climate => blazar}/tests/test_service.py (92%) rename {climate => blazar}/tests/test_states.py (95%) rename {climate/tests/plugins/oshosts => blazar/tests/utils}/__init__.py (100%) rename {climate/tests/utils => blazar/tests/utils/openstack}/__init__.py (100%) rename {climate => blazar}/tests/utils/openstack/test_base.py (96%) rename {climate => blazar}/tests/utils/openstack/test_keystone.py (73%) rename {climate => blazar}/tests/utils/openstack/test_nova.py (91%) rename {climate => blazar}/tests/utils/test_trusts.py (92%) rename {climate => blazar}/utils/__init__.py (100%) rename {climate/tests => blazar}/utils/openstack/__init__.py (100%) rename {climate => blazar}/utils/openstack/base.py (97%) rename {climate => blazar}/utils/openstack/keystone.py (94%) rename {climate => blazar}/utils/openstack/nova.py (93%) rename {climate => blazar}/utils/service.py (93%) rename {climate => blazar}/utils/trusts.py (88%) rename {climate => blazar}/version.py (92%) delete mode 100644 climate/db/migration/alembic_migrations/versions/README delete mode 100644 climate/opts.py delete mode 100644 climate/utils/openstack/__init__.py rename contrib/tempest/tempest/cli/{climateclient.py => blazarclient.py} (78%) create mode 100644 etc/blazar/README-blazar.conf.txt rename etc/{climate/climate-config-generator.conf => blazar/blazar-config-generator.conf} (80%) delete mode 100644 etc/climate/README-climate.conf.txt diff --git a/MANIFEST.in b/MANIFEST.in index 83807a75..d785bec5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,7 +3,7 @@ include README.rst include ChangeLog include LICENSE -recursive-include climate/locale * +recursive-include blazar/locale * exclude .gitignore exclude .gitreview diff --git a/README.rst b/README.rst index 0d112be6..4dfa3e88 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ Prerequisites ------------- * Keystone v3 API endpoint * Dedicated account for write operations on behalf of the admin - climate_username + blazar_username * Service account Configuration diff --git a/blazar/__init__.py b/blazar/__init__.py index f38535b3..e69de29b 100644 --- a/blazar/__init__.py +++ b/blazar/__init__.py @@ -1,5 +0,0 @@ -import os - -__path__ = [ - os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), - 'climate')] diff --git a/climate/__init__.py b/blazar/api/__init__.py similarity index 100% rename from climate/__init__.py rename to blazar/api/__init__.py diff --git a/climate/api/context.py b/blazar/api/context.py similarity index 92% rename from climate/api/context.py rename to blazar/api/context.py index d4847b9f..e9ca921e 100644 --- a/climate/api/context.py +++ b/blazar/api/context.py @@ -15,8 +15,8 @@ import json -from climate import context -from climate import exceptions +from blazar import context +from blazar import exceptions def ctx_from_headers(headers): @@ -27,7 +27,7 @@ def ctx_from_headers(headers): except TypeError: raise exceptions.WrongFormat() - return context.ClimateContext( + return context.BlazarContext( user_id=headers['X-User-Id'], project_id=headers['X-Project-Id'], auth_token=headers['X-Auth-Token'], diff --git a/climate/api/root.py b/blazar/api/root.py similarity index 97% rename from climate/api/root.py rename to blazar/api/root.py index 529a5854..74d2355e 100644 --- a/climate/api/root.py +++ b/blazar/api/root.py @@ -16,7 +16,7 @@ import json import pecan -from climate.api.v2 import controllers +from blazar.api.v2 import controllers class RootController(object): diff --git a/climate/api/__init__.py b/blazar/api/v1/__init__.py similarity index 100% rename from climate/api/__init__.py rename to blazar/api/v1/__init__.py diff --git a/climate/api/v1/app.py b/blazar/api/v1/app.py similarity index 82% rename from climate/api/v1/app.py rename to blazar/api/v1/app.py index fdd16dea..84361196 100644 --- a/climate/api/v1/app.py +++ b/blazar/api/v1/app.py @@ -21,23 +21,23 @@ from oslo_log import log as logging from oslo_middleware import debug from werkzeug import exceptions as werkzeug_exceptions -from climate.api.v1.oshosts import v1_0 as host_api_v1_0 -from climate.api.v1 import utils as api_utils -from climate.api.v1 import v1_0 as api_v1_0 +from blazar.api.v1.oshosts import v1_0 as host_api_v1_0 +from blazar.api.v1 import utils as api_utils +from blazar.api.v1 import v1_0 as api_v1_0 LOG = logging.getLogger(__name__) CONF = cfg.CONF -CONF.import_opt('os_auth_host', 'climate.config') -CONF.import_opt('os_auth_port', 'climate.config') -CONF.import_opt('os_auth_protocol', 'climate.config') -CONF.import_opt('os_admin_username', 'climate.config') -CONF.import_opt('os_admin_password', 'climate.config') -CONF.import_opt('os_admin_project_name', 'climate.config') -CONF.import_opt('os_auth_version', 'climate.config') -CONF.import_opt('log_exchange', 'climate.config') +CONF.import_opt('os_auth_host', 'blazar.config') +CONF.import_opt('os_auth_port', 'blazar.config') +CONF.import_opt('os_auth_protocol', 'blazar.config') +CONF.import_opt('os_admin_username', 'blazar.config') +CONF.import_opt('os_admin_password', 'blazar.config') +CONF.import_opt('os_admin_project_name', 'blazar.config') +CONF.import_opt('os_auth_version', 'blazar.config') +CONF.import_opt('log_exchange', 'blazar.config') eventlet.monkey_patch( @@ -71,9 +71,9 @@ def version_list(): def make_app(): """App builder (wsgi). - Entry point for Climate REST API server. + Entry point for Blazar REST API server. """ - app = flask.Flask('climate.api') + app = flask.Flask('blazar.api') app.route('/', methods=['GET'])(version_list) app.route('/versions', methods=['GET'])(version_list) diff --git a/climate/api/v1/__init__.py b/blazar/api/v1/oshosts/__init__.py similarity index 100% rename from climate/api/v1/__init__.py rename to blazar/api/v1/oshosts/__init__.py diff --git a/climate/api/v1/oshosts/service.py b/blazar/api/v1/oshosts/service.py similarity index 86% rename from climate/api/v1/oshosts/service.py rename to blazar/api/v1/oshosts/service.py index f5b6baf8..4823377c 100644 --- a/climate/api/v1/oshosts/service.py +++ b/blazar/api/v1/oshosts/service.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.manager.oshosts import rpcapi as manager_rpcapi -from climate import policy -from climate.utils import trusts +from blazar.manager.oshosts import rpcapi as manager_rpcapi +from blazar import policy +from blazar.utils import trusts class API(object): @@ -42,7 +42,7 @@ class API(object): def get_computehost(self, host_id): """Get computehost by its ID. - :param host_id: ID of the computehost in Climate DB. + :param host_id: ID of the computehost in Blazar DB. :type host_id: str """ return self.manager_rpcapi.get_computehost(host_id) @@ -51,7 +51,7 @@ class API(object): def update_computehost(self, host_id, data): """Update computehost. Only name changing may be proceeded. - :param host_id: ID of the computehost in Climate DB. + :param host_id: ID of the computehost in Blazar DB. :type host_id: str :param data: New computehost characteristics. :type data: dict @@ -62,7 +62,7 @@ class API(object): def delete_computehost(self, host_id): """Delete specified computehost. - :param host_id: ID of the computehost in Climate DB. + :param host_id: ID of the computehost in Blazar DB. :type host_id: str """ self.manager_rpcapi.delete_computehost(host_id) diff --git a/climate/api/v1/oshosts/v1_0.py b/blazar/api/v1/oshosts/v1_0.py similarity index 92% rename from climate/api/v1/oshosts/v1_0.py rename to blazar/api/v1/oshosts/v1_0.py index e7a52fa7..04fcec80 100644 --- a/climate/api/v1/oshosts/v1_0.py +++ b/blazar/api/v1/oshosts/v1_0.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.api.v1.oshosts import service -from climate.api.v1 import utils as api_utils -from climate.api.v1 import validation -from climate import utils +from blazar.api.v1.oshosts import service +from blazar.api.v1 import utils as api_utils +from blazar.api.v1 import validation +from blazar import utils rest = api_utils.Rest('host_v1_0', __name__) diff --git a/climate/api/v1/service.py b/blazar/api/v1/service.py similarity index 83% rename from climate/api/v1/service.py rename to blazar/api/v1/service.py index bfc5c01e..1fbd6994 100644 --- a/climate/api/v1/service.py +++ b/blazar/api/v1/service.py @@ -15,11 +15,11 @@ from oslo_log import log as logging -from climate import context -from climate import exceptions -from climate.manager import rpcapi as manager_rpcapi -from climate import policy -from climate.utils import trusts +from blazar import context +from blazar import exceptions +from blazar.manager import rpcapi as manager_rpcapi +from blazar import policy +from blazar.utils import trusts LOG = logging.getLogger(__name__) @@ -55,7 +55,7 @@ class API(object): def get_lease(self, lease_id): """Get lease by its ID. - :param lease_id: ID of the lease in Climate DB. + :param lease_id: ID of the lease in Blazar DB. :type lease_id: str """ return self.manager_rpcapi.get_lease(lease_id) @@ -64,7 +64,7 @@ class API(object): def update_lease(self, lease_id, data): """Update lease. Only name changing and prolonging may be proceeded. - :param lease_id: ID of the lease in Climate DB. + :param lease_id: ID of the lease in Blazar DB. :type lease_id: str :param data: New lease characteristics. :type data: dict @@ -74,9 +74,9 @@ class API(object): start_date = data.pop('start_date', None) if data: - raise exceptions.ClimateException('Only name changing and ' - 'dates changing may be ' - 'proceeded.') + raise exceptions.BlazarException('Only name changing and ' + 'dates changing may be ' + 'proceeded.') data = {} if new_name: data['name'] = new_name @@ -90,7 +90,7 @@ class API(object): def delete_lease(self, lease_id): """Delete specified lease. - :param lease_id: ID of the lease in Climate DB. + :param lease_id: ID of the lease in Blazar DB. :type lease_id: str """ self.manager_rpcapi.delete_lease(lease_id) diff --git a/climate/api/v1/utils.py b/blazar/api/v1/utils.py similarity index 95% rename from climate/api/v1/utils.py rename to blazar/api/v1/utils.py index 8b7144d6..b96aaca1 100644 --- a/climate/api/v1/utils.py +++ b/blazar/api/v1/utils.py @@ -21,11 +21,11 @@ import oslo_messaging as messaging from oslo_serialization import jsonutils from werkzeug import datastructures -from climate.api import context -from climate.db import exceptions as db_exceptions -from climate import exceptions as ex -from climate.i18n import _ -from climate.manager import exceptions as manager_exceptions +from blazar.api import context +from blazar.db import exceptions as db_exceptions +from blazar import exceptions as ex +from blazar.i18n import _ +from blazar.manager import exceptions as manager_exceptions LOG = logging.getLogger(__name__) @@ -74,7 +74,7 @@ class Rest(flask.Blueprint): with context.ctx_from_headers(flask.request.headers): try: return func(**kwargs) - except ex.ClimateException as e: + except ex.BlazarException as e: return bad_request(e) except messaging.RemoteError as e: # Get the exception from manager and common exceptions @@ -96,7 +96,7 @@ class Rest(flask.Blueprint): cls.code) else: # We obfuscate all Exceptions - # but Climate ones for + # but Blazar ones for # security reasons err = 'Internal Server Error' return internal_error(500, err, e) @@ -241,7 +241,7 @@ def internal_error(status_code, descr, exc=None): def bad_request(error): - """Called if Climate exception occurred.""" + """Called if Blazar exception occurred.""" if not error.code: error.code = 400 diff --git a/climate/api/v1/v1_0.py b/blazar/api/v1/v1_0.py similarity index 92% rename from climate/api/v1/v1_0.py rename to blazar/api/v1/v1_0.py index 4d1cb55f..7ac7a44c 100644 --- a/climate/api/v1/v1_0.py +++ b/blazar/api/v1/v1_0.py @@ -15,10 +15,10 @@ from oslo_log import log as logging -from climate.api.v1 import service -from climate.api.v1 import utils as api_utils -from climate.api.v1 import validation -from climate import utils +from blazar.api.v1 import service +from blazar.api.v1 import utils as api_utils +from blazar.api.v1 import validation +from blazar import utils LOG = logging.getLogger(__name__) diff --git a/climate/api/v1/validation.py b/blazar/api/v1/validation.py similarity index 95% rename from climate/api/v1/validation.py rename to blazar/api/v1/validation.py index 657602f6..55cd1bf6 100644 --- a/climate/api/v1/validation.py +++ b/blazar/api/v1/validation.py @@ -17,8 +17,8 @@ import functools import six -from climate.api.v1 import utils as api_utils -from climate import exceptions +from blazar.api.v1 import utils as api_utils +from blazar import exceptions def check_exists(get_function, object_id=None, **get_args): diff --git a/climate/api/v1/oshosts/__init__.py b/blazar/api/v2/__init__.py similarity index 100% rename from climate/api/v1/oshosts/__init__.py rename to blazar/api/v2/__init__.py diff --git a/climate/api/v2/app.py b/blazar/api/v2/app.py similarity index 90% rename from climate/api/v2/app.py rename to blazar/api/v2/app.py index bad06d91..9da6a294 100644 --- a/climate/api/v2/app.py +++ b/blazar/api/v2/app.py @@ -18,8 +18,8 @@ from oslo_config import cfg from oslo_middleware import debug import pecan -from climate.api.v2 import hooks -from climate.api.v2 import middleware +from blazar.api.v2 import hooks +from blazar.api.v2 import middleware auth_opts = [ @@ -31,7 +31,7 @@ auth_opts = [ CONF = cfg.CONF CONF.register_opts(auth_opts) -CONF.import_opt('log_exchange', 'climate.config') +CONF.import_opt('log_exchange', 'blazar.config') OPT_GROUP_NAME = 'keystone_authtoken' @@ -71,8 +71,8 @@ def setup_app(pecan_config=None, extra_hooks=None): def make_app(): config = { 'app': { - 'modules': ['climate.api.v2'], - 'root': 'climate.api.root.RootController', + 'modules': ['blazar.api.v2'], + 'root': 'blazar.api.root.RootController', 'enable_acl': True, } } diff --git a/climate/api/v2/controllers/__init__.py b/blazar/api/v2/controllers/__init__.py similarity index 94% rename from climate/api/v2/controllers/__init__.py rename to blazar/api/v2/controllers/__init__.py index 781b5aa8..82dd5cf5 100644 --- a/climate/api/v2/controllers/__init__.py +++ b/blazar/api/v2/controllers/__init__.py @@ -22,8 +22,8 @@ import pecan from pecan import rest from stevedore import enabled -from climate import exceptions -from climate.i18n import _ +from blazar import exceptions +from blazar.i18n import _ LOG = logging.getLogger(__name__) @@ -53,7 +53,7 @@ class V2Controller(rest.RestController): self.extension_manager = enabled.EnabledExtensionManager( check_func=lambda ext: ext.name in CONF.api.api_v2_controllers, - namespace='climate.api.v2.controllers.extensions', + namespace='blazar.api.v2.controllers.extensions', invoke_on_load=True ) self._log_missing_plugins(CONF.api.api_v2_controllers) @@ -62,7 +62,7 @@ class V2Controller(rest.RestController): try: setattr(self, ext.obj.name, ext.obj) except TypeError: - raise exceptions.ClimateException( + raise exceptions.BlazarException( _("API name must be specified for " "extension {0}").format(ext.name)) self._routes.update(ext.obj.extra_routes) diff --git a/climate/api/v2/controllers/base.py b/blazar/api/v2/controllers/base.py similarity index 97% rename from climate/api/v2/controllers/base.py rename to blazar/api/v2/controllers/base.py index 3db7b58c..ebef8470 100644 --- a/climate/api/v2/controllers/base.py +++ b/blazar/api/v2/controllers/base.py @@ -16,7 +16,7 @@ import wsme from wsme import types as wtypes -from climate.api.v2.controllers import types +from blazar.api.v2.controllers import types class _Base(wtypes.DynamicBase): diff --git a/climate/api/v2/controllers/extensions/__init__.py b/blazar/api/v2/controllers/extensions/__init__.py similarity index 100% rename from climate/api/v2/controllers/extensions/__init__.py rename to blazar/api/v2/controllers/extensions/__init__.py diff --git a/climate/api/v2/controllers/extensions/host.py b/blazar/api/v2/controllers/extensions/host.py similarity index 94% rename from climate/api/v2/controllers/extensions/host.py rename to blazar/api/v2/controllers/extensions/host.py index 4a499dc3..f61cbf20 100644 --- a/climate/api/v2/controllers/extensions/host.py +++ b/blazar/api/v2/controllers/extensions/host.py @@ -18,13 +18,13 @@ import pecan from wsme import types as wtypes import wsmeext.pecan as wsme_pecan -from climate.api.v2.controllers import base -from climate.api.v2.controllers import extensions -from climate.api.v2.controllers import types -from climate import exceptions -from climate.i18n import _ -from climate import policy -from climate.utils import trusts +from blazar.api.v2.controllers import base +from blazar.api.v2.controllers import extensions +from blazar.api.v2.controllers import types +from blazar import exceptions +from blazar.i18n import _ +from blazar import policy +from blazar.utils import trusts LOG = logging.getLogger(__name__) @@ -142,7 +142,7 @@ class HostsController(extensions.BaseController): if host is not None: return Host.convert(host) else: - raise exceptions.ClimateException(_("Host can't be created")) + raise exceptions.BlazarException(_("Host can't be created")) @policy.authorize('oshosts', 'update') @wsme_pecan.wsexpose(Host, types.IntegerType(), body=Host, diff --git a/climate/api/v2/controllers/extensions/lease.py b/blazar/api/v2/controllers/extensions/lease.py similarity index 89% rename from climate/api/v2/controllers/extensions/lease.py rename to blazar/api/v2/controllers/extensions/lease.py index 1cd9109e..9aed504d 100644 --- a/climate/api/v2/controllers/extensions/lease.py +++ b/blazar/api/v2/controllers/extensions/lease.py @@ -17,14 +17,14 @@ import pecan from wsme import types as wtypes import wsmeext.pecan as wsme_pecan -from climate.api.v2.controllers import base -from climate.api.v2.controllers import extensions -from climate.api.v2.controllers import types -from climate import exceptions -from climate.i18n import _ -from climate.manager import service -from climate import policy -from climate.utils import trusts +from blazar.api.v2.controllers import base +from blazar.api.v2.controllers import extensions +from blazar.api.v2.controllers import types +from blazar import exceptions +from blazar.i18n import _ +from blazar.manager import service +from blazar import policy +from blazar.utils import trusts class Lease(base._Base): @@ -126,7 +126,7 @@ class LeasesController(extensions.BaseController): if lease is not None: return Lease.convert(lease) else: - raise exceptions.ClimateException(_("Lease can't be created")) + raise exceptions.BlazarException(_("Lease can't be created")) @policy.authorize('leases', 'update') @wsme_pecan.wsexpose(Lease, types.UuidType(), body=Lease, status_code=202) @@ -144,10 +144,10 @@ class LeasesController(extensions.BaseController): None) if sublease_dct != {}: - raise exceptions.ClimateException('Only name changing, ' - 'dates and before end ' - 'notifications may be ' - 'proceeded.') + raise exceptions.BlazarException('Only name changing, ' + 'dates and before end ' + 'notifications may be ' + 'proceeded.') if new_name: sublease_dct['name'] = new_name if end_date: diff --git a/climate/api/v2/controllers/types.py b/blazar/api/v2/controllers/types.py similarity index 99% rename from climate/api/v2/controllers/types.py rename to blazar/api/v2/controllers/types.py index b7abd2a7..bd764491 100644 --- a/climate/api/v2/controllers/types.py +++ b/blazar/api/v2/controllers/types.py @@ -21,7 +21,7 @@ import six from wsme import types as wtypes from wsme import utils as wutils -from climate import exceptions +from blazar import exceptions class UuidType(wtypes.UserType): diff --git a/climate/api/v2/hooks.py b/blazar/api/v2/hooks.py similarity index 92% rename from climate/api/v2/hooks.py rename to blazar/api/v2/hooks.py index 03ac2cd0..34cb1fe6 100644 --- a/climate/api/v2/hooks.py +++ b/blazar/api/v2/hooks.py @@ -17,10 +17,10 @@ from oslo_config import cfg from oslo_log import log as logging from pecan import hooks -from climate.api import context -from climate.db import api as dbapi -from climate.manager.oshosts import rpcapi as hosts_rpcapi -from climate.manager import rpcapi +from blazar.api import context +from blazar.db import api as dbapi +from blazar.manager.oshosts import rpcapi as hosts_rpcapi +from blazar.manager import rpcapi LOG = logging.getLogger(__name__) diff --git a/climate/api/v2/middleware/__init__.py b/blazar/api/v2/middleware/__init__.py similarity index 94% rename from climate/api/v2/middleware/__init__.py rename to blazar/api/v2/middleware/__init__.py index 85f1cc4d..c8edb109 100644 --- a/climate/api/v2/middleware/__init__.py +++ b/blazar/api/v2/middleware/__init__.py @@ -18,10 +18,10 @@ import json from oslo_log import log as logging import webob -from climate.db import exceptions as db_exceptions -from climate import exceptions -from climate.i18n import _ -from climate.manager import exceptions as manager_exceptions +from blazar.db import exceptions as db_exceptions +from blazar import exceptions +from blazar.i18n import _ +from blazar.manager import exceptions as manager_exceptions LOG = logging.getLogger(__name__) @@ -48,7 +48,7 @@ class ParsableErrorMiddleware(object): try: status_code = int(status.split(' ')[0]) except (ValueError, TypeError): # pragma: nocover - raise exceptions.ClimateException(_( + raise exceptions.BlazarException(_( 'Status {0} was unexpected').format(status)) else: if status_code >= 400: @@ -69,7 +69,7 @@ class ParsableErrorMiddleware(object): # still work if no errors are raised try: app_iter = self.app(environ, replacement_start_response) - except exceptions.ClimateException as e: + except exceptions.BlazarException as e: faultstring = "{0} {1}".format(e.__class__.__name__, str(e)) replacement_start_response( webob.response.Response(status=str(e.code)).status, diff --git a/climate/api/v2/__init__.py b/blazar/cmd/__init__.py similarity index 100% rename from climate/api/v2/__init__.py rename to blazar/cmd/__init__.py diff --git a/climate/cmd/api.py b/blazar/cmd/api.py similarity index 89% rename from climate/cmd/api.py rename to blazar/cmd/api.py index 5aacc990..a9e139a4 100644 --- a/climate/cmd/api.py +++ b/blazar/cmd/api.py @@ -22,11 +22,11 @@ from eventlet import wsgi from oslo_config import cfg from oslo_log import log as logging -gettext.install('climate', unicode=1) +gettext.install('blazar', unicode=1) -from climate.api.v1 import app as v1_app -from climate.api.v2 import app as v2_app -from climate.utils import service as service_utils +from blazar.api.v1 import app as v1_app +from blazar.api.v2 import app as v2_app +from blazar.utils import service as service_utils opts = [ @@ -46,7 +46,7 @@ CONF = cfg.CONF CONF.register_cli_opts(opts) CONF.register_opts(api_opts) -CONF.import_opt('host', 'climate.config') +CONF.import_opt('host', 'blazar.config') class VersionSelectorApplication(object): @@ -90,8 +90,8 @@ class VersionSelectorApplication(object): def main(): - """Entry point to start Climate API wsgi server.""" - cfg.CONF(sys.argv[1:], project='climate', prog='climate-api') + """Entry point to start Blazar API wsgi server.""" + cfg.CONF(sys.argv[1:], project='blazar', prog='blazar-api') service_utils.prepare_service(sys.argv) if not CONF.enable_v1_api: app = v2_app.make_app() diff --git a/climate/cmd/manager.py b/blazar/cmd/manager.py similarity index 77% rename from climate/cmd/manager.py rename to blazar/cmd/manager.py index 7a9f7bd8..cd258c52 100644 --- a/climate/cmd/manager.py +++ b/blazar/cmd/manager.py @@ -21,16 +21,16 @@ eventlet.monkey_patch() from oslo_config import cfg from oslo_service import service -gettext.install('climate', unicode=1) +gettext.install('blazar', unicode=1) -from climate.db import api as db_api -from climate.manager import service as manager_service -from climate.notification import notifier -from climate.utils import service as service_utils +from blazar.db import api as db_api +from blazar.manager import service as manager_service +from blazar.notification import notifier +from blazar.utils import service as service_utils def main(): - cfg.CONF(project='climate', prog='climate-manager') + cfg.CONF(project='blazar', prog='blazar-manager') service_utils.prepare_service(sys.argv) db_api.setup_db() notifier.init() diff --git a/climate/config.py b/blazar/config.py similarity index 98% rename from climate/config.py rename to blazar/config.py index 7d11a1d0..59c60630 100644 --- a/climate/config.py +++ b/blazar/config.py @@ -47,7 +47,7 @@ os_opts = [ 'The user must have admin role in ' 'project'), cfg.StrOpt('os_admin_password', - default='climate', + default='blazar', help='Password of the admin user'), cfg.StrOpt('os_admin_project_name', default='admin', diff --git a/climate/context.py b/blazar/context.py similarity index 96% rename from climate/context.py rename to blazar/context.py index f5dfb26f..884ad1cf 100644 --- a/climate/context.py +++ b/blazar/context.py @@ -77,7 +77,7 @@ class BaseContext(object): return self.__values -class ClimateContext(BaseContext): +class BlazarContext(BaseContext): _elements = set([ "user_id", @@ -100,8 +100,8 @@ class ClimateContext(BaseContext): def current(): - return ClimateContext.current() + return BlazarContext.current() def elevated(): - return ClimateContext.elevated() + return BlazarContext.elevated() diff --git a/climate/cmd/__init__.py b/blazar/db/__init__.py similarity index 100% rename from climate/cmd/__init__.py rename to blazar/db/__init__.py diff --git a/climate/db/api.py b/blazar/db/api.py similarity index 97% rename from climate/db/api.py rename to blazar/db/api.py index 0c163735..d9b5066b 100644 --- a/climate/db/api.py +++ b/blazar/db/api.py @@ -15,8 +15,8 @@ """Defines interface for DB access. -Functions in this module are imported into the climate.db namespace. Call these -functions from climate.db namespace, not the climate.db.api namespace. +Functions in this module are imported into the blazar.db namespace. Call these +functions from blazar.db namespace, not the blazar.db.api namespace. All functions in this module return objects that implement a dictionary-like interface. @@ -27,7 +27,7 @@ interface. `sqlalchemy` is the only supported backend right now. :sql_connection: string specifying the sqlalchemy connection to use, like: - `sqlite:///var/lib/climate/climate.sqlite`. + `sqlite:///var/lib/blazar/blazar.sqlite`. """ @@ -38,7 +38,7 @@ from oslo_log import log as logging _BACKEND_MAPPING = { - 'sqlalchemy': 'climate.db.sqlalchemy.api', + 'sqlalchemy': 'blazar.db.sqlalchemy.api', } db_options.set_defaults(cfg.CONF) diff --git a/climate/db/base.py b/blazar/db/base.py similarity index 95% rename from climate/db/base.py rename to blazar/db/base.py index 442c2d3e..18419674 100644 --- a/climate/db/base.py +++ b/blazar/db/base.py @@ -20,7 +20,7 @@ from oslo_utils import importutils db_driver_opts = [ - cfg.StrOpt('db_driver', default='climate.db', + cfg.StrOpt('db_driver', default='blazar.db', help='Driver to use for database access') ] diff --git a/climate/db/exceptions.py b/blazar/db/exceptions.py similarity index 75% rename from climate/db/exceptions.py rename to blazar/db/exceptions.py index c3088361..bef0e54d 100644 --- a/climate/db/exceptions.py +++ b/blazar/db/exceptions.py @@ -15,28 +15,28 @@ from oslo_log import log as logging -from climate import exceptions -from climate.i18n import _ +from blazar import exceptions +from blazar.i18n import _ LOG = logging.getLogger(__name__) -class ClimateDBException(exceptions.ClimateException): +class BlazarDBException(exceptions.BlazarException): msg_fmt = _('An unknown database exception occurred') -class ClimateDBDuplicateEntry(ClimateDBException): +class BlazarDBDuplicateEntry(BlazarDBException): msg_fmt = _('Duplicate entry for %(columns)s in %(model)s model was found') -class ClimateDBNotFound(ClimateDBException): +class BlazarDBNotFound(BlazarDBException): msg_fmt = _('%(id)s %(model)s was not found') -class ClimateDBInvalidFilter(ClimateDBException): +class BlazarDBInvalidFilter(BlazarDBException): msg_fmt = _('%(query_filter)s is invalid') -class ClimateDBInvalidFilterOperator(ClimateDBException): +class BlazarDBInvalidFilterOperator(BlazarDBException): msg_fmt = _('%(filter_operator)s is invalid') diff --git a/climate/db/migration/README b/blazar/db/migration/README similarity index 72% rename from climate/db/migration/README rename to blazar/db/migration/README index 93f35797..8a240b79 100644 --- a/climate/db/migration/README +++ b/blazar/db/migration/README @@ -14,44 +14,44 @@ # License for the specific language governing permissions and limitations # under the License. -Climate project uses Alembic to handle database migrations. A migration occurs +Blazar project uses Alembic to handle database migrations. A migration occurs by executing a script that details the changes needed to upgrade/downgrade the database. The migration scripts are ordered so that multiple scripts can run sequentially to update the database. You can then upgrade to the latest database version via: -$ climate-db-manage --config-file /path/to/climate.conf upgrade head +$ blazar-db-manage --config-file /path/to/blazar.conf upgrade head To check the current database version: -$ climate-db-manage --config-file /path/to/climate.conf current +$ blazar-db-manage --config-file /path/to/blazar.conf current To create a script to run the migration offline: -$ climate-db-manage --config-file /path/to/climate.conf upgrade head --sql +$ blazar-db-manage --config-file /path/to/blazar.conf upgrade head --sql To run the offline migration between specific migration versions: -$ climate-db-manage --config-file /path/to/climate.conf upgrade \ +$ blazar-db-manage --config-file /path/to/blazar.conf upgrade \ : --sql Upgrade the database incrementally: -$ climate-db-manage --config-file /path/to/climate.conf \ +$ blazar-db-manage --config-file /path/to/blazar.conf \ upgrade --delta <# of revs> Downgrade the database by a certain number of revisions: -$ climate-db-manage --config-file /path/to/climate.conf downgrade \ +$ blazar-db-manage --config-file /path/to/blazar.conf downgrade \ --delta <# of revs> DEVELOPERS: -A database migration script is required when you submit a change to Climate +A database migration script is required when you submit a change to Blazar that alters the database model definition. The migration script is a special python file that includes code to update/downgrade the database to match the changes in the model definition. Alembic will execute these scripts in order to -provide a linear migration path between revision. The climate-db-manage command +provide a linear migration path between revision. The blazar-db-manage command can be used to generate migration template for you to complete. The operations in the template are those supported by the Alembic migration library. -After you modified the Climate models accordingly, you can create the revision. +After you modified the Blazar models accordingly, you can create the revision. -$ climate-db-manage --config-file /path/to/climate.conf revision \ +$ blazar-db-manage --config-file /path/to/blazar.conf revision \ -m "description of revision" \ --autogenerate @@ -63,13 +63,13 @@ In rare circumstances, you may want to start with an empty migration template and manually author the changes necessary for an upgrade/downgrade. You can create a blank file via: -$ climate-db-manage --config-file /path/to/climate.conf revision \ +$ blazar-db-manage --config-file /path/to/blazar.conf revision \ -m "description of revision" The migration timeline should remain linear so that there is a clear path when upgrading/downgrading. To verify that the timeline does branch, you can run this command: -$ climate-db-manage --config-file /path/to/climate.conf check_migration +$ blazar-db-manage --config-file /path/to/blazar.conf check_migration If the migration path does branch, you can find the branch point via: -$ climate-db-manage --config-file /path/to/climate.conf history +$ blazar-db-manage --config-file /path/to/blazar.conf history diff --git a/climate/db/__init__.py b/blazar/db/migration/__init__.py similarity index 100% rename from climate/db/__init__.py rename to blazar/db/migration/__init__.py diff --git a/climate/db/migration/alembic.ini b/blazar/db/migration/alembic.ini similarity index 93% rename from climate/db/migration/alembic.ini rename to blazar/db/migration/alembic.ini index e9a55872..6da2725a 100644 --- a/climate/db/migration/alembic.ini +++ b/blazar/db/migration/alembic.ini @@ -11,7 +11,7 @@ script_location = %(here)s/alembic_migrations # the 'revision' command, regardless of autogenerate # revision_environment = false -# default to an empty string because the Climate migration cli will +# default to an empty string because the Blazar migration cli will # extract the correct value and set it programatically before alembic is fully # invoked. sqlalchemy.url = diff --git a/climate/db/migration/alembic_migrations/env.py b/blazar/db/migration/alembic_migrations/env.py similarity index 90% rename from climate/db/migration/alembic_migrations/env.py rename to blazar/db/migration/alembic_migrations/env.py index 8ea0e7f4..4b348f74 100644 --- a/climate/db/migration/alembic_migrations/env.py +++ b/blazar/db/migration/alembic_migrations/env.py @@ -17,8 +17,8 @@ from alembic import context from sqlalchemy import create_engine, pool from logging import config as log_config -from climate.db.sqlalchemy import model_base -from climate.db.sqlalchemy import models # noqa +from blazar.db.sqlalchemy import model_base +from blazar.db.sqlalchemy import models # noqa # this is the Alembic Config object, which provides # access to the values within the .ini file in use. @@ -32,7 +32,7 @@ log_config.fileConfig(config.config_file_name) # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata -target_metadata = model_base.ClimateBase.metadata +target_metadata = model_base.BlazarBase.metadata # other values from the config, defined by the needs of env.py, # can be acquired: @@ -79,6 +79,6 @@ def run_migrations_online(config): connection.close() if context.is_offline_mode(): - run_migrations_offline(config.climate_config) + run_migrations_offline(config.blazar_config) else: - run_migrations_online(config.climate_config) + run_migrations_online(config.blazar_config) diff --git a/climate/db/migration/alembic_migrations/script.py.mako b/blazar/db/migration/alembic_migrations/script.py.mako similarity index 100% rename from climate/db/migration/alembic_migrations/script.py.mako rename to blazar/db/migration/alembic_migrations/script.py.mako diff --git a/climate/db/migration/alembic_migrations/versions/0_1_initial.py b/blazar/db/migration/alembic_migrations/versions/0_1_initial.py similarity index 100% rename from climate/db/migration/alembic_migrations/versions/0_1_initial.py rename to blazar/db/migration/alembic_migrations/versions/0_1_initial.py diff --git a/climate/db/migration/alembic_migrations/versions/10e34bba18e8_add_service_name_to_.py b/blazar/db/migration/alembic_migrations/versions/10e34bba18e8_add_service_name_to_.py similarity index 100% rename from climate/db/migration/alembic_migrations/versions/10e34bba18e8_add_service_name_to_.py rename to blazar/db/migration/alembic_migrations/versions/10e34bba18e8_add_service_name_to_.py diff --git a/climate/db/migration/alembic_migrations/versions/1fd6c2eded89_add_trust_id_to_comp.py b/blazar/db/migration/alembic_migrations/versions/1fd6c2eded89_add_trust_id_to_comp.py similarity index 100% rename from climate/db/migration/alembic_migrations/versions/1fd6c2eded89_add_trust_id_to_comp.py rename to blazar/db/migration/alembic_migrations/versions/1fd6c2eded89_add_trust_id_to_comp.py diff --git a/climate/db/migration/alembic_migrations/versions/23d6240b51b2_add_status_to_leases.py b/blazar/db/migration/alembic_migrations/versions/23d6240b51b2_add_status_to_leases.py similarity index 100% rename from climate/db/migration/alembic_migrations/versions/23d6240b51b2_add_status_to_leases.py rename to blazar/db/migration/alembic_migrations/versions/23d6240b51b2_add_status_to_leases.py diff --git a/climate/db/migration/alembic_migrations/versions/2bcfe76b0474_change_tenant_to_project.py b/blazar/db/migration/alembic_migrations/versions/2bcfe76b0474_change_tenant_to_project.py similarity index 100% rename from climate/db/migration/alembic_migrations/versions/2bcfe76b0474_change_tenant_to_project.py rename to blazar/db/migration/alembic_migrations/versions/2bcfe76b0474_change_tenant_to_project.py diff --git a/blazar/db/migration/alembic_migrations/versions/README b/blazar/db/migration/alembic_migrations/versions/README new file mode 100644 index 00000000..5304e633 --- /dev/null +++ b/blazar/db/migration/alembic_migrations/versions/README @@ -0,0 +1,3 @@ +This directory contains the migration scripts for the Blazar project. Please +see the README in blazar/db/migration on how to use and generate new +migrations. diff --git a/climate/db/migration/cli.py b/blazar/db/migration/cli.py similarity index 95% rename from climate/db/migration/cli.py rename to blazar/db/migration/cli.py index 548259ee..f8505ba9 100644 --- a/climate/db/migration/cli.py +++ b/blazar/db/migration/cli.py @@ -14,7 +14,7 @@ # limitations under the License. -"""CLI tool to manage the Climate DB. Inspired by Neutron's same tool.""" +"""CLI tool to manage the Blazar DB. Inspired by Neutron's same tool.""" import gettext import os @@ -25,8 +25,8 @@ from alembic import util as alembic_util from oslo_config import cfg from oslo_db import options as db_options -gettext.install('climate', unicode=1) -from climate.i18n import _ +gettext.install('blazar', unicode=1) +from blazar.i18n import _ CONF = cfg.CONF @@ -112,7 +112,7 @@ def main(): config = alembic_config.Config( os.path.join(os.path.dirname(__file__), 'alembic.ini') ) - config.climate_config = CONF + config.blazar_config = CONF CONF() db_options.set_defaults(CONF) diff --git a/climate/db/migration/__init__.py b/blazar/db/sqlalchemy/__init__.py similarity index 100% rename from climate/db/migration/__init__.py rename to blazar/db/sqlalchemy/__init__.py diff --git a/climate/db/sqlalchemy/api.py b/blazar/db/sqlalchemy/api.py similarity index 94% rename from climate/db/sqlalchemy/api.py rename to blazar/db/sqlalchemy/api.py index 827a692f..5840e9c6 100644 --- a/climate/db/sqlalchemy/api.py +++ b/blazar/db/sqlalchemy/api.py @@ -25,10 +25,10 @@ import sqlalchemy as sa from sqlalchemy.sql.expression import asc from sqlalchemy.sql.expression import desc -from climate.db import exceptions as db_exc -from climate.db.sqlalchemy import facade_wrapper -from climate.db.sqlalchemy import models -from climate.i18n import _ +from blazar.db import exceptions as db_exc +from blazar.db.sqlalchemy import facade_wrapper +from blazar.db.sqlalchemy import models +from blazar.i18n import _ LOG = logging.getLogger(__name__) @@ -161,7 +161,7 @@ def reservation_create(values): reservation.save(session=session) except common_db_exc.DBDuplicateEntry as e: # raise exception about duplicated columns (e.columns) - raise db_exc.ClimateDBDuplicateEntry( + raise db_exc.BlazarDBDuplicateEntry( model=reservation.__class__.__name__, columns=e.columns) return reservation_get(reservation.id) @@ -185,8 +185,8 @@ def reservation_destroy(reservation_id): if not reservation: # raise not found error - raise db_exc.ClimateDBNotFound(id=reservation_id, - model='Reservation') + raise db_exc.BlazarDBNotFound(id=reservation_id, + model='Reservation') session.delete(reservation) @@ -234,7 +234,7 @@ def lease_create(values): lease.save(session=session) except common_db_exc.DBDuplicateEntry as e: # raise exception about duplicated columns (e.columns) - raise db_exc.ClimateDBDuplicateEntry( + raise db_exc.BlazarDBDuplicateEntry( model=lease.__class__.__name__, columns=e.columns) try: @@ -245,7 +245,7 @@ def lease_create(values): reservation.save(session=session) except common_db_exc.DBDuplicateEntry as e: # raise exception about duplicated columns (e.columns) - raise db_exc.ClimateDBDuplicateEntry( + raise db_exc.BlazarDBDuplicateEntry( model=reservation.__class__.__name__, columns=e.columns) try: @@ -256,7 +256,7 @@ def lease_create(values): event.save(session=session) except common_db_exc.DBDuplicateEntry as e: # raise exception about duplicated columns (e.columns) - raise db_exc.ClimateDBDuplicateEntry( + raise db_exc.BlazarDBDuplicateEntry( model=event.__class__.__name__, columns=e.columns) return lease_get(lease.id) @@ -280,7 +280,7 @@ def lease_destroy(lease_id): if not lease: # raise not found error - raise db_exc.ClimateDBNotFound(id=lease_id, model='Lease') + raise db_exc.BlazarDBNotFound(id=lease_id, model='Lease') session.delete(lease) @@ -355,7 +355,7 @@ def event_create(values): event.save(session=session) except common_db_exc.DBDuplicateEntry as e: # raise exception about duplicated columns (e.columns) - raise db_exc.ClimateDBDuplicateEntry( + raise db_exc.BlazarDBDuplicateEntry( model=event.__class__.__name__, columns=e.columns) return event_get(event.id) @@ -379,7 +379,7 @@ def event_destroy(event_id): if not event: # raise not found error - raise db_exc.ClimateDBNotFound(id=event_id, model='Event') + raise db_exc.BlazarDBNotFound(id=event_id, model='Event') session.delete(event) @@ -421,7 +421,7 @@ def host_reservation_create(values): host_reservation.save(session=session) except common_db_exc.DBDuplicateEntry as e: # raise exception about duplicated columns (e.columns) - raise db_exc.ClimateDBDuplicateEntry( + raise db_exc.BlazarDBDuplicateEntry( model=host_reservation.__class__.__name__, columns=e.columns) return host_reservation_get(host_reservation.id) @@ -447,7 +447,7 @@ def host_reservation_destroy(host_reservation_id): if not host_reservation: # raise not found error - raise db_exc.ClimateDBNotFound( + raise db_exc.BlazarDBNotFound( id=host_reservation_id, model='ComputeHostReservation') session.delete(host_reservation) @@ -490,7 +490,7 @@ def host_allocation_create(values): host_allocation.save(session=session) except common_db_exc.DBDuplicateEntry as e: # raise exception about duplicated columns (e.columns) - raise db_exc.ClimateDBDuplicateEntry( + raise db_exc.BlazarDBDuplicateEntry( model=host_allocation.__class__.__name__, columns=e.columns) return host_allocation_get(host_allocation.id) @@ -516,7 +516,7 @@ def host_allocation_destroy(host_allocation_id): if not host_allocation: # raise not found error - raise db_exc.ClimateDBNotFound( + raise db_exc.BlazarDBNotFound( id=host_allocation_id, model='ComputeHostAllocation') session.delete(host_allocation) @@ -577,7 +577,7 @@ def host_get_all_by_queries(queries): try: key, op, value = query.split(' ', 3) except ValueError: - raise db_exc.ClimateDBInvalidFilter(query_filter=query) + raise db_exc.BlazarDBInvalidFilter(query_filter=query) column = getattr(models.ComputeHost, key, None) if column: @@ -590,7 +590,7 @@ def host_get_all_by_queries(queries): attr = filter(lambda e: hasattr(column, e % op), ['%s', '%s_', '__%s__'])[0] % op except IndexError: - raise db_exc.ClimateDBInvalidFilterOperator( + raise db_exc.BlazarDBInvalidFilterOperator( filter_operator=op) if value == 'null': @@ -606,7 +606,7 @@ def host_get_all_by_queries(queries): ).filter(models.ComputeHostExtraCapability.capability_name == key ).all() if not extra_filter: - raise db_exc.ClimateDBNotFound( + raise db_exc.BlazarDBNotFound( id=key, model='ComputeHostExtraCapability') for host in extra_filter: @@ -630,7 +630,7 @@ def host_create(values): host.save(session=session) except common_db_exc.DBDuplicateEntry as e: # raise exception about duplicated columns (e.columns) - raise db_exc.ClimateDBDuplicateEntry( + raise db_exc.BlazarDBDuplicateEntry( model=host.__class__.__name__, columns=e.columns) return host_get(host.id) @@ -654,7 +654,7 @@ def host_destroy(host_id): if not host: # raise not found error - raise db_exc.ClimateDBNotFound(id=host_id, model='Host') + raise db_exc.BlazarDBNotFound(id=host_id, model='Host') session.delete(host) @@ -691,7 +691,7 @@ def host_extra_capability_create(values): host_extra_capability.save(session=session) except common_db_exc.DBDuplicateEntry as e: # raise exception about duplicated columns (e.columns) - raise db_exc.ClimateDBDuplicateEntry( + raise db_exc.BlazarDBDuplicateEntry( model=host_extra_capability.__class__.__name__, columns=e.columns) @@ -720,7 +720,7 @@ def host_extra_capability_destroy(host_extra_capability_id): if not host_extra_capability: # raise not found error - raise db_exc.ClimateDBNotFound( + raise db_exc.BlazarDBNotFound( id=host_extra_capability_id, model='ComputeHostExtraCapability') diff --git a/climate/db/sqlalchemy/facade_wrapper.py b/blazar/db/sqlalchemy/facade_wrapper.py similarity index 100% rename from climate/db/sqlalchemy/facade_wrapper.py rename to blazar/db/sqlalchemy/facade_wrapper.py diff --git a/climate/db/sqlalchemy/model_base.py b/blazar/db/sqlalchemy/model_base.py similarity index 88% rename from climate/db/sqlalchemy/model_base.py rename to blazar/db/sqlalchemy/model_base.py index 18fdd205..6209b9b6 100644 --- a/climate/db/sqlalchemy/model_base.py +++ b/blazar/db/sqlalchemy/model_base.py @@ -18,8 +18,8 @@ from sqlalchemy.ext import declarative from sqlalchemy.orm import attributes -class _ClimateBase(models.ModelBase, models.TimestampMixin): - """Base class for all Climate SQLAlchemy DB Models.""" +class _BlazarBase(models.ModelBase, models.TimestampMixin): + """Base class for all Blazar SQLAlchemy DB Models.""" def to_dict(self): """sqlalchemy based automatic to_dict method.""" @@ -44,4 +44,4 @@ def datetime_to_str(dct, attr_name): if dct.get(attr_name) is not None: dct[attr_name] = dct[attr_name].isoformat(' ') -ClimateBase = declarative.declarative_base(cls=_ClimateBase) +BlazarBase = declarative.declarative_base(cls=_BlazarBase) diff --git a/climate/db/sqlalchemy/models.py b/blazar/db/sqlalchemy/models.py similarity index 95% rename from climate/db/sqlalchemy/models.py rename to blazar/db/sqlalchemy/models.py index e23e3ce5..3f2487ad 100644 --- a/climate/db/sqlalchemy/models.py +++ b/blazar/db/sqlalchemy/models.py @@ -21,7 +21,7 @@ import sqlalchemy as sa from sqlalchemy.dialects.mysql import MEDIUMTEXT from sqlalchemy.orm import relationship -from climate.db.sqlalchemy import model_base as mb +from blazar.db.sqlalchemy import model_base as mb # FIXME: https://bugs.launchpad.net/climate/+bug/1300132 # LOG = logging.getLogger(__name__) @@ -44,7 +44,7 @@ def _id_column(): # Main objects: Lease, Reservation, Event -class Lease(mb.ClimateBase): +class Lease(mb.BlazarBase): """Contains all info about lease.""" __tablename__ = 'leases' @@ -75,7 +75,7 @@ class Lease(mb.ClimateBase): return d -class Reservation(mb.ClimateBase): +class Reservation(mb.BlazarBase): """Specifies group of nodes within a cluster.""" __tablename__ = 'reservations' @@ -120,7 +120,7 @@ class Reservation(mb.ClimateBase): return d -class Event(mb.ClimateBase): +class Event(mb.BlazarBase): """An events occurring with the lease.""" __tablename__ = 'events' @@ -135,7 +135,7 @@ class Event(mb.ClimateBase): return super(Event, self).to_dict() -class ComputeHostReservation(mb.ClimateBase): +class ComputeHostReservation(mb.BlazarBase): """Description Specifies resources asked by reservation from @@ -155,7 +155,7 @@ class ComputeHostReservation(mb.ClimateBase): return super(ComputeHostReservation, self).to_dict() -class ComputeHostAllocation(mb.ClimateBase): +class ComputeHostAllocation(mb.BlazarBase): """Mapping between ComputeHost, ComputeHostReservation and Reservation.""" __tablename__ = 'computehost_allocations' @@ -170,7 +170,7 @@ class ComputeHostAllocation(mb.ClimateBase): return super(ComputeHostAllocation, self).to_dict() -class ComputeHost(mb.ClimateBase): +class ComputeHost(mb.BlazarBase): """Description Specifies resources asked by reservation from @@ -199,7 +199,7 @@ class ComputeHost(mb.ClimateBase): return super(ComputeHost, self).to_dict() -class ComputeHostExtraCapability(mb.ClimateBase): +class ComputeHostExtraCapability(mb.BlazarBase): """Description Allows to define extra capabilities per administrator request for each diff --git a/climate/db/sqlalchemy/types.py b/blazar/db/sqlalchemy/types.py similarity index 100% rename from climate/db/sqlalchemy/types.py rename to blazar/db/sqlalchemy/types.py diff --git a/climate/db/sqlalchemy/utils.py b/blazar/db/sqlalchemy/utils.py similarity index 98% rename from climate/db/sqlalchemy/utils.py rename to blazar/db/sqlalchemy/utils.py index 30e78642..5d3d9655 100644 --- a/climate/db/sqlalchemy/utils.py +++ b/blazar/db/sqlalchemy/utils.py @@ -19,8 +19,8 @@ import sys import sqlalchemy as sa -from climate.db.sqlalchemy import facade_wrapper -from climate.db.sqlalchemy import models +from blazar.db.sqlalchemy import facade_wrapper +from blazar.db.sqlalchemy import models get_session = facade_wrapper.get_session diff --git a/climate/db/utils.py b/blazar/db/utils.py similarity index 94% rename from climate/db/utils.py rename to blazar/db/utils.py index 8fb2325c..61632733 100644 --- a/climate/db/utils.py +++ b/blazar/db/utils.py @@ -16,8 +16,8 @@ """Defines interface for DB access. -Functions in this module are imported into the climate.db namespace. Call these -functions from climate.db namespace, not the climate.db.api namespace. +Functions in this module are imported into the blazar.db namespace. Call these +functions from blazar.db namespace, not the blazar.db.api namespace. All functions in this module return objects that implement a dictionary-like interface. @@ -38,7 +38,7 @@ from oslo_log import log as logging _BACKEND_MAPPING = { - 'sqlalchemy': 'climate.db.sqlalchemy.utils', + 'sqlalchemy': 'blazar.db.sqlalchemy.utils', } IMPL = db_api.DBAPI(cfg.CONF.database.backend, diff --git a/climate/exceptions.py b/blazar/exceptions.py similarity index 83% rename from climate/exceptions.py rename to blazar/exceptions.py index 57e3d757..c270dd66 100644 --- a/climate/exceptions.py +++ b/blazar/exceptions.py @@ -16,14 +16,14 @@ from oslo_log import log as logging -from climate.i18n import _ +from blazar.i18n import _ LOG = logging.getLogger(__name__) -class ClimateException(Exception): - """Base Climate Exception. +class BlazarException(Exception): + """Base Blazar Exception. To correctly use this class, inherit from it and define a 'msg_fmt' and 'code' properties. @@ -49,16 +49,16 @@ class ClimateException(Exception): message = self.msg_fmt - super(ClimateException, self).__init__(message) + super(BlazarException, self).__init__(message) -class NotFound(ClimateException): +class NotFound(BlazarException): """Object not found exception.""" msg_fmt = _("Object with %(object)s not found") code = 404 -class NotAuthorized(ClimateException): +class NotAuthorized(BlazarException): msg_fmt = _("Not authorized") code = 403 @@ -67,7 +67,7 @@ class PolicyNotAuthorized(NotAuthorized): msg_fmt = _("Policy doesn't allow %(action)s to be performed") -class ConfigNotFound(ClimateException): +class ConfigNotFound(BlazarException): msg_fmt = _("Could not find config at %(path)s") @@ -75,22 +75,22 @@ class ServiceCatalogNotFound(NotFound): msg_fmt = _("Could not find service catalog") -class WrongFormat(ClimateException): +class WrongFormat(BlazarException): msg_fmt = _("Unenxpectable object format") -class ServiceClient(ClimateException): +class ServiceClient(BlazarException): msg_fmt = _("Service %(service)s have some problems") -class TaskFailed(ClimateException): +class TaskFailed(BlazarException): msg_fmt = _('Current task failed') -class Timeout(ClimateException): +class Timeout(BlazarException): msg_fmt = _('Current task failed with timeout') -class InvalidInput(ClimateException): +class InvalidInput(BlazarException): code = 400 msg_fmt = _("Expected a %(cls)s type but received %(value)s.") diff --git a/climate/i18n.py b/blazar/i18n.py similarity index 98% rename from climate/i18n.py rename to blazar/i18n.py index def38795..73bdd5a3 100644 --- a/climate/i18n.py +++ b/blazar/i18n.py @@ -18,7 +18,7 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html import oslo_i18n -DOMAIN = 'climate' +DOMAIN = 'blazar' _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN) diff --git a/climate/manager/__init__.py b/blazar/manager/__init__.py similarity index 86% rename from climate/manager/__init__.py rename to blazar/manager/__init__.py index dbe4bd36..5e0b85ef 100644 --- a/climate/manager/__init__.py +++ b/blazar/manager/__init__.py @@ -18,13 +18,13 @@ import oslo_messaging as messaging opts = [ cfg.StrOpt('rpc_topic', - default='climate.manager', - help='The topic Climate uses for climate-manager messages.'), + default='blazar.manager', + help='The topic Blazar uses for blazar-manager messages.'), ] CONF = cfg.CONF CONF.register_opts(opts, 'manager') -CONF.import_opt('host', 'climate.config') +CONF.import_opt('host', 'blazar.config') RPC_API_VERSION = '1.0' diff --git a/climate/manager/exceptions.py b/blazar/manager/exceptions.py similarity index 72% rename from climate/manager/exceptions.py rename to blazar/manager/exceptions.py index 0388bd7f..655fa412 100644 --- a/climate/manager/exceptions.py +++ b/blazar/manager/exceptions.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate import exceptions -from climate.i18n import _ +from blazar import exceptions +from blazar.i18n import _ class NoFreePool(exceptions.NotFound): @@ -25,23 +25,23 @@ class HostNotInFreePool(exceptions.NotFound): msg_fmt = _("Host %(host)s not in freepool '%(freepool_name)s'") -class CantRemoveHost(exceptions.ClimateException): +class CantRemoveHost(exceptions.BlazarException): code = 409 msg_fmt = _("Can't remove host(s) %(host)s from Aggregate %(pool)s") -class CantAddHost(exceptions.ClimateException): +class CantAddHost(exceptions.BlazarException): code = 409 msg_fmt = _("Can't add host(s) %(host)s to Aggregate %(pool)s") -class AggregateHaveHost(exceptions.ClimateException): +class AggregateHaveHost(exceptions.BlazarException): code = 409 msg_fmt = _("Can't delete Aggregate '%(name)s', " "host(s) attached to it : %(hosts)s") -class AggregateAlreadyHasHost(exceptions.ClimateException): +class AggregateAlreadyHasHost(exceptions.BlazarException): code = 409 msg_fmt = _("Aggregate %(pool)s already has host(s) %(host)s ") @@ -58,45 +58,45 @@ class InvalidHost(exceptions.NotAuthorized): msg_fmt = _("Invalid values for host %(host)s") -class MultipleHostsFound(exceptions.ClimateException): +class MultipleHostsFound(exceptions.BlazarException): code = 409 msg_fmt = _("Multiple Hosts found for pattern '%(host)s'") -class HostHavingServers(exceptions.ClimateException): +class HostHavingServers(exceptions.BlazarException): code = 409 msg_fmt = _("Servers [%(servers)s] found for host %(host)s") -class PluginConfigurationError(exceptions.ClimateException): +class PluginConfigurationError(exceptions.BlazarException): msg_fmt = _("Plugin Configuration error : %(error)s") -class EventError(exceptions.ClimateException): +class EventError(exceptions.BlazarException): msg_fmt = '%(error)s' -class InvalidDate(exceptions.ClimateException): +class InvalidDate(exceptions.BlazarException): msg_fmt = _( '%(date)s is an invalid date. Required format: %(date_format)s') -class UnsupportedResourceType(exceptions.ClimateException): +class UnsupportedResourceType(exceptions.BlazarException): msg_fmt = _("The %(resource_type)s resource type is not supported") -class LeaseNameAlreadyExists(exceptions.ClimateException): +class LeaseNameAlreadyExists(exceptions.BlazarException): code = 409 msg_fmt = _("The lease with name: %(name)s already exists") -class MissingTrustId(exceptions.ClimateException): +class MissingTrustId(exceptions.BlazarException): msg_fmt = _("A trust id is required") # oshost plugin related exceptions -class CantAddExtraCapability(exceptions.ClimateException): +class CantAddExtraCapability(exceptions.BlazarException): code = 409 msg_fmt = _("Can't add extracapabilities %(keys)s to Host %(host)s") @@ -111,7 +111,7 @@ class ServiceNotFound(exceptions.NotFound): msg_fmt = _("Service %(service)s not found") -class WrongClientVersion(exceptions.ClimateException): +class WrongClientVersion(exceptions.BlazarException): code = 400 msg_fmt = _("Unfortunately you use wrong client version") @@ -121,20 +121,20 @@ class NoManagementUrl(exceptions.NotFound): msg_fmt = _("You haven't management url for service") -class HypervisorNotFound(exceptions.ClimateException): +class HypervisorNotFound(exceptions.BlazarException): msg_fmt = _("Aggregate '%(pool)s' not found!") -class NotEnoughHostsAvailable(exceptions.ClimateException): +class NotEnoughHostsAvailable(exceptions.BlazarException): msg_fmt = _("Not enough hosts available") -class MalformedRequirements(exceptions.ClimateException): +class MalformedRequirements(exceptions.BlazarException): code = 400 msg_fmt = _("Malformed requirements %(rqrms)s") -class InvalidState(exceptions.ClimateException): +class InvalidState(exceptions.BlazarException): code = 409 msg_fmt = _("Invalid State %(state)s for %(id)s") @@ -143,5 +143,5 @@ class InvalidStateUpdate(InvalidState): msg_fmt = _("Unable to update ID %(id)s state with %(action)s:%(status)s") -class ProjectIdNotFound(exceptions.ClimateException): +class ProjectIdNotFound(exceptions.BlazarException): msg_fmt = _("No project_id found in current context") diff --git a/climate/db/sqlalchemy/__init__.py b/blazar/manager/oshosts/__init__.py similarity index 100% rename from climate/db/sqlalchemy/__init__.py rename to blazar/manager/oshosts/__init__.py diff --git a/climate/manager/oshosts/rpcapi.py b/blazar/manager/oshosts/rpcapi.py similarity index 90% rename from climate/manager/oshosts/rpcapi.py rename to blazar/manager/oshosts/rpcapi.py index d71f8e17..d939a96b 100644 --- a/climate/manager/oshosts/rpcapi.py +++ b/blazar/manager/oshosts/rpcapi.py @@ -15,17 +15,17 @@ from oslo_config import cfg -from climate import manager -from climate.utils import service +from blazar import manager +from blazar.utils import service CONF = cfg.CONF -CONF.import_opt('rpc_topic', 'climate.manager.service', 'manager') +CONF.import_opt('rpc_topic', 'blazar.manager.service', 'manager') class ManagerRPCAPI(service.RPCClient): """Client side for the Manager RPC API. - Used from other services to communicate with climate-manager service. + Used from other services to communicate with blazar-manager service. """ BASE_RPC_API_VERSION = '1.0' diff --git a/climate/manager/rpcapi.py b/blazar/manager/rpcapi.py similarity index 92% rename from climate/manager/rpcapi.py rename to blazar/manager/rpcapi.py index 4edbf00e..3904a617 100644 --- a/climate/manager/rpcapi.py +++ b/blazar/manager/rpcapi.py @@ -13,14 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate import manager -from climate.utils import service +from blazar import manager +from blazar.utils import service class ManagerRPCAPI(service.RPCClient): """Client side for the Manager RPC API. - Used from other services to communicate with climate-manager service. + Used from other services to communicate with blazar-manager service. """ def __init__(self): """Initiate RPC API client with needed topic and RPC version.""" diff --git a/climate/manager/service.py b/blazar/manager/service.py similarity index 94% rename from climate/manager/service.py rename to blazar/manager/service.py index aa2aefe9..f340a4c8 100644 --- a/climate/manager/service.py +++ b/blazar/manager/service.py @@ -21,15 +21,15 @@ from oslo_log import log as logging import six from stevedore import enabled -from climate.db import api as db_api -from climate.db import exceptions as db_ex -from climate import exceptions as common_ex -from climate.i18n import _ -from climate import manager -from climate.manager import exceptions -from climate.notification import api as notification_api -from climate.utils import service as service_utils -from climate.utils import trusts +from blazar.db import api as db_api +from blazar.db import exceptions as db_ex +from blazar import exceptions as common_ex +from blazar.i18n import _ +from blazar import manager +from blazar.manager import exceptions +from blazar.notification import api as notification_api +from blazar.utils import service as service_utils +from blazar.utils import trusts manager_opts = [ cfg.ListOpt('plugins', @@ -52,9 +52,9 @@ LEASE_DATE_FORMAT = "%Y-%m-%d %H:%M" class ManagerService(service_utils.RPCServer): - """Service class for the climate-manager service. + """Service class for the blazar-manager service. - Responsible for working with Climate DB, scheduling logic, running events, + Responsible for working with Blazar DB, scheduling logic, running events, working with plugins, etc. """ @@ -75,7 +75,7 @@ class ManagerService(service_utils.RPCServer): extension_manager = enabled.EnabledExtensionManager( check_func=lambda ext: ext.name in config_plugins, - namespace='climate.resource.plugins', + namespace='blazar.resource.plugins', invoke_on_load=False ) @@ -120,7 +120,7 @@ class ManagerService(service_utils.RPCServer): def _event(self): """Tries to commit event. - If there is an event in Climate DB to be done, do it and change its + If there is an event in Blazar DB to be done, do it and change its status to 'DONE'. """ LOG.debug('Trying to get event from DB.') @@ -224,7 +224,7 @@ class ManagerService(service_utils.RPCServer): before_end_date) self._check_date_within_lease_limits(before_end_date, lease_values) - except common_ex.ClimateException as e: + except common_ex.BlazarException as e: LOG.error("Invalid before_end_date param. %s" % e.message) raise e elif CONF.manager.notify_hours_before_lease_end > 0: @@ -244,11 +244,11 @@ class ManagerService(service_utils.RPCServer): lease_values.update({'trust_id': trust_id}) lease = db_api.lease_create(lease_values) lease_id = lease['id'] - except db_ex.ClimateDBDuplicateEntry: + except db_ex.BlazarDBDuplicateEntry: LOG.exception('Cannot create a lease - duplicated lease name') raise exceptions.LeaseNameAlreadyExists( name=lease_values['name']) - except db_ex.ClimateDBException: + except db_ex.BlazarDBException: LOG.exception('Cannot create a lease') raise else: @@ -265,7 +265,7 @@ class ManagerService(service_utils.RPCServer): raise exceptions.UnsupportedResourceType( resource_type) except (exceptions.UnsupportedResourceType, - common_ex.ClimateException): + common_ex.BlazarException): LOG.exception("Failed to create reservation for a lease. " "Rollback the lease and associated " "reservations") @@ -334,7 +334,7 @@ class ManagerService(service_utils.RPCServer): before_end_date = self._date_from_string(before_end_date) self._check_date_within_lease_limits(before_end_date, values) - except common_ex.ClimateException as e: + except common_ex.BlazarException as e: LOG.error("Invalid before_end_date param. %s" % e.message) raise e @@ -357,7 +357,7 @@ class ManagerService(service_utils.RPCServer): } ) if not event: - raise common_ex.ClimateException( + raise common_ex.BlazarException( 'Start lease event not found') db_api.event_update(event['id'], {'time': values['start_date']}) @@ -370,7 +370,7 @@ class ManagerService(service_utils.RPCServer): } ) if not event: - raise common_ex.ClimateException( + raise common_ex.BlazarException( 'End lease event not found') db_api.event_update(event['id'], {'time': values['end_date']}) @@ -395,7 +395,7 @@ class ManagerService(service_utils.RPCServer): plugin = self.plugins[reservation['resource_type']] try: plugin.on_end(reservation['resource_id']) - except (db_ex.ClimateDBException, RuntimeError): + except (db_ex.BlazarDBException, RuntimeError): LOG.exception("Failed to delete a reservation " "for a lease.") raise @@ -430,7 +430,7 @@ class ManagerService(service_utils.RPCServer): self.resource_actions[resource_type][action_time]( reservation['resource_id'] ) - except common_ex.ClimateException: + except common_ex.BlazarException: LOG.exception("Failed to execute action %(action)s " "for lease %(lease)s" % { diff --git a/climate/manager/oshosts/__init__.py b/blazar/notification/__init__.py similarity index 100% rename from climate/manager/oshosts/__init__.py rename to blazar/notification/__init__.py diff --git a/climate/notification/api.py b/blazar/notification/api.py similarity index 96% rename from climate/notification/api.py rename to blazar/notification/api.py index 2684df57..e829fa6a 100644 --- a/climate/notification/api.py +++ b/blazar/notification/api.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from climate.notification import notifier +from blazar.notification import notifier IMPL = notifier.Notifier() diff --git a/climate/notification/notifier.py b/blazar/notification/notifier.py similarity index 96% rename from climate/notification/notifier.py rename to blazar/notification/notifier.py index 75fa0ed4..65ba033c 100644 --- a/climate/notification/notifier.py +++ b/blazar/notification/notifier.py @@ -20,7 +20,7 @@ import oslo_messaging as messaging notification_opts = [ cfg.StrOpt('publisher_id', - default="climate.lease", + default="blazar.lease", help='Publisher ID for notifications') ] @@ -53,7 +53,7 @@ def get_notifier(publisher_id): class Notifier(object): - """Notification class for climate + """Notification class for blazar Responsible for sending lease events notifications using oslo.nofity """ diff --git a/blazar/opts.py b/blazar/opts.py new file mode 100644 index 00000000..ec0403cd --- /dev/null +++ b/blazar/opts.py @@ -0,0 +1,56 @@ +# 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. + +import itertools + +import blazar.api.v2.app +import blazar.api.v2.controllers +import blazar.cmd.api +import blazar.config +import blazar.db.base +import blazar.db.migration.cli +import blazar.manager +import blazar.manager.service +import blazar.notification.notifier +import blazar.plugins.instances.vm_plugin +import blazar.plugins.oshosts.host_plugin +import blazar.plugins.oshosts.reservation_pool +import blazar.utils.openstack.keystone +import blazar.utils.openstack.nova + + +def list_opts(): + return [ + ('DEFAULT', + itertools.chain( + blazar.api.v2.app.auth_opts, + blazar.cmd.api.api_opts, + blazar.cmd.api.opts, + blazar.config.cli_opts, + blazar.config.os_opts, + blazar.db.base.db_driver_opts, + blazar.db.migration.cli.command_opts, + blazar.utils.openstack.keystone.opts, + blazar.utils.openstack.keystone.keystone_opts, + blazar.utils.openstack.nova.nova_opts)), + ('api', blazar.api.v2.controllers.api_opts), + ('manager', itertools.chain(blazar.manager.opts, + blazar.manager.service.manager_opts)), + ('notifications', blazar.notification.notifier.notification_opts), + (blazar.plugins.instances.RESOURCE_TYPE, + blazar.plugins.instances.vm_plugin.plugin_opts), + (blazar.plugins.oshosts.RESOURCE_TYPE, itertools.chain( + blazar.plugins.oshosts.host_plugin.plugin_opts, + blazar.plugins.oshosts.reservation_pool.OPTS)), + + ] diff --git a/climate/notification/__init__.py b/blazar/plugins/__init__.py similarity index 100% rename from climate/notification/__init__.py rename to blazar/plugins/__init__.py diff --git a/climate/plugins/base.py b/blazar/plugins/base.py similarity index 98% rename from climate/plugins/base.py rename to blazar/plugins/base.py index 08cf2127..2151eb41 100644 --- a/climate/plugins/base.py +++ b/blazar/plugins/base.py @@ -19,7 +19,7 @@ from oslo_config import cfg from oslo_log import log as logging import six -from climate.db import api as db_api +from blazar.db import api as db_api LOG = logging.getLogger(__name__) CONF = cfg.CONF diff --git a/climate/plugins/dummy_vm_plugin.py b/blazar/plugins/dummy_vm_plugin.py similarity index 97% rename from climate/plugins/dummy_vm_plugin.py rename to blazar/plugins/dummy_vm_plugin.py index 2c94bb1c..575de8f3 100644 --- a/climate/plugins/dummy_vm_plugin.py +++ b/blazar/plugins/dummy_vm_plugin.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.plugins import base +from blazar.plugins import base class DummyVMPlugin(base.BasePlugin): diff --git a/climate/plugins/instances/__init__.py b/blazar/plugins/instances/__init__.py similarity index 100% rename from climate/plugins/instances/__init__.py rename to blazar/plugins/instances/__init__.py diff --git a/climate/plugins/instances/vm_plugin.py b/blazar/plugins/instances/vm_plugin.py similarity index 90% rename from climate/plugins/instances/vm_plugin.py rename to blazar/plugins/instances/vm_plugin.py index 2703aee7..bd63c009 100644 --- a/climate/plugins/instances/vm_plugin.py +++ b/blazar/plugins/instances/vm_plugin.py @@ -18,10 +18,10 @@ from novaclient import exceptions as nova_exceptions from oslo_config import cfg from oslo_log import log as logging -from climate import exceptions as climate_exceptions -from climate.plugins import base -from climate.plugins import instances as plugin -from climate.utils.openstack import nova +from blazar import exceptions as blazar_exceptions +from blazar.plugins import base +from blazar.plugins import instances as plugin +from blazar.utils.openstack import nova LOG = logging.getLogger(__name__) @@ -62,7 +62,7 @@ class VMPlugin(base.BasePlugin, nova.NovaClientWrapper): # creating snapshot or suspending already deleted instance if 'create_image' in actions: - with eventlet.timeout.Timeout(600, climate_exceptions.Timeout): + with eventlet.timeout.Timeout(600, blazar_exceptions.Timeout): try: self.nova.servers.create_image(resource_id) eventlet.sleep(5) @@ -71,7 +71,7 @@ class VMPlugin(base.BasePlugin, nova.NovaClientWrapper): except nova_exceptions.NotFound: LOG.error('Instance %s has been already deleted. ' 'Cannot create image.' % resource_id) - except climate_exceptions.Timeout: + except blazar_exceptions.Timeout: LOG.error('Image create failed with timeout. Take a look ' 'at nova.') except nova_exceptions.Conflict as e: @@ -105,10 +105,10 @@ class VMPlugin(base.BasePlugin, nova.NovaClientWrapper): else: LOG.error('Nova reported unexpected task status %s for ' 'instance %s' % (task_state, resource_id)) - raise climate_exceptions.TaskFailed() + raise blazar_exceptions.TaskFailed() def _split_actions(self, actions): try: return actions.replace(' ', '').split(',') except AttributeError: - raise climate_exceptions.WrongFormat() + raise blazar_exceptions.WrongFormat() diff --git a/climate/plugins/oshosts/__init__.py b/blazar/plugins/oshosts/__init__.py similarity index 100% rename from climate/plugins/oshosts/__init__.py rename to blazar/plugins/oshosts/__init__.py diff --git a/climate/plugins/oshosts/host_plugin.py b/blazar/plugins/oshosts/host_plugin.py similarity index 96% rename from climate/plugins/oshosts/host_plugin.py rename to blazar/plugins/oshosts/host_plugin.py index f2b1e4fc..e83140ac 100644 --- a/climate/plugins/oshosts/host_plugin.py +++ b/blazar/plugins/oshosts/host_plugin.py @@ -21,16 +21,16 @@ import uuid from oslo_config import cfg import six -from climate.db import api as db_api -from climate.db import exceptions as db_ex -from climate.db import utils as db_utils -from climate.manager import exceptions as manager_ex -from climate.plugins import base -from climate.plugins import oshosts as plugin -from climate.plugins.oshosts import nova_inventory -from climate.plugins.oshosts import reservation_pool as rp -from climate.utils.openstack import nova -from climate.utils import trusts +from blazar.db import api as db_api +from blazar.db import exceptions as db_ex +from blazar.db import utils as db_utils +from blazar.manager import exceptions as manager_ex +from blazar.plugins import base +from blazar.plugins import oshosts as plugin +from blazar.plugins.oshosts import nova_inventory +from blazar.plugins.oshosts import reservation_pool as rp +from blazar.utils.openstack import nova +from blazar.utils import trusts plugin_opts = [ cfg.StrOpt('on_end', @@ -255,7 +255,7 @@ class PhysicalHostPlugin(base.BasePlugin, nova.NovaClientWrapper): if trust_id: host_details.update({'trust_id': trust_id}) host = db_api.host_create(host_details) - except db_ex.ClimateDBException: + except db_ex.BlazarDBException: # We need to rollback # TODO(sbauza): Investigate use of Taskflow for atomic # transactions @@ -269,7 +269,7 @@ class PhysicalHostPlugin(base.BasePlugin, nova.NovaClientWrapper): } try: db_api.host_extra_capability_create(values) - except db_ex.ClimateDBException: + except db_ex.BlazarDBException: cantaddextracapability.append(key) if cantaddextracapability: raise manager_ex.CantAddExtraCapability( @@ -329,7 +329,7 @@ class PhysicalHostPlugin(base.BasePlugin, nova.NovaClientWrapper): # NOTE(sbauza): Extracapabilities will be destroyed thanks to # the DB FK. db_api.host_destroy(host_id) - except db_ex.ClimateDBException: + except db_ex.BlazarDBException: # Nothing so bad, but we need to advert the admin # he has to rerun raise manager_ex.CantRemoveHost(host=host_id, diff --git a/climate/plugins/oshosts/nova_inventory.py b/blazar/plugins/oshosts/nova_inventory.py similarity index 96% rename from climate/plugins/oshosts/nova_inventory.py rename to blazar/plugins/oshosts/nova_inventory.py index 1f291ed1..c772533b 100644 --- a/climate/plugins/oshosts/nova_inventory.py +++ b/blazar/plugins/oshosts/nova_inventory.py @@ -15,8 +15,8 @@ from novaclient import exceptions as nova_exceptions -from climate.manager import exceptions as manager_exceptions -from climate.utils.openstack import nova +from blazar.manager import exceptions as manager_exceptions +from blazar.utils.openstack import nova class NovaInventory(nova.NovaClientWrapper): diff --git a/climate/plugins/oshosts/reservation_pool.py b/blazar/plugins/oshosts/reservation_pool.py similarity index 93% rename from climate/plugins/oshosts/reservation_pool.py rename to blazar/plugins/oshosts/reservation_pool.py index 2f326910..213cb685 100644 --- a/climate/plugins/oshosts/reservation_pool.py +++ b/blazar/plugins/oshosts/reservation_pool.py @@ -20,10 +20,10 @@ from novaclient import exceptions as nova_exceptions from oslo_config import cfg from oslo_log import log as logging -from climate import context -from climate.manager import exceptions as manager_exceptions -from climate.plugins import oshosts as plugin -from climate.utils.openstack import nova +from blazar import context +from blazar.manager import exceptions as manager_exceptions +from blazar.plugins import oshosts as plugin +from blazar.utils.openstack import nova LOG = logging.getLogger(__name__) @@ -34,14 +34,16 @@ OPTS = [ help='Name of the special aggregate where all hosts ' 'are candidate for physical host reservation'), cfg.StrOpt('project_id_key', - default='climate:project', + default='blazar:project', help='Aggregate metadata value for key matching project_id'), - cfg.StrOpt('climate_owner', - default='climate:owner', + cfg.StrOpt('blazar_owner', + default='blazar:owner', + deprecated_name='climate_owner', help='Aggregate metadata key for knowing owner project_id'), - cfg.StrOpt('climate_az_prefix', - default='climate:', - help='Prefix for Availability Zones created by Climate'), + cfg.StrOpt('blazar_az_prefix', + default='blazar:', + deprecated_name='climate_az_prefix', + help='Prefix for Availability Zones created by Blazar'), ] CONF = cfg.CONF @@ -98,7 +100,7 @@ class ReservationPool(nova.NovaClientWrapper): name = name or self._generate_aggregate_name() if az: - az_name = "%s%s" % (self.config.climate_az_prefix, + az_name = "%s%s" % (self.config.blazar_az_prefix, name) LOG.debug('Creating pool aggregate: %s ' 'with Availability Zone %s' % (name, az_name)) @@ -117,7 +119,7 @@ class ReservationPool(nova.NovaClientWrapper): LOG.error(e.message) raise e - meta = {self.config.climate_owner: project_id} + meta = {self.config.blazar_owner: project_id} self.nova.aggregates.set_metadata(agg, meta) return agg diff --git a/climate/policy.py b/blazar/policy.py similarity index 92% rename from climate/policy.py rename to blazar/policy.py index f5bdb983..d5acfcb9 100644 --- a/climate/policy.py +++ b/blazar/policy.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Policy Engine For Climate.""" +"""Policy Engine For Blazar.""" import functools @@ -22,8 +22,8 @@ from oslo_log import log as logging from oslo_policy import opts from oslo_policy import policy -from climate import context -from climate import exceptions +from blazar import context +from blazar import exceptions CONF = cfg.CONF opts.set_defaults(CONF) @@ -60,7 +60,7 @@ def set_rules(data, default_rule=None): def enforce(context, action, target, do_raise=True): """Verifies that the action is valid on the target in this context. - :param context: climate context + :param context: blazar context :param action: string representing the action to be checked this should be colon separated for clarity. i.e. ``compute:create_instance``, @@ -72,7 +72,7 @@ def enforce(context, action, target, do_raise=True): :param do_raise: if True (the default), raises PolicyNotAuthorized; if False, returns False - :raises climate.exceptions.PolicyNotAuthorized: if verification fails + :raises blazar.exceptions.PolicyNotAuthorized: if verification fails and do_raise is True. :return: returns a non-False value (not necessarily "True") if @@ -93,7 +93,7 @@ def enforce(context, action, target, do_raise=True): **extra) -def authorize(extension, action=None, api='climate', ctx=None, +def authorize(extension, action=None, api='blazar', ctx=None, target=None): def decorator(func): diff --git a/climate/states.py b/blazar/states.py similarity index 93% rename from climate/states.py rename to blazar/states.py index a67a6599..a0201cf0 100644 --- a/climate/states.py +++ b/blazar/states.py @@ -13,16 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Actions and states for Climate objects.""" +"""Actions and states for Blazar objects.""" import abc from oslo_log import log as logging import six -from climate.db import api as db_api -from climate.db import exceptions as db_exc -from climate.manager import exceptions as mgr_exc +from blazar.db import api as db_api +from blazar.db import exceptions as db_exc +from blazar.manager import exceptions as mgr_exc LOG = logging.getLogger(__name__) @@ -90,7 +90,7 @@ class LeaseState(ObjectState): def save(self): try: db_api.lease_update(self.id, self.current()) - except db_exc.ClimateDBException: + except db_exc.BlazarDBException: # Lease can be not yet in DB, we must first write it raise mgr_exc.InvalidState(id=self.id, state=self.current()) return self.current() diff --git a/climate/tests/__init__.py b/blazar/tests/__init__.py similarity index 90% rename from climate/tests/__init__.py rename to blazar/tests/__init__.py index 70d4bc31..7de2b826 100644 --- a/climate/tests/__init__.py +++ b/blazar/tests/__init__.py @@ -24,15 +24,15 @@ from oslo_log import log as logging from oslotest import base from oslotest import mockpatch -from climate import context -from climate.db.sqlalchemy import api as db_api -from climate.db.sqlalchemy import facade_wrapper -from climate import policy -from climate.tests import fake_policy +from blazar import context +from blazar.db.sqlalchemy import api as db_api +from blazar.db.sqlalchemy import facade_wrapper +from blazar import policy +from blazar.tests import fake_policy cfg.CONF.set_override('use_stderr', False) -logging.setup(cfg.CONF, 'climate') +logging.setup(cfg.CONF, 'blazar') _DB_CACHE = None @@ -80,7 +80,7 @@ class TestCase(testscenarios.WithScenarios, base.BaseTestCase): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() self.context_mock = None - cfg.CONF(args=[], project='climate') + cfg.CONF(args=[], project='blazar') self.policy = self.useFixture(PolicyFixture()) def patch(self, obj, attr): @@ -90,7 +90,7 @@ class TestCase(testscenarios.WithScenarios, base.BaseTestCase): def set_context(self, ctx): if self.context_mock is None: - self.context_mock = self.patch(context.ClimateContext, 'current') + self.context_mock = self.patch(context.BlazarContext, 'current') self.context_mock.return_value = ctx diff --git a/climate/tests/api/__init__.py b/blazar/tests/api/__init__.py similarity index 96% rename from climate/tests/api/__init__.py rename to blazar/tests/api/__init__.py index 322f7669..b4fddb0f 100644 --- a/climate/tests/api/__init__.py +++ b/blazar/tests/api/__init__.py @@ -22,11 +22,11 @@ import pecan.testing import six -from climate.api import context as api_context -from climate import context -from climate.manager.oshosts import rpcapi as hosts_rpcapi -from climate.manager import rpcapi -from climate import tests +from blazar.api import context as api_context +from blazar import context +from blazar.manager.oshosts import rpcapi as hosts_rpcapi +from blazar.manager import rpcapi +from blazar import tests PATH_PREFIX = '/v2' @@ -42,10 +42,10 @@ class APITest(tests.TestCase): def setUp(self): def fake_ctx_from_headers(headers): if not headers: - return context.ClimateContext( + return context.BlazarContext( user_id='fake', project_id='fake', roles=['member']) roles = headers.get('X-Roles', six.text_type('member')).split(',') - return context.ClimateContext( + return context.BlazarContext( user_id=headers.get('X-User-Id', 'fake'), project_id=headers.get('X-Project-Id', 'fake'), auth_token=headers.get('X-Auth-Token', None), @@ -100,8 +100,8 @@ class APITest(tests.TestCase): self.config = { 'app': { - 'modules': ['climate.api.v2'], - 'root': 'climate.api.root.RootController', + 'modules': ['blazar.api.v2'], + 'root': 'blazar.api.root.RootController', 'enable_acl': enable_acl, }, } diff --git a/climate/tests/api/test_acl.py b/blazar/tests/api/test_acl.py similarity index 97% rename from climate/tests/api/test_acl.py rename to blazar/tests/api/test_acl.py index d80f93e4..8e78bf7a 100644 --- a/climate/tests/api/test_acl.py +++ b/blazar/tests/api/test_acl.py @@ -16,8 +16,8 @@ Tests for ACL. Checks whether certain kinds of requests are blocked or allowed to be processed. """ -from climate import policy -from climate.tests import api +from blazar import policy +from blazar.tests import api class TestACL(api.APITest): diff --git a/climate/tests/api/test_context.py b/blazar/tests/api/test_context.py similarity index 92% rename from climate/tests/api/test_context.py rename to blazar/tests/api/test_context.py index ef4d6f76..fa8102e1 100644 --- a/climate/tests/api/test_context.py +++ b/blazar/tests/api/test_context.py @@ -15,10 +15,10 @@ import json -from climate.api import context as api_context -from climate import context -from climate import exceptions -from climate import tests +from blazar.api import context as api_context +from blazar import context +from blazar import exceptions +from blazar import tests class ContextTestCase(tests.TestCase): @@ -33,7 +33,7 @@ class ContextTestCase(tests.TestCase): u'X-Roles': u'user_name0, user_name1'} def test_ctx_from_headers(self): - self.context = self.patch(context, 'ClimateContext') + self.context = self.patch(context, 'BlazarContext') catalog = json.dumps({'nova': 'catalog'}) self.fake_headers[u'X-Service-Catalog'] = catalog api_context.ctx_from_headers(self.fake_headers) diff --git a/climate/tests/api/test_root.py b/blazar/tests/api/test_root.py similarity index 98% rename from climate/tests/api/test_root.py rename to blazar/tests/api/test_root.py index 7c920626..6f0e0378 100644 --- a/climate/tests/api/test_root.py +++ b/blazar/tests/api/test_root.py @@ -15,7 +15,7 @@ import json -from climate.tests import api +from blazar.tests import api class TestRoot(api.APITest): diff --git a/climate/tests/api/test_version_selector.py b/blazar/tests/api/test_version_selector.py similarity index 97% rename from climate/tests/api/test_version_selector.py rename to blazar/tests/api/test_version_selector.py index fe924008..b9bdefcb 100644 --- a/climate/tests/api/test_version_selector.py +++ b/blazar/tests/api/test_version_selector.py @@ -15,10 +15,10 @@ import json -from climate.api.v1 import app as v1_app -from climate.api.v2 import app as v2_app -from climate.cmd import api -from climate import tests +from blazar.api.v1 import app as v1_app +from blazar.api.v2 import app as v2_app +from blazar.cmd import api +from blazar import tests class FakeWSGIApp(object): diff --git a/climate/plugins/__init__.py b/blazar/tests/api/v1/__init__.py similarity index 100% rename from climate/plugins/__init__.py rename to blazar/tests/api/v1/__init__.py diff --git a/climate/tests/api/v1/__init__.py b/blazar/tests/api/v1/oshosts/__init__.py similarity index 100% rename from climate/tests/api/v1/__init__.py rename to blazar/tests/api/v1/oshosts/__init__.py diff --git a/climate/tests/api/v1/oshosts/test_service.py b/blazar/tests/api/v1/oshosts/test_service.py similarity index 94% rename from climate/tests/api/v1/oshosts/test_service.py rename to blazar/tests/api/v1/oshosts/test_service.py index 95b7ff07..bd4757e5 100644 --- a/climate/tests/api/v1/oshosts/test_service.py +++ b/blazar/tests/api/v1/oshosts/test_service.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.api.v1.oshosts import service as service_api -from climate import tests +from blazar.api.v1.oshosts import service as service_api +from blazar import tests class RPCApiTestCase(tests.TestCase): diff --git a/climate/tests/api/v1/oshosts/test_v1_0.py b/blazar/tests/api/v1/oshosts/test_v1_0.py similarity index 92% rename from climate/tests/api/v1/oshosts/test_v1_0.py rename to blazar/tests/api/v1/oshosts/test_v1_0.py index 788bebd8..1b6edbf3 100644 --- a/climate/tests/api/v1/oshosts/test_v1_0.py +++ b/blazar/tests/api/v1/oshosts/test_v1_0.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.api.v1.oshosts import service as service_api -from climate.api.v1.oshosts import v1_0 as api -from climate.api.v1 import utils as utils_api -from climate import tests +from blazar.api.v1.oshosts import service as service_api +from blazar.api.v1.oshosts import v1_0 as api +from blazar.api.v1 import utils as utils_api +from blazar import tests class RESTApiTestCase(tests.TestCase): diff --git a/climate/tests/api/v1/test_app.py b/blazar/tests/api/v1/test_app.py similarity index 93% rename from climate/tests/api/v1/test_app.py rename to blazar/tests/api/v1/test_app.py index 007835ca..40a57aac 100644 --- a/climate/tests/api/v1/test_app.py +++ b/blazar/tests/api/v1/test_app.py @@ -18,10 +18,10 @@ from keystonemiddleware import auth_token from oslo_config import cfg from werkzeug import exceptions as werkzeug_exceptions -from climate.api.v1 import app -from climate.api.v1.oshosts import v1_0 as host_api_v1_0 -from climate.api.v1 import utils as api_utils -from climate import tests +from blazar.api.v1 import app +from blazar.api.v1.oshosts import v1_0 as host_api_v1_0 +from blazar.api.v1 import utils as api_utils +from blazar import tests class AppTestCase(tests.TestCase): @@ -76,7 +76,7 @@ class AppTestCase(tests.TestCase): auth_port='35357', auth_protocol='http', auth_version='v2.0', - admin_password='climate', + admin_password='blazar', auth_host='127.0.0.1') diff --git a/climate/tests/api/v1/test_service.py b/blazar/tests/api/v1/test_service.py similarity index 95% rename from climate/tests/api/v1/test_service.py rename to blazar/tests/api/v1/test_service.py index 9e4c1840..28c941c8 100644 --- a/climate/tests/api/v1/test_service.py +++ b/blazar/tests/api/v1/test_service.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.api.v1 import service as service_api -from climate import tests +from blazar.api.v1 import service as service_api +from blazar import tests class RPCApiTestCase(tests.TestCase): diff --git a/climate/tests/api/v1/test_utils.py b/blazar/tests/api/v1/test_utils.py similarity index 98% rename from climate/tests/api/v1/test_utils.py rename to blazar/tests/api/v1/test_utils.py index fb36e4c7..a9024902 100644 --- a/climate/tests/api/v1/test_utils.py +++ b/blazar/tests/api/v1/test_utils.py @@ -15,8 +15,8 @@ import flask -from climate.api.v1 import utils -from climate import tests +from blazar.api.v1 import utils +from blazar import tests class Error: diff --git a/climate/tests/api/v1/test_v1_0.py b/blazar/tests/api/v1/test_v1_0.py similarity index 92% rename from climate/tests/api/v1/test_v1_0.py rename to blazar/tests/api/v1/test_v1_0.py index c6c8362a..efcfb5ae 100644 --- a/climate/tests/api/v1/test_v1_0.py +++ b/blazar/tests/api/v1/test_v1_0.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.api.v1 import service as service_api -from climate.api.v1 import utils as utils_api -from climate.api.v1 import v1_0 as api -from climate import tests +from blazar.api.v1 import service as service_api +from blazar.api.v1 import utils as utils_api +from blazar.api.v1 import v1_0 as api +from blazar import tests class RESTApiTestCase(tests.TestCase): diff --git a/climate/tests/api/v1/test_validation.py b/blazar/tests/api/v1/test_validation.py similarity index 88% rename from climate/tests/api/v1/test_validation.py rename to blazar/tests/api/v1/test_validation.py index de968ffe..15b150da 100644 --- a/climate/tests/api/v1/test_validation.py +++ b/blazar/tests/api/v1/test_validation.py @@ -13,11 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.api.v1 import service as service_api -from climate.api.v1 import utils as api_utils -from climate.api.v1 import validation as validation_api -from climate import exceptions -from climate import tests +from blazar.api.v1 import service as service_api +from blazar.api.v1 import utils as api_utils +from blazar.api.v1 import validation as validation_api +from blazar import exceptions +from blazar import tests class ValidationTestCase(tests.TestCase): diff --git a/climate/tests/api/v1/oshosts/__init__.py b/blazar/tests/api/v2/__init__.py similarity index 100% rename from climate/tests/api/v1/oshosts/__init__.py rename to blazar/tests/api/v2/__init__.py diff --git a/climate/tests/api/v2/test_hosts.py b/blazar/tests/api/v2/test_hosts.py similarity index 99% rename from climate/tests/api/v2/test_hosts.py rename to blazar/tests/api/v2/test_hosts.py index eab8c446..4fa605e7 100644 --- a/climate/tests/api/v2/test_hosts.py +++ b/blazar/tests/api/v2/test_hosts.py @@ -20,8 +20,8 @@ import uuid import six -from climate.tests import api -from climate.utils import trusts +from blazar.tests import api +from blazar.utils import trusts def fake_computehost(**kw): diff --git a/climate/tests/api/v2/test_leases.py b/blazar/tests/api/v2/test_leases.py similarity index 99% rename from climate/tests/api/v2/test_leases.py rename to blazar/tests/api/v2/test_leases.py index 96e19b1e..1337dbe1 100644 --- a/climate/tests/api/v2/test_leases.py +++ b/blazar/tests/api/v2/test_leases.py @@ -20,8 +20,8 @@ import uuid import six -from climate.tests import api -from climate.utils import trusts +from blazar.tests import api +from blazar.utils import trusts def fake_lease(**kw): diff --git a/climate/tests/api/v2/__init__.py b/blazar/tests/db/__init__.py similarity index 100% rename from climate/tests/api/v2/__init__.py rename to blazar/tests/db/__init__.py diff --git a/climate/tests/db/migration/__init__.py b/blazar/tests/db/migration/__init__.py similarity index 98% rename from climate/tests/db/migration/__init__.py rename to blazar/tests/db/migration/__init__.py index fab2e058..377c3ece 100644 --- a/climate/tests/db/migration/__init__.py +++ b/blazar/tests/db/migration/__init__.py @@ -37,13 +37,13 @@ from oslo_log import log as logging import sqlalchemy import sqlalchemy.exc -import climate.db.migration -from climate import tests +import blazar.db.migration +from blazar import tests LOG = logging.getLogger(__name__) CONF = cfg.CONF -synchronized = lockutils.synchronized_with_prefix('climate-') +synchronized = lockutils.synchronized_with_prefix('blazar-') def _get_connect_string(backend, user, passwd, database): @@ -78,14 +78,14 @@ def _is_backend_avail(backend, user, passwd, database): def _have_mysql(user, passwd, database): - present = os.environ.get('CLIMATE_MYSQL_PRESENT') + present = os.environ.get('BLAZAR_MYSQL_PRESENT') if present is None: return _is_backend_avail('mysql', user, passwd, database) return present.lower() in ('', 'true') def _have_postgresql(user, passwd, database): - present = os.environ.get('CLIMATE_TEST_POSTGRESQL_PRESENT') + present = os.environ.get('BLAZAR_TEST_POSTGRESQL_PRESENT') if present is None: return _is_backend_avail('postgres', user, passwd, database) return present.lower() in ('', 'true') @@ -187,18 +187,18 @@ class BaseMigrationTestCase(tests.TestCase): self.DEFAULT_CONFIG_FILE = os.path.join( os.path.dirname(__file__), 'test_migrations.conf') - # Test machines can set the CLIMATE_TEST_MIGRATIONS_CONF variable + # Test machines can set the BLAZAR_TEST_MIGRATIONS_CONF variable # to override the location of the config file for migration testing self.CONFIG_FILE_PATH = os.environ.get( - 'CLIMATE_TEST_MIGRATIONS_CONF', + 'BLAZAR_TEST_MIGRATIONS_CONF', self.DEFAULT_CONFIG_FILE) self.ALEMBIC_CONFIG = alembic_config.Config( - os.path.join(os.path.dirname(climate.db.migration.__file__), + os.path.join(os.path.dirname(blazar.db.migration.__file__), 'alembic.ini') ) - self.ALEMBIC_CONFIG.climate_config = CONF + self.ALEMBIC_CONFIG.blazar_config = CONF self.snake_walk = False self.downgrade = False diff --git a/climate/tests/db/migration/test_migrations.conf b/blazar/tests/db/migration/test_migrations.conf similarity index 100% rename from climate/tests/db/migration/test_migrations.conf rename to blazar/tests/db/migration/test_migrations.conf diff --git a/climate/tests/db/migration/test_migrations.py b/blazar/tests/db/migration/test_migrations.py similarity index 99% rename from climate/tests/db/migration/test_migrations.py rename to blazar/tests/db/migration/test_migrations.py index 772082c3..2571976f 100644 --- a/climate/tests/db/migration/test_migrations.py +++ b/blazar/tests/db/migration/test_migrations.py @@ -40,7 +40,7 @@ postgres=# create database openstack_citest with owner openstack_citest; from oslo_config import cfg import sqlalchemy -from climate.tests.db import migration +from blazar.tests.db import migration CONF = cfg.CONF diff --git a/climate/tests/db/__init__.py b/blazar/tests/db/sqlalchemy/__init__.py similarity index 100% rename from climate/tests/db/__init__.py rename to blazar/tests/db/sqlalchemy/__init__.py diff --git a/climate/tests/db/sqlalchemy/test_sqlalchemy_api.py b/blazar/tests/db/sqlalchemy/test_sqlalchemy_api.py similarity index 95% rename from climate/tests/db/sqlalchemy/test_sqlalchemy_api.py rename to blazar/tests/db/sqlalchemy/test_sqlalchemy_api.py index 44909a76..08636d0e 100644 --- a/climate/tests/db/sqlalchemy/test_sqlalchemy_api.py +++ b/blazar/tests/db/sqlalchemy/test_sqlalchemy_api.py @@ -17,12 +17,12 @@ import datetime import operator import uuid -from climate.db import exceptions as db_exceptions -from climate.db.sqlalchemy import api as db_api -from climate.db.sqlalchemy import models -from climate.plugins import instances as vm_plugin -from climate.plugins import oshosts as host_plugin -from climate import tests +from blazar.db import exceptions as db_exceptions +from blazar.db.sqlalchemy import api as db_api +from blazar.db.sqlalchemy import models +from blazar.plugins import instances as vm_plugin +from blazar.plugins import oshosts as host_plugin +from blazar import tests def _get_fake_random_uuid(): @@ -242,7 +242,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): """Create two leases with same names, and checks it raises an error.""" db_api.lease_create(_get_fake_phys_lease_values()) - self.assertRaises(db_exceptions.ClimateDBDuplicateEntry, + self.assertRaises(db_exceptions.BlazarDBDuplicateEntry, db_api.lease_create, _get_fake_phys_lease_values()) @@ -259,7 +259,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): lease_values['id'] = _get_fake_random_uuid() lease_values['name'] = 'duplicated_reservation' - self.assertRaises(db_exceptions.ClimateDBDuplicateEntry, + self.assertRaises(db_exceptions.BlazarDBDuplicateEntry, db_api.lease_create, lease_values) @@ -278,7 +278,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): lease_values['name'] = 'duplicated_event' lease_values['reservations'][0]['id'] = _get_fake_random_uuid() - self.assertRaises(db_exceptions.ClimateDBDuplicateEntry, + self.assertRaises(db_exceptions.BlazarDBDuplicateEntry, db_api.lease_create, lease_values) @@ -294,7 +294,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): def test_delete_wrong_lease(self): """Delete a lease that doesn't exist and check that raises an error.""" - self.assertRaises(db_exceptions.ClimateDBNotFound, + self.assertRaises(db_exceptions.BlazarDBNotFound, db_api.lease_destroy, 'fake_id') def test_get_physical_lease(self): @@ -391,7 +391,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): def test_reservation_destroy_for_reservation_not_found(self): self.assertFalse(db_api.reservation_get('1')) - self.assertRaises(db_exceptions.ClimateDBNotFound, + self.assertRaises(db_exceptions.BlazarDBNotFound, db_api.reservation_destroy, '1') def test_create_duplicate_reservation(self): @@ -402,7 +402,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): """ uuid = _get_fake_random_uuid() db_api.reservation_create(_get_fake_phys_reservation_values(id=uuid)) - self.assertRaises(db_exceptions.ClimateDBDuplicateEntry, + self.assertRaises(db_exceptions.BlazarDBDuplicateEntry, db_api.reservation_create, _get_fake_phys_reservation_values(id=uuid)) @@ -430,7 +430,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): db_api.host_reservation_create( _get_fake_host_reservation_values(id='1')) - self.assertRaises(db_exceptions.ClimateDBDuplicateEntry, + self.assertRaises(db_exceptions.BlazarDBDuplicateEntry, db_api.host_reservation_create, _get_fake_host_reservation_values(id='1')) @@ -441,7 +441,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): including cascade deletion from reservations table. """ - self.assertRaises(db_exceptions.ClimateDBNotFound, + self.assertRaises(db_exceptions.BlazarDBNotFound, db_api.host_reservation_destroy, 'fake_id') result = db_api.host_reservation_create( @@ -487,7 +487,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): """Create a duplicated host and verify that an exception is raised.""" db_api.host_create(_get_fake_host_values(id='1')) # Making sure we still raise a DuplicateDBEntry - self.assertRaises(db_exceptions.ClimateDBDuplicateEntry, + self.assertRaises(db_exceptions.BlazarDBDuplicateEntry, db_api.host_create, _get_fake_host_values(id='1')) @@ -526,7 +526,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): self.assertEqual(0, len( db_api.host_get_all_by_queries(['cpu_info like %wrongcpu%', 'vgpu == 2']))) - self.assertRaises(db_exceptions.ClimateDBNotFound, + self.assertRaises(db_exceptions.BlazarDBNotFound, db_api.host_get_all_by_queries, ['apples < 2048']) def test_search_for_hosts_by_composed_queries(self): @@ -539,11 +539,11 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): self.assertEqual(0, len( db_api.host_get_all_by_queries(['memory_mb < 2048', 'cpu_info like %Westmere%']))) - self.assertRaises(db_exceptions.ClimateDBInvalidFilter, + self.assertRaises(db_exceptions.BlazarDBInvalidFilter, db_api.host_get_all_by_queries, ['memory_mb <']) - self.assertRaises(db_exceptions.ClimateDBNotFound, + self.assertRaises(db_exceptions.BlazarDBNotFound, db_api.host_get_all_by_queries, ['apples < 2048']) - self.assertRaises(db_exceptions.ClimateDBInvalidFilterOperator, + self.assertRaises(db_exceptions.BlazarDBInvalidFilterOperator, db_api.host_get_all_by_queries, ['memory_mb wrongop 2048']) self.assertEqual(1, len( @@ -572,7 +572,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): db_api.host_create(_get_fake_host_values(id=1)) db_api.host_destroy(1) self.assertEqual(None, db_api.host_get(1)) - self.assertRaises(db_exceptions.ClimateDBNotFound, + self.assertRaises(db_exceptions.BlazarDBNotFound, db_api.host_destroy, 2) def test_create_host_extra_capability(self): @@ -583,7 +583,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): def test_create_duplicated_host_extra_capability(self): db_api.host_extra_capability_create( _get_fake_host_extra_capabilities(id=1)) - self.assertRaises(db_exceptions.ClimateDBDuplicateEntry, + self.assertRaises(db_exceptions.BlazarDBDuplicateEntry, db_api.host_extra_capability_create, _get_fake_host_extra_capabilities(id='1')) @@ -613,7 +613,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): _get_fake_host_extra_capabilities(id='1')) db_api.host_extra_capability_destroy('1') self.assertEqual(None, db_api.host_extra_capability_get('1')) - self.assertRaises(db_exceptions.ClimateDBNotFound, + self.assertRaises(db_exceptions.BlazarDBNotFound, db_api.host_extra_capability_destroy, '1') def test_host_extra_capability_get_all_per_name(self): @@ -640,7 +640,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): _get_fake_host_allocation_values(id='1') ) - self.assertRaises(db_exceptions.ClimateDBDuplicateEntry, + self.assertRaises(db_exceptions.BlazarDBDuplicateEntry, db_api.host_allocation_create, _get_fake_host_allocation_values(id='1')) @@ -675,7 +675,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): host_allocation_id = _get_fake_random_uuid() self.assertIsNone(db_api.host_allocation_get(host_allocation_id)) - self.assertRaises(db_exceptions.ClimateDBNotFound, + self.assertRaises(db_exceptions.BlazarDBNotFound, db_api.host_allocation_destroy, host_allocation_id) @@ -706,7 +706,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): test_event = db_api.event_create(fake_values) self.assertTrue(test_event) - self.assertRaises(db_exceptions.ClimateDBDuplicateEntry, + self.assertRaises(db_exceptions.BlazarDBDuplicateEntry, db_api.event_create, fake_values) def test_event_update(self): @@ -731,7 +731,7 @@ class SQLAlchemyDBApiTestCase(tests.DBTestCase): def test_destroy_for_event_not_found(self): self.assertFalse(db_api.event_get('1')) - self.assertRaises(db_exceptions.ClimateDBNotFound, + self.assertRaises(db_exceptions.BlazarDBNotFound, db_api.event_destroy, '1') def test_event_get_first_sorted_by_event_type_filter(self): diff --git a/climate/tests/db/sqlalchemy/test_utils.py b/blazar/tests/db/sqlalchemy/test_utils.py similarity index 99% rename from climate/tests/db/sqlalchemy/test_utils.py rename to blazar/tests/db/sqlalchemy/test_utils.py index 716a6b67..e5a7622b 100644 --- a/climate/tests/db/sqlalchemy/test_utils.py +++ b/blazar/tests/db/sqlalchemy/test_utils.py @@ -19,9 +19,9 @@ import uuid from oslo_context import context -from climate.db.sqlalchemy import api as db_api -from climate.db.sqlalchemy import utils as db_utils -from climate import tests +from blazar.db.sqlalchemy import api as db_api +from blazar.db.sqlalchemy import utils as db_utils +from blazar import tests def _get_fake_random_uuid(): diff --git a/climate/tests/db/test_api.py b/blazar/tests/db/test_api.py similarity index 94% rename from climate/tests/db/test_api.py rename to blazar/tests/db/test_api.py index 1cb4bda7..63ed6558 100644 --- a/climate/tests/db/test_api.py +++ b/blazar/tests/db/test_api.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.db import api as db_api -from climate import tests +from blazar.db import api as db_api +from blazar import tests class DBApiTestCase(tests.TestCase): diff --git a/climate/tests/db/test_utils.py b/blazar/tests/db/test_utils.py similarity index 96% rename from climate/tests/db/test_utils.py rename to blazar/tests/db/test_utils.py index 33dc0770..b7848f76 100644 --- a/climate/tests/db/test_utils.py +++ b/blazar/tests/db/test_utils.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from climate import tests +from blazar import tests class DBUtilsTestCase(tests.TestCase): diff --git a/climate/tests/fake_lease.py b/blazar/tests/fake_lease.py similarity index 100% rename from climate/tests/fake_lease.py rename to blazar/tests/fake_lease.py diff --git a/climate/tests/fake_policy.py b/blazar/tests/fake_policy.py similarity index 60% rename from climate/tests/fake_policy.py rename to blazar/tests/fake_policy.py index c59ceeb6..b7b87386 100644 --- a/climate/tests/fake_policy.py +++ b/blazar/tests/fake_policy.py @@ -21,19 +21,19 @@ policy_data = """ "default": "!", "admin_api": "rule:admin", - "climate:leases": "rule:admin_or_owner", - "climate:oshosts": "rule:admin_api", + "blazar:leases": "rule:admin_or_owner", + "blazar:oshosts": "rule:admin_api", - "climate:leases:get": "rule:admin_or_owner", - "climate:leases:create": "rule:admin_or_owner", - "climate:leases:delete": "rule:admin_or_owner", - "climate:leases:update": "rule:admin_or_owner", + "blazar:leases:get": "rule:admin_or_owner", + "blazar:leases:create": "rule:admin_or_owner", + "blazar:leases:delete": "rule:admin_or_owner", + "blazar:leases:update": "rule:admin_or_owner", - "climate:plugins:get": "@", + "blazar:plugins:get": "@", - "climate:oshosts:get": "rule:admin_api", - "climate:oshosts:create": "rule:admin_api", - "climate:oshosts:delete": "rule:admin_api", - "climate:oshosts:update": "rule:admin_api" + "blazar:oshosts:get": "rule:admin_api", + "blazar:oshosts:create": "rule:admin_api", + "blazar:oshosts:delete": "rule:admin_api", + "blazar:oshosts:update": "rule:admin_api" } """ diff --git a/climate/tests/db/sqlalchemy/__init__.py b/blazar/tests/manager/__init__.py similarity index 100% rename from climate/tests/db/sqlalchemy/__init__.py rename to blazar/tests/manager/__init__.py diff --git a/climate/tests/manager/test_rpcapi.py b/blazar/tests/manager/test_rpcapi.py similarity index 96% rename from climate/tests/manager/test_rpcapi.py rename to blazar/tests/manager/test_rpcapi.py index 8e660c60..131c6712 100644 --- a/climate/tests/manager/test_rpcapi.py +++ b/blazar/tests/manager/test_rpcapi.py @@ -14,8 +14,8 @@ # limitations under the License. -from climate.manager import rpcapi -from climate import tests +from blazar.manager import rpcapi +from blazar import tests class RPCAPITestCase(tests.TestCase): diff --git a/climate/tests/manager/test_service.py b/blazar/tests/manager/test_service.py similarity index 97% rename from climate/tests/manager/test_service.py rename to blazar/tests/manager/test_service.py index 7a254e8e..05b6d9ca 100644 --- a/climate/tests/manager/test_service.py +++ b/blazar/tests/manager/test_service.py @@ -21,19 +21,19 @@ from oslo_config import cfg from stevedore import enabled import testtools -from climate import context -from climate.db import api as db_api -from climate.db import exceptions as db_ex -from climate import exceptions -from climate.manager import exceptions as manager_ex -from climate.manager import service -from climate.notification import api as notifier_api -from climate.plugins import base -from climate.plugins import dummy_vm_plugin -from climate.plugins.oshosts import host_plugin -from climate import tests -from climate.utils.openstack import base as base_utils -from climate.utils import trusts +from blazar import context +from blazar.db import api as db_api +from blazar.db import exceptions as db_ex +from blazar import exceptions +from blazar.manager import exceptions as manager_ex +from blazar.manager import service +from blazar.notification import api as notifier_api +from blazar.plugins import base +from blazar.plugins import dummy_vm_plugin +from blazar.plugins.oshosts import host_plugin +from blazar import tests +from blazar.utils.openstack import base as base_utils +from blazar.utils import trusts class FakeExtension(): @@ -114,7 +114,7 @@ class ServiceTestCase(tests.TestCase): self.good_date = datetime.datetime.strptime('2012-12-13 13:13', '%Y-%m-%d %H:%M') - self.ctx = self.patch(self.context, 'ClimateContext') + self.ctx = self.patch(self.context, 'BlazarContext') self.trust_ctx = self.patch(self.trusts, 'create_ctx_from_trust') self.trust_create = self.patch(self.trusts, 'create_trust') self.lease_get = self.patch(self.db_api, 'lease_get') @@ -542,7 +542,7 @@ class ServiceTestCase(tests.TestCase): 'trust_id': 'exxee111qwwwwe'} self.patch(self.db_api, - 'lease_create').side_effect = db_ex.ClimateDBDuplicateEntry + 'lease_create').side_effect = db_ex.BlazarDBDuplicateEntry self.assertRaises(manager_ex.LeaseNameAlreadyExists, self.manager.create_lease, lease_values) @@ -990,7 +990,7 @@ class ServiceTestCase(tests.TestCase): 'name': 'renamed', 'start_date': '2013-12-15 20:00' } - self.assertRaises(exceptions.ClimateException, + self.assertRaises(exceptions.BlazarException, self.manager.update_lease, self.lease_id, lease_values) @@ -1018,7 +1018,7 @@ class ServiceTestCase(tests.TestCase): 'datetime', mock.Mock(wraps=datetime.datetime)) as patched: patched.utcnow.return_value = target - self.assertRaises(exceptions.ClimateException, + self.assertRaises(exceptions.BlazarException, self.manager.update_lease, self.lease_id, lease_values) @@ -1113,13 +1113,13 @@ class ServiceTestCase(tests.TestCase): self.event_update.assert_called_once_with('1', {'status': 'DONE'}) def test_basic_action_raise_exception(self): - def raiseClimateException(resource_id): - raise exceptions.ClimateException(resource_id) + def raiseBlazarException(resource_id): + raise exceptions.BlazarException(resource_id) self.manager.resource_actions = ( {'virtual:instance': {'on_start': self.fake_plugin.on_start, - 'on_end': raiseClimateException}}) + 'on_end': raiseBlazarException}}) self.patch(self.manager, 'get_lease').return_value = self.lease @@ -1131,13 +1131,13 @@ class ServiceTestCase(tests.TestCase): self.event_update.assert_called_once_with('1', {'status': 'ERROR'}) def test_basic_action_raise_exception_no_reservation_status(self): - def raiseClimateException(resource_id): - raise exceptions.ClimateException(resource_id) + def raiseBlazarException(resource_id): + raise exceptions.BlazarException(resource_id) self.manager.resource_actions = ( {'virtual:instance': {'on_start': self.fake_plugin.on_start, - 'on_end': raiseClimateException}}) + 'on_end': raiseBlazarException}}) self.patch(self.manager, 'get_lease').return_value = self.lease diff --git a/climate/tests/manager/__init__.py b/blazar/tests/notification/__init__.py similarity index 100% rename from climate/tests/manager/__init__.py rename to blazar/tests/notification/__init__.py diff --git a/climate/tests/notification/test_notifier.py b/blazar/tests/notification/test_notifier.py similarity index 97% rename from climate/tests/notification/test_notifier.py rename to blazar/tests/notification/test_notifier.py index 1d412f18..bbcecf52 100644 --- a/climate/tests/notification/test_notifier.py +++ b/blazar/tests/notification/test_notifier.py @@ -16,8 +16,8 @@ from oslo_config import cfg import oslo_messaging as messaging -from climate.notification import notifier as notification -from climate import tests +from blazar.notification import notifier as notification +from blazar import tests CONF = cfg.CONF diff --git a/climate/tests/notification/__init__.py b/blazar/tests/plugins/__init__.py similarity index 100% rename from climate/tests/notification/__init__.py rename to blazar/tests/plugins/__init__.py diff --git a/climate/tests/plugins/__init__.py b/blazar/tests/plugins/instances/__init__.py similarity index 100% rename from climate/tests/plugins/__init__.py rename to blazar/tests/plugins/instances/__init__.py diff --git a/climate/tests/plugins/instances/test_vm_plugin.py b/blazar/tests/plugins/instances/test_vm_plugin.py similarity index 93% rename from climate/tests/plugins/instances/test_vm_plugin.py rename to blazar/tests/plugins/instances/test_vm_plugin.py index e38f81e5..f2b7bc62 100644 --- a/climate/tests/plugins/instances/test_vm_plugin.py +++ b/blazar/tests/plugins/instances/test_vm_plugin.py @@ -20,17 +20,17 @@ from novaclient import exceptions as nova_exceptions from oslo_log import log as logging import testtools -from climate import exceptions as climate_exceptions -from climate.plugins.instances import vm_plugin -from climate import tests -from climate.utils.openstack import nova +from blazar import exceptions as blazar_exceptions +from blazar.plugins.instances import vm_plugin +from blazar import tests +from blazar.utils.openstack import nova class VMPluginTestCase(tests.TestCase): def setUp(self): super(VMPluginTestCase, self).setUp() self.nova = nova - self.exc = climate_exceptions + self.exc = blazar_exceptions self.logging = logging self.sys = sys @@ -51,7 +51,7 @@ class VMPluginTestCase(tests.TestCase): @testtools.skip('Will be released later') def test_on_start_fail(self): def raise_exception(resource_id): - raise climate_exceptions.Conflict(409) + raise blazar_exceptions.Conflict(409) self.nova_wrapper.servers.unshelve.side_effect = raise_exception self.plugin.on_start(self.fake_id) diff --git a/climate/tests/plugins/instances/__init__.py b/blazar/tests/plugins/oshosts/__init__.py similarity index 100% rename from climate/tests/plugins/instances/__init__.py rename to blazar/tests/plugins/oshosts/__init__.py diff --git a/climate/tests/plugins/oshosts/test_nova_inventory.py b/blazar/tests/plugins/oshosts/test_nova_inventory.py similarity index 95% rename from climate/tests/plugins/oshosts/test_nova_inventory.py rename to blazar/tests/plugins/oshosts/test_nova_inventory.py index f92eb8d9..566a93a0 100644 --- a/climate/tests/plugins/oshosts/test_nova_inventory.py +++ b/blazar/tests/plugins/oshosts/test_nova_inventory.py @@ -16,11 +16,11 @@ from novaclient import exceptions as nova_exceptions from novaclient.v2 import hypervisors -from climate import context -from climate.manager import exceptions as manager_exceptions -from climate.plugins.oshosts import nova_inventory -from climate import tests -from climate.utils.openstack import base +from blazar import context +from blazar.manager import exceptions as manager_exceptions +from blazar.plugins.oshosts import nova_inventory +from blazar import tests +from blazar.utils.openstack import base class FakeNovaHypervisors(object): @@ -75,7 +75,7 @@ class NovaInventoryTestCase(tests.TestCase): def setUp(self): super(NovaInventoryTestCase, self).setUp() self.context = context - self.patch(self.context, 'ClimateContext') + self.patch(self.context, 'BlazarContext') self.nova_inventory = nova_inventory self.patch(base, 'url_for').return_value = 'http://foo.bar' self.inventory = self.nova_inventory.NovaInventory() diff --git a/climate/tests/plugins/oshosts/test_reservation_pool.py b/blazar/tests/plugins/oshosts/test_reservation_pool.py similarity index 95% rename from climate/tests/plugins/oshosts/test_reservation_pool.py rename to blazar/tests/plugins/oshosts/test_reservation_pool.py index 146e8eea..2e6761f2 100644 --- a/climate/tests/plugins/oshosts/test_reservation_pool.py +++ b/blazar/tests/plugins/oshosts/test_reservation_pool.py @@ -19,13 +19,13 @@ from novaclient import client as nova_client from novaclient import exceptions as nova_exceptions from oslo_config import cfg -from climate import context -from climate.manager import exceptions as manager_exceptions -from climate.plugins import oshosts as host_plugin -from climate.plugins.oshosts import reservation_pool as rp -from climate import tests -from climate.utils.openstack import base -from climate.utils.openstack import nova +from blazar import context +from blazar.manager import exceptions as manager_exceptions +from blazar.plugins import oshosts as host_plugin +from blazar.plugins.oshosts import reservation_pool as rp +from blazar import tests +from blazar.utils.openstack import base +from blazar.utils.openstack import nova class AggregateFake(object): @@ -48,14 +48,14 @@ class ReservationPoolTestCase(tests.TestCase): conf = cfg.CONF[host_plugin.RESOURCE_TYPE] self.freepool_name = conf.aggregate_freepool_name self.project_id_key = conf.project_id_key - self.climate_owner = conf.climate_owner - self.climate_az_prefix = conf.climate_az_prefix + self.blazar_owner = conf.blazar_owner + self.blazar_az_prefix = conf.blazar_az_prefix self.fake_freepool = AggregateFake(i=456, name=self.freepool_name, hosts=['host3']) - self.set_context(context.ClimateContext(project_id=self.project_id)) + self.set_context(context.BlazarContext(project_id=self.project_id)) self.nova_client = nova_client self.nova = self.patch(self.nova_client, 'Client').return_value @@ -112,11 +112,11 @@ class ReservationPoolTestCase(tests.TestCase): self.assertEqual(agg, self.fake_aggregate) - az_name = self.climate_az_prefix + self.pool_name + az_name = self.blazar_az_prefix + self.pool_name check0 = self.nova.aggregates.create check0.assert_called_once_with(self.pool_name, az_name) - meta = {self.climate_owner: self.project_id} + meta = {self.blazar_owner: self.project_id} check1 = self.nova.aggregates.set_metadata check1.assert_called_once_with(self.fake_aggregate, meta) diff --git a/climate/tests/plugins/test_physical_host_plugin.py b/blazar/tests/plugins/test_physical_host_plugin.py similarity index 97% rename from climate/tests/plugins/test_physical_host_plugin.py rename to blazar/tests/plugins/test_physical_host_plugin.py index 4d334191..54faab90 100644 --- a/climate/tests/plugins/test_physical_host_plugin.py +++ b/blazar/tests/plugins/test_physical_host_plugin.py @@ -20,19 +20,19 @@ import mock from novaclient import client as nova_client import testtools -from climate import context -from climate.db import api as db_api -from climate.db import exceptions as db_exceptions -from climate.db import utils as db_utils -from climate.manager import exceptions as manager_exceptions -from climate.manager import service -from climate.plugins import oshosts as plugin -from climate.plugins.oshosts import host_plugin -from climate.plugins.oshosts import nova_inventory -from climate.plugins.oshosts import reservation_pool as rp -from climate import tests -from climate.utils.openstack import base -from climate.utils import trusts +from blazar import context +from blazar.db import api as db_api +from blazar.db import exceptions as db_exceptions +from blazar.db import utils as db_utils +from blazar.manager import exceptions as manager_exceptions +from blazar.manager import service +from blazar.plugins import oshosts as plugin +from blazar.plugins.oshosts import host_plugin +from blazar.plugins.oshosts import nova_inventory +from blazar.plugins.oshosts import reservation_pool as rp +from blazar import tests +from blazar.utils.openstack import base +from blazar.utils import trusts class AggregateFake(object): @@ -48,7 +48,7 @@ class PhysicalHostPlugingSetupOnlyTestCase(tests.TestCase): def setUp(self): super(PhysicalHostPlugingSetupOnlyTestCase, self).setUp() self.context = context - self.patch(self.context, 'ClimateContext') + self.patch(self.context, 'BlazarContext') self.patch(base, 'url_for').return_value = 'http://foo.bar' self.host_plugin = host_plugin self.fake_phys_plugin = self.host_plugin.PhysicalHostPlugin() @@ -87,7 +87,7 @@ class PhysicalHostPluginTestCase(tests.TestCase): super(PhysicalHostPluginTestCase, self).setUp() self.context = context - self.patch(self.context, 'ClimateContext') + self.patch(self.context, 'BlazarContext') self.nova_client = nova_client self.nova = self.patch(self.nova_client, 'Client').return_value @@ -219,14 +219,14 @@ class PhysicalHostPluginTestCase(tests.TestCase): def test_create_host_issuing_rollback(self): def fake_db_host_create(*args, **kwargs): - raise db_exceptions.ClimateDBException + raise db_exceptions.BlazarDBException self.db_host_create.side_effect = fake_db_host_create host = self.fake_phys_plugin.create_computehost(self.fake_host) self.assertEqual(None, host) def test_create_host_having_issue_when_storing_extra_capability(self): def fake_db_host_extra_capability_create(*args, **kwargs): - raise db_exceptions.ClimateDBException + raise db_exceptions.BlazarDBException fake_host = self.fake_host.copy() fake_host.update({'foo': 'bar'}) fake_request = fake_host.copy() @@ -291,7 +291,7 @@ class PhysicalHostPluginTestCase(tests.TestCase): def test_delete_host_issuing_rollback(self): def fake_db_host_destroy(*args, **kwargs): - raise db_exceptions.ClimateDBException + raise db_exceptions.BlazarDBException self.db_host_destroy.side_effect = fake_db_host_destroy self.assertRaises(manager_exceptions.CantRemoveHost, self.fake_phys_plugin.delete_computehost, diff --git a/climate/tests/test_context.py b/blazar/tests/test_context.py similarity index 91% rename from climate/tests/test_context.py rename to blazar/tests/test_context.py index 1d88d8a3..a9254467 100644 --- a/climate/tests/test_context.py +++ b/blazar/tests/test_context.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate import context -from climate import tests +from blazar import context +from blazar import tests class TestContext(context.BaseContext): @@ -90,15 +90,15 @@ class TestContextManager(tests.TestCase): self.assertIs(self.context, TestContext.current()) -class TestClimateContext(tests.TestCase): +class TestBlazarContext(tests.TestCase): def test_elevated_empty(self): - ctx = context.ClimateContext.elevated() + ctx = context.BlazarContext.elevated() self.assertEqual(ctx.is_admin, True) def test_elevated(self): - with context.ClimateContext(user_id="user", project_id="project"): - ctx = context.ClimateContext.elevated() + with context.BlazarContext(user_id="user", project_id="project"): + ctx = context.BlazarContext.elevated() self.assertEqual(ctx.user_id, "user") self.assertEqual(ctx.project_id, "project") self.assertEqual(ctx.is_admin, True) diff --git a/climate/tests/test_exceptions.py b/blazar/tests/test_exceptions.py similarity index 70% rename from climate/tests/test_exceptions.py rename to blazar/tests/test_exceptions.py index 2ac8640f..87056dd9 100644 --- a/climate/tests/test_exceptions.py +++ b/blazar/tests/test_exceptions.py @@ -13,50 +13,50 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate import exceptions -from climate import tests +from blazar import exceptions +from blazar import tests -class ClimateExceptionTestCase(tests.TestCase): +class BlazarExceptionTestCase(tests.TestCase): def test_default_error_msg(self): - class FakeClimateException(exceptions.ClimateException): + class FakeBlazarException(exceptions.BlazarException): msg_fmt = "default message" - exc = FakeClimateException() + exc = FakeBlazarException() self.assertEqual(unicode(exc), 'default message') def test_error_msg(self): - self.assertEqual(unicode(exceptions.ClimateException('test')), + self.assertEqual(unicode(exceptions.BlazarException('test')), 'test') def test_default_error_msg_with_kwargs(self): - class FakeClimateException(exceptions.ClimateException): + class FakeBlazarException(exceptions.BlazarException): msg_fmt = "default message: %(code)s" - exc = FakeClimateException(code=500) + exc = FakeBlazarException(code=500) self.assertEqual(unicode(exc), 'default message: 500') self.assertEqual(exc.message, 'default message: 500') def test_error_msg_exception_with_kwargs(self): - class FakeClimateException(exceptions.ClimateException): + class FakeBlazarException(exceptions.BlazarException): msg_fmt = "default message: %(mispelled_code)s" - exc = FakeClimateException(code=500, mispelled_code='blah') + exc = FakeBlazarException(code=500, mispelled_code='blah') self.assertEqual(unicode(exc), 'default message: blah') self.assertEqual(exc.message, 'default message: blah') def test_default_error_code(self): - class FakeClimateException(exceptions.ClimateException): + class FakeBlazarException(exceptions.BlazarException): code = 404 - exc = FakeClimateException() + exc = FakeBlazarException() self.assertEqual(exc.kwargs['code'], 404) def test_error_code_from_kwarg(self): - class FakeClimateException(exceptions.ClimateException): + class FakeBlazarException(exceptions.BlazarException): code = 500 - exc = FakeClimateException(code=404) + exc = FakeBlazarException(code=404) self.assertEqual(exc.kwargs['code'], 404) def test_policynotauthorized_exception(self): diff --git a/climate/tests/test_policy.py b/blazar/tests/test_policy.py similarity index 82% rename from climate/tests/test_policy.py rename to blazar/tests/test_policy.py index 5f195247..680e7f89 100644 --- a/climate/tests/test_policy.py +++ b/blazar/tests/test_policy.py @@ -13,33 +13,33 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Test of Policy Engine For Climate.""" +"""Test of Policy Engine For Blazar.""" from oslo_config import cfg -from climate import context -from climate import exceptions -from climate import policy -from climate import tests +from blazar import context +from blazar import exceptions +from blazar import policy +from blazar import tests CONF = cfg.CONF -class ClimatePolicyTestCase(tests.TestCase): +class BlazarPolicyTestCase(tests.TestCase): def setUp(self): - super(ClimatePolicyTestCase, self).setUp() + super(BlazarPolicyTestCase, self).setUp() - self.context = context.ClimateContext(user_id='fake', - project_id='fake', - roles=['member']) + self.context = context.BlazarContext(user_id='fake', + project_id='fake', + roles=['member']) def test_standardpolicy(self): target_good = {'user_id': self.context.user_id, 'project_id': self.context.project_id} target_wrong = {'user_id': self.context.user_id, 'project_id': 'bad_project'} - action = "climate:leases" + action = "blazar:leases" self.assertEqual(True, policy.enforce(self.context, action, target_good)) self.assertEqual(False, policy.enforce(self.context, action, @@ -48,14 +48,14 @@ class ClimatePolicyTestCase(tests.TestCase): def test_adminpolicy(self): target = {'user_id': self.context.user_id, 'project_id': self.context.project_id} - action = "climate:oshosts" + action = "blazar:oshosts" self.assertRaises(exceptions.PolicyNotAuthorized, policy.enforce, self.context, action, target) def test_elevatedpolicy(self): target = {'user_id': self.context.user_id, 'project_id': self.context.project_id} - action = "climate:oshosts" + action = "blazar:oshosts" self.assertRaises(exceptions.PolicyNotAuthorized, policy.enforce, self.context, action, target) elevated_context = self.context.elevated() diff --git a/climate/tests/test_service.py b/blazar/tests/test_service.py similarity index 92% rename from climate/tests/test_service.py rename to blazar/tests/test_service.py index 86fa8f98..4a9dd714 100644 --- a/climate/tests/test_service.py +++ b/blazar/tests/test_service.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from climate import tests -from climate.utils import service +from blazar import tests +from blazar.utils import service class ServiceTestCase(tests.TestCase): diff --git a/climate/tests/test_states.py b/blazar/tests/test_states.py similarity index 95% rename from climate/tests/test_states.py rename to blazar/tests/test_states.py index 292f1f75..8b96035e 100644 --- a/climate/tests/test_states.py +++ b/blazar/tests/test_states.py @@ -15,12 +15,12 @@ """Test of States.""" -from climate.db import api as db_api -from climate.db import exceptions as db_exc -from climate.manager import exceptions as mgr_exc -from climate import states -from climate import tests -from climate.tests import fake_lease +from blazar.db import api as db_api +from blazar.db import exceptions as db_exc +from blazar.manager import exceptions as mgr_exc +from blazar import states +from blazar import tests +from blazar.tests import fake_lease class LeaseStateTestCase(tests.TestCase): @@ -115,7 +115,7 @@ class LeaseStateTestCase(tests.TestCase): def test_save_state_with_nonexisting_lease(self): def fake_lease_update_raise(id, values): - raise db_exc.ClimateDBException + raise db_exc.BlazarDBException self.lease_update.side_effect = fake_lease_update_raise self.leaseState = states.LeaseState(id=1, autosave=False) diff --git a/climate/tests/plugins/oshosts/__init__.py b/blazar/tests/utils/__init__.py similarity index 100% rename from climate/tests/plugins/oshosts/__init__.py rename to blazar/tests/utils/__init__.py diff --git a/climate/tests/utils/__init__.py b/blazar/tests/utils/openstack/__init__.py similarity index 100% rename from climate/tests/utils/__init__.py rename to blazar/tests/utils/openstack/__init__.py diff --git a/climate/tests/utils/openstack/test_base.py b/blazar/tests/utils/openstack/test_base.py similarity index 96% rename from climate/tests/utils/openstack/test_base.py rename to blazar/tests/utils/openstack/test_base.py index 3c8d35d8..05236efc 100644 --- a/climate/tests/utils/openstack/test_base.py +++ b/blazar/tests/utils/openstack/test_base.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.manager import exceptions -from climate import tests -from climate.utils.openstack import base +from blazar.manager import exceptions +from blazar import tests +from blazar.utils.openstack import base class TestBaseStackUtils(tests.TestCase): diff --git a/climate/tests/utils/openstack/test_keystone.py b/blazar/tests/utils/openstack/test_keystone.py similarity index 73% rename from climate/tests/utils/openstack/test_keystone.py rename to blazar/tests/utils/openstack/test_keystone.py index bfbd8e37..b6d80fcf 100644 --- a/climate/tests/utils/openstack/test_keystone.py +++ b/blazar/tests/utils/openstack/test_keystone.py @@ -15,10 +15,10 @@ from keystoneclient import client as keystone_client -from climate import context -from climate import tests -from climate.utils.openstack import base -from climate.utils.openstack import keystone +from blazar import context +from blazar import tests +from blazar.utils.openstack import base +from blazar.utils.openstack import keystone class TestCKClient(tests.TestCase): @@ -47,12 +47,12 @@ class TestCKClient(tests.TestCase): self.ctx.side_effect = RuntimeError - self.keystone.ClimateKeystoneClient(version=self.version, - username=self.username, - password=self.password, - tenant_name=self.tenant_name, - trust_id=self.trust_id, - auth_url=self.auth_url) + self.keystone.BlazarKeystoneClient(version=self.version, + username=self.username, + password=self.password, + tenant_name=self.tenant_name, + trust_id=self.trust_id, + auth_url=self.auth_url) self.client.assert_called_once_with(version=self.version, trust_id=self.trust_id, @@ -62,11 +62,11 @@ class TestCKClient(tests.TestCase): def test_client_from_kwargs_and_ctx(self): - self.keystone.ClimateKeystoneClient(version=self.version, - username=self.username, - password=self.password, - tenant_name=self.tenant_name, - auth_url=self.auth_url) + self.keystone.BlazarKeystoneClient(version=self.version, + username=self.username, + password=self.password, + tenant_name=self.tenant_name, + auth_url=self.auth_url) self.client.assert_called_once_with(version=self.version, tenant_name=self.tenant_name, @@ -77,7 +77,7 @@ class TestCKClient(tests.TestCase): def test_client_from_ctx(self): - self.keystone.ClimateKeystoneClient() + self.keystone.BlazarKeystoneClient() self.client.assert_called_once_with( version='3', diff --git a/climate/tests/utils/openstack/test_nova.py b/blazar/tests/utils/openstack/test_nova.py similarity index 91% rename from climate/tests/utils/openstack/test_nova.py rename to blazar/tests/utils/openstack/test_nova.py index 8470bc9c..f777f525 100644 --- a/climate/tests/utils/openstack/test_nova.py +++ b/blazar/tests/utils/openstack/test_nova.py @@ -17,10 +17,10 @@ from keystoneauth1 import session from keystoneauth1 import token_endpoint from novaclient import client as nova_client -from climate import context -from climate import tests -from climate.utils.openstack import base -from climate.utils.openstack import nova +from blazar import context +from blazar import tests +from blazar.utils.openstack import base +from blazar.utils.openstack import nova class TestCNClient(tests.TestCase): @@ -50,7 +50,7 @@ class TestCNClient(tests.TestCase): 'endpoint_override': self.endpoint, 'auth_token': self.auth_token} - self.nova.ClimateNovaClient(**kwargs) + self.nova.BlazarNovaClient(**kwargs) self.auth.assert_called_once_with(self.endpoint, self.auth_token) self.session.assert_called_once_with(auth=self.auth.return_value) @@ -61,7 +61,7 @@ class TestCNClient(tests.TestCase): def test_client_from_ctx(self): kwargs = {'version': self.version} - self.nova.ClimateNovaClient(**kwargs) + self.nova.BlazarNovaClient(**kwargs) self.auth.assert_called_once_with(self.url, self.ctx().auth_token) diff --git a/climate/tests/utils/test_trusts.py b/blazar/tests/utils/test_trusts.py similarity index 92% rename from climate/tests/utils/test_trusts.py rename to blazar/tests/utils/test_trusts.py index b35dcc09..3429a9e4 100644 --- a/climate/tests/utils/test_trusts.py +++ b/blazar/tests/utils/test_trusts.py @@ -15,11 +15,11 @@ import mock -from climate import context -from climate import tests -from climate.utils.openstack import base -from climate.utils.openstack import keystone -from climate.utils import trusts +from blazar import context +from blazar import tests +from blazar.utils.openstack import base +from blazar.utils.openstack import keystone +from blazar.utils import trusts class TestTrusts(tests.TestCase): @@ -30,7 +30,7 @@ class TestTrusts(tests.TestCase): self.context = context self.keystone = keystone - self.client = self.patch(self.keystone, 'ClimateKeystoneClient') + self.client = self.patch(self.keystone, 'BlazarKeystoneClient') self.patch(self.context, 'current') self.patch(self.base, 'url_for').return_value = 'http://www.foo.fake' diff --git a/climate/utils/__init__.py b/blazar/utils/__init__.py similarity index 100% rename from climate/utils/__init__.py rename to blazar/utils/__init__.py diff --git a/climate/tests/utils/openstack/__init__.py b/blazar/utils/openstack/__init__.py similarity index 100% rename from climate/tests/utils/openstack/__init__.py rename to blazar/utils/openstack/__init__.py diff --git a/climate/utils/openstack/base.py b/blazar/utils/openstack/base.py similarity index 97% rename from climate/utils/openstack/base.py rename to blazar/utils/openstack/base.py index a0bbc016..a83020a0 100644 --- a/climate/utils/openstack/base.py +++ b/blazar/utils/openstack/base.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climate.manager import exceptions +from blazar.manager import exceptions def url_for(service_catalog, service_type, admin=False, diff --git a/climate/utils/openstack/keystone.py b/blazar/utils/openstack/keystone.py similarity index 94% rename from climate/utils/openstack/keystone.py rename to blazar/utils/openstack/keystone.py index 2054ecbd..4329f023 100644 --- a/climate/utils/openstack/keystone.py +++ b/blazar/utils/openstack/keystone.py @@ -17,9 +17,9 @@ from keystoneclient import client as keystone_client from keystoneclient import exceptions as keystone_exception from oslo_config import cfg -from climate import context -from climate.manager import exceptions as manager_exceptions -from climate.utils.openstack import base +from blazar import context +from blazar.manager import exceptions as manager_exceptions +from blazar.utils.openstack import base opts = [ @@ -39,7 +39,7 @@ CONF.register_cli_opts(opts) CONF.register_opts(keystone_opts) -class ClimateKeystoneClient(object): +class BlazarKeystoneClient(object): def __init__(self, **kwargs): """Description @@ -62,7 +62,7 @@ class ClimateKeystoneClient(object): :param auth_url: auth_url :type auth_url: str - :param ctx: climate context object + :param ctx: blazar context object :type ctx: dict :param auth_url: keystone auth url diff --git a/climate/utils/openstack/nova.py b/blazar/utils/openstack/nova.py similarity index 93% rename from climate/utils/openstack/nova.py rename to blazar/utils/openstack/nova.py index b420cb91..292a5968 100644 --- a/climate/utils/openstack/nova.py +++ b/blazar/utils/openstack/nova.py @@ -20,8 +20,8 @@ from novaclient import exceptions as nova_exception from novaclient.v2 import servers from oslo_config import cfg -from climate import context -from climate.utils.openstack import base +from blazar import context +from blazar.utils.openstack import base nova_opts = [ @@ -38,10 +38,10 @@ nova_opts = [ CONF = cfg.CONF CONF.register_opts(nova_opts) -CONF.import_opt('identity_service', 'climate.utils.openstack.keystone') +CONF.import_opt('identity_service', 'blazar.utils.openstack.keystone') -class ClimateNovaClient(object): +class BlazarNovaClient(object): def __init__(self, **kwargs): """Description @@ -93,14 +93,14 @@ class ClimateNovaClient(object): # TODO(dbelova): remove these lines after novaclient 2.16.0 will be released -class ClimateServer(servers.Server): +class BlazarServer(servers.Server): def unshelve(self): """Unshelve -- Unshelve the server.""" self.manager.unshelve(self) class ServerManager(servers.ServerManager): - resource_class = ClimateServer + resource_class = BlazarServer def unshelve(self, server): """Unshelve the server.""" @@ -120,5 +120,5 @@ class NovaClientWrapper(object): @property def nova(self): ctx = context.current() - nova = ClimateNovaClient(ctx=ctx) + nova = BlazarNovaClient(ctx=ctx) return nova diff --git a/climate/utils/service.py b/blazar/utils/service.py similarity index 93% rename from climate/utils/service.py rename to blazar/utils/service.py index e5dc237a..f1e29c5f 100644 --- a/climate/utils/service.py +++ b/blazar/utils/service.py @@ -22,8 +22,8 @@ from oslo_log import log as logging import oslo_messaging as messaging from oslo_service import service -from climate import context -from climate.i18n import _ +from blazar import context +from blazar.i18n import _ LOG = logging.getLogger(__name__) @@ -73,7 +73,7 @@ class ContextEndpointHandler(object): method = getattr(self.__endpoint, name) def run_method(__ctx, **kwargs): - with context.ClimateContext(**__ctx): + with context.BlazarContext(**__ctx): return method(**kwargs) return run_method @@ -86,11 +86,11 @@ class ContextEndpointHandler(object): def with_empty_context(func): @functools.wraps(func) def decorator(*args, **kwargs): - with context.ClimateContext(): + with context.BlazarContext(): return func(*args, **kwargs) return decorator def prepare_service(argv=[]): - logging.setup(cfg.CONF, 'climate') + logging.setup(cfg.CONF, 'blazar') diff --git a/climate/utils/trusts.py b/blazar/utils/trusts.py similarity index 88% rename from climate/utils/trusts.py rename to blazar/utils/trusts.py index 6c789e3e..e31fe44f 100644 --- a/climate/utils/trusts.py +++ b/blazar/utils/trusts.py @@ -17,17 +17,17 @@ import functools from oslo_config import cfg -from climate import context -from climate.utils.openstack import keystone +from blazar import context +from blazar.utils.openstack import keystone CONF = cfg.CONF def create_trust(): """Creates trust via Keystone API v3 to use in plugins.""" - client = keystone.ClimateKeystoneClient() + client = keystone.BlazarKeystoneClient() - trustee_id = keystone.ClimateKeystoneClient( + trustee_id = keystone.BlazarKeystoneClient( username=CONF.os_admin_username, password=CONF.os_admin_password, tenant_name=CONF.os_admin_project_name).user_id @@ -44,20 +44,20 @@ def create_trust(): def delete_trust(lease): """Deletes trust for the specified lease.""" if lease.trust_id: - client = keystone.ClimateKeystoneClient(trust_id=lease.trust_id) + client = keystone.BlazarKeystoneClient(trust_id=lease.trust_id) client.trusts.delete(lease.trust_id) def create_ctx_from_trust(trust_id): """Return context built from given trust.""" - ctx = context.ClimateContext( + ctx = context.BlazarContext( user_name=CONF.os_admin_username, project_name=CONF.os_admin_project_name, ) auth_url = "%s://%s:%s/v3" % (CONF.os_auth_protocol, CONF.os_auth_host, CONF.os_auth_port) - client = keystone.ClimateKeystoneClient( + client = keystone.BlazarKeystoneClient( password=CONF.os_admin_password, trust_id=trust_id, auth_url=auth_url, @@ -65,7 +65,7 @@ def create_ctx_from_trust(trust_id): ) # use 'with ctx' statement in the place you need context from trust - return context.ClimateContext( + return context.BlazarContext( ctx, auth_token=client.auth_token, service_catalog=client.service_catalog.catalog['catalog'], diff --git a/climate/version.py b/blazar/version.py similarity index 92% rename from climate/version.py rename to blazar/version.py index 8a9f2245..127ef09e 100644 --- a/climate/version.py +++ b/blazar/version.py @@ -15,4 +15,4 @@ from pbr import version -version_info = version.VersionInfo('climate') +version_info = version.VersionInfo('blazar') diff --git a/climate/db/migration/alembic_migrations/versions/README b/climate/db/migration/alembic_migrations/versions/README deleted file mode 100644 index 0e05b409..00000000 --- a/climate/db/migration/alembic_migrations/versions/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains the migration scripts for the Climate project. Please -see the README in climate/db/migration on how to use and generate new -migrations. diff --git a/climate/opts.py b/climate/opts.py deleted file mode 100644 index 51b6de81..00000000 --- a/climate/opts.py +++ /dev/null @@ -1,56 +0,0 @@ -# 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. - -import itertools - -import climate.api.v2.app -import climate.api.v2.controllers -import climate.cmd.api -import climate.config -import climate.db.base -import climate.db.migration.cli -import climate.manager -import climate.manager.service -import climate.notification.notifier -import climate.plugins.instances.vm_plugin -import climate.plugins.oshosts.host_plugin -import climate.plugins.oshosts.reservation_pool -import climate.utils.openstack.keystone -import climate.utils.openstack.nova - - -def list_opts(): - return [ - ('DEFAULT', - itertools.chain( - climate.api.v2.app.auth_opts, - climate.cmd.api.api_opts, - climate.cmd.api.opts, - climate.config.cli_opts, - climate.config.os_opts, - climate.db.base.db_driver_opts, - climate.db.migration.cli.command_opts, - climate.utils.openstack.keystone.opts, - climate.utils.openstack.keystone.keystone_opts, - climate.utils.openstack.nova.nova_opts)), - ('api', climate.api.v2.controllers.api_opts), - ('manager', itertools.chain(climate.manager.opts, - climate.manager.service.manager_opts)), - ('notifications', climate.notification.notifier.notification_opts), - (climate.plugins.instances.RESOURCE_TYPE, - climate.plugins.instances.vm_plugin.plugin_opts), - (climate.plugins.oshosts.RESOURCE_TYPE, itertools.chain( - climate.plugins.oshosts.host_plugin.plugin_opts, - climate.plugins.oshosts.reservation_pool.OPTS)), - - ] diff --git a/climate/utils/openstack/__init__.py b/climate/utils/openstack/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/contrib/tempest/tempest/cli/climateclient.py b/contrib/tempest/tempest/cli/blazarclient.py similarity index 78% rename from contrib/tempest/tempest/cli/climateclient.py rename to contrib/tempest/tempest/cli/blazarclient.py index 4fb25def..5a89b682 100644 --- a/contrib/tempest/tempest/cli/climateclient.py +++ b/contrib/tempest/tempest/cli/blazarclient.py @@ -19,7 +19,7 @@ from tempest import cli class ClientTestBase(cli.ClientTestBase): - def climate(self, action, flags='', params='', admin=True, fail_ok=False): - """Executes climate command for the given action.""" + def blazar(self, action, flags='', params='', admin=True, fail_ok=False): + """Executes blazar command for the given action.""" return self.cmd_with_auth( - 'climate', action, flags, params, admin, fail_ok) + 'blazar', action, flags, params, admin, fail_ok) diff --git a/contrib/tempest/tempest/cli/simple_read_only/test_resource_reservation.py b/contrib/tempest/tempest/cli/simple_read_only/test_resource_reservation.py index 5c4434e6..bb7f09b0 100644 --- a/contrib/tempest/tempest/cli/simple_read_only/test_resource_reservation.py +++ b/contrib/tempest/tempest/cli/simple_read_only/test_resource_reservation.py @@ -13,33 +13,33 @@ # License for the specific language governing permissions and limitations # under the License. -from tempest.cli import climateclient +from tempest.cli import blazarclient from tempest import config_resource_reservation as config CONF = config.CONF -class SimpleReadOnlyClimateClientTest(climateclient.ClientTestBase): - """Basic, read-only tests for Climate CLI client. +class SimpleReadOnlyBlazarClientTest(blazarclient.ClientTestBase): + """Basic, read-only tests for Blazar CLI client. - Basic smoke test for the Climate CLI commands which do not require + Basic smoke test for the Blazar CLI commands which do not require creating or modifying leases. """ @classmethod def setUpClass(cls): - if (not CONF.service_available.climate): - msg = ("Skipping all Climate cli tests because it is " + if (not CONF.service_available.blazar): + msg = ("Skipping all Blazar cli tests because it is " "not available") raise cls.skipException(msg) - super(SimpleReadOnlyClimateClientTest, cls).setUpClass() + super(SimpleReadOnlyBlazarClientTest, cls).setUpClass() - def test_climate_lease_list(self): - self.climate('lease-list') + def test_blazar_lease_list(self): + self.blazar('lease-list') - def test_climate_host_list(self): - self.climate('host-list') + def test_blazar_host_list(self): + self.blazar('host-list') - def test_climate_version(self): - self.climate('', flags='--version') + def test_blazar_version(self): + self.blazar('', flags='--version') diff --git a/contrib/tempest/tempest/config_resource_reservation.py b/contrib/tempest/tempest/config_resource_reservation.py index b96cb2ad..83c88b0b 100644 --- a/contrib/tempest/tempest/config_resource_reservation.py +++ b/contrib/tempest/tempest/config_resource_reservation.py @@ -50,8 +50,8 @@ ResourceReservationGroup = [ ] -class TempestConfigPrivateClimate(config.TempestConfigPrivate): - """Climate's config wrap over standard config.""" +class TempestConfigPrivateBlazar(config.TempestConfigPrivate): + """Blazar's config wrap over standard config.""" def __init__(self, parse_conf=True): config.register_opt_group(cfg.CONF, service_available_group, @@ -61,14 +61,14 @@ class TempestConfigPrivateClimate(config.TempestConfigPrivate): self.resource_reservation = cfg.CONF.resource_reservation -class TempestClimateLazyConfig(object): +class TempestBlazarLazyConfig(object): _config = None def __getattr__(self, attr): if not self._config: - self._config = TempestConfigPrivateClimate() + self._config = TempestConfigPrivateBlazar() return getattr(self._config, attr) -CONF = TempestClimateLazyConfig() +CONF = TempestBlazarLazyConfig() diff --git a/contrib/tempest/tempest/scenario/resource_reservation_scenario.py b/contrib/tempest/tempest/scenario/resource_reservation_scenario.py index 0d78f144..99d2490d 100644 --- a/contrib/tempest/tempest/scenario/resource_reservation_scenario.py +++ b/contrib/tempest/tempest/scenario/resource_reservation_scenario.py @@ -35,7 +35,8 @@ class ResourceReservationScenarioTest(manager.ScenarioTest): @classmethod def setup_clients(cls): super(ResourceReservationScenarioTest, cls).setup_clients() - if not CONF.service_available.climate: + if not (CONF.service_available.climate or + CONF.service_available.blazar): raise cls.skipException("Resource reservation support is required") cred_provider = cls._get_credentials_provider() @@ -49,7 +50,7 @@ class ResourceReservationScenarioTest(manager.ScenarioTest): cls.admin_manager.resource_reservation_client) def get_lease_by_name(self, lease_name): - # the same as the climateclient does it: ask for the entire list + # the same as the blazarclient does it: ask for the entire list lease_list = self.reservation_client.list_lease() named_lease = [] diff --git a/contrib/tempest/tempest/scenario/test_instance_reservation.py b/contrib/tempest/tempest/scenario/test_instance_reservation.py index c8f7993b..07b4de07 100644 --- a/contrib/tempest/tempest/scenario/test_instance_reservation.py +++ b/contrib/tempest/tempest/scenario/test_instance_reservation.py @@ -29,7 +29,7 @@ CONF = config.CONF LOG = logging.getLogger(__name__) -# same as the one at climate/manager/service +# same as the one at blazar/manager/service LEASE_DATE_FORMAT = "%Y-%m-%d %H:%M" LEASE_MIN_DURATION = 2 # TODO(cmart): LEASE_IMAGE_PREFIX should be extracted from CONF @@ -44,7 +44,7 @@ class TestInstanceReservationScenario(rrs.ResourceReservationScenarioTest): 1) Create an instance with the hint parameters 2) check vm was shelved 3) check vm became active - 4) check that a new lease is created on climate + 4) check that a new lease is created on blazar 5) check its param 6) wait lease end 7) make sure VM was snapshoted and removed @@ -137,7 +137,7 @@ class TestInstanceReservationScenario(rrs.ResourceReservationScenarioTest): server = self.servers_client.show_server(self.server_id)['server'] self.assertEqual(expected_status, server['status']) - # TODO(cmart): add climate to services after pushing this code into tempest + # TODO(cmart): add blazar to services after pushing this code into tempest @decorators.skip_because('Instance reservation is not supported yet.', bug='1659200') @test.attr(type='slow') diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 18b68b22..adc5bdba 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -94,7 +94,7 @@ function configure_blazar { recreate_database blazar utf8 # Run Blazar db migrations - $BLAZAR_BIN_DIR/climate-db-manage --config-file $BLAZAR_CONF_FILE upgrade head + $BLAZAR_BIN_DIR/blazar-db-manage --config-file $BLAZAR_CONF_FILE upgrade head } # create_blazar_aggregate_freepool() - Create a Nova aggregate to use as freepool (for host reservation) @@ -149,8 +149,8 @@ function install_blazar { # start_blazar() - Start running processes, including screen function start_blazar { - screen_it blazar-a "cd $BLAZAR_DIR && $BLAZAR_BIN_DIR/climate-api --debug --config-file $BLAZAR_CONF_FILE" - screen_it blazar-m "cd $BLAZAR_DIR && $BLAZAR_BIN_DIR/climate-manager --debug --config-file $BLAZAR_CONF_FILE" + screen_it blazar-a "cd $BLAZAR_DIR && $BLAZAR_BIN_DIR/blazar-api --debug --config-file $BLAZAR_CONF_FILE" + screen_it blazar-m "cd $BLAZAR_DIR && $BLAZAR_BIN_DIR/blazar-manager --debug --config-file $BLAZAR_CONF_FILE" } @@ -162,7 +162,7 @@ function stop_blazar { done # Hack to be sure that the manager is really stop - BLAZAR_MANGER_PID=$(ps aux | grep climate-manager | grep -v grep \ + BLAZAR_MANGER_PID=$(ps aux | grep blazar-manager | grep -v grep \ | awk '{print $2}') [ ! -z "$BLAZAR_MANGER_PID" ] && sudo kill -9 $BLAZAR_MANGER_PID } diff --git a/devstack/settings b/devstack/settings index a53528a0..1fc0d00f 100644 --- a/devstack/settings +++ b/devstack/settings @@ -22,7 +22,7 @@ BLAZARNOVA_BRANCH=${BLAZARNOVA_BRANCH:-master} # Set up default directories BLAZAR_DIR=$DEST/blazar BLAZAR_CONF_DIR=${BLAZAR_CONF_DIR:-/etc/blazar} -BLAZAR_CONF_FILE=$BLAZAR_CONF_DIR/climate.conf +BLAZAR_CONF_FILE=$BLAZAR_CONF_DIR/blazar.conf BLAZARCLIENT_DIR=$DEST/python-blazarclient BLAZARNOVA_DIR=$DEST/blazar-nova diff --git a/doc/source/conf.py b/doc/source/conf.py index 9622aa6b..87b37800 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -59,10 +59,10 @@ copyright = u'2013, Mirantis Inc.;2014, Bull.' # built documents. # # Version info -from climate.version import version_info as climate_version -release = climate_version.release_string() +from blazar.version import version_info as blazar_version +release = blazar_version.release_string() # The short X.Y version. -version = climate_version.version_string() +version = blazar_version.version_string() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/source/restapi/rest_api_v2.rst b/doc/source/restapi/rest_api_v2.rst index 70f0cc19..22c5e616 100644 --- a/doc/source/restapi/rest_api_v2.rst +++ b/doc/source/restapi/rest_api_v2.rst @@ -35,10 +35,10 @@ Lease is the main abstraction for the user in the Blazar case. Lease means some kind of contract where start time, end time and resources to be reserved are mentioned. -.. rest-controller:: climate.api.v2.controllers.extensions.lease:LeasesController +.. rest-controller:: blazar.api.v2.controllers.extensions.lease:LeasesController :webprefix: /v2/leases -.. autotype:: climate.api.v2.controllers.extensions.lease.Lease +.. autotype:: blazar.api.v2.controllers.extensions.lease.Lease :members: @@ -50,8 +50,8 @@ are mentioned. Host is the abstraction for a computehost in the Blazar case. Host means a specific type of resource to be allocated. -.. rest-controller:: climate.api.v2.controllers.extensions.host:HostsController +.. rest-controller:: blazar.api.v2.controllers.extensions.host:HostsController :webprefix: /v2/os-hosts -.. autotype:: climate.api.v2.controllers.extensions.host.Host +.. autotype:: blazar.api.v2.controllers.extensions.host.Host :members: diff --git a/doc/source/userdoc/installation.guide.rst b/doc/source/userdoc/installation.guide.rst index 9b807c78..ab3474cf 100644 --- a/doc/source/userdoc/installation.guide.rst +++ b/doc/source/userdoc/installation.guide.rst @@ -50,7 +50,7 @@ This section includes instructions for Blazar installation using DevStack. .. sourcecode:: console - climate host-create hostname + blazar host-create hostname .. @@ -85,13 +85,13 @@ or .. -Next you need to configure Blazar and Nova. Define */etc/climate/climate.conf* +Next you need to configure Blazar and Nova. Define */etc/blazar/blazar.conf* file using the following example: .. sourcecode:: console [DEFAULT] - host= + host= os_auth_host= os_auth_port= @@ -110,20 +110,20 @@ file using the following example: [physical:host] on_start=on_start on_end=on_end - climate_username= - climate_password= - climate_project_name= + blazar_username= + blazar_password= + blazar_project_name= .. -Here *os_admin_** flags refer to Blazar service user. *climate_** ones - to +Here *os_admin_** flags refer to Blazar service user. *blazar_** ones - to admin user created specially to work with physical reservations. If you have no these users, create them via Keystone: .. sourcecode:: console - keystone user-create --name=climate --pass= --tenant_id= --email=climate@example.com - keystone user-role-add --tenant-id --user-id --role-id + keystone user-create --name=blazar --pass= --tenant_id= --email=blazar@example.com + keystone user-role-add --tenant-id --user-id --role-id .. @@ -158,8 +158,8 @@ endpoints: .. sourcecode:: console - keystone service-create --name climate --type reservation --description “OpenStack reservation service.” - keystone endpoint-create --region --service climate --publicurl "://:1234/v1" --adminurl "://:1234/v1" + keystone service-create --name blazar --type reservation --description “OpenStack reservation service.” + keystone endpoint-create --region --service blazar --publicurl "://:1234/v1" --adminurl "://:1234/v1" .. @@ -167,8 +167,8 @@ To start Blazar services use: .. sourcecode:: console - climate-api - climate-manager + blazar-api + blazar-manager .. diff --git a/etc/blazar/README-blazar.conf.txt b/etc/blazar/README-blazar.conf.txt new file mode 100644 index 00000000..b7d52e91 --- /dev/null +++ b/etc/blazar/README-blazar.conf.txt @@ -0,0 +1,4 @@ +To generate the sample blazar.conf file, run the following command from the top +level of the blazar directory: + + $ tox -egenconfig diff --git a/etc/climate/climate-config-generator.conf b/etc/blazar/blazar-config-generator.conf similarity index 80% rename from etc/climate/climate-config-generator.conf rename to etc/blazar/blazar-config-generator.conf index a560a30b..ac7c2d14 100644 --- a/etc/climate/climate-config-generator.conf +++ b/etc/blazar/blazar-config-generator.conf @@ -1,7 +1,7 @@ [DEFAULT] -output_file = etc/climate/climate.conf.sample +output_file = etc/blazar/blazar.conf.sample wrap_width = 80 -namespace = climate +namespace = blazar namespace = oslo.concurrency namespace = oslo.db namespace = oslo.log diff --git a/etc/climate/README-climate.conf.txt b/etc/climate/README-climate.conf.txt deleted file mode 100644 index b1c5a4bb..00000000 --- a/etc/climate/README-climate.conf.txt +++ /dev/null @@ -1,4 +0,0 @@ -To generate the sample climate.conf file, run the following command from the top -level of the blazar directory: - - $ tox -egenconfig diff --git a/etc/policy.json b/etc/policy.json index 20ae280b..251a6c8b 100644 --- a/etc/policy.json +++ b/etc/policy.json @@ -6,15 +6,15 @@ "default": "!", "admin_api": "rule:admin", - "climate:leases:get": "rule:admin_or_owner", - "climate:leases:create": "rule:admin_or_owner", - "climate:leases:delete": "rule:admin_or_owner", - "climate:leases:update": "rule:admin_or_owner", + "blazar:leases:get": "rule:admin_or_owner", + "blazar:leases:create": "rule:admin_or_owner", + "blazar:leases:delete": "rule:admin_or_owner", + "blazar:leases:update": "rule:admin_or_owner", - "climate:plugins:get": "@", + "blazar:plugins:get": "@", - "climate:oshosts:get": "rule:admin_or_owner", - "climate:oshosts:create": "rule:admin_api", - "climate:oshosts:delete": "rule:admin_api", - "climate:oshosts:update": "rule:admin_api" + "blazar:oshosts:get": "rule:admin_or_owner", + "blazar:oshosts:create": "rule:admin_api", + "blazar:oshosts:delete": "rule:admin_api", + "blazar:oshosts:update": "rule:admin_api" } diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 5299552f..4e92452e 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -60,7 +60,7 @@ copyright = u'2017, Blazar developers' # |version| and |release|, also used in various other places throughout the # built documents. # -from climate.version import version_info as blazar_version +from blazar.version import version_info as blazar_version # The short X.Y version. version = blazar_version.canonical_version_string() # The full version, including alpha/beta/rc tags. diff --git a/setup.cfg b/setup.cfg index 5e75ff66..0f4d08b1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,32 +23,37 @@ setup-hooks = pbr.hooks.setup_hook [files] packages = - climate + blazar [entry_points] console_scripts = - # Remove this alias when the rename to blazar is complete - climate-db-manage=climate.db.migration.cli:main - climate-api=climate.cmd.api:main - climate-rpc-zmq-receiver=climate.cmd.rpc_zmq_receiver:main - climate-manager=climate.cmd.manager:main + # Remove this alias when the deprecation period of "climate" is over + climate-db-manage=blazar.db.migration.cli:main + climate-api=blazar.cmd.api:main + climate-rpc-zmq-receiver=blazar.cmd.rpc_zmq_receiver:main + climate-manager=blazar.cmd.manager:main - blazar-db-manage=climate.db.migration.cli:main - blazar-api=climate.cmd.api:main - blazar-rpc-zmq-receiver=climate.cmd.rpc_zmq_receiver:main - blazar-manager=climate.cmd.manager:main + blazar-db-manage=blazar.db.migration.cli:main + blazar-api=blazar.cmd.api:main + blazar-rpc-zmq-receiver=blazar.cmd.rpc_zmq_receiver:main + blazar-manager=blazar.cmd.manager:main -climate.resource.plugins = - dummy.vm.plugin=climate.plugins.dummy_vm_plugin:DummyVMPlugin - physical.host.plugin=climate.plugins.oshosts.host_plugin:PhysicalHostPlugin - basic.vm.plugin=climate.plugins.instances.vm_plugin:VMPlugin +blazar.resource.plugins = + dummy.vm.plugin=blazar.plugins.dummy_vm_plugin:DummyVMPlugin + physical.host.plugin=blazar.plugins.oshosts.host_plugin:PhysicalHostPlugin + basic.vm.plugin=blazar.plugins.instances.vm_plugin:VMPlugin +# Remove this alias when the deprecation period of "climate" is over climate.api.v2.controllers.extensions = - oshosts=climate.api.v2.controllers.extensions.host:HostsController - leases=climate.api.v2.controllers.extensions.lease:LeasesController + oshosts=blazar.api.v2.controllers.extensions.host:HostsController + leases=blazar.api.v2.controllers.extensions.lease:LeasesController + +blazar.api.v2.controllers.extensions = + oshosts=blazar.api.v2.controllers.extensions.host:HostsController + leases=blazar.api.v2.controllers.extensions.lease:LeasesController oslo.config.opts = - climate = climate.opts:list_opts + blazar = blazar.opts:list_opts [build_sphinx] all_files = 1 @@ -58,4 +63,4 @@ source-dir = doc/source [extract_messages] keywords = _ mapping_file = babel.cfg -output_file = climate/locale/climate.pot +output_file = blazar/locale/blazar.pot diff --git a/tox.ini b/tox.ini index 3e209cbd..30d4bd17 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstac deps = -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt setenv = VIRTUAL_ENV={envdir} - DISCOVER_DIRECTORY=climate/tests + DISCOVER_DIRECTORY=blazar/tests PYTHONHASHSEED=0 commands = lockutils-wrapper python setup.py testr --slowest --testr-args="{posargs}" @@ -35,7 +35,7 @@ commands = python setup.py build_sphinx [testenv:genconfig] -commands = oslo-config-generator --config-file=etc/climate/climate-config-generator.conf +commands = oslo-config-generator --config-file=etc/blazar/blazar-config-generator.conf [flake8] show-source = true @@ -44,7 +44,7 @@ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools ignore=H105,H238,E123 [testenv:pylint] -commands = pylint climate +commands = pylint blazar [testenv:releasenotes] commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html