diff --git a/.coveragerc b/.coveragerc index c140d635..0851b38c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,7 +1,7 @@ [run] branch = True -source = smaug -omit = smaug/tests/*,smaug/openstack/* +source = karbor +omit = karbor/tests/*,karbor/openstack/* [report] ignore_errors = True diff --git a/.gitreview b/.gitreview index e76be7f2..77115de8 100644 --- a/.gitreview +++ b/.gitreview @@ -1,4 +1,4 @@ [gerrit] host=review.openstack.org port=29418 -project=openstack/smaug.git +project=openstack/karbor.git diff --git a/.testr.conf b/.testr.conf index f35259d1..d450ca44 100644 --- a/.testr.conf +++ b/.testr.conf @@ -2,6 +2,6 @@ test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./smaug/tests/unit} $LISTOPT $IDOPTION + ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./karbor/tests/unit} $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index d66e81cc..a9541c11 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -14,4 +14,4 @@ Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad, not GitHub: - https://bugs.launchpad.net/smaug + https://bugs.launchpad.net/karbor diff --git a/HACKING.rst b/HACKING.rst index d0c09a32..f429c255 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -1,4 +1,4 @@ -smaug Style Commandments +karbor Style Commandments =============================================== Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ diff --git a/MANIFEST.in b/MANIFEST.in index 67964f97..0389b6af 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ include AUTHORS include ChangeLog -recursive-include smaug *.cfg +recursive-include karbor *.cfg exclude .gitignore exclude .gitreview diff --git a/README.rst b/README.rst index 286badc1..8c78d7f3 100644 --- a/README.rst +++ b/README.rst @@ -1,11 +1,11 @@ ===== -Smaug +Karbor ===== Application Data Protection as a Service for OpenStack -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/Smaug.png - :alt: Smaug +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/Karbor.png + :alt: Karbor :width: 300 :height: 525 :align: center @@ -45,12 +45,12 @@ Links ***** * Free software: Apache license -* Documentation: http://docs.openstack.org/developer/smaug -* Source: http://git.openstack.org/cgit/openstack/smaug -* Bugs: http://bugs.launchpad.net/smaug +* Documentation: http://docs.openstack.org/developer/karbor +* Source: http://git.openstack.org/cgit/openstack/karbor +* Bugs: http://bugs.launchpad.net/karbor -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/SmaugInPieces.png - :alt: Smaug +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/KarborInPieces.png + :alt: Karbor :width: 200 :height: 525 :align: center diff --git a/doc/images/Smaug.png b/doc/images/Karbor.png similarity index 100% rename from doc/images/Smaug.png rename to doc/images/Karbor.png diff --git a/doc/images/SmaugInPieces.png b/doc/images/KarborInPieces.png similarity index 100% rename from doc/images/SmaugInPieces.png rename to doc/images/KarborInPieces.png diff --git a/doc/images/available_protectables.svg b/doc/images/available_protectables.svg index 6575080a..aa34d47b 100644 --- a/doc/images/available_protectables.svg +++ b/doc/images/available_protectables.svg @@ -9,10 +9,10 @@ - Smaug Protectables + Karbor Protectables This file contains the dependecy between protectables in the default - distribution of Smaug. The arrows, similar to inheritance point to the parent + distribution of Karbor. The arrows, similar to inheritance point to the parent since Protectables define what types they depend on so this reflects who is responsible for the connection. diff --git a/doc/images/class_diagram.svg b/doc/images/class_diagram.svg index a31c067f..4b426d0a 100644 --- a/doc/images/class_diagram.svg +++ b/doc/images/class_diagram.svg @@ -9,7 +9,7 @@ - "Smaug API model" + "Karbor API model" ; * buffer: ```json { - "smaug_version": "1.0.0", + "karbor_version": "1.0.0", "status": "in_progress", "plugins": {} } @@ -92,7 +92,7 @@ Create new Checkpoint with id ; * buffer: ```json { - "smaug_version": "1.0.0", + "karbor_version": "1.0.0", "status": "creating_indices", "plugins": {} } @@ -120,7 +120,7 @@ Create new Checkpoint with id ; * buffer: ```json { - "smaug_version": "1.0.0", + "karbor_version": "1.0.0", "status": "deleting", "plugins": {} } @@ -131,7 +131,7 @@ or returned by the provider. ## GC When deleting a checkpoint the checkpoint is only marked as deleted. On of the -Smaug server will have to run a GC collection run and make sure all the actual +Karbor server will have to run a GC collection run and make sure all the actual data is free. This is done to unify all the cleanup to one flow and make sure the deletion has been propagated to all sites before actually deleting the data. diff --git a/doc/source/api/class_diagram.pu b/doc/source/api/class_diagram.pu index d548f58c..ceffc7db 100644 --- a/doc/source/api/class_diagram.pu +++ b/doc/source/api/class_diagram.pu @@ -1,6 +1,6 @@ @startuml -title "Smaug API model" +title "Karbor API model" class Protectable { name: string diff --git a/doc/source/api/smaug_api.v1.yaml b/doc/source/api/karbor_api.v1.yaml similarity index 99% rename from doc/source/api/smaug_api.v1.yaml rename to doc/source/api/karbor_api.v1.yaml index f328114a..fdf29b0c 100644 --- a/doc/source/api/smaug_api.v1.yaml +++ b/doc/source/api/karbor_api.v1.yaml @@ -1,9 +1,9 @@ swagger: '2.0' info: - title: Smaug API + title: Karbor API description: Protect all you hold dear version: 0.99.0 -host: api.smaug.nowhere.com +host: api.karbor.nowhere.com schemes: - https basePath: /v1 @@ -729,7 +729,7 @@ paths: get: summary: Operation log entry point. description: | - Get the information about operation instances in smaug. + Get the information about operation instances in karbor. Whenever an operation is run a log instance is created. The user never creates operation logs. This should not include the 'entires' property for the operation log. diff --git a/doc/source/conf.py b/doc/source/conf.py index 2c29bfdf..aa14b233 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -38,7 +38,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'smaug' +project = u'karbor' copyright = u'2013, OpenStack Foundation' # If true, '()' will be appended to :func: etc. cross-reference text. diff --git a/doc/source/index.rst b/doc/source/index.rst index 5a134cf7..0391d5d7 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,10 +1,10 @@ ================================== -Smaug: Application Data Protection +Karbor: Application Data Protection ================================== Introduction ============ -Smaug is an OpenStack project that provides a pluggable framework for +Karbor is an OpenStack project that provides a pluggable framework for protecting and restoring Data and Metadata that comprises an OpenStack-deployed application - Application Data Protection as a Service. @@ -15,7 +15,7 @@ Application against loss/damage (e.g. backup, replication) by providing a standard framework of APIs and services that allows vendors to provide plugins through a unified interface -Using Smaug +Using Karbor =========== .. toctree:: :maxdepth: 1 @@ -26,7 +26,7 @@ Using Smaug contributing releasenotes -Smaug Specs +Karbor Specs =========== .. toctree:: :maxdepth: 1 diff --git a/doc/source/installation.rst b/doc/source/installation.rst index 4de29943..ee8fc80a 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -4,18 +4,18 @@ Installation Single-node Devstack Installation ================================= -In order to install Smaug using Devstack on a single node, add the following to +In order to install Karbor using Devstack on a single node, add the following to your local.conf, under [[local|localrc]]: .. code-block:: none - enable_plugin smaug http://git.openstack.org/openstack/smaug master - enable_plugin smaug-dashboard http://git.openstack.org/openstack/smaug-dashboard master - enable_service smaug-api - enable_service smaug-operationengine - enable_service smaug-protection - # Smaug Dashboard depends on Horizon - enable_service smaug-dashboard + enable_plugin karbor http://git.openstack.org/openstack/karbor master + enable_plugin karbor-dashboard http://git.openstack.org/openstack/karbor-dashboard master + enable_service karbor-api + enable_service karbor-operationengine + enable_service karbor-protection + # Karbor Dashboard depends on Horizon + enable_service karbor-dashboard Depenencies =========== diff --git a/doc/source/readme.rst b/doc/source/readme.rst index 079428f9..bfa47cbc 100644 --- a/doc/source/readme.rst +++ b/doc/source/readme.rst @@ -5,15 +5,15 @@ Introduction .. contents:: :depth: 2 -What is Smaug? +What is Karbor? ============== -Smaug is an OpenStack project that provides a pluggable framework for +Karbor is an OpenStack project that provides a pluggable framework for protecting and restoring Data and Metadata that comprises an OpenStack-deployed application - Application Data Protection as a Service. -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/Smaug.png - :alt: Smaug +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/Karbor.png + :alt: Karbor :align: center :height: 150px @@ -33,7 +33,7 @@ Typical Use Case: 3-Tier Cloud App 3-Tier Cloud App Web/App/DB -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/3-tirApp.png +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/3-tirApp.png :alt: 3-Tier Cloud App :width: 600 :align: center @@ -42,13 +42,13 @@ In order to provide full Protection for this typical use case, we would have to protect many resources, which have some dependency between them. The following diagram demonstrates how this dependency looks, in the form of a tree: -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/resource_tree_architecture.png +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/resource_tree_architecture.png :alt: Resource Tree :width: 600 :align: center These resources can be divided into groups, each of which will be handled by a -different plugin in Smaug: +different plugin in Karbor: - Volume - VM @@ -62,7 +62,7 @@ Main Concepts Protection Providers ----------------------- -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/ +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/ protection_provider.png :width: 600 @@ -77,7 +77,7 @@ each protection provider exposes what options it provides for each protectable. This allows the UI to dynamically adapt to each provider and show the user what options are available, what they mean and what values are supported. -This allows us to extend the providers without updates to Smaug and allow +This allows us to extend the providers without updates to Karbor and allow provider implementation to easily add specialize options. Example @@ -112,12 +112,12 @@ provider. There are two main aspect to protection plan. The first is the continuous aspect. When a plans is started it becomes enabled and continues protection processes are started and monitored (eg. replication). As long as the plan is -active Smaug will try and make sure the continuous aspects are active and valid. +active Karbor will try and make sure the continuous aspects are active and valid. -The other aspect is point in time protection or, as we call them in Smaug, +The other aspect is point in time protection or, as we call them in Karbor, checkpoints. Checkpoints are saved in the protection provider paired with the plan and, as stated, represent a restorable point in time for the plan. When a -checkpoint is created Smaug will store in the protection provider all the +checkpoint is created Karbor will store in the protection provider all the information required to successfully restore the project covered by the plan to how it was at that specific point in time. @@ -139,16 +139,16 @@ complex retention plan to automate the creation and deletion of checkpoints. Protectables ------------ -Protectabes are any class or type of entity that can be protected by Smaug. -Since setups might have different entities they would like to protect Smaug +Protectabes are any class or type of entity that can be protected by Karbor. +Since setups might have different entities they would like to protect Karbor doesn't bind the API to specific entity types. The admin can even add new protectables during set up as long as the protection provider can handle those -entities. This flexibility means that Smaug is agnostic to the relationship +entities. This flexibility means that Karbor is agnostic to the relationship between the resources being backed up. High Level Architecture ======================= -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/ +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/ high_level_architecture.png :alt: Solution Overview :width: 600 @@ -157,15 +157,15 @@ High Level Architecture The system is built from independent services and a scalable *Workflow engine* that ties them together: -Smaug API Service +Karbor API Service ================= -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/ - smaug-api.png +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/ + karbor-api.png :width: 600 These top-level north-bound APIs expose Application Data Protection services to -the Smaug user. +the Karbor user. The purpose of the services is to maximize flexibility and accommodate for (hopefully) any kind of protection for any type of resource, whether it is a @@ -177,21 +177,21 @@ a hardware device, an external database, etc.). Resource (Protectable) API --------------------------- -Enables the Smaug user to access information about which resource types are -protectable (i.e. can be protected by Smaug). In addition, enables the user to +Enables the Karbor user to access information about which resource types are +protectable (i.e. can be protected by Karbor). In addition, enables the user to get additional information on each resource type, such as a list of actual instances and their dependencies. Provider API --------------- -Enables the Smaug user to list available providers and get parameters and +Enables the Karbor user to list available providers and get parameters and result schema super-set for all plugins of a specific Provider. Plan API -------- -This API enables the Smaug user to access the protection Plan registry and do +This API enables the Karbor user to access the protection Plan registry and do the following operations: - Plan CRUD. @@ -201,7 +201,7 @@ the following operations: Automatic Operation API -------------------------- -This API enables the Smaug user to manage protection Operations: +This API enables the Karbor user to manage protection Operations: - Create a checkpoint for a given Protection Plan. - Delete unneeded checkpoints from the provider. @@ -210,7 +210,7 @@ This API enables the Smaug user to manage protection Operations: Checkpoint API --------------- -This API enables the Smaug user to access and manage the checkpoints stored in +This API enables the Karbor user to access and manage the checkpoints stored in the protection provider: - List all checkpoints given a Bank ID. @@ -221,11 +221,11 @@ the protection provider: Restore API --------------- -This API enables the Smaug user restore a checkpoint on to a restore target: +This API enables the Karbor user restore a checkpoint on to a restore target: - Create restored system from a checkpoint. -Smaug Schedule Service +Karbor Schedule Service ====================== This subsystem is responsible for scheduling and orchestrating the execution of @@ -256,7 +256,7 @@ triggers to begin the execution of the Plan Orchestration. It can be done based on a Timer or an Event Collector - Open to implementation. -In the first version of Smaug reference implementation, it will only provide +In the first version of Karbor reference implementation, it will only provide time-based triggering. Scheduled Operation @@ -265,7 +265,7 @@ Scheduled Operation The sub-component of the Schedule Service is responsible for holding the mapping between a Trigger and Operation(s). -Smaug Protection Service +Karbor Protection Service ======================== This subsystem is responsible for handling the following tasks: @@ -282,20 +282,20 @@ flow of the plan across all protection providers. Communication and Meetings ========================== -- Smaug Launchpad Link: \ https://launchpad.net/smaug -- Smaug Code Review: \ https://review.openstack.org/#/q/smaug+status:open,n,z -- Smaug Code Repository: \ https://github.com/openstack/smaug -- Smaug daily IRC Channel: #openstack-smaug -- Smaug weekly IRC Meeting on **even** Tuesday at 1500 UTC +- Karbor Launchpad Link: \ https://launchpad.net/karbor +- Karbor Code Review: \ https://review.openstack.org/#/q/karbor+status:open,n,z +- Karbor Code Repository: \ https://github.com/openstack/karbor +- Karbor daily IRC Channel: #openstack-karbor +- Karbor weekly IRC Meeting on **even** Tuesday at 1500 UTC and on **odd** Tuesday at 0900 UTC in #openstack-meeting at freenode: \ - https://wiki.openstack.org/wiki/Meetings/smaug -- Smaug Trello Board: \ https://trello.com/b/Sudr4fKT/smaug + https://wiki.openstack.org/wiki/Meetings/karbor +- Karbor Trello Board: \ https://trello.com/b/Sudr4fKT/karbor Additional references ===================== - `OpenStack Tokyo Summit 2015 talk `_ - `OpenStack Austin Summit 2016 talk `_ -- `Smaug overview slide `_ -- `Smaug overview blog `_ +- `Karbor overview slide `_ +- `Karbor overview blog `_ diff --git a/doc/source/specs/api-service.rst b/doc/source/specs/api-service.rst index 195acf2a..fe6339c4 100644 --- a/doc/source/specs/api-service.rst +++ b/doc/source/specs/api-service.rst @@ -10,7 +10,7 @@ API Service https://review.openstack.org/#/c/266338/ -The APIs expose Application Data Protection services to the Smaug user. +The APIs expose Application Data Protection services to the Karbor user. The purpose of the services is to maximize flexibility and accommodate for (hopefully) any kind of protection for any type of resource, whether @@ -27,35 +27,35 @@ WSGI Resources Controller The WSGI Controller handles incoming web requests that are dispatched from the WSGI application APIRouter. -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/api-service-class-diagram.png +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/api-service-class-diagram.png From the module class graph, api service basically have following resources Controller: Provider Controller --------------------------- -Enables the Smaug user to list available providers and get parameters and +Enables the Karbor user to list available providers and get parameters and result schema super-set for all plugins of a specific Provider. Checkpoint Controller --------------------------- -Enables the Smaug user to access and manage the checkpoints stored +Enables the Karbor user to access and manage the checkpoints stored in the protection provider. Protectable Controller --------------------------- -Enables the Smaug user to access information about which resource types -are protectable (i.e. can be protected by Smaug). +Enables the Karbor user to access information about which resource types +are protectable (i.e. can be protected by Karbor). In addition, enables the user to get additional information on each resource type, such as a list of actual instances and their dependencies. Plan Controller --------------------------- -This API enables the Smaug user to access the protection Plan registry +This API enables the Karbor user to access the protection Plan registry and do the following operations: - Plan CRUD. - List Plans. @@ -65,7 +65,7 @@ and do the following operations: Scheduled Operation Controller -------------------------- -This API enables the Smaug user to manage Scheduled Operations: +This API enables the Karbor user to manage Scheduled Operations: - Operation CRUD. - List Operations. @@ -73,7 +73,7 @@ This API enables the Smaug user to manage Scheduled Operations: Trigger Controller -------------------------- -This API enables the Smaug user to manage Triggers: +This API enables the Karbor user to manage Triggers: A trigger only can be deleted when it isn't used in any of the scheduled operation. - Trigger CRUD. @@ -83,7 +83,7 @@ scheduled operation. Restore Controller --------------------------- -This API enables the Smaug user restore a checkpoint on to a restore target: +This API enables the Karbor user restore a checkpoint on to a restore target: - Create restored system from a checkpoint. diff --git a/doc/source/specs/available_protectables.pu b/doc/source/specs/available_protectables.pu index b32b3b92..b74b3948 100644 --- a/doc/source/specs/available_protectables.pu +++ b/doc/source/specs/available_protectables.pu @@ -1,12 +1,12 @@ @startuml -title Smaug Protectables +title Karbor Protectables hide circle legend top This file contains the dependency between protectables in the default -distribution of Smaug. The arrows, similar to inheritance point to the parent +distribution of Karbor. The arrows, similar to inheritance point to the parent since Protectables define what types they depend on so this reflects who is responsible for the connection. endlegend diff --git a/doc/source/specs/bank-plugin-lease.rst b/doc/source/specs/bank-plugin-lease.rst index cc1a6e0a..27115fe5 100644 --- a/doc/source/specs/bank-plugin-lease.rst +++ b/doc/source/specs/bank-plugin-lease.rst @@ -7,7 +7,7 @@ ================= Bank Plugin Basic ================= -Bank Plugin is a component of smaug (an openstack project working as a service for data protection), +Bank Plugin is a component of karbor (an openstack project working as a service for data protection), which is responsible for execute CRUD actions in Bank. The bank is a backend (such as swift) which is used to store the metadata/data of protection plan. @@ -19,7 +19,7 @@ leases Smuag will create a checkpoint when protecting a protection plan. This checkpoint is maintained with status, which is a enum type: protecting, available, restoring, deleted, etc. -The status is used for smaug API layer to control access to one checkpoint from users. +The status is used for karbor API layer to control access to one checkpoint from users. With the 'protecting' status, there're two cases which we can't tell the difference: diff --git a/doc/source/specs/index.rst b/doc/source/specs/index.rst index 4f3859dc..dd9e6446 100644 --- a/doc/source/specs/index.rst +++ b/doc/source/specs/index.rst @@ -1,8 +1,8 @@ -Smaug Specs +Karbor Specs =========== This section contains detailed specification documents for -different features inside Smaug. +different features inside Karbor. Contents: diff --git a/doc/source/specs/operation-engine/operation_engine_design.rst b/doc/source/specs/operation-engine/operation_engine_design.rst index 83b7de94..efbef19d 100644 --- a/doc/source/specs/operation-engine/operation_engine_design.rst +++ b/doc/source/specs/operation-engine/operation_engine_design.rst @@ -8,9 +8,9 @@ Operation Engine ================ -https://blueprints.launchpad.net/smaug/+spec/operation-engine-design +https://blueprints.launchpad.net/karbor/+spec/operation-engine-design -Operation Engine is one of components in Smaug, which is responsible for +Operation Engine is one of components in Karbor, which is responsible for triggering the operations to execute when the time is up or event happens. Problem description diff --git a/doc/source/specs/pluggable_protection_provider.rst b/doc/source/specs/pluggable_protection_provider.rst index b3223d54..1701a4e1 100644 --- a/doc/source/specs/pluggable_protection_provider.rst +++ b/doc/source/specs/pluggable_protection_provider.rst @@ -22,7 +22,7 @@ Pluggable Protection Provider ========================================== -https://blueprints.launchpad.net/smaug/+spec/protection-plugin-is-design +https://blueprints.launchpad.net/karbor/+spec/protection-plugin-is-design Protection Provider =================== @@ -63,7 +63,7 @@ Protection Provider Configuration Protection Providers are loaded from configuration files, placed in the directory specified by the ``provider_config_dir`` configuration option (by -default: ``/etc/smaug/providers.d``). Each provider configuration file must +default: ``/etc/karbor/providers.d``). Each provider configuration file must bear the ``.conf`` suffix and contain a ``[provider]`` section. This section specifies the following configuration: @@ -85,11 +85,11 @@ For example:: name = Foo id = 2e0c8826-81d6-44f5-bbe5-8f46a98c5845 description = Example Protection Provider - bank = smaug.protections.smaug-swift-bank-plugin - plugin = smaug.protections.smaug-volume-protection-plugin - plugin = smaug.protections.smaug-image-protection-plugin - plugin = smaug.protections.smaug-server-protection-plugin - plugin = smaug.protections.smaug-project-protection-plugin + bank = karbor.protections.karbor-swift-bank-plugin + plugin = karbor.protections.karbor-volume-protection-plugin + plugin = karbor.protections.karbor-image-protection-plugin + plugin = karbor.protections.karbor-server-protection-plugin + plugin = karbor.protections.karbor-project-protection-plugin [swift_client] bank_swift_auth_url = http://10.0.0.10:5000 @@ -166,7 +166,7 @@ Notes: else: yield -.. figure:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/protection-service/activities-links.png +.. figure:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/protection-service/activities-links.png :alt: Activities Links :align: center @@ -186,11 +186,11 @@ This scheme decouples the tree structure from the task execution. A plugin that handles multiple resources or that aggregates multiple resources to one task can use this mechanism to only return tasks when appropriate for it's scheme. -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/pluggable_protection_provider.svg - :alt: Smaug +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/pluggable_protection_provider.svg + :alt: Karbor :align: center References ========== -1. `Class Diagram Source `_ +1. `Class Diagram Source `_ 2. `Dependency graph building algorithm `_ diff --git a/doc/source/specs/protection-service/activities-links.svg b/doc/source/specs/protection-service/activities-links.svg index b8ef83ec..85c131fe 100644 --- a/doc/source/specs/protection-service/activities-links.svg +++ b/doc/source/specs/protection-service/activities-links.svg @@ -16,7 +16,7 @@ width="630" height="400" style="fill:none;stroke:none;stroke-linecap:square;stroke-miterlimit:10" - inkscape:export-filename="/home/yuvalbr/src/smaug/doc/images/protection-service/activities-links.png" + inkscape:export-filename="/home/yuvalbr/src/karbor/doc/images/protection-service/activities-links.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> > ProtectionManager :create_checkpoint(backup_plan, protect) +Karbor_API_Service ->> ProtectionManager :create_checkpoint(backup_plan, protect) ProtectionManager -> WorkflowEngine:built task flow ProtectionManager -> WorkflowEngine: execute task flow WorkflowEngine -> CreateCheckpointTask:execute() diff --git a/doc/source/specs/protection-service/protection-service.rst b/doc/source/specs/protection-service/protection-service.rst index 7f482790..e31997c3 100644 --- a/doc/source/specs/protection-service/protection-service.rst +++ b/doc/source/specs/protection-service/protection-service.rst @@ -8,13 +8,13 @@ Protection Service Basics ==================================== -https://bugs.launchpad.net/smaug/+bug/1529199 +https://bugs.launchpad.net/karbor/+bug/1529199 -Protection Service is a component of smaug (an openstack project working as a +Protection Service is a component of karbor (an openstack project working as a service for data protection), which is responsible to execute protect/restore/other actions on operations (triggered plans). -Architecturally, it acts as a RPC server role for smaug API service to actually +Architecturally, it acts as a RPC server role for karbor API service to actually execute the actions on triggered operations. It's also the role who actually cooperates with protection plugins provided by @@ -29,7 +29,7 @@ the graph task flow. RPC interfaces ================================================ -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/protection-service/protection-architecture.png +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/protection-service/protection-architecture.png From the module graph, protection service basically provide following RPC calls: @@ -56,7 +56,7 @@ Checkpoint RPC: Main Concept ============ -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/protection-service/class-diagram.png +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/protection-service/class-diagram.png Protection Manager @@ -80,7 +80,7 @@ CheckpointCollection -------------------- Entity to manage checkpoints, which provides CRUD interfaces to handle -checkpoint. As checkpoint is a smaug internal entity, one checkpoint operation +checkpoint. As checkpoint is a karbor internal entity, one checkpoint operation is actually composed by combination of several BankPlugin atomic operations. Take create_checkpoint as example, it will first acquire write lease (there @@ -96,9 +96,9 @@ call to Protection Service. Let's take action protect as the example and analyze the sequence together with the class graph: -.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/protection-service/protect-rpc-call-seq-diagram.png +.. image:: https://raw.githubusercontent.com/openstack/karbor/master/doc/images/protection-service/protect-rpc-call-seq-diagram.png -1. Smaug **Operation Engine** +1. Karbor **Operation Engine** ------------------------------ who is responsible for triggering operation according to time schedule or events, will call RPC call of Protection Service: diff --git a/doc/source/specs/template.rst b/doc/source/specs/template.rst index 70ed7954..c9852e67 100644 --- a/doc/source/specs/template.rst +++ b/doc/source/specs/template.rst @@ -10,7 +10,7 @@ Example Spec - The title of your RFE Include the URL of your launchpad RFE: -https://bugs.launchpad.net/smaug/+bug/example-id +https://bugs.launchpad.net/karbor/+bug/example-id Introduction paragraph -- why are we doing this feature? A single paragraph of prose that **deployers, and developers, and operators** can understand. @@ -44,7 +44,7 @@ design at the same time as use cases, if desired. Note that by high-level, we mean the "view from orbit" rough cut at how things will happen. This section should 'scope' the effort from a feature standpoint: how is the -'Smaug end-to-end system' going to look like after this change? What Smaug +'Karbor end-to-end system' going to look like after this change? What Karbor areas do you intend to touch and how do you intend to work on them? @@ -143,7 +143,7 @@ but we're mostly trying to understand the timeline for implementation. Dependencies ============ -* Include specific references to specs and/or blueprints in Smaug, or in other +* Include specific references to specs and/or blueprints in Karbor, or in other projects, that this one either depends on or is related to. * If this requires functionality of another project that is not currently used diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 919951c6..451661ce 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -1,12 +1,12 @@ ============= Usage Example ============= -Resources in OpenStack (server, volume, image, network, etc) can be protected by Smaug. +Resources in OpenStack (server, volume, image, network, etc) can be protected by Karbor. This example will show protecting volume. -#. Before starting the smaug-protection service, the admin needs to configure a - Provider in /etc/smaug/providers.d/openstack-infra.conf. The Swift plugin is +#. Before starting the karbor-protection service, the admin needs to configure a + Provider in /etc/karbor/providers.d/openstack-infra.conf. The Swift plugin is the default bank plugin. The admin also needs to configure the basic Swift client account configuration:: @@ -15,8 +15,8 @@ This example will show protecting volume. name = OS Infra Provider description = This provider uses OpenStack's own services (swift, cinder) as storage id = cf56bd3e-97a7-4078-b6d5-f36246333fd9 - plugin=smaug-volume-protection-plugin - bank=smaug-swift-bank-plugin + plugin=karbor-volume-protection-plugin + bank=karbor-swift-bank-plugin [swift_client] swift_auth_url=http://10.229.47.230:5000/v2.0/ @@ -27,7 +27,7 @@ This example will show protecting volume. -#. To use cinder or smaug client, we should provide Keystone authentication +#. To use cinder or karbor client, we should provide Keystone authentication variables:: export OS_USERNAME=admin @@ -37,7 +37,7 @@ This example will show protecting volume. #. Show the provider information:: - smaug provider-show cf56bd3e-97a7-4078-b6d5-f36246333fd9 + karbor provider-show cf56bd3e-97a7-4078-b6d5-f36246333fd9 +----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Property | Value | +----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -61,7 +61,7 @@ This example will show protecting volume. #. List the protectable resources:: - smaug protectable-list + karbor protectable-list +-----------------------+ | Protectable type | +-----------------------+ @@ -70,7 +70,7 @@ This example will show protecting volume. | OS::Nova::Server | +-----------------------+ - smaug protectable-list-instances OS::Cinder::Volume + karbor protectable-list-instances OS::Cinder::Volume +--------------------------------------+--------------------+---------------------+ | Id | Type | Dependent resources | +--------------------------------------+--------------------+---------------------+ @@ -81,7 +81,7 @@ This example will show protecting volume. #. Create a protection plan with a provider and resources:: - smaug plan-create 'OS volumes protection plan.' 'cf56bd3e-97a7-4078-b6d5-f36246333fd9' 'd107b234-e16d-4e1e-800d-86523c693e5c'='OS::Cinder::Volume'='volume2','c468688b-dcb1-4bdf-b26b-62e989ac940e'='OS::Cinder::Volume'='volume1' + karbor plan-create 'OS volumes protection plan.' 'cf56bd3e-97a7-4078-b6d5-f36246333fd9' 'd107b234-e16d-4e1e-800d-86523c693e5c'='OS::Cinder::Volume'='volume2','c468688b-dcb1-4bdf-b26b-62e989ac940e'='OS::Cinder::Volume'='volume1' +-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Property | Value | +-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -95,7 +95,7 @@ This example will show protecting volume. #. Execute a protect operation manually with a plan:: - smaug checkpoint-create cf56bd3e-97a7-4078-b6d5-f36246333fd9 b5969bb9-c571-4538-b827-3746d11aa7a2 + karbor checkpoint-create cf56bd3e-97a7-4078-b6d5-f36246333fd9 b5969bb9-c571-4538-b827-3746d11aa7a2 +-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Property | Value | @@ -115,18 +115,18 @@ This example will show protecting volume. | 58811e5a-d65f-4d1e-8e3d-2e7f1b688c32 | c468688b-dcb1-4bdf-b26b-62e989ac940e | available | test_protect | 1 | 22 | volumebackups | | de4bbdab-315b-40f3-b89a-25a23c387e04 | d107b234-e16d-4e1e-800d-86523c693e5c | available | test_protect | 1 | 22 | volumebackups | +--------------------------------------+--------------------------------------+-----------+--------------+------+--------------+---------------+ - smaug checkpoint-show cf56bd3e-97a7-4078-b6d5-f36246333fd9 503e12db-a815-4101-b526-6b687ba60080 + karbor checkpoint-show cf56bd3e-97a7-4078-b6d5-f36246333fd9 503e12db-a815-4101-b526-6b687ba60080 #. Execute a protect operation automatically with a scheduler:: - smaug trigger-create 'My Trigger' 'time' "pattern"="0 20 * * 2":"format"="crontab" - smaug scheduledoperation-create 'Protect with My Trigger' 'protect' "plan_id"="b5969bb9-c571-4538-b827-3746d11aa7a2":"provider_id"="cf56bd3e-97a7-4078-b6d5-f36246333fd9" + karbor trigger-create 'My Trigger' 'time' "pattern"="0 20 * * 2":"format"="crontab" + karbor scheduledoperation-create 'Protect with My Trigger' 'protect' "plan_id"="b5969bb9-c571-4538-b827-3746d11aa7a2":"provider_id"="cf56bd3e-97a7-4078-b6d5-f36246333fd9" #. Execute a restore operation manually with a checkpoint id:: - smaug --debug restore-create cf56bd3e-97a7-4078-b6d5-f36246333fd9 2c14b9d6-529b-4308-bb17-7334eb351fd7 'http://10.229.47.230:35357/v2.0/' --parameters 'username'='admin' 'password'='123456' + karbor --debug restore-create cf56bd3e-97a7-4078-b6d5-f36246333fd9 2c14b9d6-529b-4308-bb17-7334eb351fd7 'http://10.229.47.230:35357/v2.0/' --parameters 'username'='admin' 'password'='123456' +----------------+-------------------------------------------------+ | Property | Value | +----------------+-------------------------------------------------+ @@ -159,7 +159,7 @@ This example will show protecting volume. | de4bbdab-315b-40f3-b89a-25a23c387e04 | d107b234-e16d-4e1e-800d-86523c693e5c | available | test_protect | 1 | 22 | volumebackups | +--------------------------------------+--------------------------------------+-----------+--------------+------+--------------+---------------+ - smaug checkpoint-delete cf56bd3e-97a7-4078-b6d5-f36246333fd9 2c14b9d6-529b-4308-bb17-7334eb351fd7 + karbor checkpoint-delete cf56bd3e-97a7-4078-b6d5-f36246333fd9 2c14b9d6-529b-4308-bb17-7334eb351fd7 cinder backup-list +----+-----------+--------+------+------+--------------+-----------+ diff --git a/etc/api-paste.ini b/etc/api-paste.ini index cee137c6..fedc7a0e 100644 --- a/etc/api-paste.ini +++ b/etc/api-paste.ini @@ -2,13 +2,13 @@ # OpenStack # ############# -[composite:osapi_smaug] +[composite:osapi_karbor] use = egg:Paste#urlmap /: apiversions -/v1: openstack_smaug_api_v1 +/v1: openstack_karbor_api_v1 -[composite:openstack_smaug_api_v1] -use = call:smaug.api.middleware.auth:pipeline_factory +[composite:openstack_karbor_api_v1] +use = call:karbor.api.middleware.auth:pipeline_factory noauth = request_id catch_errors noauth apiv1 keystone = request_id catch_errors authtoken keystonecontext apiv1 @@ -19,16 +19,16 @@ paste.filter_factory = oslo_middleware:RequestId.factory paste.filter_factory = oslo_middleware:CatchErrors.factory [filter:noauth] -paste.filter_factory = smaug.api.middleware.auth:NoAuthMiddleware.factory +paste.filter_factory = karbor.api.middleware.auth:NoAuthMiddleware.factory [filter:keystonecontext] -paste.filter_factory = smaug.api.middleware.auth:SmaugKeystoneContext.factory +paste.filter_factory = karbor.api.middleware.auth:KarborKeystoneContext.factory [filter:authtoken] paste.filter_factory = keystonemiddleware.auth_token:filter_factory [app:apiversions] -paste.app_factory = smaug.api.versions:Versions.factory +paste.app_factory = karbor.api.versions:Versions.factory [app:apiv1] -paste.app_factory = smaug.api.v1.router:APIRouter.factory +paste.app_factory = karbor.api.v1.router:APIRouter.factory diff --git a/etc/smaug.conf b/etc/karbor.conf similarity index 83% rename from etc/smaug.conf rename to etc/karbor.conf index 4edb7029..4d046423 100644 --- a/etc/smaug.conf +++ b/etc/karbor.conf @@ -1,17 +1,17 @@ [keystone_authtoken] -#signing_dir = /var/cache/smaug +#signing_dir = /var/cache/karbor #cafile = /opt/stack/data/ca-bundle.pem #auth_uri = http://192.168.1.102:5000 #project_domain_id = default #project_name = service #user_domain_id = default #password = nomoresecrete -#username = smaug +#username = karbor #auth_url = http://http://192.168.1.102:35357 #auth_plugin = password [DEFAULT] -#api_paste_config = /etc/smaug/api-paste.ini +#api_paste_config = /etc/karbor/api-paste.ini #logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [%(request_id)s %(user_id)s %(project_id)s%(color)s] %(instance)s%(color)s%(message)s #logging_debug_format_suffix = from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d #logging_default_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s @@ -23,7 +23,7 @@ #rpc_backend = rabbit #[database] -#connection = mysql+pymysql://root:stackdb@127.0.0.1/smaug?charset=utf8 +#connection = mysql+pymysql://root:stackdb@127.0.0.1/karbor?charset=utf8 #[oslo_messaging_rabbit] #rabbit_userid = stackrabbit diff --git a/etc/providers.d/openstack-infra.conf b/etc/providers.d/openstack-infra.conf index cb64ae0d..179080b8 100644 --- a/etc/providers.d/openstack-infra.conf +++ b/etc/providers.d/openstack-infra.conf @@ -3,9 +3,9 @@ name = OS Infra Provider description = This provider uses OpenStack's own services (swift, cinder) as storage id = cf56bd3e-97a7-4078-b6d5-f36246333fd9 -plugin=smaug-volume-protection-plugin -plugin=smaug-image-protection-plugin -bank=smaug-swift-bank-plugin +plugin=karbor-volume-protection-plugin +plugin=karbor-image-protection-plugin +bank=karbor-swift-bank-plugin [swift_client] swift_auth_url=http://127.0.0.1:5000/v2.0/ diff --git a/smaug/__init__.py b/karbor/__init__.py similarity index 95% rename from smaug/__init__.py rename to karbor/__init__.py index 29010d5b..9a9d65a0 100644 --- a/smaug/__init__.py +++ b/karbor/__init__.py @@ -16,4 +16,4 @@ import pbr.version __version__ = pbr.version.VersionInfo( - 'smaug').version_string() + 'karbor').version_string() diff --git a/smaug/api/__init__.py b/karbor/api/__init__.py similarity index 100% rename from smaug/api/__init__.py rename to karbor/api/__init__.py diff --git a/smaug/api/common.py b/karbor/api/common.py similarity index 96% rename from smaug/api/common.py rename to karbor/api/common.py index 755f279f..da60fa84 100644 --- a/smaug/api/common.py +++ b/karbor/api/common.py @@ -19,7 +19,7 @@ from oslo_log import log as logging from six.moves import urllib import webob -from smaug.i18n import _ +from karbor.i18n import _ api_common_opts = [ @@ -159,7 +159,7 @@ def get_sort_params(params, default_key='created_at', default_dir='desc'): function. :param params: webob.multidict of request parameters (from - smaug.api.openstack.wsgi.Request.params) + karbor.api.openstack.wsgi.Request.params) :param default_key: default sort key value, added to the list if no sort keys are supplied :param default_dir: default sort dir value, added to the list if the @@ -204,11 +204,11 @@ def get_request_url(request): def remove_version_from_href(href): """Removes the first api version from the href. - Given: 'http://www.smaug.com/v1.1/123' - Returns: 'http://www.smaug.com/123' + Given: 'http://www.karbor.com/v1.1/123' + Returns: 'http://www.karbor.com/123' - Given: 'http://www.smaug.com/v1.1' - Returns: 'http://www.smaug.com' + Given: 'http://www.karbor.com/v1.1' + Returns: 'http://www.karbor.com' """ parsed_url = urllib.parse.urlsplit(href) @@ -249,7 +249,7 @@ class ViewBuilder(object): prefix = self._update_link_prefix(get_request_url(request), CONF.osapi_plan_base_URL) url = os.path.join(prefix, - request.environ["smaug.context"].project_id, + request.environ["karbor.context"].project_id, collection_name) return "%s?%s" % (url, urllib.parse.urlencode(params)) @@ -258,7 +258,7 @@ class ViewBuilder(object): prefix = self._update_link_prefix(get_request_url(request), CONF.osapi_plan_base_URL) return os.path.join(prefix, - request.environ["smaug.context"].project_id, + request.environ["karbor.context"].project_id, self._collection_name, str(identifier)) @@ -268,7 +268,7 @@ class ViewBuilder(object): base_url = self._update_link_prefix(base_url, CONF.osapi_plan_base_URL) return os.path.join(base_url, - request.environ["smaug.context"].project_id, + request.environ["karbor.context"].project_id, self._collection_name, str(identifier)) diff --git a/smaug/api/middleware/__init__.py b/karbor/api/middleware/__init__.py similarity index 100% rename from smaug/api/middleware/__init__.py rename to karbor/api/middleware/__init__.py diff --git a/smaug/api/middleware/auth.py b/karbor/api/middleware/auth.py similarity index 93% rename from smaug/api/middleware/auth.py rename to karbor/api/middleware/auth.py index 7b9713bb..f1133085 100644 --- a/smaug/api/middleware/auth.py +++ b/karbor/api/middleware/auth.py @@ -27,10 +27,10 @@ from oslo_serialization import jsonutils import webob.dec import webob.exc -from smaug.api.openstack import wsgi -from smaug import context -from smaug.i18n import _ -from smaug.wsgi import common as base_wsgi +from karbor.api.openstack import wsgi +from karbor import context +from karbor.i18n import _ +from karbor.wsgi import common as base_wsgi use_forwarded_for_opt = cfg.BoolOpt( @@ -58,7 +58,7 @@ def pipeline_factory(loader, global_conf, **local_conf): class InjectContext(base_wsgi.Middleware): - """Add a 'smaug.context' to WSGI environ.""" + """Add a 'karbor.context' to WSGI environ.""" def __init__(self, context, *args, **kwargs): self.context = context @@ -66,11 +66,11 @@ class InjectContext(base_wsgi.Middleware): @webob.dec.wsgify(RequestClass=base_wsgi.Request) def __call__(self, req): - req.environ['smaug.context'] = self.context + req.environ['karbor.context'] = self.context return self.application -class SmaugKeystoneContext(base_wsgi.Middleware): +class KarborKeystoneContext(base_wsgi.Middleware): """Make a request context from keystone headers.""" @webob.dec.wsgify(RequestClass=base_wsgi.Request) @@ -125,7 +125,7 @@ class SmaugKeystoneContext(base_wsgi.Middleware): request_id=req_id, auth_token_info=auth_token_info) - environ['smaug.context'] = ctx + environ['karbor.context'] = ctx return self.application @@ -159,5 +159,5 @@ class NoAuthMiddleware(base_wsgi.Middleware): is_admin=True, remote_address=remote_address) - req.environ['smaug.context'] = ctx + req.environ['karbor.context'] = ctx return self.application diff --git a/smaug/api/openstack/__init__.py b/karbor/api/openstack/__init__.py similarity index 100% rename from smaug/api/openstack/__init__.py rename to karbor/api/openstack/__init__.py diff --git a/smaug/api/openstack/wsgi.py b/karbor/api/openstack/wsgi.py similarity index 99% rename from smaug/api/openstack/wsgi.py rename to karbor/api/openstack/wsgi.py index b80a5882..f3241234 100644 --- a/smaug/api/openstack/wsgi.py +++ b/karbor/api/openstack/wsgi.py @@ -20,11 +20,11 @@ from oslo_utils import excutils import six import webob -from smaug import exception -from smaug import i18n -from smaug.i18n import _, _LE, _LI -from smaug import utils -from smaug.wsgi import common as wsgi +from karbor import exception +from karbor import i18n +from karbor.i18n import _, _LE, _LI +from karbor import utils +from karbor.wsgi import common as wsgi LOG = logging.getLogger(__name__) @@ -620,7 +620,7 @@ class Resource(wsgi.Application): action_args.update(contents) project_id = action_args.pop("project_id", None) - context = request.environ.get('smaug.context') + context = request.environ.get('karbor.context') if (context and project_id and (project_id != context.project_id)): msg = _("Malformed request url") return Fault(webob.exc.HTTPBadRequest(explanation=msg)) @@ -962,7 +962,7 @@ class Fault(webob.exc.HTTPException): def _set_request_id_header(req, headers): - context = req.environ.get('smaug.context') + context = req.environ.get('karbor.context') if context: headers['x-compute-request-id'] = context.request_id diff --git a/smaug/api/v1/__init__.py b/karbor/api/v1/__init__.py similarity index 100% rename from smaug/api/v1/__init__.py rename to karbor/api/v1/__init__.py diff --git a/smaug/api/v1/plans.py b/karbor/api/v1/plans.py similarity index 93% rename from smaug/api/v1/plans.py rename to karbor/api/v1/plans.py index 5003a762..2a23fd2c 100644 --- a/smaug/api/v1/plans.py +++ b/karbor/api/v1/plans.py @@ -18,17 +18,17 @@ from oslo_utils import uuidutils from webob import exc -import smaug -from smaug.api import common -from smaug.api.openstack import wsgi -from smaug import exception -from smaug.i18n import _, _LI +import karbor +from karbor.api import common +from karbor.api.openstack import wsgi +from karbor import exception +from karbor.i18n import _, _LI -from smaug import objects -from smaug.objects import base as objects_base -import smaug.policy -from smaug.services.operationengine import api as operationengine_api -from smaug import utils +from karbor import objects +from karbor.objects import base as objects_base +import karbor.policy +from karbor.services.operationengine import api as operationengine_api +from karbor import utils import six @@ -50,7 +50,7 @@ def check_policy(context, action, target_obj=None): 'user_id': context.user_id, } - if isinstance(target_obj, objects_base.SmaugObject): + if isinstance(target_obj, objects_base.KarborObject): # Turn object into dict so target.update can work target.update( target_obj.obj_to_primitive() or {}) @@ -58,7 +58,7 @@ def check_policy(context, action, target_obj=None): target.update(target_obj or {}) _action = 'plan:%s' % action - smaug.policy.enforce(context, _action, target) + karbor.policy.enforce(context, _action, target) class PlanViewBuilder(common.ViewBuilder): @@ -126,7 +126,7 @@ class PlansController(wsgi.Controller): def show(self, req, id): """Return data about the given plan.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show plan with id: %s"), id, context=context) @@ -145,7 +145,7 @@ class PlansController(wsgi.Controller): def delete(self, req, id): """Delete a plan.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Delete plan with id: %s"), id, context=context) @@ -161,7 +161,7 @@ class PlansController(wsgi.Controller): def index(self, req): """Returns a list of plans, transformed through view builder.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show plan list"), context=context) @@ -236,7 +236,7 @@ class PlansController(wsgi.Controller): raise exc.HTTPUnprocessableEntity() LOG.debug('Create plan request body: %s', body) - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] check_policy(context, 'create') plan = body['plan'] LOG.debug('Create plan request plan: %s', plan) @@ -278,7 +278,7 @@ class PlansController(wsgi.Controller): def update(self, req, id, body): """Update a plan.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] if not body: msg = _("Missing request body") @@ -333,7 +333,7 @@ class PlansController(wsgi.Controller): try: check_policy(context, 'get', plan) except exception.PolicyNotAuthorized: - # raise PlanNotFound instead to make sure smaug behaves + # raise PlanNotFound instead to make sure karbor behaves # as it used to raise exception.PlanNotFound(plan_id=plan_id) LOG.info(_LI("Plan info retrieved successfully."), resource=plan) @@ -347,13 +347,13 @@ class PlansController(wsgi.Controller): raise exception.InvalidPlan(reason=msg) # TODO(chenying) replication scene: need call rpc API when # the status of the plan is changed. - if isinstance(plan, objects_base.SmaugObject): + if isinstance(plan, objects_base.KarborObject): plan.update(fields) plan.save() LOG.info(_LI("Plan updated successfully."), resource=plan) else: msg = _("The parameter plan must be a object of " - "SmaugObject class.") + "KarborObject class.") raise exception.InvalidInput(reason=msg) def validate_plan_resources(self, plan): diff --git a/smaug/api/v1/protectables.py b/karbor/api/v1/protectables.py similarity index 95% rename from smaug/api/v1/protectables.py rename to karbor/api/v1/protectables.py index 95edd9b2..84c74abc 100644 --- a/smaug/api/v1/protectables.py +++ b/karbor/api/v1/protectables.py @@ -17,14 +17,14 @@ from oslo_log import log as logging from webob import exc -from smaug.api import common -from smaug.api.openstack import wsgi -from smaug import exception -from smaug.i18n import _, _LI +from karbor.api import common +from karbor.api.openstack import wsgi +from karbor import exception +from karbor.i18n import _, _LI -import smaug.policy -from smaug.services.protection import api as protection_api -from smaug import utils +import karbor.policy +from karbor.services.protection import api as protection_api +from karbor import utils import six @@ -46,7 +46,7 @@ def check_policy(context, action): 'user_id': context.user_id, } _action = 'protectable:%s' % action - smaug.policy.enforce(context, _action, target) + karbor.policy.enforce(context, _action, target) class ProtectableViewBuilder(common.ViewBuilder): @@ -124,7 +124,7 @@ class ProtectablesController(wsgi.Controller): def show(self, req, id): """Return data about the given protectable_type.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] protectable_type = id LOG.info(_LI("Show the information of a given" " protectable type: %s"), protectable_type) @@ -151,7 +151,7 @@ class ProtectablesController(wsgi.Controller): transformed through view builder. """ - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show protectable type list"), context=context) protectable_types = self._get_all(context) @@ -173,7 +173,7 @@ class ProtectablesController(wsgi.Controller): def instances_index(self, req, protectable_type): """Return data about the given protectable_type.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show the instances of a given" " protectable type: %s"), protectable_type) @@ -252,7 +252,7 @@ class ProtectablesController(wsgi.Controller): def instances_show(self, req, protectable_type, protectable_id): """Return a instance about the given protectable_type and id.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show the instance of a given protectable" " type: %s"), protectable_type) diff --git a/smaug/api/v1/providers.py b/karbor/api/v1/providers.py similarity index 95% rename from smaug/api/v1/providers.py rename to karbor/api/v1/providers.py index 032b7ab2..fbc1bd1e 100644 --- a/smaug/api/v1/providers.py +++ b/karbor/api/v1/providers.py @@ -18,15 +18,15 @@ from oslo_utils import uuidutils from webob import exc -from smaug.api import common -from smaug.api.openstack import wsgi -from smaug import exception -from smaug.i18n import _, _LI +from karbor.api import common +from karbor.api.openstack import wsgi +from karbor import exception +from karbor.i18n import _, _LI -from smaug import objects -import smaug.policy -from smaug.services.protection import api as protection_api -from smaug import utils +from karbor import objects +import karbor.policy +from karbor.services.protection import api as protection_api +from karbor import utils import six @@ -59,7 +59,7 @@ def check_policy(context, action): 'user_id': context.user_id, } _action = 'provider:%s' % action - smaug.policy.enforce(context, _action, target) + karbor.policy.enforce(context, _action, target) class ProviderViewBuilder(common.ViewBuilder): @@ -183,7 +183,7 @@ class ProvidersController(wsgi.Controller): def show(self, req, id): """Return data about the given provider id.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show provider with id: %s"), id) @@ -198,7 +198,7 @@ class ProvidersController(wsgi.Controller): def index(self, req): """Returns a list of providers, transformed through view builder.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show provider list"), context=context) @@ -275,7 +275,7 @@ class ProvidersController(wsgi.Controller): try: check_policy(context, 'get') except exception.PolicyNotAuthorized: - # raise ProviderNotFound instead to make sure smaug behaves + # raise ProviderNotFound instead to make sure karbor behaves # as it used to raise exception.ProviderNotFound(provider_id=provider_id) @@ -286,7 +286,7 @@ class ProvidersController(wsgi.Controller): def checkpoints_index(self, req, provider_id): """Returns a list of checkpoints, transformed through view builder.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show checkpoints list. " "provider_id:%s"), provider_id) @@ -350,7 +350,7 @@ class ProvidersController(wsgi.Controller): if not self.is_valid_body(body, 'checkpoint'): raise exc.HTTPUnprocessableEntity() - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.debug('Create checkpoint request ' 'body: %s provider_id:%s', body, provider_id) @@ -403,7 +403,7 @@ class ProvidersController(wsgi.Controller): def checkpoints_show(self, req, provider_id, checkpoint_id): """Return data about the given checkpoint id.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show checkpoint with id: %s."), checkpoint_id) @@ -433,7 +433,7 @@ class ProvidersController(wsgi.Controller): try: check_policy(context, 'checkpoint_get') except exception.PolicyNotAuthorized: - # raise CheckpointNotFound instead to make sure smaug behaves + # raise CheckpointNotFound instead to make sure karbor behaves # as it used to raise exception.CheckpointNotFound(checkpoint_id=checkpoint_id) @@ -448,7 +448,7 @@ class ProvidersController(wsgi.Controller): def checkpoints_delete(self, req, provider_id, checkpoint_id): """Delete a checkpoint.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Delete checkpoint with id: %s."), checkpoint_id) diff --git a/smaug/api/v1/restores.py b/karbor/api/v1/restores.py similarity index 93% rename from smaug/api/v1/restores.py rename to karbor/api/v1/restores.py index 993c94cb..8a581a06 100644 --- a/smaug/api/v1/restores.py +++ b/karbor/api/v1/restores.py @@ -18,17 +18,17 @@ from oslo_utils import uuidutils from webob import exc -import smaug -from smaug.api import common -from smaug.api.openstack import wsgi -from smaug import exception -from smaug.i18n import _, _LI +import karbor +from karbor.api import common +from karbor.api.openstack import wsgi +from karbor import exception +from karbor.i18n import _, _LI -from smaug import objects -from smaug.objects import base as objects_base -import smaug.policy -from smaug.services.protection import api as protection_api -from smaug import utils +from karbor import objects +from karbor.objects import base as objects_base +import karbor.policy +from karbor.services.protection import api as protection_api +from karbor import utils import six @@ -51,7 +51,7 @@ def check_policy(context, action, target_obj=None): 'user_id': context.user_id, } - if isinstance(target_obj, objects_base.SmaugObject): + if isinstance(target_obj, objects_base.KarborObject): # Turn object into dict so target.update can work target.update( target_obj.obj_to_primitive() or {}) @@ -59,7 +59,7 @@ def check_policy(context, action, target_obj=None): target.update(target_obj or {}) _action = 'restore:%s' % action - smaug.policy.enforce(context, _action, target) + karbor.policy.enforce(context, _action, target) class RestoreViewBuilder(common.ViewBuilder): @@ -130,7 +130,7 @@ class RestoresController(wsgi.Controller): def show(self, req, id): """Return data about the given restore.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show restore with id: %s"), id, context=context) @@ -149,7 +149,7 @@ class RestoresController(wsgi.Controller): def index(self, req): """Returns a list of restores, transformed through view builder.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] LOG.info(_LI("Show restore list"), context=context) @@ -226,7 +226,7 @@ class RestoresController(wsgi.Controller): raise exc.HTTPUnprocessableEntity() LOG.debug('Create restore request body: %s', body) - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] check_policy(context, 'create') restore = body['restore'] LOG.debug('Create restore request : %s', restore) @@ -290,7 +290,7 @@ class RestoresController(wsgi.Controller): try: check_policy(context, 'get', restore) except exception.PolicyNotAuthorized: - # raise RestoreNotFound instead to make sure smaug behaves + # raise RestoreNotFound instead to make sure karbor behaves # as it used to raise exception.RestoreNotFound(restore_id=restore_id) LOG.info(_LI("Restore info retrieved successfully.")) @@ -302,13 +302,13 @@ class RestoresController(wsgi.Controller): except exception.RestoreNotFound as error: raise exc.HTTPNotFound(explanation=error.msg) - if isinstance(restore, objects_base.SmaugObject): + if isinstance(restore, objects_base.KarborObject): restore.update(fields) restore.save() LOG.info(_LI("restore updated successfully.")) else: msg = _("The parameter restore must be a object of " - "SmaugObject class.") + "KarborObject class.") raise exception.InvalidInput(reason=msg) diff --git a/smaug/api/v1/router.py b/karbor/api/v1/router.py similarity index 92% rename from smaug/api/v1/router.py rename to karbor/api/v1/router.py index 97bb2e72..5d9484f3 100644 --- a/smaug/api/v1/router.py +++ b/karbor/api/v1/router.py @@ -10,14 +10,14 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug.api.openstack import ProjectMapper -from smaug.api.v1 import plans -from smaug.api.v1 import protectables -from smaug.api.v1 import providers -from smaug.api.v1 import restores -from smaug.api.v1 import scheduled_operations -from smaug.api.v1 import triggers -from smaug.wsgi import common as wsgi_common +from karbor.api.openstack import ProjectMapper +from karbor.api.v1 import plans +from karbor.api.v1 import protectables +from karbor.api.v1 import providers +from karbor.api.v1 import restores +from karbor.api.v1 import scheduled_operations +from karbor.api.v1 import triggers +from karbor.wsgi import common as wsgi_common class APIRouter(wsgi_common.Router): diff --git a/smaug/api/v1/scheduled_operations.py b/karbor/api/v1/scheduled_operations.py similarity index 92% rename from smaug/api/v1/scheduled_operations.py rename to karbor/api/v1/scheduled_operations.py index 6b797551..e76c1e59 100644 --- a/smaug/api/v1/scheduled_operations.py +++ b/karbor/api/v1/scheduled_operations.py @@ -16,15 +16,15 @@ from oslo_log import log as logging from oslo_utils import uuidutils from webob import exc -from smaug.api import common -from smaug.api.openstack import wsgi -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug import policy -from smaug.services.operationengine import api as operationengine_api -from smaug.services.operationengine import operation_manager -from smaug import utils +from karbor.api import common +from karbor.api.openstack import wsgi +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor import policy +from karbor.services.operationengine import api as operationengine_api +from karbor.services.operationengine import operation_manager +from karbor import utils LOG = logging.getLogger(__name__) @@ -94,7 +94,7 @@ class ScheduledOperationController(wsgi.Controller): raise exc.HTTPUnprocessableEntity() LOG.debug('Create a scheduled operation, request body: %s', body) - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] check_policy(context, 'create') operation_info = body['scheduled_operation'] @@ -156,7 +156,7 @@ class ScheduledOperationController(wsgi.Controller): LOG.debug('Delete scheduled operation(%s) start', id) - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] operation = self._get_operation_by_id(context, id, ['trigger']) trigger = operation.trigger @@ -178,7 +178,7 @@ class ScheduledOperationController(wsgi.Controller): LOG.debug('Get scheduled operation(%s) start', id) - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] operation = self._get_operation_by_id(context, id) check_policy(context, 'get', operation) @@ -187,7 +187,7 @@ class ScheduledOperationController(wsgi.Controller): def index(self, req): """Returns a list of operations, transformed through view builder.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] check_policy(context, 'list') params = req.params.copy() @@ -257,11 +257,11 @@ class ScheduledOperationController(wsgi.Controller): def _raise_unknown_exception(self, exception_instance): value = exception_instance.msg if isinstance( - exception_instance, exception.SmaugException) else type( + exception_instance, exception.KarborException) else type( exception_instance) msg = (_('Unexpected API Error. Please report this at ' - 'http://bugs.launchpad.net/smaug/ and attach the ' - 'Smaug API log if possible.\n%s') % value) + 'http://bugs.launchpad.net/karbor/ and attach the ' + 'Karbor API log if possible.\n%s') % value) raise exc.HTTPInternalServerError(explanation=msg) diff --git a/smaug/api/v1/triggers.py b/karbor/api/v1/triggers.py similarity index 91% rename from smaug/api/v1/triggers.py rename to karbor/api/v1/triggers.py index 7b6f6e8c..aeb504f8 100644 --- a/smaug/api/v1/triggers.py +++ b/karbor/api/v1/triggers.py @@ -18,14 +18,14 @@ from oslo_utils import uuidutils import uuid from webob import exc -from smaug.api import common -from smaug.api.openstack import wsgi -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug import policy -from smaug.services.operationengine import api as operationengine_api -from smaug import utils +from karbor.api import common +from karbor.api.openstack import wsgi +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor import policy +from karbor.services.operationengine import api as operationengine_api +from karbor import utils LOG = logging.getLogger(__name__) @@ -90,7 +90,7 @@ class TriggersController(wsgi.Controller): raise exc.HTTPUnprocessableEntity() LOG.debug('Create a trigger, request body: %s', body) - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] check_policy(context, 'create') trigger_info = body['trigger_info'] @@ -126,7 +126,7 @@ class TriggersController(wsgi.Controller): LOG.debug('Delete trigger(%s) start', id) - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] trigger = self._get_trigger_by_id(context, id) check_policy(context, 'delete', trigger) @@ -157,7 +157,7 @@ class TriggersController(wsgi.Controller): LOG.debug('Update trigger(%s) start', id) - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] trigger = self._get_trigger_by_id(context, id) check_policy(context, 'update', trigger) @@ -190,7 +190,7 @@ class TriggersController(wsgi.Controller): LOG.debug('Get trigger(%s) start', id) - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] trigger = self._get_trigger_by_id(context, id) check_policy(context, 'get', trigger) @@ -199,7 +199,7 @@ class TriggersController(wsgi.Controller): def index(self, req): """Returns a list of triggers, transformed through view builder.""" - context = req.environ['smaug.context'] + context = req.environ['karbor.context'] check_policy(context, 'list') params = req.params.copy() @@ -240,11 +240,11 @@ class TriggersController(wsgi.Controller): def _raise_unknown_exception(self, exception_instance): value = exception_instance.msg if isinstance( - exception_instance, exception.SmaugException) else type( + exception_instance, exception.KarborException) else type( exception_instance) msg = (_('Unexpected API Error. Please report this at ' - 'http://bugs.launchpad.net/smaug/ and attach the ' - 'Smaug API log if possible.\n%s') % value) + 'http://bugs.launchpad.net/karbor/ and attach the ' + 'Karbor API log if possible.\n%s') % value) raise exc.HTTPInternalServerError(explanation=msg) diff --git a/smaug/api/versions.py b/karbor/api/versions.py similarity index 97% rename from smaug/api/versions.py rename to karbor/api/versions.py index 134907cd..b9619152 100644 --- a/smaug/api/versions.py +++ b/karbor/api/versions.py @@ -11,11 +11,11 @@ # under the License. import httplib +from karbor.api.openstack import wsgi from oslo_log import log as logging import webob.dec from oslo_serialization import jsonutils -from smaug.api.openstack import wsgi LOG = logging.getLogger(__name__) diff --git a/smaug/cmd/__init__.py b/karbor/cmd/__init__.py similarity index 100% rename from smaug/cmd/__init__.py rename to karbor/cmd/__init__.py diff --git a/smaug/cmd/api.py b/karbor/cmd/api.py similarity index 75% rename from smaug/cmd/api.py rename to karbor/cmd/api.py index 19ebc823..90b23d71 100644 --- a/smaug/cmd/api.py +++ b/karbor/cmd/api.py @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Starter script for smaug OS API.""" +"""Starter script for karbor OS API.""" import eventlet eventlet.monkey_patch() @@ -22,13 +22,13 @@ from oslo_config import cfg from oslo_log import log as logging # Need to register global_opts -from smaug.common import config # noqa -from smaug import i18n +from karbor.common import config # noqa +from karbor import i18n i18n.enable_lazy() -from smaug import objects -from smaug import rpc -from smaug import service -from smaug import version +from karbor import objects +from karbor import rpc +from karbor import service +from karbor import version CONF = cfg.CONF @@ -36,12 +36,12 @@ CONF = cfg.CONF def main(): objects.register_all() - CONF(sys.argv[1:], project='smaug', + CONF(sys.argv[1:], project='karbor', version=version.version_string()) - logging.setup(CONF, "smaug") + logging.setup(CONF, "karbor") rpc.init(CONF) launcher = service.process_launcher() - server = service.WSGIService('osapi_smaug') + server = service.WSGIService('osapi_karbor') launcher.launch_service(server, workers=server.workers) launcher.wait() diff --git a/smaug/cmd/manage.py b/karbor/cmd/manage.py similarity index 90% rename from smaug/cmd/manage.py rename to karbor/cmd/manage.py index 9187c3ec..8103f312 100644 --- a/smaug/cmd/manage.py +++ b/karbor/cmd/manage.py @@ -12,7 +12,7 @@ # limitations under the License. """ - CLI interface for smaug management. + CLI interface for karbor management. """ from __future__ import print_function @@ -25,19 +25,19 @@ from oslo_config import cfg from oslo_db.sqlalchemy import migration from oslo_log import log as logging -from smaug import i18n +from karbor import i18n i18n.enable_lazy() # Need to register global_opts -from smaug.common import config # noqa -from smaug import context -from smaug import db -from smaug.db import migration as db_migration -from smaug.db.sqlalchemy import api as db_api -from smaug.i18n import _ -from smaug import objects -from smaug import utils -from smaug import version +from karbor.common import config # noqa +from karbor import context +from karbor import db +from karbor.db import migration as db_migration +from karbor.db.sqlalchemy import api as db_api +from karbor.i18n import _ +from karbor import objects +from karbor import utils +from karbor import version CONF = cfg.CONF @@ -93,9 +93,9 @@ class ConfigCommands(object): @args('param', nargs='?', default=None, help='Configuration parameter to display (default: %(default)s)') def list(self, param=None): - """List parameters configured for smaug. + """List parameters configured for karbor. - Lists all parameters configured for smaug unless an optional argument + Lists all parameters configured for karbor unless an optional argument is specified. If the parameter is specified we only print the requested parameter. If the parameter is not found an appropriate error is produced by .get*(). @@ -111,7 +111,7 @@ class ConfigCommands(object): class ServiceCommands(object): """Methods for managing services.""" def list(self): - """Show a list of all smaug services.""" + """Show a list of all karbor services.""" ctxt = context.get_admin_context() services = db.service_get_all(ctxt) @@ -210,7 +210,7 @@ def main(): CONF.register_cli_opt(category_opt) script_name = sys.argv[0] if len(sys.argv) < 2: - print(_("\nOpenStack Smaug version: %(version)s\n") % + print(_("\nOpenStack Karbor version: %(version)s\n") % {'version': version.version_string()}) print(script_name + " category action []") print(_("Available categories:")) @@ -219,9 +219,9 @@ def main(): sys.exit(2) try: - CONF(sys.argv[1:], project='smaug', + CONF(sys.argv[1:], project='karbor', version=version.version_string()) - logging.setup(CONF, "smaug") + logging.setup(CONF, "karbor") except cfg.ConfigDirNotFoundError as details: print(_("Invalid directory: %s") % details) sys.exit(2) @@ -237,7 +237,7 @@ def main(): except Exception: print(_('sudo failed, continuing as if nothing happened')) - print(_('Please re-run smaug-manage as root.')) + print(_('Please re-run karbor-manage as root.')) sys.exit(2) fn = CONF.category.action_fn diff --git a/smaug/cmd/operationengine.py b/karbor/cmd/operationengine.py similarity index 72% rename from smaug/cmd/operationengine.py rename to karbor/cmd/operationengine.py index 8b58ea7a..b873c96b 100644 --- a/smaug/cmd/operationengine.py +++ b/karbor/cmd/operationengine.py @@ -11,7 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. -"""Starter script for smaug OperationEngine.""" +"""Starter script for karbor OperationEngine.""" import eventlet eventlet.monkey_patch() @@ -21,14 +21,14 @@ import sys from oslo_config import cfg from oslo_log import log as logging -from smaug import i18n +from karbor import i18n i18n.enable_lazy() -from smaug import objects +from karbor import objects # Need to register global_opts -from smaug.common import config # noqa -from smaug import service -from smaug import version +from karbor.common import config # noqa +from karbor import service +from karbor import version CONF = cfg.CONF @@ -36,9 +36,9 @@ CONF = cfg.CONF def main(): objects.register_all() - CONF(sys.argv[1:], project='smaug', + CONF(sys.argv[1:], project='karbor', version=version.version_string()) - logging.setup(CONF, "smaug") - server = service.Service.create(binary='smaug-operationengine') + logging.setup(CONF, "karbor") + server = service.Service.create(binary='karbor-operationengine') service.serve(server) service.wait() diff --git a/smaug/cmd/protection.py b/karbor/cmd/protection.py similarity index 73% rename from smaug/cmd/protection.py rename to karbor/cmd/protection.py index 3fb7468d..e8b5fa22 100644 --- a/smaug/cmd/protection.py +++ b/karbor/cmd/protection.py @@ -11,7 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. -"""Starter script for smaug protection service.""" +"""Starter script for karbor protection service.""" import eventlet eventlet.monkey_patch() @@ -21,14 +21,14 @@ import sys from oslo_config import cfg from oslo_log import log as logging -from smaug import i18n +from karbor import i18n i18n.enable_lazy() -from smaug import objects +from karbor import objects # Need to register global_opts -from smaug.common import config # noqa -from smaug import service -from smaug import version +from karbor.common import config # noqa +from karbor import service +from karbor import version CONF = cfg.CONF @@ -36,9 +36,9 @@ CONF = cfg.CONF def main(): objects.register_all() - CONF(sys.argv[1:], project='smaug', + CONF(sys.argv[1:], project='karbor', version=version.version_string()) - logging.setup(CONF, "smaug") - server = service.Service.create(binary='smaug-protection') + logging.setup(CONF, "karbor") + server = service.Service.create(binary='karbor-protection') service.serve(server) service.wait() diff --git a/smaug/common/__init__.py b/karbor/common/__init__.py similarity index 100% rename from smaug/common/__init__.py rename to karbor/common/__init__.py diff --git a/smaug/common/config.py b/karbor/common/config.py similarity index 85% rename from smaug/common/config.py rename to karbor/common/config.py index 956c48c0..ed78dc11 100644 --- a/smaug/common/config.py +++ b/karbor/common/config.py @@ -31,11 +31,11 @@ logging.register_options(CONF) core_opts = [ cfg.StrOpt('api_paste_config', default="api-paste.ini", - help='File name for the paste.deploy config for smaug-api'), + help='File name for the paste.deploy config for karbor-api'), cfg.StrOpt('state_path', - default='/var/lib/smaug', + default='/var/lib/karbor', deprecated_name='pybasedir', - help="Top-level directory for maintaining smaug's state"), + help="Top-level directory for maintaining karbor's state"), ] debug_opts = [ @@ -50,17 +50,17 @@ global_opts = [ help='Maximum time since last check-in for a service to be ' 'considered up'), cfg.StrOpt('operationengine_topic', - default='smaug-operationengine', + default='karbor-operationengine', help='The topic that OperationEngine nodes listen on'), cfg.StrOpt('operationengine_manager', - default='smaug.services.operationengine.manager.' + default='karbor.services.operationengine.manager.' 'OperationEngineManager', help='Full class name for the Manager for OperationEngine'), cfg.StrOpt('protection_topic', - default='smaug-protection', + default='karbor-protection', help='The topic that protection nodes listen on'), cfg.StrOpt('protection_manager', - default='smaug.services.protection.manager.ProtectionManager', + default='karbor.services.protection.manager.ProtectionManager', help='Full class name for the Manager for Protection'), cfg.StrOpt('host', default=socket.gethostname(), diff --git a/smaug/common/constants.py b/karbor/common/constants.py similarity index 100% rename from smaug/common/constants.py rename to karbor/common/constants.py diff --git a/smaug/common/smaug_keystone_plugin.py b/karbor/common/karbor_keystone_plugin.py similarity index 85% rename from smaug/common/smaug_keystone_plugin.py rename to karbor/common/karbor_keystone_plugin.py index 1bb3521b..94949842 100644 --- a/smaug/common/smaug_keystone_plugin.py +++ b/karbor/common/karbor_keystone_plugin.py @@ -18,9 +18,9 @@ from keystoneclient.v3 import client as kc_v3 from oslo_config import cfg from oslo_log import log as logging -from smaug import exception -from smaug.i18n import _LW -from smaug import utils +from karbor import exception +from karbor.i18n import _LW +from karbor import utils LOG = logging.getLogger(__name__) @@ -31,40 +31,40 @@ CONF = cfg.CONF # [trustee] # auth_type = password # auth_url = http://192.168.1.2:35357 -# username = smaug +# username = karbor # password = password # user_domain_id = default TRUSTEE_CONF_GROUP = 'trustee' loading.register_auth_conf_options(CONF, TRUSTEE_CONF_GROUP) -class SmaugKeystonePlugin(object): - """Contruct a keystone client plugin with Smaug user +class KarborKeystonePlugin(object): + """Contruct a keystone client plugin with karbor user to offer the following functions: 1. get the endpoint of service, such as nova, cinder - 2. create trust to smaug + 2. create trust to karbor """ def __init__(self): self._client = None self._auth_uri = "" - self._smaug_user_id = "" + self._karbor_user_id = "" self._do_init() def _do_init(self): - auth_plugin = self._get_smaug_auth_plugin() - # set the project which smaug belongs to + auth_plugin = self._get_karbor_auth_plugin() + # set the project which karbor belongs to auth_plugin._project_name = "service" auth_plugin._project_domain_id = "default" self._client = self._get_keystone_client(auth_plugin) lcfg = CONF[TRUSTEE_CONF_GROUP] - self._smaug_user_id = self._get_service_user( + self._karbor_user_id = self._get_service_user( lcfg.username, lcfg.user_domain_id) try: @@ -93,7 +93,7 @@ class SmaugKeystonePlugin(object): msg = ('get service(%s) endpoint failed' % service_name) raise exception.AuthorizationFailure(obj=msg) - def create_trust_to_smaug(self, context): + def create_trust_to_karbor(self, context): if not context.auth_token_info: msg = ("user=%s, project=%s" % (context.user_id, context.project_id)) @@ -106,7 +106,7 @@ class SmaugKeystonePlugin(object): l_kc_v3 = self._get_keystone_client(user_auth_plugin) try: trust = l_kc_v3.trusts.create(trustor_user=context.user_id, - trustee_user=self._smaug_user_id, + trustee_user=self._karbor_user_id, project=context.project_id, impersonation=True, role_names=context.roles) @@ -115,13 +115,13 @@ class SmaugKeystonePlugin(object): except Exception as e: raise exception.AuthorizationFailure(obj=str(e)) - def delete_trust_to_smaug(self, trust_id): - auth_plugin = self._get_smaug_auth_plugin(trust_id) + def delete_trust_to_karbor(self, trust_id): + auth_plugin = self._get_karbor_auth_plugin(trust_id) client = self._get_keystone_client(auth_plugin) client.trusts.delete(trust_id) def create_trust_session(self, trust_id): - auth_plugin = self._get_smaug_auth_plugin(trust_id) + auth_plugin = self._get_karbor_auth_plugin(trust_id) return keystone_session.Session(auth=auth_plugin) def _get_service_user(self, user_name, user_domain_id): @@ -136,13 +136,13 @@ class SmaugKeystonePlugin(object): msg = ("get service's user(%s) endpoint failed" % user_name) raise exception.AuthorizationFailure(obj=msg) - def _get_smaug_auth_plugin(self, trust_id=None): + def _get_karbor_auth_plugin(self, trust_id=None): auth_plugin = loading.load_auth_from_conf_options( CONF, TRUSTEE_CONF_GROUP, trust_id=trust_id) if not auth_plugin: LOG.warning(_LW('Please add the trustee credentials you ' - 'need to the %s section of your smaug.conf ' + 'need to the %s section of your karbor.conf ' 'file.') % TRUSTEE_CONF_GROUP) raise exception.AuthorizationFailure(obj=TRUSTEE_CONF_GROUP) diff --git a/smaug/context.py b/karbor/context.py similarity index 98% rename from smaug/context.py rename to karbor/context.py index 94f26735..a1cff3cd 100644 --- a/smaug/context.py +++ b/karbor/context.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -"""RequestContext: context for requests that persist through all of smaug.""" +"""RequestContext: context for requests that persist through all of karbor.""" import copy @@ -22,8 +22,8 @@ from oslo_log import log as logging from oslo_utils import timeutils import six -from smaug.i18n import _ -from smaug import policy +from karbor.i18n import _ +from karbor import policy CONF = cfg.CONF diff --git a/smaug/db/__init__.py b/karbor/db/__init__.py similarity index 90% rename from smaug/db/__init__.py rename to karbor/db/__init__.py index 664db07b..d124b1c5 100644 --- a/smaug/db/__init__.py +++ b/karbor/db/__init__.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. """ -DB abstraction for smaug +DB abstraction for karbor """ -from smaug.db.api import * # noqa +from karbor.db.api import * # noqa diff --git a/smaug/db/api.py b/karbor/db/api.py similarity index 98% rename from smaug/db/api.py rename to karbor/db/api.py index c3a21064..a11fa0d9 100644 --- a/smaug/db/api.py +++ b/karbor/db/api.py @@ -12,8 +12,8 @@ """Defines interface for DB access. -Functions in this module are imported into the smaug.db namespace. Call these -functions from smaug.db namespace, not the smaug.db.api namespace. +Functions in this module are imported into the karbor.db namespace. Call these +functions from karbor.db namespace, not the karbor.db.api namespace. All functions in this module return objects that implement a dictionary-like interface. Currently, many of these objects are sqlalchemy objects that @@ -24,7 +24,7 @@ these objects be simple dictionaries. **Related Flags** :connection: string specifying the sqlalchemy connection to use, like: - `sqlite:///var/lib/smaug/smaug.sqlite`. + `sqlite:///var/lib/karbor/karbor.sqlite`. :enable_new_services: when adding a new service to the database, is it in the pool of available hardware (Default: True) @@ -46,9 +46,9 @@ db_opts = [ CONF = cfg.CONF CONF.register_opts(db_opts) db_options.set_defaults(CONF) -CONF.set_default('sqlite_db', 'smaug.sqlite', group='database') +CONF.set_default('sqlite_db', 'karbor.sqlite', group='database') -_BACKEND_MAPPING = {'sqlalchemy': 'smaug.db.sqlalchemy.api'} +_BACKEND_MAPPING = {'sqlalchemy': 'karbor.db.sqlalchemy.api'} IMPL = db_concurrency.TpoolDbapiWrapper(CONF, _BACKEND_MAPPING) diff --git a/smaug/db/base.py b/karbor/db/base.py similarity index 96% rename from smaug/db/base.py rename to karbor/db/base.py index 7c4e5d07..6aa9b6e5 100644 --- a/smaug/db/base.py +++ b/karbor/db/base.py @@ -18,7 +18,7 @@ from oslo_utils import importutils db_driver_opt = cfg.StrOpt('db_driver', - default='smaug.db', + default='karbor.db', help='Driver to use for database access') CONF = cfg.CONF diff --git a/smaug/db/migration.py b/karbor/db/migration.py similarity index 93% rename from smaug/db/migration.py rename to karbor/db/migration.py index 358b9ddb..49dcd004 100644 --- a/smaug/db/migration.py +++ b/karbor/db/migration.py @@ -19,7 +19,7 @@ from oslo_config import cfg from oslo_db import options from stevedore import driver -from smaug.db.sqlalchemy import api as db_api +from karbor.db.sqlalchemy import api as db_api INIT_VERSION = 000 @@ -41,7 +41,7 @@ def get_backend(): with _LOCK: if _IMPL is None: _IMPL = driver.DriverManager( - "smaug.database.migration_backend", + "karbor.database.migration_backend", cfg.CONF.database.backend).driver return _IMPL diff --git a/smaug/db/sqlalchemy/__init__.py b/karbor/db/sqlalchemy/__init__.py similarity index 100% rename from smaug/db/sqlalchemy/__init__.py rename to karbor/db/sqlalchemy/__init__.py diff --git a/smaug/db/sqlalchemy/api.py b/karbor/db/sqlalchemy/api.py similarity index 99% rename from smaug/db/sqlalchemy/api.py rename to karbor/db/sqlalchemy/api.py index 7ec7309d..2280ab96 100644 --- a/smaug/db/sqlalchemy/api.py +++ b/karbor/db/sqlalchemy/api.py @@ -35,15 +35,15 @@ from sqlalchemy.sql import expression from sqlalchemy.sql.expression import literal_column from sqlalchemy.sql import func -from smaug.db.sqlalchemy import models -from smaug import exception -from smaug.i18n import _, _LW +from karbor.db.sqlalchemy import models +from karbor import exception +from karbor.i18n import _, _LW CONF = cfg.CONF LOG = logging.getLogger(__name__) -options.set_defaults(CONF, connection='sqlite:///$state_path/smaug.sqlite') +options.set_defaults(CONF, connection='sqlite:///$state_path/karbor.sqlite') _LOCK = threading.Lock() _FACADE = None @@ -1051,7 +1051,7 @@ def restore_destroy(context, restore_id): def is_valid_model_filters(model, filters): """Return True if filter values exist on the model - :param model: a smaug model + :param model: a karbor model :param filters: dictionary of filters """ for key in filters.keys(): diff --git a/smaug/db/sqlalchemy/migrate_repo/README b/karbor/db/sqlalchemy/migrate_repo/README similarity index 100% rename from smaug/db/sqlalchemy/migrate_repo/README rename to karbor/db/sqlalchemy/migrate_repo/README diff --git a/smaug/db/sqlalchemy/migrate_repo/__init__.py b/karbor/db/sqlalchemy/migrate_repo/__init__.py similarity index 100% rename from smaug/db/sqlalchemy/migrate_repo/__init__.py rename to karbor/db/sqlalchemy/migrate_repo/__init__.py diff --git a/smaug/db/sqlalchemy/migrate_repo/manage.py b/karbor/db/sqlalchemy/migrate_repo/manage.py similarity index 94% rename from smaug/db/sqlalchemy/migrate_repo/manage.py rename to karbor/db/sqlalchemy/migrate_repo/manage.py index 2a4f2b6d..d544b97f 100644 --- a/smaug/db/sqlalchemy/migrate_repo/manage.py +++ b/karbor/db/sqlalchemy/migrate_repo/manage.py @@ -13,7 +13,7 @@ import os -from smaug.db.sqlalchemy import migrate_repo +from karbor.db.sqlalchemy import migrate_repo from migrate.versioning.shell import main diff --git a/smaug/db/sqlalchemy/migrate_repo/migrate.cfg b/karbor/db/sqlalchemy/migrate_repo/migrate.cfg similarity index 97% rename from smaug/db/sqlalchemy/migrate_repo/migrate.cfg rename to karbor/db/sqlalchemy/migrate_repo/migrate.cfg index 04ed3cee..692c7a90 100644 --- a/smaug/db/sqlalchemy/migrate_repo/migrate.cfg +++ b/karbor/db/sqlalchemy/migrate_repo/migrate.cfg @@ -1,7 +1,7 @@ [db_settings] # Used to identify which repository this database is versioned under. # You can use the name of your project. -repository_id=smaug +repository_id=karbor # The name of the database table used to track the schema version. # This name shouldn't already be used by your project. diff --git a/smaug/db/sqlalchemy/migrate_repo/versions/001_smaug_init.py b/karbor/db/sqlalchemy/migrate_repo/versions/001_karbor_init.py similarity index 100% rename from smaug/db/sqlalchemy/migrate_repo/versions/001_smaug_init.py rename to karbor/db/sqlalchemy/migrate_repo/versions/001_karbor_init.py diff --git a/smaug/db/sqlalchemy/migrate_repo/versions/__init__.py b/karbor/db/sqlalchemy/migrate_repo/versions/__init__.py similarity index 100% rename from smaug/db/sqlalchemy/migrate_repo/versions/__init__.py rename to karbor/db/sqlalchemy/migrate_repo/versions/__init__.py diff --git a/smaug/db/sqlalchemy/models.py b/karbor/db/sqlalchemy/models.py similarity index 91% rename from smaug/db/sqlalchemy/models.py rename to karbor/db/sqlalchemy/models.py index a4774bd0..14e5913e 100644 --- a/smaug/db/sqlalchemy/models.py +++ b/karbor/db/sqlalchemy/models.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. """ -SQLAlchemy models for smaug data. +SQLAlchemy models for karbor data. """ from oslo_config import cfg @@ -25,9 +25,9 @@ CONF = cfg.CONF BASE = declarative_base() -class SmaugBase(models.TimestampMixin, - models.ModelBase): - """Base class for Smaug Models.""" +class KarborBase(models.TimestampMixin, + models.ModelBase): + """Base class for karbor Models.""" __table_args__ = {'mysql_engine': 'InnoDB'} @@ -42,7 +42,7 @@ class SmaugBase(models.TimestampMixin, self.save(session=session) -class Service(BASE, SmaugBase): +class Service(BASE, KarborBase): """Represents a running service on a host.""" __tablename__ = 'services' @@ -54,7 +54,7 @@ class Service(BASE, SmaugBase): disabled = Column(Boolean, default=False) disabled_reason = Column(String(255)) # adding column modified_at to contain timestamp - # for manual enable/disable of smaug services + # for manual enable/disable of karbor services # updated_at column will now contain timestamps for # periodic updates modified_at = Column(DateTime) @@ -62,7 +62,7 @@ class Service(BASE, SmaugBase): rpc_available_version = Column(String(36)) -class Trigger(BASE, SmaugBase): +class Trigger(BASE, KarborBase): """Represents a trigger.""" __tablename__ = 'triggers' @@ -74,7 +74,7 @@ class Trigger(BASE, SmaugBase): properties = Column(Text, nullable=False) -class ScheduledOperation(BASE, SmaugBase): +class ScheduledOperation(BASE, KarborBase): """Represents a scheduled operation.""" __tablename__ = 'scheduled_operations' @@ -98,7 +98,7 @@ class ScheduledOperation(BASE, SmaugBase): 'Trigger.deleted == 0)') -class ScheduledOperationState(BASE, SmaugBase): +class ScheduledOperationState(BASE, KarborBase): """Represents a scheduled operation state.""" __tablename__ = 'scheduled_operation_states' @@ -124,7 +124,7 @@ class ScheduledOperationState(BASE, SmaugBase): 'ScheduledOperation.deleted == 0)') -class ScheduledOperationLog(BASE, SmaugBase): +class ScheduledOperationLog(BASE, KarborBase): """Represents a scheduled operation log.""" __tablename__ = 'scheduled_operation_logs' @@ -142,7 +142,7 @@ class ScheduledOperationLog(BASE, SmaugBase): extend_info = Column(Text) -class Plan(BASE, SmaugBase): +class Plan(BASE, KarborBase): """Represents a Plan.""" __tablename__ = 'plans' @@ -154,7 +154,7 @@ class Plan(BASE, SmaugBase): parameters = Column(Text) -class Resource(BASE, SmaugBase): +class Resource(BASE, KarborBase): """Represents a resource in a plan.""" __tablename__ = 'resources' @@ -170,7 +170,7 @@ class Resource(BASE, SmaugBase): 'Resource.deleted == False)') -class Restore(BASE, SmaugBase): +class Restore(BASE, KarborBase): """Represents a Restore.""" __tablename__ = 'restores' @@ -183,7 +183,7 @@ class Restore(BASE, SmaugBase): status = Column(String(64)) -class OperationLog(BASE, SmaugBase): +class OperationLog(BASE, KarborBase): """Represents a operation log.""" __tablename__ = 'operation_logs' @@ -200,7 +200,7 @@ class OperationLog(BASE, SmaugBase): def register_models(): """Register Models and create metadata. - Called from smaug.db.sqlalchemy.__init__ as part of loading the driver, + Called from karbor.db.sqlalchemy.__init__ as part of loading the driver, it will never need to be called explicitly elsewhere unless the connection is lost and needs to be reestablished. """ diff --git a/smaug/exception.py b/karbor/exception.py similarity index 86% rename from smaug/exception.py rename to karbor/exception.py index f46398f2..c167d684 100644 --- a/smaug/exception.py +++ b/karbor/exception.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -"""Smaug base exception handling. +"""karbor base exception handling. -Includes decorator for re-raising Smaug-type exceptions. +Includes decorator for re-raising karbor-type exceptions. SHOULD include dedicated exception logging. @@ -28,7 +28,7 @@ import webob.exc from webob.util import status_generic_reasons from webob.util import status_reasons -from smaug.i18n import _, _LE +from karbor.i18n import _, _LE LOG = logging.getLogger(__name__) @@ -69,8 +69,8 @@ class Error(Exception): pass -class SmaugException(Exception): - """Base Smaug Exception +class KarborException(Exception): + """Base karbor Exception To correctly use this class, inherit from it and define a 'message' property. That message will get printf'd @@ -83,16 +83,16 @@ class SmaugException(Exception): safe = False def __init__(self, message=None, **kwargs): - """Initiate the instance of SmaugException + """Initiate the instance of KarborException There are two ways to initiate the instance. 1. Specify the value of 'message' and leave the 'kwargs' None. 2. Leave 'message' None, and specify the keyword arguments matched - with the format of SmaugException.message. Especially, can't + with the format of KarborException.message. Especially, can't use the 'message' as the key in the 'kwargs', otherwise, the first argument('message') will be set. - Note: This class doesn't support to create instance of SmaugException + Note: This class doesn't support to create instance of KarborException with another instance. """ self.kwargs = kwargs @@ -126,13 +126,13 @@ class SmaugException(Exception): # it, because if we try to access the message via 'message' it will be # overshadowed by the class' message attribute self.msg = message - super(SmaugException, self).__init__(message) + super(KarborException, self).__init__(message) def __unicode__(self): return six.text_type(self.msg) -class NotAuthorized(SmaugException): +class NotAuthorized(KarborException): message = _("Not authorized.") code = 403 @@ -149,7 +149,7 @@ class AuthorizationFailure(NotAuthorized): message = _("Authorization for %(obj)s is failed ") -class Invalid(SmaugException): +class Invalid(KarborException): message = _("Unacceptable parameters.") code = 400 @@ -162,7 +162,7 @@ class InvalidInput(Invalid): message = _("Invalid input received: %(reason)s") -class NotFound(SmaugException): +class NotFound(KarborException): message = _("Resource could not be found.") code = 404 safe = True @@ -172,7 +172,7 @@ class ConfigNotFound(NotFound): message = _("Could not find config at %(path)s") -class MalformedRequestBody(SmaugException): +class MalformedRequestBody(KarborException): message = _("Malformed message body: %(reason)s") @@ -212,7 +212,7 @@ class ScheduledOperationLogNotFound(NotFound): message = _("Scheduled Operation Log %(log_id)s could not be found.") -class ListProtectableResourceFailed(SmaugException): +class ListProtectableResourceFailed(KarborException): message = _("List protectable resources of type %(type)s failed: " "%(reason)s") @@ -263,27 +263,27 @@ class ProviderNotFound(NotFound): " not be found.") -class CreateBackupFailed(SmaugException): +class CreateBackupFailed(KarborException): message = _("Create Backup failed: %(reason)s, id=%(resource_id)s," " type=%(resource_type)s") -class DeleteBackupFailed(SmaugException): +class DeleteBackupFailed(KarborException): message = _("Delete Backup failed: %(reason)s, id=%(resource_id)s," " type=%(resource_type)s") -class RestoreBackupFailed(SmaugException): +class RestoreBackupFailed(KarborException): message = _("Restore Backup failed: %(reason)s, id=%(resource_id)s," " type=%(resource_type)s") -class GetBackupFailed(SmaugException): +class GetBackupFailed(KarborException): message = _("Get Backup failed: %(reason)s, id=%(resource_id)s," " type=%(resource_type)s") -class FlowError(SmaugException): +class FlowError(KarborException): message = _("Flow: %(flow)s, Error: %(error)s") @@ -292,35 +292,35 @@ class CheckpointNotFound(NotFound): " not be found.") -class BankCreateObjectFailed(SmaugException): +class BankCreateObjectFailed(KarborException): message = _("Create Object in Bank Failed: %(reason)s") -class BankUpdateObjectFailed(SmaugException): +class BankUpdateObjectFailed(KarborException): message = _("Update Object %(key)s in Bank Failed: %(reason)s") -class BankDeleteObjectFailed(SmaugException): +class BankDeleteObjectFailed(KarborException): message = _("Delete Object %(key)s in Bank Failed: %(reason)s") -class BankGetObjectFailed(SmaugException): +class BankGetObjectFailed(KarborException): message = _("Get Object %(key)s in Bank Failed: %(reason)s") -class BankListObjectsFailed(SmaugException): +class BankListObjectsFailed(KarborException): message = _("Get Object in Bank Failed: %(reason)s") -class BankReadonlyViolation(SmaugException): +class BankReadonlyViolation(KarborException): message = _("Bank read-only violation") -class AcquireLeaseFailed(SmaugException): +class AcquireLeaseFailed(KarborException): message = _("Acquire Lease in Failed: %(reason)s") -class CreateContainerFailed(SmaugException): +class CreateContainerFailed(KarborException): message = _("Create Container in Bank Failed: %(reason)s") @@ -336,9 +336,9 @@ class InvalidOriginalId(Invalid): message = _("The original_id: %(original_id)s is invalid.") -class CheckpointNotAvailable(SmaugException): +class CheckpointNotAvailable(KarborException): message = _("The checkpoint %(checkpoint_id)s is not available") -class CheckpointNotBeDeleted(SmaugException): +class CheckpointNotBeDeleted(KarborException): message = _("The checkpoint %(checkpoint_id)s can not be deleted.") diff --git a/smaug/i18n.py b/karbor/i18n.py similarity index 98% rename from smaug/i18n.py rename to karbor/i18n.py index b9b039b0..428bfdff 100644 --- a/smaug/i18n.py +++ b/karbor/i18n.py @@ -18,7 +18,7 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html . import oslo_i18n as i18n -DOMAIN = 'smaug' +DOMAIN = 'karbor' _translators = i18n.TranslatorFactory(domain=DOMAIN) diff --git a/smaug/loadables.py b/karbor/loadables.py similarity index 99% rename from smaug/loadables.py rename to karbor/loadables.py index 2bfcc881..620ca25d 100644 --- a/smaug/loadables.py +++ b/karbor/loadables.py @@ -41,7 +41,7 @@ import sys from oslo_utils import importutils -from smaug import exception +from karbor import exception class BaseLoader(object): diff --git a/smaug/manager.py b/karbor/manager.py similarity index 98% rename from smaug/manager.py rename to karbor/manager.py index eb540e9c..62960f66 100644 --- a/smaug/manager.py +++ b/karbor/manager.py @@ -44,8 +44,8 @@ from oslo_log import log as logging import oslo_messaging as messaging from oslo_service import periodic_task -from smaug.db import base -from smaug import version +from karbor.db import base +from karbor import version CONF = cfg.CONF diff --git a/smaug/objects/__init__.py b/karbor/objects/__init__.py similarity index 66% rename from smaug/objects/__init__.py rename to karbor/objects/__init__.py index 4550261e..2d92e09f 100644 --- a/smaug/objects/__init__.py +++ b/karbor/objects/__init__.py @@ -15,11 +15,11 @@ def register_all(): # You must make sure your object gets imported in this # function in order for it to be registered by services that may # need to receive it via RPC. - __import__('smaug.objects.service') - __import__('smaug.objects.plan') - __import__('smaug.objects.scheduled_operation') - __import__('smaug.objects.trigger') - __import__('smaug.objects.scheduled_operation_log') - __import__('smaug.objects.scheduled_operation_state') - __import__('smaug.objects.restore') - __import__('smaug.objects.operation_log') + __import__('karbor.objects.service') + __import__('karbor.objects.plan') + __import__('karbor.objects.scheduled_operation') + __import__('karbor.objects.trigger') + __import__('karbor.objects.scheduled_operation_log') + __import__('karbor.objects.scheduled_operation_state') + __import__('karbor.objects.restore') + __import__('karbor.objects.operation_log') diff --git a/smaug/objects/base.py b/karbor/objects/base.py similarity index 89% rename from smaug/objects/base.py rename to karbor/objects/base.py index ae762f6d..8feeb23d 100644 --- a/smaug/objects/base.py +++ b/karbor/objects/base.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -"""Smaug common internal object model""" +"""karbor common internal object model""" import contextlib import datetime @@ -19,11 +19,11 @@ from oslo_log import log as logging from oslo_versionedobjects import base from oslo_versionedobjects import fields -from smaug import db -from smaug.db.sqlalchemy import models -from smaug import exception -from smaug.i18n import _ -from smaug import objects +from karbor import db +from karbor.db.sqlalchemy import models +from karbor import exception +from karbor.i18n import _ +from karbor import objects LOG = logging.getLogger('object') @@ -32,7 +32,7 @@ remotable_classmethod = base.remotable_classmethod obj_make_list = base.obj_make_list -class SmaugObjectRegistry(base.VersionedObjectRegistry): +class KarborObjectRegistry(base.VersionedObjectRegistry): def registration_hook(self, cls, index): setattr(objects, cls.obj_name(), cls) # For Versioned Object Classes that have a model store the model in @@ -44,11 +44,11 @@ class SmaugObjectRegistry(base.VersionedObjectRegistry): pass -class SmaugObject(base.VersionedObject): - OBJ_SERIAL_NAMESPACE = 'smaug_object' - OBJ_PROJECT_NAMESPACE = 'smaug' +class KarborObject(base.VersionedObject): + OBJ_SERIAL_NAMESPACE = 'karbor_object' + OBJ_PROJECT_NAMESPACE = 'karbor' - def smaug_obj_get_changes(self): + def karbor_obj_get_changes(self): """Returns a dict of changed fields with tz unaware datetimes. Any timezone aware datetime field will be converted to UTC timezone @@ -108,11 +108,11 @@ class SmaugObject(base.VersionedObject): # We're using obj_extra_fields to provide aliases for some fields while # in transition period. This override is to make these aliases pass # "'foo' in obj" tests. - return name in self.obj_extra_fields or super(SmaugObject, + return name in self.obj_extra_fields or super(KarborObject, self).__contains__(name) -class SmaugObjectDictCompat(base.VersionedObjectDictCompat): +class KarborObjectDictCompat(base.VersionedObjectDictCompat): """Mix-in to provide dictionary key access compat. If an object needs to support attribute access using @@ -135,7 +135,7 @@ class SmaugObjectDictCompat(base.VersionedObjectDictCompat): # The following preserves that compatibility but in # the future we'll remove this shim altogether so don't # rely on it. - LOG.debug('Smaug object %(object_name)s has no ' + LOG.debug('Karbor object %(object_name)s has no ' 'attribute named: %(attribute_name)s', {'object_name': self.__class__.__name__, 'attribute_name': key}) @@ -153,7 +153,7 @@ class SmaugObjectDictCompat(base.VersionedObjectDictCompat): return None -class SmaugPersistentObject(object): +class KarborPersistentObject(object): """Mixin class for Persistent objects. This adds the fields that we use in common for all persistent objects. @@ -188,7 +188,7 @@ class SmaugPersistentObject(object): self._context = original_context -class SmaugComparableObject(base.ComparableVersionedObject): +class KarborComparableObject(base.ComparableVersionedObject): def __eq__(self, obj): if hasattr(obj, 'obj_to_primitive'): return self.obj_to_primitive() == obj.obj_to_primitive() @@ -199,8 +199,8 @@ class ObjectListBase(base.ObjectListBase): pass -class SmaugObjectSerializer(base.VersionedObjectSerializer): - OBJ_BASE_CLASS = SmaugObject +class KarborObjectSerializer(base.VersionedObjectSerializer): + OBJ_BASE_CLASS = KarborObject class DictOfDictOfStringsField(fields.AutoTypedField): diff --git a/smaug/objects/operation_log.py b/karbor/objects/operation_log.py similarity index 87% rename from smaug/objects/operation_log.py rename to karbor/objects/operation_log.py index 4c0d9e7e..71860198 100644 --- a/smaug/objects/operation_log.py +++ b/karbor/objects/operation_log.py @@ -14,20 +14,20 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_versionedobjects import fields -from smaug import db -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug.objects import base +from karbor import db +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor.objects import base CONF = cfg.CONF LOG = logging.getLogger(__name__) -@base.SmaugObjectRegistry.register -class OperationLog(base.SmaugPersistentObject, base.SmaugObject, - base.SmaugObjectDictCompat, - base.SmaugComparableObject): +@base.KarborObjectRegistry.register +class OperationLog(base.KarborPersistentObject, base.KarborObject, + base.KarborObjectDictCompat, + base.KarborComparableObject): # Version 1.0: Initial version VERSION = '1.0' @@ -61,13 +61,13 @@ class OperationLog(base.SmaugPersistentObject, base.SmaugObject, if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason=_('already created')) - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() db_operation_log = db.operation_log_create(self._context, updates) self._from_db_object(self._context, self, db_operation_log) @base.remotable def save(self): - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() if updates: db.operation_log_update(self._context, self.id, updates) self.obj_reset_changes() @@ -78,8 +78,8 @@ class OperationLog(base.SmaugPersistentObject, base.SmaugObject, db.operation_log_destroy(self._context, self.id) -@base.SmaugObjectRegistry.register -class OperationLogList(base.ObjectListBase, base.SmaugObject): +@base.KarborObjectRegistry.register +class OperationLogList(base.ObjectListBase, base.KarborObject): VERSION = '1.0' fields = { diff --git a/smaug/objects/plan.py b/karbor/objects/plan.py similarity index 92% rename from smaug/objects/plan.py rename to karbor/objects/plan.py index 45b803fb..3f1605b1 100644 --- a/smaug/objects/plan.py +++ b/karbor/objects/plan.py @@ -15,20 +15,20 @@ from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_versionedobjects import fields -from smaug import db -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug.objects import base +from karbor import db +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor.objects import base CONF = cfg.CONF LOG = logging.getLogger(__name__) -@base.SmaugObjectRegistry.register -class Plan(base.SmaugPersistentObject, base.SmaugObject, - base.SmaugObjectDictCompat, - base.SmaugComparableObject): +@base.KarborObjectRegistry.register +class Plan(base.KarborPersistentObject, base.KarborObject, + base.KarborObjectDictCompat, + base.KarborComparableObject): # Version 1.0: Initial version VERSION = '1.0' @@ -107,7 +107,7 @@ class Plan(base.SmaugPersistentObject, base.SmaugObject, if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason=_('already created')) - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() parameters = updates.pop('parameters', None) if parameters is not None: @@ -121,7 +121,7 @@ class Plan(base.SmaugPersistentObject, base.SmaugObject, @base.remotable def save(self): - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() if updates: if 'parameters' in updates: parameters = updates.pop('parameters', None) @@ -150,8 +150,8 @@ class Plan(base.SmaugPersistentObject, base.SmaugObject, db.plan_destroy(self._context, self.id) -@base.SmaugObjectRegistry.register -class PlanList(base.ObjectListBase, base.SmaugObject): +@base.KarborObjectRegistry.register +class PlanList(base.ObjectListBase, base.KarborObject): VERSION = '1.0' fields = { diff --git a/smaug/objects/restore.py b/karbor/objects/restore.py similarity index 88% rename from smaug/objects/restore.py rename to karbor/objects/restore.py index a1b4aa14..946694c5 100644 --- a/smaug/objects/restore.py +++ b/karbor/objects/restore.py @@ -15,20 +15,20 @@ from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_versionedobjects import fields -from smaug import db -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug.objects import base +from karbor import db +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor.objects import base CONF = cfg.CONF LOG = logging.getLogger(__name__) -@base.SmaugObjectRegistry.register -class Restore(base.SmaugPersistentObject, base.SmaugObject, - base.SmaugObjectDictCompat, - base.SmaugComparableObject): +@base.KarborObjectRegistry.register +class Restore(base.KarborPersistentObject, base.KarborObject, + base.KarborObjectDictCompat, + base.KarborComparableObject): # Version 1.0: Initial version VERSION = '1.0' @@ -63,7 +63,7 @@ class Restore(base.SmaugPersistentObject, base.SmaugObject, if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason=_('already created')) - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() parameters = updates.pop('parameters', None) if parameters is not None: @@ -74,7 +74,7 @@ class Restore(base.SmaugPersistentObject, base.SmaugObject, @base.remotable def save(self): - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() if updates: db.restore_update(self._context, self.id, updates) self.obj_reset_changes() @@ -85,8 +85,8 @@ class Restore(base.SmaugPersistentObject, base.SmaugObject, db.restore_destroy(self._context, self.id) -@base.SmaugObjectRegistry.register -class RestoreList(base.ObjectListBase, base.SmaugObject): +@base.KarborObjectRegistry.register +class RestoreList(base.ObjectListBase, base.KarborObject): VERSION = '1.0' fields = { diff --git a/smaug/objects/scheduled_operation.py b/karbor/objects/scheduled_operation.py similarity index 88% rename from smaug/objects/scheduled_operation.py rename to karbor/objects/scheduled_operation.py index 19a98490..c177ff2b 100644 --- a/smaug/objects/scheduled_operation.py +++ b/karbor/objects/scheduled_operation.py @@ -15,20 +15,20 @@ from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_versionedobjects import fields -from smaug import db -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug.objects import base +from karbor import db +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor.objects import base CONF = cfg.CONF LOG = logging.getLogger(__name__) -@base.SmaugObjectRegistry.register -class ScheduledOperation(base.SmaugPersistentObject, base.SmaugObject, - base.SmaugObjectDictCompat, - base.SmaugComparableObject): +@base.KarborObjectRegistry.register +class ScheduledOperation(base.KarborPersistentObject, base.KarborObject, + base.KarborObjectDictCompat, + base.KarborComparableObject): # Version 1.0: Initial version VERSION = '1.0' @@ -94,14 +94,14 @@ class ScheduledOperation(base.SmaugPersistentObject, base.SmaugObject, raise exception.ObjectActionError(action='create', reason=_('already created')) - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() self._convert_operation_definition_to_db_format(updates) db_op = db.scheduled_operation_create(self._context, updates) self._from_db_object(self._context, self, db_op) @base.remotable def save(self): - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() if updates and self.id: db.scheduled_operation_update(self._context, self.id, @@ -114,8 +114,8 @@ class ScheduledOperation(base.SmaugPersistentObject, base.SmaugObject, db.scheduled_operation_delete(self._context, self.id) -@base.SmaugObjectRegistry.register -class ScheduledOperationList(base.ObjectListBase, base.SmaugObject): +@base.KarborObjectRegistry.register +class ScheduledOperationList(base.ObjectListBase, base.KarborObject): VERSION = '1.0' fields = { diff --git a/smaug/objects/scheduled_operation_log.py b/karbor/objects/scheduled_operation_log.py similarity index 85% rename from smaug/objects/scheduled_operation_log.py rename to karbor/objects/scheduled_operation_log.py index e6500b31..36e0ea52 100644 --- a/smaug/objects/scheduled_operation_log.py +++ b/karbor/objects/scheduled_operation_log.py @@ -14,19 +14,19 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_versionedobjects import fields -from smaug import db -from smaug import exception -from smaug.i18n import _ -from smaug.objects import base +from karbor import db +from karbor import exception +from karbor.i18n import _ +from karbor.objects import base CONF = cfg.CONF LOG = logging.getLogger(__name__) -@base.SmaugObjectRegistry.register -class ScheduledOperationLog(base.SmaugPersistentObject, base.SmaugObject, - base.SmaugObjectDictCompat, - base.SmaugComparableObject): +@base.KarborObjectRegistry.register +class ScheduledOperationLog(base.KarborPersistentObject, base.KarborObject, + base.KarborObjectDictCompat, + base.KarborComparableObject): # Version 1.0: Initial version VERSION = '1.0' @@ -62,13 +62,13 @@ class ScheduledOperationLog(base.SmaugPersistentObject, base.SmaugObject, raise exception.ObjectActionError(action='create', reason=_('already created')) - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() db_log = db.scheduled_operation_log_create(self._context, updates) self._from_db_object(self._context, self, db_log) @base.remotable def save(self): - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() if updates and self.id is not None: db.scheduled_operation_log_update(self._context, self.id, updates) self.obj_reset_changes() @@ -85,8 +85,8 @@ class ScheduledOperationLog(base.SmaugPersistentObject, base.SmaugObject, context, operation_id, retained_num, excepted_states) -@base.SmaugObjectRegistry.register -class ScheduledOperationLogList(base.ObjectListBase, base.SmaugObject): +@base.KarborObjectRegistry.register +class ScheduledOperationLogList(base.ObjectListBase, base.KarborObject): VERSION = '1.0' fields = { diff --git a/smaug/objects/scheduled_operation_state.py b/karbor/objects/scheduled_operation_state.py similarity index 88% rename from smaug/objects/scheduled_operation_state.py rename to karbor/objects/scheduled_operation_state.py index a2988fbe..239c3320 100644 --- a/smaug/objects/scheduled_operation_state.py +++ b/karbor/objects/scheduled_operation_state.py @@ -14,20 +14,20 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_versionedobjects import fields -from smaug import db -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug.objects import base +from karbor import db +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor.objects import base CONF = cfg.CONF LOG = logging.getLogger(__name__) -@base.SmaugObjectRegistry.register -class ScheduledOperationState(base.SmaugPersistentObject, base.SmaugObject, - base.SmaugObjectDictCompat, - base.SmaugComparableObject): +@base.KarborObjectRegistry.register +class ScheduledOperationState(base.KarborPersistentObject, base.KarborObject, + base.KarborObjectDictCompat, + base.KarborComparableObject): # Version 1.0: Initial version VERSION = '1.0' @@ -81,13 +81,13 @@ class ScheduledOperationState(base.SmaugPersistentObject, base.SmaugObject, raise exception.ObjectActionError(action='create', reason=_('already created')) - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() db_state = db.scheduled_operation_state_create(self._context, updates) self._from_db_object(self._context, self, db_state) @base.remotable def save(self): - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() if updates and self.operation_id: db.scheduled_operation_state_update(self._context, self.operation_id, @@ -101,8 +101,8 @@ class ScheduledOperationState(base.SmaugPersistentObject, base.SmaugObject, self.operation_id) -@base.SmaugObjectRegistry.register -class ScheduledOperationStateList(base.ObjectListBase, base.SmaugObject): +@base.KarborObjectRegistry.register +class ScheduledOperationStateList(base.ObjectListBase, base.KarborObject): VERSION = '1.0' fields = { diff --git a/smaug/objects/service.py b/karbor/objects/service.py similarity index 87% rename from smaug/objects/service.py rename to karbor/objects/service.py index f519ab5c..083cd9aa 100644 --- a/smaug/objects/service.py +++ b/karbor/objects/service.py @@ -14,20 +14,20 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_versionedobjects import fields -from smaug import db -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug.objects import base +from karbor import db +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor.objects import base CONF = cfg.CONF LOG = logging.getLogger(__name__) -@base.SmaugObjectRegistry.register -class Service(base.SmaugPersistentObject, base.SmaugObject, - base.SmaugObjectDictCompat, - base.SmaugComparableObject): +@base.KarborObjectRegistry.register +class Service(base.KarborPersistentObject, base.KarborObject, + base.KarborObjectDictCompat, + base.KarborComparableObject): # Version 1.0: Initial version VERSION = '1.0' @@ -73,13 +73,13 @@ class Service(base.SmaugPersistentObject, base.SmaugObject, if self.obj_attr_is_set('id'): raise exception.ObjectActionError(action='create', reason=_('already created')) - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() db_service = db.service_create(self._context, updates) self._from_db_object(self._context, self, db_service) @base.remotable def save(self): - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() if updates: db.service_update(self._context, self.id, updates) self.obj_reset_changes() @@ -90,8 +90,8 @@ class Service(base.SmaugPersistentObject, base.SmaugObject, db.service_destroy(self._context, self.id) -@base.SmaugObjectRegistry.register -class ServiceList(base.ObjectListBase, base.SmaugObject): +@base.KarborObjectRegistry.register +class ServiceList(base.ObjectListBase, base.KarborObject): VERSION = '1.0' fields = { diff --git a/smaug/objects/trigger.py b/karbor/objects/trigger.py similarity index 87% rename from smaug/objects/trigger.py rename to karbor/objects/trigger.py index aed3bb9d..22a08d65 100644 --- a/smaug/objects/trigger.py +++ b/karbor/objects/trigger.py @@ -15,17 +15,17 @@ from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_versionedobjects import fields -from smaug import db -from smaug.objects import base +from karbor import db +from karbor.objects import base CONF = cfg.CONF LOG = logging.getLogger(__name__) -@base.SmaugObjectRegistry.register -class Trigger(base.SmaugPersistentObject, base.SmaugObject, - base.SmaugObjectDictCompat, - base.SmaugComparableObject): +@base.KarborObjectRegistry.register +class Trigger(base.KarborPersistentObject, base.KarborObject, + base.KarborObjectDictCompat, + base.KarborComparableObject): # Version 1.0: Initial version VERSION = '1.0' @@ -67,14 +67,14 @@ class Trigger(base.SmaugPersistentObject, base.SmaugObject, @base.remotable def create(self): - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() self._convert_properties_to_db_format(updates) db_trigger = db.trigger_create(self._context, updates) self._from_db_object(self._context, self, db_trigger) @base.remotable def save(self): - updates = self.smaug_obj_get_changes() + updates = self.karbor_obj_get_changes() if updates and self.id: self._convert_properties_to_db_format(updates) db.trigger_update(self._context, self.id, updates) @@ -86,8 +86,8 @@ class Trigger(base.SmaugPersistentObject, base.SmaugObject, db.trigger_delete(self._context, self.id) -@base.SmaugObjectRegistry.register -class TriggerList(base.ObjectListBase, base.SmaugObject): +@base.KarborObjectRegistry.register +class TriggerList(base.ObjectListBase, base.KarborObject): VERSION = '1.0' fields = { diff --git a/smaug/policy.py b/karbor/policy.py similarity index 96% rename from smaug/policy.py rename to karbor/policy.py index 92e77cc3..beca6d7d 100644 --- a/smaug/policy.py +++ b/karbor/policy.py @@ -13,14 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. -"""Policy Engine For Smaug""" +"""Policy Engine For karbor""" from oslo_config import cfg from oslo_policy import opts as policy_opts from oslo_policy import policy -from smaug import exception +from karbor import exception CONF = cfg.CONF policy_opts.set_defaults(cfg.CONF, 'policy.json') @@ -48,7 +48,7 @@ def enforce_action(context, action): def enforce(context, action, target): """Verifies that the action is valid on the target in this context. - :param context: smaug context + :param context: karbor context :param action: string representing the action to be checked this should be colon separated for clarity. i.e. ``compute:create_instance``, diff --git a/smaug/resource.py b/karbor/resource.py similarity index 100% rename from smaug/resource.py rename to karbor/resource.py diff --git a/smaug/rpc.py b/karbor/rpc.py similarity index 96% rename from smaug/rpc.py rename to karbor/rpc.py index fd347288..ac33fbd4 100644 --- a/smaug/rpc.py +++ b/karbor/rpc.py @@ -27,15 +27,15 @@ from oslo_config import cfg import oslo_messaging as messaging from oslo_serialization import jsonutils -import smaug.context -import smaug.exception +import karbor.context +import karbor.exception CONF = cfg.CONF TRANSPORT = None NOTIFIER = None ALLOWED_EXMODS = [ - smaug.exception.__name__, + karbor.exception.__name__, ] EXTRA_EXMODS = [] @@ -107,7 +107,7 @@ class RequestContextSerializer(messaging.Serializer): return _context def deserialize_context(self, context): - return smaug.context.RequestContext.from_dict(context) + return karbor.context.RequestContext.from_dict(context) def get_client(target, version_cap=None, serializer=None): diff --git a/smaug/service.py b/karbor/service.py similarity index 94% rename from smaug/service.py rename to karbor/service.py index e23f7678..cf37c567 100644 --- a/smaug/service.py +++ b/karbor/service.py @@ -26,15 +26,15 @@ from oslo_service import loopingcall from oslo_service import service from oslo_utils import importutils -from smaug import context -from smaug import db -from smaug import exception -from smaug.i18n import _, _LE, _LI, _LW -from smaug.objects import base as objects_base -from smaug import rpc -from smaug import version -from smaug.wsgi import common as wsgi_common -from smaug.wsgi import eventlet_server as wsgi +from karbor import context +from karbor import db +from karbor import exception +from karbor.i18n import _, _LE, _LI, _LW +from karbor.objects import base as objects_base +from karbor import rpc +from karbor import version +from karbor.wsgi import common as wsgi_common +from karbor.wsgi import eventlet_server as wsgi LOG = logging.getLogger(__name__) @@ -51,14 +51,14 @@ service_opts = [ help='Range, in seconds, to randomly delay when starting the' ' periodic task OperationEngine to reduce stampeding.' ' (Disable by setting to 0)'), - cfg.StrOpt('osapi_smaug_listen', + cfg.StrOpt('osapi_karbor_listen', default="0.0.0.0", - help='IP address on which OpenStack Smaug API listens'), - cfg.PortOpt('osapi_smaug_listen_port', + help='IP address on which OpenStack Karbor API listens'), + cfg.PortOpt('osapi_karbor_listen_port', default=8799, - help='Port on which OpenStack Smaug API listens'), - cfg.IntOpt('osapi_smaug_workers', - help='Number of workers for OpenStack Smaug API service. ' + help='Port on which OpenStack Karbor API listens'), + cfg.IntOpt('osapi_karbor_workers', + help='Number of workers for OpenStack Karbor API service. ' 'The default is equal to the number of CPUs available.'), ] CONF = cfg.CONF @@ -118,7 +118,7 @@ class Service(service.Service): target = messaging.Target(topic=self.topic, server=self.host) endpoints = [self.manager] endpoints.extend(self.manager.additional_endpoints) - serializer = objects_base.SmaugObjectSerializer() + serializer = objects_base.KarborObjectSerializer() self.rpcserver = rpc.get_server(target, endpoints, serializer) self.rpcserver.start() @@ -180,7 +180,7 @@ class Service(service.Service): :param host: defaults to CONF.host :param binary: defaults to basename of executable - :param topic: defaults to bin_name - 'smaug-' part + :param topic: defaults to bin_name - 'karbor-' part :param manager: defaults to CONF._manager :param report_interval: defaults to CONF.report_interval :param periodic_interval: defaults to CONF.periodic_interval @@ -194,7 +194,7 @@ class Service(service.Service): if not topic: topic = binary if not manager: - subtopic = topic.rpartition('smaug-')[2] + subtopic = topic.rpartition('karbor-')[2] manager = CONF.get('%s_manager' % subtopic, None) if report_interval is None: report_interval = CONF.report_interval diff --git a/smaug/services/__init__.py b/karbor/services/__init__.py similarity index 100% rename from smaug/services/__init__.py rename to karbor/services/__init__.py diff --git a/smaug/services/operationengine/__init__.py b/karbor/services/operationengine/__init__.py similarity index 100% rename from smaug/services/operationengine/__init__.py rename to karbor/services/operationengine/__init__.py diff --git a/smaug/services/operationengine/api.py b/karbor/services/operationengine/api.py similarity index 94% rename from smaug/services/operationengine/api.py rename to karbor/services/operationengine/api.py index 37e3e09b..37860fed 100644 --- a/smaug/services/operationengine/api.py +++ b/karbor/services/operationengine/api.py @@ -16,8 +16,8 @@ from oslo_config import cfg from oslo_log import log as logging -from smaug.db import base -from smaug.services.operationengine import rpcapi as operationengine_rpcapi +from karbor.db import base +from karbor.services.operationengine import rpcapi as operationengine_rpcapi CONF = cfg.CONF diff --git a/smaug/services/operationengine/engine/__init__.py b/karbor/services/operationengine/engine/__init__.py similarity index 100% rename from smaug/services/operationengine/engine/__init__.py rename to karbor/services/operationengine/engine/__init__.py diff --git a/smaug/services/operationengine/engine/executors/__init__.py b/karbor/services/operationengine/engine/executors/__init__.py similarity index 100% rename from smaug/services/operationengine/engine/executors/__init__.py rename to karbor/services/operationengine/engine/executors/__init__.py diff --git a/smaug/services/operationengine/engine/executors/base.py b/karbor/services/operationengine/engine/executors/base.py similarity index 100% rename from smaug/services/operationengine/engine/executors/base.py rename to karbor/services/operationengine/engine/executors/base.py diff --git a/smaug/services/operationengine/engine/executors/scheduled_operation_executor.py b/karbor/services/operationengine/engine/executors/scheduled_operation_executor.py similarity index 94% rename from smaug/services/operationengine/engine/executors/scheduled_operation_executor.py rename to karbor/services/operationengine/engine/executors/scheduled_operation_executor.py index 9d233608..65f2c6f5 100644 --- a/smaug/services/operationengine/engine/executors/scheduled_operation_executor.py +++ b/karbor/services/operationengine/engine/executors/scheduled_operation_executor.py @@ -19,12 +19,12 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_utils import timeutils -from smaug.common import constants -from smaug import context -from smaug.i18n import _LE, _LW -from smaug import objects -from smaug.services.operationengine.engine.executors import base -from smaug.services.operationengine import operation_manager +from karbor.common import constants +from karbor import context +from karbor.i18n import _LE, _LW +from karbor import objects +from karbor.services.operationengine.engine.executors import base +from karbor.services.operationengine import operation_manager CONF = cfg.CONF diff --git a/smaug/services/operationengine/engine/executors/thread_pool_executor.py b/karbor/services/operationengine/engine/executors/thread_pool_executor.py similarity index 97% rename from smaug/services/operationengine/engine/executors/thread_pool_executor.py rename to karbor/services/operationengine/engine/executors/thread_pool_executor.py index cd3f9827..0c7517bd 100644 --- a/smaug/services/operationengine/engine/executors/thread_pool_executor.py +++ b/karbor/services/operationengine/engine/executors/thread_pool_executor.py @@ -16,8 +16,8 @@ from oslo_config import cfg from oslo_log import log as logging from threading import RLock -from smaug.i18n import _LE -from smaug.services.operationengine.engine.executors import\ +from karbor.i18n import _LE +from karbor.services.operationengine.engine.executors import\ scheduled_operation_executor as base_executor executor_opts = [ diff --git a/smaug/services/operationengine/engine/trigger_manager.py b/karbor/services/operationengine/engine/trigger_manager.py similarity index 96% rename from smaug/services/operationengine/engine/trigger_manager.py rename to karbor/services/operationengine/engine/trigger_manager.py index 22e137a3..c501880a 100644 --- a/smaug/services/operationengine/engine/trigger_manager.py +++ b/karbor/services/operationengine/engine/trigger_manager.py @@ -15,9 +15,9 @@ Manage all triggers. """ from stevedore import driver as import_driver -from smaug import exception -from smaug.i18n import _ -from smaug.services.operationengine.engine import triggers as all_triggers +from karbor import exception +from karbor.i18n import _ +from karbor.services.operationengine.engine import triggers as all_triggers class TriggerManager(object): @@ -36,7 +36,7 @@ class TriggerManager(object): self._trigger_obj_map = {} executor_cls = import_driver.DriverManager( - 'smaug.operationengine.engine.executor', + 'karbor.operationengine.engine.executor', 'executor').driver self._executor = executor_cls() diff --git a/smaug/services/operationengine/engine/triggers/__init__.py b/karbor/services/operationengine/engine/triggers/__init__.py similarity index 98% rename from smaug/services/operationengine/engine/triggers/__init__.py rename to karbor/services/operationengine/engine/triggers/__init__.py index e9f6f434..4c099146 100644 --- a/smaug/services/operationengine/engine/triggers/__init__.py +++ b/karbor/services/operationengine/engine/triggers/__init__.py @@ -14,7 +14,7 @@ from abc import ABCMeta from abc import abstractmethod import six -from smaug import loadables +from karbor import loadables @six.add_metaclass(ABCMeta) diff --git a/smaug/services/operationengine/engine/triggers/timetrigger/__init__.py b/karbor/services/operationengine/engine/triggers/timetrigger/__init__.py similarity index 100% rename from smaug/services/operationengine/engine/triggers/timetrigger/__init__.py rename to karbor/services/operationengine/engine/triggers/timetrigger/__init__.py diff --git a/smaug/services/operationengine/engine/triggers/timetrigger/time_format_manager.py b/karbor/services/operationengine/engine/triggers/timetrigger/time_format_manager.py similarity index 94% rename from smaug/services/operationengine/engine/triggers/timetrigger/time_format_manager.py rename to karbor/services/operationengine/engine/triggers/timetrigger/time_format_manager.py index d504a672..8beb12a4 100644 --- a/smaug/services/operationengine/engine/triggers/timetrigger/time_format_manager.py +++ b/karbor/services/operationengine/engine/triggers/timetrigger/time_format_manager.py @@ -14,9 +14,9 @@ Manage all time formats. """ -from smaug import exception -from smaug.i18n import _ -from smaug.services.operationengine.engine.triggers.timetrigger import\ +from karbor import exception +from karbor.i18n import _ +from karbor.services.operationengine.engine.triggers.timetrigger import\ timeformats diff --git a/smaug/services/operationengine/engine/triggers/timetrigger/time_trigger.py b/karbor/services/operationengine/engine/triggers/timetrigger/time_trigger.py similarity index 98% rename from smaug/services/operationengine/engine/triggers/timetrigger/time_trigger.py rename to karbor/services/operationengine/engine/triggers/timetrigger/time_trigger.py index b92a0a94..4fbb25b0 100644 --- a/smaug/services/operationengine/engine/triggers/timetrigger/time_trigger.py +++ b/karbor/services/operationengine/engine/triggers/timetrigger/time_trigger.py @@ -18,10 +18,10 @@ from oslo_log import log as logging from oslo_utils import timeutils import six -from smaug import exception -from smaug.i18n import _, _LE -from smaug.services.operationengine.engine import triggers -from smaug.services.operationengine.engine.triggers.timetrigger import\ +from karbor import exception +from karbor.i18n import _, _LE +from karbor.services.operationengine.engine import triggers +from karbor.services.operationengine.engine.triggers.timetrigger import\ time_format_manager time_trigger_opts = [ diff --git a/smaug/services/operationengine/engine/triggers/timetrigger/timeformats/__init__.py b/karbor/services/operationengine/engine/triggers/timetrigger/timeformats/__init__.py similarity index 98% rename from smaug/services/operationengine/engine/triggers/timetrigger/timeformats/__init__.py rename to karbor/services/operationengine/engine/triggers/timetrigger/timeformats/__init__.py index 99054b0a..7ca76424 100644 --- a/smaug/services/operationengine/engine/triggers/timetrigger/timeformats/__init__.py +++ b/karbor/services/operationengine/engine/triggers/timetrigger/timeformats/__init__.py @@ -17,7 +17,7 @@ Operation classes from abc import ABCMeta import six -from smaug import loadables +from karbor import loadables @six.add_metaclass(ABCMeta) diff --git a/smaug/services/operationengine/engine/triggers/timetrigger/timeformats/crontab_time.py b/karbor/services/operationengine/engine/triggers/timetrigger/timeformats/crontab_time.py similarity index 92% rename from smaug/services/operationengine/engine/triggers/timetrigger/timeformats/crontab_time.py rename to karbor/services/operationengine/engine/triggers/timetrigger/timeformats/crontab_time.py index 6b9ae027..6fceb370 100644 --- a/smaug/services/operationengine/engine/triggers/timetrigger/timeformats/crontab_time.py +++ b/karbor/services/operationengine/engine/triggers/timetrigger/timeformats/crontab_time.py @@ -14,9 +14,9 @@ from croniter import croniter from datetime import datetime from oslo_utils import timeutils -from smaug import exception -from smaug.i18n import _ -from smaug.services.operationengine.engine.triggers.timetrigger import\ +from karbor import exception +from karbor.i18n import _ +from karbor.services.operationengine.engine.triggers.timetrigger import\ timeformats diff --git a/smaug/services/operationengine/smaug_client.py b/karbor/services/operationengine/karbor_client.py similarity index 95% rename from smaug/services/operationengine/smaug_client.py rename to karbor/services/operationengine/karbor_client.py index d1d1b967..439d9270 100644 --- a/smaug/services/operationengine/smaug_client.py +++ b/karbor/services/operationengine/karbor_client.py @@ -12,5 +12,5 @@ def client(user_id, project_id): - """Get smaug client""" + """Get karbor client""" return None diff --git a/smaug/services/operationengine/manager.py b/karbor/services/operationengine/manager.py similarity index 93% rename from smaug/services/operationengine/manager.py rename to karbor/services/operationengine/manager.py index 22f57179..48903ba6 100644 --- a/smaug/services/operationengine/manager.py +++ b/karbor/services/operationengine/manager.py @@ -18,13 +18,13 @@ from oslo_config import cfg from oslo_log import log as logging import oslo_messaging as messaging -from smaug.common import constants -from smaug import context as smaug_context -from smaug import exception -from smaug import manager -from smaug import objects -from smaug.services.operationengine.engine import trigger_manager -from smaug.services.operationengine import user_trust_manager +from karbor.common import constants +from karbor import context as karbor_context +from karbor import exception +from karbor import manager +from karbor import objects +from karbor.services.operationengine.engine import trigger_manager +from karbor.services.operationengine import user_trust_manager CONF = cfg.CONF @@ -33,7 +33,7 @@ LOG = logging.getLogger(__name__) class OperationEngineManager(manager.Manager): - """Smaug OperationEngine Manager.""" + """karbor OperationEngine Manager.""" RPC_API_VERSION = '1.0' @@ -63,7 +63,7 @@ class OperationEngineManager(manager.Manager): limit = 100 marker = None filters = {} - ctxt = smaug_context.get_admin_context() + ctxt = karbor_context.get_admin_context() while True: triggers = objects.TriggerList.get_by_filters( ctxt, filters, limit, marker) @@ -85,7 +85,7 @@ class OperationEngineManager(manager.Manager): constants.OPERATION_STATE_TRIGGERED, constants.OPERATION_STATE_RUNNING]} columns_to_join = ['operation'] - ctxt = smaug_context.get_admin_context() + ctxt = karbor_context.get_admin_context() resume_states = [constants.OPERATION_STATE_TRIGGERED, constants.OPERATION_STATE_RUNNING] while True: diff --git a/smaug/services/operationengine/operation_manager.py b/karbor/services/operationengine/operation_manager.py similarity index 95% rename from smaug/services/operationengine/operation_manager.py rename to karbor/services/operationengine/operation_manager.py index 3f9f937c..d092fbc5 100644 --- a/smaug/services/operationengine/operation_manager.py +++ b/karbor/services/operationengine/operation_manager.py @@ -14,9 +14,9 @@ Manage all operations. """ -from smaug import exception -from smaug.i18n import _ -from smaug.services.operationengine import operations +from karbor import exception +from karbor.i18n import _ +from karbor.services.operationengine import operations class OperationManager(object): diff --git a/smaug/services/operationengine/operations/__init__.py b/karbor/services/operationengine/operations/__init__.py similarity index 90% rename from smaug/services/operationengine/operations/__init__.py rename to karbor/services/operationengine/operations/__init__.py index 02fa557f..56740dd3 100644 --- a/smaug/services/operationengine/operations/__init__.py +++ b/karbor/services/operationengine/operations/__init__.py @@ -14,8 +14,8 @@ Operation classes """ -from smaug import loadables -from smaug.services.operationengine.operations import base +from karbor import loadables +from karbor.services.operationengine.operations import base class OperationHandler(loadables.BaseLoader): diff --git a/smaug/services/operationengine/operations/base.py b/karbor/services/operationengine/operations/base.py similarity index 98% rename from smaug/services/operationengine/operations/base.py rename to karbor/services/operationengine/operations/base.py index 2b5d9a1f..82795b33 100644 --- a/smaug/services/operationengine/operations/base.py +++ b/karbor/services/operationengine/operations/base.py @@ -22,10 +22,10 @@ from datetime import timedelta from oslo_config import cfg from oslo_log import log as logging -from smaug.common import constants -from smaug import context -from smaug.i18n import _LE -from smaug import objects +from karbor.common import constants +from karbor import context +from karbor.i18n import _LE +from karbor import objects record_operation_log_executor_opts = [ diff --git a/smaug/services/operationengine/operations/protect_operation.py b/karbor/services/operationengine/operations/protect_operation.py similarity index 85% rename from smaug/services/operationengine/operations/protect_operation.py rename to karbor/services/operationengine/operations/protect_operation.py index 7661ed0b..9bd56271 100644 --- a/smaug/services/operationengine/operations/protect_operation.py +++ b/karbor/services/operationengine/operations/protect_operation.py @@ -10,15 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_utils import uuidutils -from smaug.common import constants -from smaug import context -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug.services.operationengine.operations import base -from smaug.services.operationengine import smaug_client +from karbor.common import constants +from karbor import context +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor.services.operationengine import karbor_client +from karbor.services.operationengine.operations import base +from oslo_utils import uuidutils class ProtectOperation(base.Operation): @@ -54,8 +54,8 @@ class ProtectOperation(base.Operation): @classmethod def _run(cls, operation_definition, param, log_ref): - client = smaug_client.client(param.get("user_id"), - param.get("project_id")) + client = karbor_client.client(param.get("user_id"), + param.get("project_id")) try: client.checkpoints.create(operation_definition.get("provider_id"), operation_definition.get("plan_id")) diff --git a/smaug/services/operationengine/rpcapi.py b/karbor/services/operationengine/rpcapi.py similarity index 94% rename from smaug/services/operationengine/rpcapi.py rename to karbor/services/operationengine/rpcapi.py index 083cec90..d67a23f6 100644 --- a/smaug/services/operationengine/rpcapi.py +++ b/karbor/services/operationengine/rpcapi.py @@ -17,8 +17,8 @@ Client side of the OperationEngine manager RPC API. from oslo_config import cfg import oslo_messaging as messaging -from smaug.objects import base as objects_base -from smaug import rpc +from karbor.objects import base as objects_base +from karbor import rpc CONF = cfg.CONF @@ -38,7 +38,7 @@ class OperationEngineAPI(object): super(OperationEngineAPI, self).__init__() target = messaging.Target(topic=CONF.operationengine_topic, version=self.RPC_API_VERSION) - serializer = objects_base.SmaugObjectSerializer() + serializer = objects_base.KarborObjectSerializer() self.client = rpc.get_client(target, version_cap=None, serializer=serializer) diff --git a/smaug/services/operationengine/user_trust_manager.py b/karbor/services/operationengine/user_trust_manager.py similarity index 91% rename from smaug/services/operationengine/user_trust_manager.py rename to karbor/services/operationengine/user_trust_manager.py index 8eaa49c2..18962baa 100644 --- a/smaug/services/operationengine/user_trust_manager.py +++ b/karbor/services/operationengine/user_trust_manager.py @@ -12,8 +12,8 @@ from oslo_log import log as logging -from smaug.common import smaug_keystone_plugin -from smaug.i18n import _LE +from karbor.common import karbor_keystone_plugin +from karbor.i18n import _LE LOG = logging.getLogger(__name__) @@ -31,7 +31,7 @@ class UserTrustManager(object): def __init__(self): self._user_trust_map = {} - self._skp = smaug_keystone_plugin.SmaugKeystonePlugin() + self._skp = karbor_keystone_plugin.KarborKeystonePlugin() def _user_trust_key(self, user_id, project_id): return "%s_%s" % (user_id, project_id) @@ -73,11 +73,11 @@ class UserTrustManager(object): auth_info['operation_ids'].add(operation_id) return auth_info['trust_id'] - trust_id = self._skp.create_trust_to_smaug(context) + trust_id = self._skp.create_trust_to_karbor(context) try: lsession = self._skp.create_trust_session(trust_id) except Exception: - self._skp.delete_trust_to_smaug(trust_id) + self._skp.delete_trust_to_karbor(trust_id) raise self._add_user_trust_info(context.user_id, context.project_id, @@ -94,7 +94,7 @@ class UserTrustManager(object): operation_ids = auth_info['operation_ids'] operation_ids.discard(operation_id) if len(operation_ids) == 0: - self._skp.delete_trust_to_smaug(auth_info['trust_id']) + self._skp.delete_trust_to_karbor(auth_info['trust_id']) self._del_user_trust_info(context.user_id, context.project_id) def resume_operation(self, operation_id, user_id, project_id, trust_id): diff --git a/smaug/services/protection/__init__.py b/karbor/services/protection/__init__.py similarity index 100% rename from smaug/services/protection/__init__.py rename to karbor/services/protection/__init__.py diff --git a/smaug/services/protection/api.py b/karbor/services/protection/api.py similarity index 97% rename from smaug/services/protection/api.py rename to karbor/services/protection/api.py index ff45469b..1e07956e 100644 --- a/smaug/services/protection/api.py +++ b/karbor/services/protection/api.py @@ -16,8 +16,8 @@ from oslo_config import cfg from oslo_log import log as logging -from smaug.db import base -from smaug.services.protection import rpcapi as protection_rpcapi +from karbor.db import base +from karbor.services.protection import rpcapi as protection_rpcapi CONF = cfg.CONF diff --git a/smaug/services/protection/bank_plugin.py b/karbor/services/protection/bank_plugin.py similarity index 99% rename from smaug/services/protection/bank_plugin.py rename to karbor/services/protection/bank_plugin.py index 86f33569..1cd82a2d 100644 --- a/smaug/services/protection/bank_plugin.py +++ b/karbor/services/protection/bank_plugin.py @@ -17,7 +17,7 @@ import six from oslo_config import cfg from oslo_log import log as logging -from smaug import exception +from karbor import exception CONF = cfg.CONF diff --git a/smaug/services/protection/bank_plugins/__init__.py b/karbor/services/protection/bank_plugins/__init__.py similarity index 100% rename from smaug/services/protection/bank_plugins/__init__.py rename to karbor/services/protection/bank_plugins/__init__.py diff --git a/smaug/services/protection/bank_plugins/swift_bank_plugin.py b/karbor/services/protection/bank_plugins/swift_bank_plugin.py similarity index 96% rename from smaug/services/protection/bank_plugins/swift_bank_plugin.py rename to karbor/services/protection/bank_plugins/swift_bank_plugin.py index 054b9333..51cf90a0 100644 --- a/smaug/services/protection/bank_plugins/swift_bank_plugin.py +++ b/karbor/services/protection/bank_plugins/swift_bank_plugin.py @@ -15,19 +15,19 @@ import math import time import uuid +from karbor import exception +from karbor.i18n import _, _LE +from karbor.services.protection.bank_plugin import BankPlugin +from karbor.services.protection.bank_plugin import LeasePlugin +from karbor.services.protection import client_factory from oslo_config import cfg from oslo_log import log as logging from oslo_service import loopingcall -from smaug import exception -from smaug.i18n import _, _LE -from smaug.services.protection.bank_plugin import BankPlugin -from smaug.services.protection.bank_plugin import LeasePlugin -from smaug.services.protection import client_factory from swiftclient import ClientException swift_bank_plugin_opts = [ cfg.StrOpt('bank_swift_object_container', - default='smaug', + default='karbor', help='The default swift container to use.'), ] @@ -45,7 +45,7 @@ lease_opt = [cfg.IntOpt('lease_expire_window', help='validity_window for bank lease, in seconds'), ] -class SwiftConnectionFailed(exception.SmaugException): +class SwiftConnectionFailed(exception.KarborException): message = _("Connection to swift failed: %(reason)s") diff --git a/smaug/services/protection/checkpoint.py b/karbor/services/protection/checkpoint.py similarity index 98% rename from smaug/services/protection/checkpoint.py rename to karbor/services/protection/checkpoint.py index 101a5e11..a3d2c679 100644 --- a/smaug/services/protection/checkpoint.py +++ b/karbor/services/protection/checkpoint.py @@ -11,15 +11,14 @@ # under the License. from datetime import datetime - +from karbor.common import constants +from karbor import exception +from karbor.i18n import _, _LE +from karbor.services.protection import graph from oslo_config import cfg from oslo_log import log as logging from oslo_utils import timeutils from oslo_utils import uuidutils -from smaug.common import constants -from smaug import exception -from smaug.i18n import _, _LE -from smaug.services.protection import graph CONF = cfg.CONF diff --git a/smaug/services/protection/client_factory.py b/karbor/services/protection/client_factory.py similarity index 98% rename from smaug/services/protection/client_factory.py rename to karbor/services/protection/client_factory.py index 23877e77..3ce47a68 100644 --- a/smaug/services/protection/client_factory.py +++ b/karbor/services/protection/client_factory.py @@ -10,12 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. +from karbor.i18n import _LE import os from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils -from smaug.i18n import _LE LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/clients/__init__.py b/karbor/services/protection/clients/__init__.py similarity index 100% rename from smaug/services/protection/clients/__init__.py rename to karbor/services/protection/clients/__init__.py diff --git a/smaug/services/protection/clients/cinder.py b/karbor/services/protection/clients/cinder.py similarity index 96% rename from smaug/services/protection/clients/cinder.py rename to karbor/services/protection/clients/cinder.py index d703e1b1..2c030979 100644 --- a/smaug/services/protection/clients/cinder.py +++ b/karbor/services/protection/clients/cinder.py @@ -13,8 +13,8 @@ from cinderclient import client as cc from oslo_config import cfg from oslo_log import log as logging -from smaug.i18n import _LI, _LE -from smaug.services.protection import utils +from karbor.i18n import _LI, _LE +from karbor.services.protection import utils LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/clients/glance.py b/karbor/services/protection/clients/glance.py similarity index 95% rename from smaug/services/protection/clients/glance.py rename to karbor/services/protection/clients/glance.py index 932d4277..14b9d3c4 100644 --- a/smaug/services/protection/clients/glance.py +++ b/karbor/services/protection/clients/glance.py @@ -13,8 +13,8 @@ from glanceclient import client as gc from oslo_config import cfg from oslo_log import log as logging -from smaug.i18n import _LE, _LI -from smaug.services.protection import utils +from karbor.i18n import _LE, _LI +from karbor.services.protection import utils LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/clients/heat.py b/karbor/services/protection/clients/heat.py similarity index 98% rename from smaug/services/protection/clients/heat.py rename to karbor/services/protection/clients/heat.py index 92fc733c..f110e0ad 100644 --- a/smaug/services/protection/clients/heat.py +++ b/karbor/services/protection/clients/heat.py @@ -14,7 +14,7 @@ from heatclient import client as hc from keystoneclient.v2_0 import client as kc from oslo_log import log as logging -from smaug.i18n import _LE, _LI +from karbor.i18n import _LE, _LI LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/clients/neutron.py b/karbor/services/protection/clients/neutron.py similarity index 95% rename from smaug/services/protection/clients/neutron.py rename to karbor/services/protection/clients/neutron.py index 290102a7..f356624d 100644 --- a/smaug/services/protection/clients/neutron.py +++ b/karbor/services/protection/clients/neutron.py @@ -13,8 +13,8 @@ from neutronclient.v2_0 import client as neutron_client from oslo_config import cfg from oslo_log import log as logging -from smaug.i18n import _LE, _LI -from smaug.services.protection import utils +from karbor.i18n import _LE, _LI +from karbor.services.protection import utils LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/clients/nova.py b/karbor/services/protection/clients/nova.py similarity index 96% rename from smaug/services/protection/clients/nova.py rename to karbor/services/protection/clients/nova.py index 18200b48..b0347452 100644 --- a/smaug/services/protection/clients/nova.py +++ b/karbor/services/protection/clients/nova.py @@ -13,8 +13,8 @@ from novaclient import client as nc from oslo_config import cfg from oslo_log import log as logging -from smaug.i18n import _LI, _LE -from smaug.services.protection import utils +from karbor.i18n import _LI, _LE +from karbor.services.protection import utils LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/clients/swift.py b/karbor/services/protection/clients/swift.py similarity index 98% rename from smaug/services/protection/clients/swift.py rename to karbor/services/protection/clients/swift.py index ebf6693c..caa5cca1 100644 --- a/smaug/services/protection/clients/swift.py +++ b/karbor/services/protection/clients/swift.py @@ -12,8 +12,8 @@ from oslo_config import cfg from oslo_log import log as logging -from smaug.i18n import _LE, _LI -from smaug.services.protection import utils +from karbor.i18n import _LE, _LI +from karbor.services.protection import utils from swiftclient import client as swift LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/flows/__init__.py b/karbor/services/protection/flows/__init__.py similarity index 100% rename from smaug/services/protection/flows/__init__.py rename to karbor/services/protection/flows/__init__.py diff --git a/smaug/services/protection/flows/create_protection.py b/karbor/services/protection/flows/create_protection.py similarity index 98% rename from smaug/services/protection/flows/create_protection.py rename to karbor/services/protection/flows/create_protection.py index 46753050..2a1a9850 100644 --- a/smaug/services/protection/flows/create_protection.py +++ b/karbor/services/protection/flows/create_protection.py @@ -10,11 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. +from karbor.common import constants +from karbor.i18n import _ from oslo_config import cfg from oslo_log import log as logging from oslo_service import loopingcall -from smaug.common import constants -from smaug.i18n import _ from taskflow import task sync_status_opts = [ diff --git a/smaug/services/protection/flows/create_restoration.py b/karbor/services/protection/flows/create_restoration.py similarity index 96% rename from smaug/services/protection/flows/create_restoration.py rename to karbor/services/protection/flows/create_restoration.py index 393ee1a8..2bc122a2 100644 --- a/smaug/services/protection/flows/create_restoration.py +++ b/karbor/services/protection/flows/create_restoration.py @@ -16,9 +16,9 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_service import loopingcall -from smaug.i18n import _, _LE -from smaug.services.protection.client_factory import ClientFactory -from smaug.services.protection.restore_heat import HeatTemplate +from karbor.i18n import _, _LE +from karbor.services.protection.client_factory import ClientFactory +from karbor.services.protection.restore_heat import HeatTemplate from taskflow import task sync_status_opts = [ diff --git a/smaug/services/protection/flows/delete_checkpoint.py b/karbor/services/protection/flows/delete_checkpoint.py similarity index 98% rename from smaug/services/protection/flows/delete_checkpoint.py rename to karbor/services/protection/flows/delete_checkpoint.py index 70f4f5d1..85f2fda2 100644 --- a/smaug/services/protection/flows/delete_checkpoint.py +++ b/karbor/services/protection/flows/delete_checkpoint.py @@ -10,11 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. +from karbor.common import constants +from karbor.i18n import _ from oslo_config import cfg from oslo_log import log as logging from oslo_service import loopingcall -from smaug.common import constants -from smaug.i18n import _ from taskflow import task sync_status_opts = [ diff --git a/smaug/services/protection/flows/worker.py b/karbor/services/protection/flows/worker.py similarity index 90% rename from smaug/services/protection/flows/worker.py rename to karbor/services/protection/flows/worker.py index 1f691a2a..eb48bbdc 100644 --- a/smaug/services/protection/flows/worker.py +++ b/karbor/services/protection/flows/worker.py @@ -15,16 +15,16 @@ from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils -from smaug.common import constants -from smaug.i18n import _LE -from smaug.services.protection.flows import create_protection -from smaug.services.protection.flows import create_restoration -from smaug.services.protection.flows import delete_checkpoint +from karbor.common import constants +from karbor.i18n import _LE +from karbor.services.protection.flows import create_protection +from karbor.services.protection.flows import create_restoration +from karbor.services.protection.flows import delete_checkpoint workflow_opts = [ cfg.StrOpt( 'workflow_engine', - default="smaug.services.protection.flows.workflow.TaskFlowEngine", + default="karbor.services.protection.flows.workflow.TaskFlowEngine", help='The workflow engine provides *flow* and *task* interface') ] diff --git a/smaug/services/protection/flows/workflow.py b/karbor/services/protection/flows/workflow.py similarity index 99% rename from smaug/services/protection/flows/workflow.py rename to karbor/services/protection/flows/workflow.py index a383e97e..7ca6edec 100644 --- a/smaug/services/protection/flows/workflow.py +++ b/karbor/services/protection/flows/workflow.py @@ -14,9 +14,9 @@ import abc import futurist import six +from karbor import exception +from karbor.i18n import _, _LE from oslo_log import log as logging -from smaug import exception -from smaug.i18n import _, _LE from taskflow import engines from taskflow.patterns import graph_flow diff --git a/smaug/services/protection/graph.py b/karbor/services/protection/graph.py similarity index 98% rename from smaug/services/protection/graph.py rename to karbor/services/protection/graph.py index 56c09ab3..d44c84ef 100644 --- a/smaug/services/protection/graph.py +++ b/karbor/services/protection/graph.py @@ -17,9 +17,9 @@ from oslo_log import log as logging import six -from smaug import exception -from smaug.i18n import _ -from smaug.resource import Resource +from karbor import exception +from karbor.i18n import _ +from karbor.resource import Resource _GraphBuilderContext = namedtuple("_GraphBuilderContext", ( diff --git a/smaug/services/protection/manager.py b/karbor/services/protection/manager.py similarity index 95% rename from smaug/services/protection/manager.py rename to karbor/services/protection/manager.py index 552fb44d..3c4d91cd 100644 --- a/smaug/services/protection/manager.py +++ b/karbor/services/protection/manager.py @@ -21,32 +21,32 @@ from oslo_config import cfg from oslo_log import log as logging import oslo_messaging as messaging -from smaug.common import constants -from smaug import exception -from smaug.i18n import _, _LI, _LE -from smaug import manager -from smaug.resource import Resource -from smaug.services.protection.flows import worker as flow_manager -from smaug.services.protection.protectable_registry import ProtectableRegistry -from smaug.services.protection.provider import PluggableProtectionProvider -from smaug import utils +from karbor.common import constants +from karbor import exception +from karbor.i18n import _, _LI, _LE +from karbor import manager +from karbor.resource import Resource +from karbor.services.protection.flows import worker as flow_manager +from karbor.services.protection.protectable_registry import ProtectableRegistry +from karbor.services.protection.provider import PluggableProtectionProvider +from karbor import utils LOG = logging.getLogger(__name__) protection_manager_opts = [ cfg.StrOpt('provider_registry', - default='smaug.services.protection.provider.ProviderRegistry', + default='karbor.services.protection.provider.ProviderRegistry', help='the provider registry') ] CONF = cfg.CONF CONF.register_opts(protection_manager_opts) -PROVIDER_NAMESPACE = 'smaug.provider' +PROVIDER_NAMESPACE = 'karbor.provider' class ProtectionManager(manager.Manager): - """Smaug Protection Manager.""" + """karbor Protection Manager.""" RPC_API_VERSION = '1.0' @@ -192,7 +192,7 @@ class ProtectionManager(manager.Manager): LOG.exception( _LE("Failed to create delete checkpoint flow, checkpoint:%s."), checkpoint_id) - raise exception.SmaugException(_( + raise exception.KarborException(_( "Failed to create delete checkpoint flow." )) try: diff --git a/smaug/services/protection/plugins/__init__.py b/karbor/services/protection/plugins/__init__.py similarity index 100% rename from smaug/services/protection/plugins/__init__.py rename to karbor/services/protection/plugins/__init__.py diff --git a/smaug/services/protection/protectable_plugin.py b/karbor/services/protection/protectable_plugin.py similarity index 100% rename from smaug/services/protection/protectable_plugin.py rename to karbor/services/protection/protectable_plugin.py diff --git a/smaug/services/protection/protectable_plugins/__init__.py b/karbor/services/protection/protectable_plugins/__init__.py similarity index 100% rename from smaug/services/protection/protectable_plugins/__init__.py rename to karbor/services/protection/protectable_plugins/__init__.py diff --git a/smaug/services/protection/protectable_plugins/image.py b/karbor/services/protection/protectable_plugins/image.py similarity index 95% rename from smaug/services/protection/protectable_plugins/image.py rename to karbor/services/protection/protectable_plugins/image.py index 701fc921..04491159 100644 --- a/smaug/services/protection/protectable_plugins/image.py +++ b/karbor/services/protection/protectable_plugins/image.py @@ -12,15 +12,14 @@ import six +from karbor.common import constants +from karbor import exception +from karbor.i18n import _LE +from karbor import resource +from karbor.services.protection.client_factory import ClientFactory +from karbor.services.protection import protectable_plugin from oslo_log import log as logging -from smaug.common import constants -from smaug import exception -from smaug.i18n import _LE -from smaug import resource -from smaug.services.protection.client_factory import ClientFactory -from smaug.services.protection import protectable_plugin - LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/protectable_plugins/project.py b/karbor/services/protection/protectable_plugins/project.py similarity index 92% rename from smaug/services/protection/protectable_plugins/project.py rename to karbor/services/protection/protectable_plugins/project.py index 05db9e37..bddfde5f 100644 --- a/smaug/services/protection/protectable_plugins/project.py +++ b/karbor/services/protection/protectable_plugins/project.py @@ -10,11 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_log import log as logging -from smaug.common import constants -from smaug import resource -from smaug.services.protection import protectable_plugin +from karbor.common import constants +from karbor import resource +from karbor.services.protection import protectable_plugin +from oslo_log import log as logging LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/protectable_plugins/server.py b/karbor/services/protection/protectable_plugins/server.py similarity index 91% rename from smaug/services/protection/protectable_plugins/server.py rename to karbor/services/protection/protectable_plugins/server.py index 099fa1d8..a2f1a4bf 100644 --- a/smaug/services/protection/protectable_plugins/server.py +++ b/karbor/services/protection/protectable_plugins/server.py @@ -12,13 +12,13 @@ import six +from karbor.common import constants +from karbor import exception +from karbor.i18n import _LE +from karbor import resource +from karbor.services.protection.client_factory import ClientFactory +from karbor.services.protection import protectable_plugin from oslo_log import log as logging -from smaug.common import constants -from smaug import exception -from smaug.i18n import _LE -from smaug import resource -from smaug.services.protection.client_factory import ClientFactory -from smaug.services.protection import protectable_plugin LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/protectable_plugins/volume.py b/karbor/services/protection/protectable_plugins/volume.py similarity index 93% rename from smaug/services/protection/protectable_plugins/volume.py rename to karbor/services/protection/protectable_plugins/volume.py index f76ad580..b32c5ed5 100644 --- a/smaug/services/protection/protectable_plugins/volume.py +++ b/karbor/services/protection/protectable_plugins/volume.py @@ -12,13 +12,13 @@ import six +from karbor.common import constants +from karbor import exception +from karbor.i18n import _LE +from karbor import resource +from karbor.services.protection.client_factory import ClientFactory +from karbor.services.protection import protectable_plugin from oslo_log import log as logging -from smaug.common import constants -from smaug import exception -from smaug.i18n import _LE -from smaug import resource -from smaug.services.protection.client_factory import ClientFactory -from smaug.services.protection import protectable_plugin LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/protectable_registry.py b/karbor/services/protection/protectable_registry.py similarity index 94% rename from smaug/services/protection/protectable_registry.py rename to karbor/services/protection/protectable_registry.py index cc1469ad..e77346fb 100644 --- a/smaug/services/protection/protectable_registry.py +++ b/karbor/services/protection/protectable_registry.py @@ -10,18 +10,18 @@ # License for the specific language governing permissions and limitations # under the License. +from karbor import exception +from karbor.i18n import _ +from karbor.services.protection.graph import build_graph import six from oslo_log import log as logging -from smaug import exception -from smaug.i18n import _ -from smaug.services.protection.graph import build_graph from stevedore import extension LOG = logging.getLogger(__name__) -class ProtectablePluginLoadFailed(exception.SmaugException): +class ProtectablePluginLoadFailed(exception.KarborException): message = _("Could not load %(name)s: %(error)s") @@ -41,7 +41,7 @@ class ProtectableRegistry(object): """ mgr = extension.ExtensionManager( - namespace='smaug.protectables', + namespace='karbor.protectables', invoke_on_load=True, on_load_failure_callback=_raise_extension_exception) diff --git a/smaug/services/protection/protection_plugin.py b/karbor/services/protection/protection_plugin.py similarity index 100% rename from smaug/services/protection/protection_plugin.py rename to karbor/services/protection/protection_plugin.py diff --git a/smaug/services/protection/protection_plugins/__init__.py b/karbor/services/protection/protection_plugins/__init__.py similarity index 100% rename from smaug/services/protection/protection_plugins/__init__.py rename to karbor/services/protection/protection_plugins/__init__.py diff --git a/smaug/services/protection/protection_plugins/base_protection_plugin.py b/karbor/services/protection/protection_plugins/base_protection_plugin.py similarity index 97% rename from smaug/services/protection/protection_plugins/base_protection_plugin.py rename to karbor/services/protection/protection_plugins/base_protection_plugin.py index b73be3cd..5fdf6b43 100644 --- a/smaug/services/protection/protection_plugins/base_protection_plugin.py +++ b/karbor/services/protection/protection_plugins/base_protection_plugin.py @@ -13,8 +13,8 @@ import abc import six -from smaug.common import constants -from smaug.services.protection.protection_plugin import ProtectionPlugin +from karbor.common import constants +from karbor.services.protection.protection_plugin import ProtectionPlugin @six.add_metaclass(abc.ABCMeta) diff --git a/smaug/services/protection/protection_plugins/image/__init__.py b/karbor/services/protection/protection_plugins/image/__init__.py similarity index 100% rename from smaug/services/protection/protection_plugins/image/__init__.py rename to karbor/services/protection/protection_plugins/image/__init__.py diff --git a/smaug/services/protection/protection_plugins/image/image_plugin_schemas.py b/karbor/services/protection/protection_plugins/image/image_plugin_schemas.py similarity index 100% rename from smaug/services/protection/protection_plugins/image/image_plugin_schemas.py rename to karbor/services/protection/protection_plugins/image/image_plugin_schemas.py diff --git a/smaug/services/protection/protection_plugins/image/image_protection_plugin.py b/karbor/services/protection/protection_plugins/image/image_protection_plugin.py similarity index 96% rename from smaug/services/protection/protection_plugins/image/image_protection_plugin.py rename to karbor/services/protection/protection_plugins/image/image_protection_plugin.py index e5a56c9e..3ac4c63b 100644 --- a/smaug/services/protection/protection_plugins/image/image_protection_plugin.py +++ b/karbor/services/protection/protection_plugins/image/image_protection_plugin.py @@ -14,16 +14,16 @@ import eventlet import os from io import BytesIO +from karbor.common import constants +from karbor import exception +from karbor.i18n import _, _LE +from karbor.services.protection.client_factory import ClientFactory +from karbor.services.protection.protection_plugins.base_protection_plugin \ + import BaseProtectionPlugin +from karbor.services.protection.protection_plugins.image \ + import image_plugin_schemas as image_schemas from oslo_config import cfg from oslo_log import log as logging -from smaug.common import constants -from smaug import exception -from smaug.i18n import _, _LE -from smaug.services.protection.client_factory import ClientFactory -from smaug.services.protection.protection_plugins.base_protection_plugin \ - import BaseProtectionPlugin -from smaug.services.protection.protection_plugins.image \ - import image_plugin_schemas as image_schemas from time import sleep protection_opts = [ @@ -155,7 +155,7 @@ class GlanceProtectionPlugin(BaseProtectionPlugin): original_image_id = resource_node.value.id heat_template = kwargs.get("heat_template") - name = kwargs.get("restore_name", "smaug-restore-image") + name = kwargs.get("restore_name", "karbor-restore-image") LOG.info(_("restoring image backup, image_id: %s."), original_image_id) diff --git a/smaug/services/protection/protection_plugins/server/__init__.py b/karbor/services/protection/protection_plugins/server/__init__.py similarity index 100% rename from smaug/services/protection/protection_plugins/server/__init__.py rename to karbor/services/protection/protection_plugins/server/__init__.py diff --git a/smaug/services/protection/protection_plugins/server/nova_protection_plugin.py b/karbor/services/protection/protection_plugins/server/nova_protection_plugin.py similarity index 97% rename from smaug/services/protection/protection_plugins/server/nova_protection_plugin.py rename to karbor/services/protection/protection_plugins/server/nova_protection_plugin.py index 681f27cc..d9aae421 100644 --- a/smaug/services/protection/protection_plugins/server/nova_protection_plugin.py +++ b/karbor/services/protection/protection_plugins/server/nova_protection_plugin.py @@ -16,17 +16,17 @@ import os from time import sleep from uuid import uuid4 +from karbor.common import constants +from karbor import exception +from karbor.i18n import _, _LE +from karbor.services.protection.client_factory import ClientFactory +from karbor.services.protection.protection_plugins.base_protection_plugin \ + import BaseProtectionPlugin +from karbor.services.protection.protection_plugins.server \ + import server_plugin_schemas +from karbor.services.protection.restore_heat import HeatResource from oslo_config import cfg from oslo_log import log as logging -from smaug.common import constants -from smaug import exception -from smaug.i18n import _, _LE -from smaug.services.protection.client_factory import ClientFactory -from smaug.services.protection.protection_plugins.base_protection_plugin \ - import BaseProtectionPlugin -from smaug.services.protection.protection_plugins.server \ - import server_plugin_schemas -from smaug.services.protection.restore_heat import HeatResource protection_opts = [ cfg.IntOpt('backup_image_object_size', @@ -282,7 +282,7 @@ class NovaProtectionPlugin(BaseProtectionPlugin): original_server_id = resource_node.value.id heat_template = kwargs.get("heat_template") - restore_name = kwargs.get("restore_name", "smaug-restore-server") + restore_name = kwargs.get("restore_name", "karbor-restore-server") LOG.info(_("restoring server backup, server_id: %s."), original_server_id) diff --git a/smaug/services/protection/protection_plugins/server/server_plugin_schemas.py b/karbor/services/protection/protection_plugins/server/server_plugin_schemas.py similarity index 100% rename from smaug/services/protection/protection_plugins/server/server_plugin_schemas.py rename to karbor/services/protection/protection_plugins/server/server_plugin_schemas.py diff --git a/smaug/services/protection/protection_plugins/volume/__init__.py b/karbor/services/protection/protection_plugins/volume/__init__.py similarity index 100% rename from smaug/services/protection/protection_plugins/volume/__init__.py rename to karbor/services/protection/protection_plugins/volume/__init__.py diff --git a/smaug/services/protection/protection_plugins/volume/cinder_protection_plugin.py b/karbor/services/protection/protection_plugins/volume/cinder_protection_plugin.py similarity index 95% rename from smaug/services/protection/protection_plugins/volume/cinder_protection_plugin.py rename to karbor/services/protection/protection_plugins/volume/cinder_protection_plugin.py index a1802924..f7fa970d 100644 --- a/smaug/services/protection/protection_plugins/volume/cinder_protection_plugin.py +++ b/karbor/services/protection/protection_plugins/volume/cinder_protection_plugin.py @@ -14,18 +14,19 @@ import six from uuid import uuid4 from cinderclient.exceptions import NotFound +from karbor.common import constants +from karbor import exception +from karbor.i18n import _, _LE +from karbor.services.protection.client_factory import ClientFactory +from karbor.services.protection.protection_plugins.base_protection_plugin \ + import BaseProtectionPlugin +from karbor.services.protection.protection_plugins.volume \ + import volume_plugin_cinder_schemas as cinder_schemas +from karbor.services.protection.restore_heat import HeatResource from oslo_config import cfg from oslo_log import log as logging from oslo_service import loopingcall -from smaug.common import constants -from smaug import exception -from smaug.i18n import _, _LE -from smaug.services.protection.client_factory import ClientFactory -from smaug.services.protection.protection_plugins.base_protection_plugin \ - import BaseProtectionPlugin -from smaug.services.protection.protection_plugins.volume \ - import volume_plugin_cinder_schemas as cinder_schemas -from smaug.services.protection.restore_heat import HeatResource + protection_opts = [ cfg.IntOpt('protection_sync_interval', diff --git a/smaug/services/protection/protection_plugins/volume/volume_plugin_cinder_schemas.py b/karbor/services/protection/protection_plugins/volume/volume_plugin_cinder_schemas.py similarity index 100% rename from smaug/services/protection/protection_plugins/volume/volume_plugin_cinder_schemas.py rename to karbor/services/protection/protection_plugins/volume/volume_plugin_cinder_schemas.py diff --git a/smaug/services/protection/provider.py b/karbor/services/protection/provider.py similarity index 94% rename from smaug/services/protection/provider.py rename to karbor/services/protection/provider.py index bc9109f8..44e6d798 100644 --- a/smaug/services/protection/provider.py +++ b/karbor/services/protection/provider.py @@ -12,19 +12,19 @@ import os +from karbor.common import constants +from karbor.i18n import _, _LE +from karbor.resource import Resource +from karbor.services.protection import bank_plugin +from karbor.services.protection.checkpoint import CheckpointCollection +from karbor.services.protection.graph import GraphWalker +from karbor.services.protection.protectable_registry import ProtectableRegistry +from karbor.services.protection.resource_graph import ResourceGraphContext +from karbor.services.protection.resource_graph \ + import ResourceGraphWalkerListener +from karbor import utils from oslo_config import cfg from oslo_log import log as logging -from smaug.common import constants -from smaug.i18n import _, _LE -from smaug.resource import Resource -from smaug.services.protection import bank_plugin -from smaug.services.protection.checkpoint import CheckpointCollection -from smaug.services.protection.graph import GraphWalker -from smaug.services.protection.protectable_registry import ProtectableRegistry -from smaug.services.protection.resource_graph import ResourceGraphContext -from smaug.services.protection.resource_graph \ - import ResourceGraphWalkerListener -from smaug import utils provider_opts = [ cfg.MultiStrOpt('plugin', @@ -47,12 +47,12 @@ CONF = cfg.CONF LOG = logging.getLogger(__name__) -PROTECTION_NAMESPACE = 'smaug.protections' +PROTECTION_NAMESPACE = 'karbor.protections' CONF.register_opt(cfg.StrOpt('provider_config_dir', default='providers.d', help='Configuration directory for providers.' - ' Absolute path, or relative to smaug ' + ' Absolute path, or relative to karbor ' ' configuration directory.')) diff --git a/smaug/services/protection/resource_graph.py b/karbor/services/protection/resource_graph.py similarity index 96% rename from smaug/services/protection/resource_graph.py rename to karbor/services/protection/resource_graph.py index 96be5fa9..439404d1 100644 --- a/smaug/services/protection/resource_graph.py +++ b/karbor/services/protection/resource_graph.py @@ -10,10 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. +from karbor.common import constants +from karbor.i18n import _, _LE +from karbor.services.protection.graph import GraphWalkerListener from oslo_log import log as logging -from smaug.common import constants -from smaug.i18n import _, _LE -from smaug.services.protection.graph import GraphWalkerListener LOG = logging.getLogger(__name__) diff --git a/smaug/services/protection/restore_heat.py b/karbor/services/protection/restore_heat.py similarity index 96% rename from smaug/services/protection/restore_heat.py rename to karbor/services/protection/restore_heat.py index d79e52fa..c6427c18 100644 --- a/smaug/services/protection/restore_heat.py +++ b/karbor/services/protection/restore_heat.py @@ -14,9 +14,9 @@ import datetime import json import yaml +from karbor.exception import InvalidOriginalId +from karbor.i18n import _LE from oslo_log import log as logging -from smaug.exception import InvalidOriginalId -from smaug.i18n import _LE LOG = logging.getLogger(__name__) @@ -42,7 +42,7 @@ class HeatResource(object): class HeatTemplate(object): heat_template_version = str(datetime.date(2015, 10, 15)) - description = "smaug restore template" + description = "karbor restore template" def __init__(self): self._resources = [] diff --git a/smaug/services/protection/rpcapi.py b/karbor/services/protection/rpcapi.py similarity index 97% rename from smaug/services/protection/rpcapi.py rename to karbor/services/protection/rpcapi.py index acb94bb8..d1a9f0d7 100644 --- a/smaug/services/protection/rpcapi.py +++ b/karbor/services/protection/rpcapi.py @@ -19,8 +19,8 @@ Client side of the protection manager RPC API. from oslo_config import cfg import oslo_messaging as messaging -from smaug.objects import base as objects_base -from smaug import rpc +from karbor.objects import base as objects_base +from karbor import rpc CONF = cfg.CONF @@ -40,7 +40,7 @@ class ProtectionAPI(object): super(ProtectionAPI, self).__init__() target = messaging.Target(topic=CONF.protection_topic, version=self.RPC_API_VERSION) - serializer = objects_base.SmaugObjectSerializer() + serializer = objects_base.KarborObjectSerializer() self.client = rpc.get_client(target, version_cap=None, serializer=serializer) diff --git a/smaug/services/protection/utils.py b/karbor/services/protection/utils.py similarity index 93% rename from smaug/services/protection/utils.py rename to karbor/services/protection/utils.py index 39f0c338..690dbab5 100644 --- a/smaug/services/protection/utils.py +++ b/karbor/services/protection/utils.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug import exception -from smaug.i18n import _ +from karbor import exception +from karbor.i18n import _ def _parse_service_catalog_info(config, context): @@ -22,13 +22,13 @@ def _parse_service_catalog_info(config, context): "must be in the form: " "::" ) % config - raise exception.SmaugException(msg) + raise exception.KarborException(msg) for entry in context.service_catalog: if entry.get('type') == service_type: return entry.get('endpoints')[0].get(endpoint_type) - raise exception.SmaugException(_( + raise exception.KarborException(_( "Couldn't find the endpoint of service type %s " "from service catalog") % service_type) diff --git a/smaug/tests/__init__.py b/karbor/tests/__init__.py similarity index 100% rename from smaug/tests/__init__.py rename to karbor/tests/__init__.py diff --git a/smaug/tests/base.py b/karbor/tests/base.py similarity index 93% rename from smaug/tests/base.py rename to karbor/tests/base.py index 102dcb4e..c6b4d823 100644 --- a/smaug/tests/base.py +++ b/karbor/tests/base.py @@ -20,11 +20,11 @@ from oslo_messaging import conffixture as messaging_conffixture from oslo_utils import timeutils from oslotest import base -from smaug.common import config # noqa Need to register global_opts -from smaug.db import migration -from smaug.db.sqlalchemy import api as sqla_api -from smaug import rpc -from smaug.tests.unit import conf_fixture +from karbor.common import config # noqa Need to register global_opts +from karbor.db import migration +from karbor.db.sqlalchemy import api as sqla_api +from karbor import rpc +from karbor.tests.unit import conf_fixture CONF = cfg.CONF @@ -67,7 +67,7 @@ class TestCase(base.BaseTestCase): """Run before each test method to initialize test environment.""" super(TestCase, self).setUp() - rpc.add_extra_exmods("smaug.tests.unit") + rpc.add_extra_exmods("karbor.tests.unit") self.addCleanup(rpc.clear_extra_exmods) self.addCleanup(rpc.cleanup) diff --git a/smaug/tests/contrib/gate_hook.sh b/karbor/tests/contrib/gate_hook.sh similarity index 100% rename from smaug/tests/contrib/gate_hook.sh rename to karbor/tests/contrib/gate_hook.sh diff --git a/smaug/tests/contrib/post_test_hook.sh b/karbor/tests/contrib/post_test_hook.sh similarity index 93% rename from smaug/tests/contrib/post_test_hook.sh rename to karbor/tests/contrib/post_test_hook.sh index f5f66e02..1ac55410 100644 --- a/smaug/tests/contrib/post_test_hook.sh +++ b/karbor/tests/contrib/post_test_hook.sh @@ -2,7 +2,7 @@ set -xe -SMAUG_DIR="$BASE/new/smaug" +KARBOR_DIR="$BASE/new/karbor" TEMPEST_DIR="$BASE/new/tempest" SCRIPTS_DIR="/usr/os-testr-env/bin/" @@ -46,11 +46,11 @@ sudo pip uninstall -y virtualenv sudo pip install "virtualenv>=15.0.1" # Set owner permissions according to job's requirements. -cd "$SMAUG_DIR" -sudo chown -R $owner:stack "$SMAUG_DIR" +cd "$KARBOR_DIR" +sudo chown -R $owner:stack "$KARBOR_DIR" # Run tests -echo "Running smaug $venv tests" +echo "Running karbor $venv tests" set +e sudo -n -H -u "$owner" tox -e "$venv" testr_exit_code=$? diff --git a/smaug/tests/fullstack/__init__.py b/karbor/tests/fullstack/__init__.py similarity index 100% rename from smaug/tests/fullstack/__init__.py rename to karbor/tests/fullstack/__init__.py diff --git a/smaug/tests/fullstack/smaug_base.py b/karbor/tests/fullstack/karbor_base.py similarity index 90% rename from smaug/tests/fullstack/smaug_base.py rename to karbor/tests/fullstack/karbor_base.py index 5662230d..4f640f6d 100644 --- a/smaug/tests/fullstack/smaug_base.py +++ b/karbor/tests/fullstack/karbor_base.py @@ -11,8 +11,8 @@ # under the License. from cinderclient.v2 import client as cinder_client +from karborclient.v1 import client as karbor_client from novaclient import client as nova_client -from smaugclient.v1 import client as smaug_client import os_client_config @@ -38,7 +38,7 @@ def _credentials(cloud='devstack-admin'): return _get_cloud_config(cloud=cloud).get_auth_args() -def _get_smaug_client_from_creds(): +def _get_karbor_client_from_creds(): api_version = "" cloud_config = _get_cloud_config() keystone_session = cloud_config.get_session_client("data-protect") @@ -59,7 +59,7 @@ def _get_smaug_client_from_creds(): 'region_name': region_name, } - client = smaug_client.Client(api_version, endpoint, **kwargs) + client = karbor_client.Client(api_version, endpoint, **kwargs) return client @@ -155,19 +155,19 @@ class ObjectStore(object): close_func() -class SmaugBaseTest(base.BaseTestCase): - """Basic class for Smaug fullstack testing. +class KarborBaseTest(base.BaseTestCase): + """Basic class for karbor fullstack testing. - This class has common code shared for Smaug fullstack testing - including the various clients (smaug) and common + This class has common code shared for karbor fullstack testing + including the various clients (karbor) and common setup/cleanup code. """ def setUp(self): - super(SmaugBaseTest, self).setUp() + super(KarborBaseTest, self).setUp() self.cinder_client = _get_cinder_client_from_creds() self.nova_client = _get_nova_client_from_creds() - self.smaug_client = _get_smaug_client_from_creds() + self.karbor_client = _get_karbor_client_from_creds() self.keystone_endpoint = _get_keystone_endpoint_from_creds() self._testcase_store = ObjectStore() @@ -176,7 +176,7 @@ class SmaugBaseTest(base.BaseTestCase): def tearDown(self): self._testcase_store.close() - super(SmaugBaseTest, self).tearDown() + super(KarborBaseTest, self).tearDown() def provider_list(self): - return self.smaug_client.providers.list() + return self.karbor_client.providers.list() diff --git a/smaug/tests/fullstack/smaug_objects.py b/karbor/tests/fullstack/karbor_objects.py similarity index 80% rename from smaug/tests/fullstack/smaug_objects.py rename to karbor/tests/fullstack/karbor_objects.py index 66a14790..86b54019 100644 --- a/smaug/tests/fullstack/smaug_objects.py +++ b/karbor/tests/fullstack/karbor_objects.py @@ -11,9 +11,9 @@ # under the License. from functools import partial -from smaug.common import constants -from smaug.tests.fullstack import smaug_base as base -from smaug.tests.fullstack import utils +from karbor.common import constants +from karbor.tests.fullstack import karbor_base as base +from karbor.tests.fullstack import utils SHORT_TIMEOUT = 30 MEDIUM_TIMEOUT = 90 @@ -31,11 +31,11 @@ class Checkpoint(object): def __init__(self): self.id = None self._provider_id = None - self.smaug_client = base._get_smaug_client_from_creds() + self.karbor_client = base._get_karbor_client_from_creds() def _checkpoint_status(self, status=None): try: - cp = self.smaug_client.checkpoints.get(self._provider_id, self.id) + cp = self.karbor_client.checkpoints.get(self._provider_id, self.id) except Exception: return False @@ -46,8 +46,8 @@ class Checkpoint(object): def create(self, provider_id, plan_id, timeout=LONG_TIMEOUT): self._provider_id = provider_id - checkpoint = self.smaug_client.checkpoints.create(provider_id, - plan_id) + checkpoint = self.karbor_client.checkpoints.create(provider_id, + plan_id) self.id = checkpoint.id utils.wait_until_true(partial(self._checkpoint_status, constants.CHECKPOINT_STATUS_AVAILABLE), @@ -56,7 +56,7 @@ class Checkpoint(object): def close(self, timeout=LONG_TIMEOUT): try: - self.smaug_client.checkpoints.delete(self._provider_id, self.id) + self.karbor_client.checkpoints.delete(self._provider_id, self.id) except Exception: return utils.wait_until_true(partial(self._checkpoint_status, @@ -69,7 +69,7 @@ class Plan(object): def __init__(self): self.id = None - self.smaug_client = base._get_smaug_client_from_creds() + self.karbor_client = base._get_karbor_client_from_creds() def create(self, provider_id, resources, parameters={"dummy": {"dummy": "dummy"}}, name=None): @@ -80,21 +80,21 @@ class Plan(object): return resource.to_dict() if name is None: - name = "SmaugFullstack-Plan-{id}".format(id=self._name_id) + name = "KarborFullstack-Plan-{id}".format(id=self._name_id) self._name_id += 1 resources = map(_transform_resource, resources) - plan = self.smaug_client.plans.create(name, provider_id, resources, - parameters) + plan = self.karbor_client.plans.create(name, provider_id, resources, + parameters) self.id = plan.id return self.id def update(self, data): - return self.smaug_client.plans.update(self.id, data) + return self.karbor_client.plans.update(self.id, data) def close(self): try: - self.smaug_client.plans.delete(self.id) + self.karbor_client.plans.delete(self.id) except Exception: return @@ -102,11 +102,11 @@ class Plan(object): class Restore(object): def __init__(self): self.id = None - self.smaug_client = base._get_smaug_client_from_creds() + self.karbor_client = base._get_karbor_client_from_creds() def _restore_status(self, status=None): try: - restore = self.smaug_client.restores.get(self.id) + restore = self.karbor_client.restores.get(self.id) except Exception: return False @@ -117,10 +117,10 @@ class Restore(object): def create(self, provider_id, checkpoint_id, target, parameters, timeout=LONG_TIMEOUT): - restore = self.smaug_client.restores.create(provider_id, - checkpoint_id, - target, - parameters) + restore = self.karbor_client.restores.create(provider_id, + checkpoint_id, + target, + parameters) self.id = restore.id utils.wait_until_true(partial(self._restore_status, 'success'), timeout=timeout, sleep=LONG_SLEEP) @@ -135,20 +135,20 @@ class Trigger(object): def __init__(self): self.id = None - self.smaug_client = base._get_smaug_client_from_creds() + self.karbor_client = base._get_karbor_client_from_creds() def create(self, type, properties, name=None): if name is None: - name = "SmaugFullstack-Trigger-{id}".format(id=self._name_id) + name = "KarborFullstack-Trigger-{id}".format(id=self._name_id) self._name_id += 1 - trigger = self.smaug_client.triggers.create(name, type, properties) + trigger = self.karbor_client.triggers.create(name, type, properties) self.id = trigger.id return self.id def close(self): try: - self.smaug_client.triggers.delete(self.id) + self.karbor_client.triggers.delete(self.id) except Exception: return @@ -185,7 +185,7 @@ class Server(object): image = self.nova_client.images.find(name=image) flavor = self.nova_client.flavors.find(name=flavor) if name is None: - name = "SmaugFullstack-Server-{id}".format(id=self._name_id) + name = "KarborFullstack-Server-{id}".format(id=self._name_id) self._name_id += 1 self._name = name @@ -248,7 +248,7 @@ class Volume(object): def create(self, size, name=None, timeout=MEDIUM_TIMEOUT): if name is None: - name = "SmaugFullstack-Volume-{id}".format(id=self._name_id) + name = "KarborFullstack-Volume-{id}".format(id=self._name_id) self._name_id += 1 self._name = name diff --git a/smaug/tests/fullstack/test_checkpoints.py b/karbor/tests/fullstack/test_checkpoints.py similarity index 77% rename from smaug/tests/fullstack/test_checkpoints.py rename to karbor/tests/fullstack/test_checkpoints.py index cb7536b8..be7734d6 100644 --- a/smaug/tests/fullstack/test_checkpoints.py +++ b/karbor/tests/fullstack/test_checkpoints.py @@ -10,12 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug.common import constants -from smaug.tests.fullstack import smaug_base -from smaug.tests.fullstack import smaug_objects as objects +from karbor.common import constants +from karbor.tests.fullstack import karbor_base +from karbor.tests.fullstack import karbor_objects as objects -class CheckpointsTest(smaug_base.SmaugBaseTest): +class CheckpointsTest(karbor_base.KarborBaseTest): """Test Checkpoints operation """ def setUp(self): super(CheckpointsTest, self).setUp() @@ -45,20 +45,20 @@ class CheckpointsTest(smaug_base.SmaugBaseTest): plan = self.store(objects.Plan()) plan.create(self.provider_id, [volume, ]) - checkpoints = self.smaug_client.checkpoints.list(self.provider_id) + checkpoints = self.karbor_client.checkpoints.list(self.provider_id) before_num = len(checkpoints) checkpoint = objects.Checkpoint() checkpoint.create(self.provider_id, plan.id) # sanity - checkpoint_item = self.smaug_client.checkpoints.get(self.provider_id, - checkpoint.id) + checkpoint_item = self.karbor_client.checkpoints.get(self.provider_id, + checkpoint.id) self.assertEqual(constants.CHECKPOINT_STATUS_AVAILABLE, checkpoint_item.status) checkpoint.close() - checkpoints = self.smaug_client.checkpoints.list(self.provider_id) + checkpoints = self.karbor_client.checkpoints.list(self.provider_id) after_num = len(checkpoints) self.assertEqual(before_num, after_num) @@ -68,13 +68,13 @@ class CheckpointsTest(smaug_base.SmaugBaseTest): plan = self.store(objects.Plan()) plan.create(self.provider_id, [volume, ]) - checkpoints = self.smaug_client.checkpoints.list(self.provider_id) + checkpoints = self.karbor_client.checkpoints.list(self.provider_id) before_num = len(checkpoints) checkpoint = objects.Checkpoint() checkpoint.create(self.provider_id, plan.id) - checkpoints = self.smaug_client.checkpoints.list(self.provider_id) + checkpoints = self.karbor_client.checkpoints.list(self.provider_id) after_num = len(checkpoints) self.assertEqual(1, after_num - before_num) @@ -88,8 +88,8 @@ class CheckpointsTest(smaug_base.SmaugBaseTest): checkpoint.create(self.provider_id, plan.id) # sanity - checkpoint_item = self.smaug_client.checkpoints.get(self.provider_id, - checkpoint.id) + checkpoint_item = self.karbor_client.checkpoints.get(self.provider_id, + checkpoint.id) self.assertEqual(constants.CHECKPOINT_STATUS_AVAILABLE, checkpoint_item.status) self.assertEqual(checkpoint.id, checkpoint_item.id) diff --git a/smaug/tests/fullstack/test_plans.py b/karbor/tests/fullstack/test_plans.py similarity index 81% rename from smaug/tests/fullstack/test_plans.py rename to karbor/tests/fullstack/test_plans.py index 1a9cd164..3a007f67 100644 --- a/smaug/tests/fullstack/test_plans.py +++ b/karbor/tests/fullstack/test_plans.py @@ -10,12 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug.common import constants -from smaug.tests.fullstack import smaug_base -from smaug.tests.fullstack import smaug_objects as objects +from karbor.common import constants +from karbor.tests.fullstack import karbor_base +from karbor.tests.fullstack import karbor_objects as objects -class PlansTest(smaug_base.SmaugBaseTest): +class PlansTest(karbor_base.KarborBaseTest): """Test Plans operation""" def setUp(self): super(PlansTest, self).setUp() @@ -24,7 +24,7 @@ class PlansTest(smaug_base.SmaugBaseTest): self.provider_id = providers[0].id def test_plans_list(self): - nplans_before = len(self.smaug_client.plans.list()) + nplans_before = len(self.karbor_client.plans.list()) # create plan volume = self.store(objects.Volume()) volume.create(1) @@ -34,7 +34,7 @@ class PlansTest(smaug_base.SmaugBaseTest): plan2.create(self.provider_id, [volume, ]) # list plans after creating - nplans_after = len(self.smaug_client.plans.list()) + nplans_after = len(self.karbor_client.plans.list()) self.assertEqual(2, nplans_after - nplans_before) def test_plans_get(self): @@ -44,7 +44,7 @@ class PlansTest(smaug_base.SmaugBaseTest): plan = self.store(objects.Plan()) plan.create(self.provider_id, [volume, ], name=plan_name) - plan_item = self.smaug_client.plans.get(plan.id) + plan_item = self.karbor_client.plans.get(plan.id) self.assertEqual(plan_name, plan_item.name) def test_plans_update(self): @@ -60,7 +60,7 @@ class PlansTest(smaug_base.SmaugBaseTest): plan.create(self.provider_id, [volume1, ], name=plan_initial_name) # sanity - plan_item = self.smaug_client.plans.get(plan.id) + plan_item = self.karbor_client.plans.get(plan.id) self.assertEqual(plan_initial_name, plan_item.name) self.assertEqual("suspended", plan_item.status) self.assertEqual([{"id": volume1.id, @@ -70,16 +70,16 @@ class PlansTest(smaug_base.SmaugBaseTest): # update name data = {"name": plan_updated_name} - plan_item = self.smaug_client.plans.update(plan.id, data) + plan_item = self.karbor_client.plans.update(plan.id, data) self.assertEqual(plan_updated_name, plan_item.name) # update resources data = {"resources": [volume2.to_dict(), ]} - plan_item = self.smaug_client.plans.update(plan.id, data) + plan_item = self.karbor_client.plans.update(plan.id, data) self.assertEqual([volume2.to_dict(), ], plan_item.resources) # update status data = {"status": "started"} - plan_item = self.smaug_client.plans.update(plan.id, data) + plan_item = self.karbor_client.plans.update(plan.id, data) self.assertEqual("started", plan_item.status) diff --git a/smaug/tests/fullstack/test_protectables.py b/karbor/tests/fullstack/test_protectables.py similarity index 77% rename from smaug/tests/fullstack/test_protectables.py rename to karbor/tests/fullstack/test_protectables.py index 75883da4..4c03b094 100644 --- a/smaug/tests/fullstack/test_protectables.py +++ b/karbor/tests/fullstack/test_protectables.py @@ -10,37 +10,37 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug.tests.fullstack import smaug_base -from smaug.tests.fullstack import smaug_objects as objects +from karbor.tests.fullstack import karbor_base +from karbor.tests.fullstack import karbor_objects as objects -class ProtectablesTest(smaug_base.SmaugBaseTest): +class ProtectablesTest(karbor_base.KarborBaseTest): """Test Protectables operation """ def test_protectables_get_with_project(self): protectable_type = 'OS::Keystone::Project' - res = self.smaug_client.protectables.get(protectable_type) + res = self.karbor_client.protectables.get(protectable_type) self.assertTrue(len(res.dependent_types)) def test_protectables_list_instances(self): - res_list = self.smaug_client.protectables.list_instances( + res_list = self.karbor_client.protectables.list_instances( 'OS::Cinder::Volume') before_num = len(res_list) volume1 = self.store(objects.Volume()) volume1.create(1) - res_list = self.smaug_client.protectables.list_instances( + res_list = self.karbor_client.protectables.list_instances( 'OS::Cinder::Volume') after_num = len(res_list) self.assertEqual(1, after_num - before_num) def test_protectables_get_with_server(self): - server_list = self.smaug_client.protectables.list_instances( + server_list = self.karbor_client.protectables.list_instances( 'OS::Nova::Server') before_num = len(server_list) server = self.store(objects.Server()) server.create() - server_list = self.smaug_client.protectables.list_instances( + server_list = self.karbor_client.protectables.list_instances( 'OS::Nova::Server') after_num = len(server_list) self.assertEqual(1, after_num - before_num) @@ -54,7 +54,7 @@ class ProtectablesTest(smaug_base.SmaugBaseTest): server.attach_volume(volume.id) volume_item = self.cinder_client.volumes.get(volume.id) - ins_res = self.smaug_client.protectables.get_instance( + ins_res = self.karbor_client.protectables.get_instance( 'OS::Nova::Server', volume_item.attachments[0]["server_id"]) self.assertTrue(ins_res.dependent_resources) self.assertEqual('OS::Cinder::Volume', diff --git a/smaug/tests/fullstack/test_providers.py b/karbor/tests/fullstack/test_providers.py similarity index 73% rename from smaug/tests/fullstack/test_providers.py rename to karbor/tests/fullstack/test_providers.py index 88b51804..4dc3f630 100644 --- a/smaug/tests/fullstack/test_providers.py +++ b/karbor/tests/fullstack/test_providers.py @@ -11,18 +11,18 @@ # under the License. -from smaug.tests.fullstack import smaug_base +from karbor.tests.fullstack import karbor_base -class ProvidersTest(smaug_base.SmaugBaseTest): +class ProvidersTest(karbor_base.KarborBaseTest): """Test Providers operation""" def test_providers_list(self): - provider_res = self.smaug_client.providers.list() + provider_res = self.karbor_client.providers.list() self.assertTrue(len(provider_res)) def test_provider_get(self): - providers = self.smaug_client.providers.list() + providers = self.karbor_client.providers.list() for provider in providers: - provider_res = self.smaug_client.providers.get(provider.id) + provider_res = self.karbor_client.providers.get(provider.id) self.assertEqual(provider.name, provider_res.name) diff --git a/smaug/tests/fullstack/test_restores.py b/karbor/tests/fullstack/test_restores.py similarity index 89% rename from smaug/tests/fullstack/test_restores.py rename to karbor/tests/fullstack/test_restores.py index 6e485834..86df7906 100644 --- a/smaug/tests/fullstack/test_restores.py +++ b/karbor/tests/fullstack/test_restores.py @@ -10,12 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. +from karbor.tests.fullstack import karbor_base +from karbor.tests.fullstack import karbor_objects as objects import re -from smaug.tests.fullstack import smaug_base -from smaug.tests.fullstack import smaug_objects as objects -class RestoresTest(smaug_base.SmaugBaseTest): +class RestoresTest(karbor_base.KarborBaseTest): """Test Restores operation """ parameters = {"username": "admin", "password": "secretadmin"} @@ -53,7 +53,7 @@ class RestoresTest(smaug_base.SmaugBaseTest): checkpoint = self.store(objects.Checkpoint()) checkpoint.create(self.provider_id, plan.id) - restores = self.smaug_client.restores.list() + restores = self.karbor_client.restores.list() before_num = len(restores) restore_target = self.get_restore_target(self.keystone_endpoint) @@ -61,7 +61,7 @@ class RestoresTest(smaug_base.SmaugBaseTest): restore.create(self.provider_id, checkpoint.id, restore_target, self.parameters) - restores = self.smaug_client.restores.list() + restores = self.karbor_client.restores.list() after_num = len(restores) self.assertEqual(1, after_num - before_num) @@ -78,7 +78,7 @@ class RestoresTest(smaug_base.SmaugBaseTest): restore.create(self.provider_id, checkpoint.id, restore_target, self.parameters) - restore_item = self.smaug_client.restores.get(restore.id) + restore_item = self.karbor_client.restores.get(restore.id) self.assertEqual(restore.id, restore_item.id) def test_restore_list(self): @@ -89,7 +89,7 @@ class RestoresTest(smaug_base.SmaugBaseTest): checkpoint = self.store(objects.Checkpoint()) checkpoint.create(self.provider_id, plan.id) - restores = self.smaug_client.restores.list() + restores = self.karbor_client.restores.list() before_num = len(restores) restore_target = self.get_restore_target(self.keystone_endpoint) @@ -100,6 +100,6 @@ class RestoresTest(smaug_base.SmaugBaseTest): restore2.create(self.provider_id, checkpoint.id, restore_target, self.parameters) - restores = self.smaug_client.restores.list() + restores = self.karbor_client.restores.list() after_num = len(restores) self.assertEqual(2, after_num - before_num) diff --git a/smaug/tests/fullstack/test_triggers.py b/karbor/tests/fullstack/test_triggers.py similarity index 75% rename from smaug/tests/fullstack/test_triggers.py rename to karbor/tests/fullstack/test_triggers.py index 939e31cd..d53b2f96 100644 --- a/smaug/tests/fullstack/test_triggers.py +++ b/karbor/tests/fullstack/test_triggers.py @@ -11,22 +11,22 @@ # under the License. -from smaug.tests.fullstack import smaug_base -from smaug.tests.fullstack import smaug_objects as objects +from karbor.tests.fullstack import karbor_base +from karbor.tests.fullstack import karbor_objects as objects -class TriggersTest(smaug_base.SmaugBaseTest): +class TriggersTest(karbor_base.KarborBaseTest): """Test Triggers operation """ def test_triggers_list(self): - trigger_items = self.smaug_client.triggers.list() + trigger_items = self.karbor_client.triggers.list() before_num = len(trigger_items) trigger1 = self.store(objects.Trigger()) trigger1.create('time', {'pattern': '0 20 * * 2', 'format': 'crontab'}) trigger2 = self.store(objects.Trigger()) trigger2.create('time', {'pattern': '0 10 * * *', 'format': 'crontab'}) - trigger_items = self.smaug_client.triggers.list() + trigger_items = self.karbor_client.triggers.list() after_num = len(trigger_items) self.assertEqual(2, after_num - before_num) @@ -35,15 +35,15 @@ class TriggersTest(smaug_base.SmaugBaseTest): trigger = self.store(objects.Trigger()) trigger.create('time', {'pattern': '0 15 * * 2', 'format': 'crontab'}, name=trigger_name) - trigger = self.smaug_client.triggers.get(trigger.id) + trigger = self.karbor_client.triggers.get(trigger.id) self.assertEqual(trigger_name, trigger.name) def test_triggers_delete(self): trigger = objects.Trigger() - trigger_items = self.smaug_client.triggers.list() + trigger_items = self.karbor_client.triggers.list() before_num = len(trigger_items) trigger.create('time', {'pattern': '0 12 * * 2', 'format': 'crontab'}) - self.smaug_client.triggers.delete(trigger.id) - trigger_items = self.smaug_client.triggers.list() + self.karbor_client.triggers.delete(trigger.id) + trigger_items = self.karbor_client.triggers.list() after_num = len(trigger_items) self.assertEqual(0, after_num - before_num) diff --git a/smaug/tests/fullstack/utils.py b/karbor/tests/fullstack/utils.py similarity index 100% rename from smaug/tests/fullstack/utils.py rename to karbor/tests/fullstack/utils.py diff --git a/smaug/tests/test_smaug.py b/karbor/tests/test_karbor.py similarity index 86% rename from smaug/tests/test_smaug.py rename to karbor/tests/test_karbor.py index c9a8764c..e8270cdd 100644 --- a/smaug/tests/test_smaug.py +++ b/karbor/tests/test_karbor.py @@ -13,16 +13,16 @@ # under the License. """ -test_smaug +test_karbor ---------------------------------- -Tests for `smaug` module. +Tests for `karbor` module. """ -from smaug.tests import base +from karbor.tests import base -class TestSmaug(base.TestCase): +class TestKarbor(base.TestCase): def test_something(self): pass diff --git a/smaug/tests/unit/__init__.py b/karbor/tests/unit/__init__.py similarity index 95% rename from smaug/tests/unit/__init__.py rename to karbor/tests/unit/__init__.py index 78fc0a3a..34945c47 100644 --- a/smaug/tests/unit/__init__.py +++ b/karbor/tests/unit/__init__.py @@ -12,7 +12,7 @@ import eventlet -from smaug import objects +from karbor import objects eventlet.monkey_patch() objects.register_all() diff --git a/smaug/tests/unit/api/__init__.py b/karbor/tests/unit/api/__init__.py similarity index 100% rename from smaug/tests/unit/api/__init__.py rename to karbor/tests/unit/api/__init__.py diff --git a/smaug/tests/unit/api/fakes.py b/karbor/tests/unit/api/fakes.py similarity index 93% rename from smaug/tests/unit/api/fakes.py rename to karbor/tests/unit/api/fakes.py index d38a8e3f..b047f59d 100644 --- a/smaug/tests/unit/api/fakes.py +++ b/karbor/tests/unit/api/fakes.py @@ -20,9 +20,9 @@ import webob import webob.dec import webob.request -from smaug.api.openstack import wsgi as os_wsgi -from smaug import context -from smaug.wsgi import common as wsgi +from karbor.api.openstack import wsgi as os_wsgi +from karbor import context +from karbor.wsgi import common as wsgi FAKE_UUID = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' @@ -81,7 +81,7 @@ class HTTPRequest(webob.Request): use_admin_context = kwargs.pop('use_admin_context', False) out = os_wsgi.Request.blank(*args, **kwargs) - out.environ['smaug.context'] = FakeRequestContext( + out.environ['karbor.context'] = FakeRequestContext( 'fake_user', 'fakeproject', is_admin=use_admin_context) diff --git a/smaug/tests/unit/api/middleware/__init__.py b/karbor/tests/unit/api/middleware/__init__.py similarity index 100% rename from smaug/tests/unit/api/middleware/__init__.py rename to karbor/tests/unit/api/middleware/__init__.py diff --git a/smaug/tests/unit/api/middleware/test_auth.py b/karbor/tests/unit/api/middleware/test_auth.py similarity index 88% rename from smaug/tests/unit/api/middleware/test_auth.py rename to karbor/tests/unit/api/middleware/test_auth.py index 25832873..853f9c09 100644 --- a/smaug/tests/unit/api/middleware/test_auth.py +++ b/karbor/tests/unit/api/middleware/test_auth.py @@ -15,23 +15,23 @@ from oslo_middleware import request_id import webob -import smaug.api.middleware.auth -from smaug.tests import base +import karbor.api.middleware.auth +from karbor.tests import base -class TestSmaugKeystoneContextMiddleware(base.TestCase): +class TestKarborKeystoneContextMiddleware(base.TestCase): def setUp(self): - super(TestSmaugKeystoneContextMiddleware, self).setUp() + super(TestKarborKeystoneContextMiddleware, self).setUp() @webob.dec.wsgify() def fake_app(req): - self.context = req.environ['smaug.context'] + self.context = req.environ['karbor.context'] return webob.Response() self.context = None - self.middleware = (smaug.api.middleware.auth - .SmaugKeystoneContext(fake_app)) + self.middleware = (karbor.api.middleware.auth + .KarborKeystoneContext(fake_app)) self.request = webob.Request.blank('/') self.request.headers['X_TENANT_ID'] = 'testtenantid' self.request.headers['X_AUTH_TOKEN'] = 'testauthtoken' diff --git a/smaug/tests/unit/api/openstack/__init__.py b/karbor/tests/unit/api/openstack/__init__.py similarity index 100% rename from smaug/tests/unit/api/openstack/__init__.py rename to karbor/tests/unit/api/openstack/__init__.py diff --git a/smaug/tests/unit/api/openstack/test_wsgi.py b/karbor/tests/unit/api/openstack/test_wsgi.py similarity index 98% rename from smaug/tests/unit/api/openstack/test_wsgi.py rename to karbor/tests/unit/api/openstack/test_wsgi.py index 83e545c2..8dcdece5 100644 --- a/smaug/tests/unit/api/openstack/test_wsgi.py +++ b/karbor/tests/unit/api/openstack/test_wsgi.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug.api.openstack import wsgi -from smaug.tests import base +from karbor.api.openstack import wsgi +from karbor.tests import base class RequestTest(base.TestCase): diff --git a/smaug/tests/unit/api/test_common.py b/karbor/tests/unit/api/test_common.py similarity index 99% rename from smaug/tests/unit/api/test_common.py rename to karbor/tests/unit/api/test_common.py index 9025781c..c16ef7f1 100644 --- a/smaug/tests/unit/api/test_common.py +++ b/karbor/tests/unit/api/test_common.py @@ -21,8 +21,8 @@ import webob.exc from oslo_config import cfg -from smaug.api import common -from smaug.tests import base +from karbor.api import common +from karbor.tests import base NS = "{http://docs.openstack.org/compute/api/v1.1}" @@ -31,7 +31,7 @@ CONF = cfg.CONF class PaginationParamsTest(base.TestCase): - """Unit tests for `smaug.api.common.get_pagination_params` method. + """Unit tests for `karbor.api.common.get_pagination_params` method. This method takes in a request object and returns 'marker' and 'limit' GET params. diff --git a/smaug/tests/unit/api/v1/__init__.py b/karbor/tests/unit/api/v1/__init__.py similarity index 100% rename from smaug/tests/unit/api/v1/__init__.py rename to karbor/tests/unit/api/v1/__init__.py diff --git a/smaug/tests/unit/api/v1/test_plans.py b/karbor/tests/unit/api/v1/test_plans.py similarity index 92% rename from smaug/tests/unit/api/v1/test_plans.py rename to karbor/tests/unit/api/v1/test_plans.py index a838a87b..01b1770e 100644 --- a/smaug/tests/unit/api/v1/test_plans.py +++ b/karbor/tests/unit/api/v1/test_plans.py @@ -15,11 +15,11 @@ import mock from oslo_config import cfg from webob import exc -from smaug.api.v1 import plans -from smaug import context -from smaug import exception -from smaug.tests import base -from smaug.tests.unit.api import fakes +from karbor.api.v1 import plans +from karbor import context +from karbor import exception +from karbor.tests import base +from karbor.tests.unit.api import fakes CONF = cfg.CONF @@ -39,7 +39,7 @@ class PlanApiTest(base.TestCase): self.ctxt = context.RequestContext('admin', 'fakeproject', True) @mock.patch( - 'smaug.objects.plan.Plan.create') + 'karbor.objects.plan.Plan.create') def test_plan_create(self, mock_plan_create): plan = self._plan_in_request_body() body = {"plan": plan} @@ -77,9 +77,9 @@ class PlanApiTest(base.TestCase): req, body) @mock.patch( - 'smaug.api.v1.plans.PlansController._plan_get') + 'karbor.api.v1.plans.PlansController._plan_get') @mock.patch( - 'smaug.api.v1.plans.PlansController._plan_update') + 'karbor.api.v1.plans.PlansController._plan_update') def test_plan_update(self, mock_plan_update, mock_plan_get): plan = self._plan_in_request_body() body = {"plan": plan} @@ -118,7 +118,7 @@ class PlanApiTest(base.TestCase): req, "2a9ce1f3-cc1a-4516-9435-0ebb13caa398", body) @mock.patch( - 'smaug.api.v1.plans.PlansController._get_all') + 'karbor.api.v1.plans.PlansController._get_all') def test_plan_list_detail(self, moak_get_all): req = fakes.HTTPRequest.blank('/v1/plans') self.controller.index(req) @@ -131,7 +131,7 @@ class PlanApiTest(base.TestCase): self.controller.create(req, body) @mock.patch( - 'smaug.api.v1.plans.PlansController._plan_get') + 'karbor.api.v1.plans.PlansController._plan_get') def test_plan_show(self, moak_plan_get): req = fakes.HTTPRequest.blank('/v1/plans') self.controller.\ @@ -145,7 +145,7 @@ class PlanApiTest(base.TestCase): req, "1") @mock.patch( - 'smaug.api.v1.plans.PlansController._plan_get') + 'karbor.api.v1.plans.PlansController._plan_get') def test_plan_delete(self, moak_plan_get): req = fakes.HTTPRequest.blank('/v1/plans') self.controller.\ @@ -159,9 +159,9 @@ class PlanApiTest(base.TestCase): req, "1") @mock.patch( - 'smaug.api.v1.plans.check_policy') + 'karbor.api.v1.plans.check_policy') @mock.patch( - 'smaug.api.v1.plans.PlansController._plan_get') + 'karbor.api.v1.plans.PlansController._plan_get') def test_plan_update_InvalidStatus(self, mock_plan_get, mock_check_policy): plan = self._plan_in_request_body(name=DEFAULT_NAME, provider_id=DEFAULT_PROVIDER_ID, diff --git a/smaug/tests/unit/api/v1/test_protectables.py b/karbor/tests/unit/api/v1/test_protectables.py similarity index 81% rename from smaug/tests/unit/api/v1/test_protectables.py rename to karbor/tests/unit/api/v1/test_protectables.py index 99683210..ea5f4300 100644 --- a/smaug/tests/unit/api/v1/test_protectables.py +++ b/karbor/tests/unit/api/v1/test_protectables.py @@ -14,11 +14,11 @@ import mock from oslo_config import cfg -from smaug.api.v1 import protectables -from smaug import context -from smaug import exception -from smaug.tests import base -from smaug.tests.unit.api import fakes +from karbor.api.v1 import protectables +from karbor import context +from karbor import exception +from karbor.tests import base +from karbor.tests.unit.api import fakes CONF = cfg.CONF @@ -30,16 +30,16 @@ class ProtectablesApiTest(base.TestCase): self.ctxt = context.RequestContext('admin', 'fakeproject', True) @mock.patch( - 'smaug.api.v1.protectables.ProtectablesController._get_all') + 'karbor.api.v1.protectables.ProtectablesController._get_all') def test_protectables_list_detail(self, moak_get_all): req = fakes.HTTPRequest.blank('/v1/protectables') self.controller.index(req) self.assertTrue(moak_get_all.called) @mock.patch( - 'smaug.services.protection.api.API.show_protectable_type') + 'karbor.services.protection.api.API.show_protectable_type') @mock.patch( - 'smaug.api.v1.protectables.ProtectablesController._get_all') + 'karbor.api.v1.protectables.ProtectablesController._get_all') def test_protectables_show(self, moak_get_all, moak_show_protectable_type): req = fakes.HTTPRequest.blank('/v1/protectables') moak_get_all.return_value = ["OS::Keystone::Project"] @@ -49,7 +49,7 @@ class ProtectablesApiTest(base.TestCase): self.assertTrue(moak_show_protectable_type.called) @mock.patch( - 'smaug.api.v1.protectables.ProtectablesController._get_all') + 'karbor.api.v1.protectables.ProtectablesController._get_all') def test_protectables_show_Invalid(self, moak_get_all): req = fakes.HTTPRequest.blank('/v1/protectables') moak_get_all.return_value = ["OS::Keystone::Project"] @@ -58,10 +58,10 @@ class ProtectablesApiTest(base.TestCase): self.assertTrue(moak_get_all.called) @mock.patch( - 'smaug.services.protection.api.API.' + 'karbor.services.protection.api.API.' 'list_protectable_instances') @mock.patch( - 'smaug.api.v1.protectables.ProtectablesController._get_all') + 'karbor.api.v1.protectables.ProtectablesController._get_all') def test_protectables_instances_index(self, moak_get_all, moak_list_protectable_instances): req = fakes.HTTPRequest.blank('/v1/protectables') @@ -72,13 +72,13 @@ class ProtectablesApiTest(base.TestCase): self.assertTrue(moak_list_protectable_instances.called) @mock.patch( - 'smaug.services.protection.api.API.' + 'karbor.services.protection.api.API.' 'list_protectable_dependents') @mock.patch( - 'smaug.services.protection.api.API.' + 'karbor.services.protection.api.API.' 'show_protectable_instance') @mock.patch( - 'smaug.api.v1.protectables.ProtectablesController._get_all') + 'karbor.api.v1.protectables.ProtectablesController._get_all') def test_protectables_instances_show(self, moak_get_all, moak_show_protectable_instance, moak_list_protectable_dependents): diff --git a/smaug/tests/unit/api/v1/test_providers.py b/karbor/tests/unit/api/v1/test_providers.py similarity index 90% rename from smaug/tests/unit/api/v1/test_providers.py rename to karbor/tests/unit/api/v1/test_providers.py index 890aebfd..722cd4e6 100644 --- a/smaug/tests/unit/api/v1/test_providers.py +++ b/karbor/tests/unit/api/v1/test_providers.py @@ -16,10 +16,10 @@ from oslo_config import cfg from webob import exc -from smaug.api.v1 import providers -from smaug import context -from smaug.tests import base -from smaug.tests.unit.api import fakes +from karbor.api.v1 import providers +from karbor import context +from karbor.tests import base +from karbor.tests.unit.api import fakes CONF = cfg.CONF @@ -31,14 +31,14 @@ class ProvidersApiTest(base.TestCase): self.ctxt = context.RequestContext('admin', 'fakeproject', True) @mock.patch( - 'smaug.api.v1.providers.ProvidersController._get_all') + 'karbor.api.v1.providers.ProvidersController._get_all') def test_providers_list_detail(self, moak_get_all): req = fakes.HTTPRequest.blank('/v1/providers') self.controller.index(req) self.assertTrue(moak_get_all.called) @mock.patch( - 'smaug.services.protection.api.API.show_provider') + 'karbor.services.protection.api.API.show_provider') def test_providers_show(self, moak_show_provider): req = fakes.HTTPRequest.blank('/v1/providers') self.controller.\ @@ -51,7 +51,7 @@ class ProvidersApiTest(base.TestCase): req, "1") @mock.patch( - 'smaug.services.protection.api.API.' + 'karbor.services.protection.api.API.' 'show_checkpoint') def test_checkpoint_show(self, moak_show_checkpoint): req = fakes.HTTPRequest.blank('/v1/providers/' @@ -67,7 +67,7 @@ class ProvidersApiTest(base.TestCase): self.assertTrue(moak_show_checkpoint.called) @mock.patch( - 'smaug.services.protection.api.API.' + 'karbor.services.protection.api.API.' 'show_checkpoint') def test_checkpoint_show_Invalid(self, moak_show_checkpoint): req = fakes.HTTPRequest.blank('/v1/providers/' @@ -82,7 +82,7 @@ class ProvidersApiTest(base.TestCase): '1') @mock.patch( - 'smaug.services.protection.api.API.' + 'karbor.services.protection.api.API.' 'list_checkpoints') def test_checkpoint_index(self, moak_list_checkpoints): req = fakes.HTTPRequest.blank('/v1/providers/' @@ -100,7 +100,7 @@ class ProvidersApiTest(base.TestCase): self.assertTrue(moak_list_checkpoints.called) @mock.patch( - 'smaug.services.protection.api.API.' + 'karbor.services.protection.api.API.' 'delete') def test_checkpoints_delete(self, moak_delete): req = fakes.HTTPRequest.blank('/v1/providers/' @@ -112,10 +112,10 @@ class ProvidersApiTest(base.TestCase): self.assertTrue(moak_delete.called) @mock.patch( - 'smaug.services.protection.api.API.' + 'karbor.services.protection.api.API.' 'protect') @mock.patch( - 'smaug.objects.plan.Plan.get_by_id') + 'karbor.objects.plan.Plan.get_by_id') def test_checkpoints_create(self, mock_plan_create, mock_protect): checkpoint = { diff --git a/smaug/tests/unit/api/v1/test_restores.py b/karbor/tests/unit/api/v1/test_restores.py similarity index 90% rename from smaug/tests/unit/api/v1/test_restores.py rename to karbor/tests/unit/api/v1/test_restores.py index 2c712bfe..43e258ab 100644 --- a/smaug/tests/unit/api/v1/test_restores.py +++ b/karbor/tests/unit/api/v1/test_restores.py @@ -15,11 +15,11 @@ import mock from oslo_config import cfg from webob import exc -from smaug.api.v1 import restores -from smaug import context -from smaug import exception -from smaug.tests import base -from smaug.tests.unit.api import fakes +from karbor.api.v1 import restores +from karbor import context +from karbor import exception +from karbor.tests import base +from karbor.tests.unit.api import fakes CONF = cfg.CONF @@ -40,12 +40,12 @@ class RestoreApiTest(base.TestCase): self.ctxt = context.RequestContext('admin', 'fakeproject', True) @mock.patch( - 'smaug.services.protection.api.API.restore') + 'karbor.services.protection.api.API.restore') @mock.patch( - 'smaug.api.v1.restores.' + 'karbor.api.v1.restores.' 'RestoresController._restore_update') @mock.patch( - 'smaug.objects.restore.Restore.create') + 'karbor.objects.restore.Restore.create') def test_restore_create(self, mock_restore_create, mock_restore_update, mock_rpc_restore): @@ -79,14 +79,14 @@ class RestoreApiTest(base.TestCase): req, body) @mock.patch( - 'smaug.api.v1.restores.RestoresController._get_all') + 'karbor.api.v1.restores.RestoresController._get_all') def test_restore_list_detail(self, moak_get_all): req = fakes.HTTPRequest.blank('/v1/restores') self.controller.index(req) self.assertTrue(moak_get_all.called) @mock.patch( - 'smaug.api.v1.restores.RestoresController.' + 'karbor.api.v1.restores.RestoresController.' '_restore_get') def test_restore_show(self, moak_restore_get): req = fakes.HTTPRequest.blank('/v1/restores') @@ -101,7 +101,7 @@ class RestoreApiTest(base.TestCase): req, "1") @mock.patch( - 'smaug.api.v1.restores.RestoresController.' + 'karbor.api.v1.restores.RestoresController.' '_restore_get') def test_restore_delete(self, moak_restore_get): req = fakes.HTTPRequest.blank('/v1/restores') diff --git a/smaug/tests/unit/api/v1/test_router.py b/karbor/tests/unit/api/v1/test_router.py similarity index 87% rename from smaug/tests/unit/api/v1/test_router.py rename to karbor/tests/unit/api/v1/test_router.py index da4490a6..45162883 100644 --- a/smaug/tests/unit/api/v1/test_router.py +++ b/karbor/tests/unit/api/v1/test_router.py @@ -10,10 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug.api.openstack import ProjectMapper -from smaug.api.v1 import router -from smaug.tests import base -from smaug.tests.unit.api import fakes +from karbor.api.openstack import ProjectMapper +from karbor.api.v1 import router +from karbor.tests import base +from karbor.tests.unit.api import fakes class PlansRouterTestCase(base.TestCase): diff --git a/smaug/tests/unit/api/v1/test_scheduled_operation.py b/karbor/tests/unit/api/v1/test_scheduled_operation.py similarity index 96% rename from smaug/tests/unit/api/v1/test_scheduled_operation.py rename to karbor/tests/unit/api/v1/test_scheduled_operation.py index 1f05d371..193058e4 100644 --- a/smaug/tests/unit/api/v1/test_scheduled_operation.py +++ b/karbor/tests/unit/api/v1/test_scheduled_operation.py @@ -13,14 +13,14 @@ import uuid from webob import exc -from smaug.api.v1 import plans as plan_api -from smaug.api.v1 import scheduled_operations as operation_api -from smaug.api.v1 import triggers as trigger_api -from smaug import context -from smaug import exception -from smaug.tests import base -from smaug.tests.unit.api import fakes -from smaug.tests.unit.api.v1 import test_triggers +from karbor.api.v1 import plans as plan_api +from karbor.api.v1 import scheduled_operations as operation_api +from karbor.api.v1 import triggers as trigger_api +from karbor import context +from karbor import exception +from karbor.tests import base +from karbor.tests.unit.api import fakes +from karbor.tests.unit.api.v1 import test_triggers class FakeRemoteOperationApi(object): diff --git a/smaug/tests/unit/api/v1/test_triggers.py b/karbor/tests/unit/api/v1/test_triggers.py similarity index 96% rename from smaug/tests/unit/api/v1/test_triggers.py rename to karbor/tests/unit/api/v1/test_triggers.py index af97f519..aece61a3 100644 --- a/smaug/tests/unit/api/v1/test_triggers.py +++ b/karbor/tests/unit/api/v1/test_triggers.py @@ -12,13 +12,13 @@ from webob import exc -from smaug.api.v1 import triggers as trigger_api -from smaug import context -from smaug import exception -from smaug.i18n import _ -from smaug import objects -from smaug.tests import base -from smaug.tests.unit.api import fakes +from karbor.api.v1 import triggers as trigger_api +from karbor import context +from karbor import exception +from karbor.i18n import _ +from karbor import objects +from karbor.tests import base +from karbor.tests.unit.api import fakes class FakeRemoteOperationApi(object): diff --git a/smaug/tests/unit/clients/__init__.py b/karbor/tests/unit/clients/__init__.py similarity index 100% rename from smaug/tests/unit/clients/__init__.py rename to karbor/tests/unit/clients/__init__.py diff --git a/smaug/tests/unit/clients/test_cinder_client.py b/karbor/tests/unit/clients/test_cinder_client.py similarity index 93% rename from smaug/tests/unit/clients/test_cinder_client.py rename to karbor/tests/unit/clients/test_cinder_client.py index c4a622f8..77721cd9 100644 --- a/smaug/tests/unit/clients/test_cinder_client.py +++ b/karbor/tests/unit/clients/test_cinder_client.py @@ -10,11 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg -from smaug.context import RequestContext -from smaug.services.protection.clients import cinder +from karbor.context import RequestContext +from karbor.services.protection.clients import cinder -from smaug.tests import base +from karbor.tests import base +from oslo_config import cfg class CinderClientTest(base.TestCase): diff --git a/smaug/tests/unit/clients/test_glance_client.py b/karbor/tests/unit/clients/test_glance_client.py similarity index 93% rename from smaug/tests/unit/clients/test_glance_client.py rename to karbor/tests/unit/clients/test_glance_client.py index e98bff86..60f19e41 100644 --- a/smaug/tests/unit/clients/test_glance_client.py +++ b/karbor/tests/unit/clients/test_glance_client.py @@ -11,11 +11,11 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg -from smaug.context import RequestContext -from smaug.services.protection.clients import glance -from smaug.tests import base +from karbor.context import RequestContext +from karbor.services.protection.clients import glance +from karbor.tests import base +from oslo_config import cfg class GlanceClientTest(base.TestCase): diff --git a/smaug/tests/unit/clients/test_neutron_client.py b/karbor/tests/unit/clients/test_neutron_client.py similarity index 93% rename from smaug/tests/unit/clients/test_neutron_client.py rename to karbor/tests/unit/clients/test_neutron_client.py index b3248c4b..c7ccc3da 100644 --- a/smaug/tests/unit/clients/test_neutron_client.py +++ b/karbor/tests/unit/clients/test_neutron_client.py @@ -11,11 +11,11 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg -from smaug.context import RequestContext -from smaug.services.protection.clients import neutron -from smaug.tests import base +from karbor.context import RequestContext +from karbor.services.protection.clients import neutron +from karbor.tests import base +from oslo_config import cfg class NeutronClientTest(base.TestCase): diff --git a/smaug/tests/unit/clients/test_nova_client.py b/karbor/tests/unit/clients/test_nova_client.py similarity index 93% rename from smaug/tests/unit/clients/test_nova_client.py rename to karbor/tests/unit/clients/test_nova_client.py index 95878d96..18d1803d 100644 --- a/smaug/tests/unit/clients/test_nova_client.py +++ b/karbor/tests/unit/clients/test_nova_client.py @@ -10,11 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg -from smaug.context import RequestContext -from smaug.services.protection.clients import nova +from karbor.context import RequestContext +from karbor.services.protection.clients import nova -from smaug.tests import base +from karbor.tests import base +from oslo_config import cfg class NovaClientTest(base.TestCase): diff --git a/smaug/tests/unit/clients/test_swift_client.py b/karbor/tests/unit/clients/test_swift_client.py similarity index 95% rename from smaug/tests/unit/clients/test_swift_client.py rename to karbor/tests/unit/clients/test_swift_client.py index b14de473..547d789b 100644 --- a/smaug/tests/unit/clients/test_swift_client.py +++ b/karbor/tests/unit/clients/test_swift_client.py @@ -10,11 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg -from smaug.context import RequestContext -from smaug.services.protection.clients import swift -from smaug.tests import base +from karbor.context import RequestContext +from karbor.services.protection.clients import swift +from karbor.tests import base +from oslo_config import cfg class SwiftClientTest(base.TestCase): diff --git a/smaug/tests/unit/conf_fixture.py b/karbor/tests/unit/conf_fixture.py similarity index 89% rename from smaug/tests/unit/conf_fixture.py rename to karbor/tests/unit/conf_fixture.py index 1f9bbc89..05bd2dc9 100644 --- a/smaug/tests/unit/conf_fixture.py +++ b/karbor/tests/unit/conf_fixture.py @@ -16,13 +16,13 @@ from oslo_config import cfg CONF = cfg.CONF -CONF.import_opt('policy_file', 'smaug.policy', group='oslo_policy') +CONF.import_opt('policy_file', 'karbor.policy', group='oslo_policy') def set_defaults(conf): conf.set_default('connection', 'sqlite://', group='database') conf.set_default('sqlite_synchronous', False, group='database') - conf.set_default('policy_file', 'smaug.tests.unit/policy.json', + conf.set_default('policy_file', 'karbor.tests.unit/policy.json', group='oslo_policy') conf.set_default('policy_dirs', [], group='oslo_policy') conf.set_default('auth_strategy', 'noauth') diff --git a/smaug/tests/unit/db/__init__.py b/karbor/tests/unit/db/__init__.py similarity index 100% rename from smaug/tests/unit/db/__init__.py rename to karbor/tests/unit/db/__init__.py diff --git a/smaug/tests/unit/db/test_models.py b/karbor/tests/unit/db/test_models.py similarity index 98% rename from smaug/tests/unit/db/test_models.py rename to karbor/tests/unit/db/test_models.py index da8de7ff..e02f0b79 100644 --- a/smaug/tests/unit/db/test_models.py +++ b/karbor/tests/unit/db/test_models.py @@ -18,10 +18,10 @@ from oslo_config import cfg from oslo_utils import uuidutils import six -from smaug import context -from smaug import db -from smaug import exception -from smaug.tests import base +from karbor import context +from karbor import db +from karbor import exception +from karbor.tests import base CONF = cfg.CONF @@ -396,7 +396,7 @@ class ScheduledOperationLogTestCase(base.TestCase): class PlanDbTestCase(base.TestCase): - """Unit tests for smaug.db.api.plan_*.""" + """Unit tests for karbor.db.api.plan_*.""" fake_plan = { 'name': 'My 3 tier application', @@ -488,7 +488,7 @@ class PlanDbTestCase(base.TestCase): class RestoreDbTestCase(base.TestCase): - """Unit tests for smaug.db.api.restore_*.""" + """Unit tests for karbor.db.api.restore_*.""" fake_restore = { "id": "36ea41b2-c358-48a7-9117-70cb7617410a", @@ -556,7 +556,7 @@ class RestoreDbTestCase(base.TestCase): class OperationLogTestCase(base.TestCase): - """Unit tests for smaug.db.api.operation_log_*.""" + """Unit tests for karbor.db.api.operation_log_*.""" fake_operation_log = { "id": "36ea41b2-c358-48a7-9117-70cb7617410a", diff --git a/smaug/tests/unit/fake_bank.py b/karbor/tests/unit/fake_bank.py similarity index 95% rename from smaug/tests/unit/fake_bank.py rename to karbor/tests/unit/fake_bank.py index 9e51ab61..1598f558 100644 --- a/smaug/tests/unit/fake_bank.py +++ b/karbor/tests/unit/fake_bank.py @@ -12,7 +12,7 @@ from oslo_config import cfg -from smaug.services.protection import bank_plugin +from karbor.services.protection import bank_plugin fake_bank_opts = [ cfg.StrOpt('fake_host'), diff --git a/smaug/tests/unit/fake_operation_log.py b/karbor/tests/unit/fake_operation_log.py similarity index 98% rename from smaug/tests/unit/fake_operation_log.py rename to karbor/tests/unit/fake_operation_log.py index 2a444e8e..8d15e022 100644 --- a/smaug/tests/unit/fake_operation_log.py +++ b/karbor/tests/unit/fake_operation_log.py @@ -12,7 +12,7 @@ from oslo_versionedobjects import fields -from smaug import objects +from karbor import objects def fake_db_operation_log(**updates): diff --git a/smaug/tests/unit/fake_plan.py b/karbor/tests/unit/fake_plan.py similarity index 98% rename from smaug/tests/unit/fake_plan.py rename to karbor/tests/unit/fake_plan.py index 9530ff92..cb2f8f44 100644 --- a/smaug/tests/unit/fake_plan.py +++ b/karbor/tests/unit/fake_plan.py @@ -12,7 +12,7 @@ from oslo_versionedobjects import fields -from smaug import objects +from karbor import objects db_plan = { 'id': '1', diff --git a/smaug/tests/unit/fake_protection.py b/karbor/tests/unit/fake_protection.py similarity index 96% rename from smaug/tests/unit/fake_protection.py rename to karbor/tests/unit/fake_protection.py index e61f4faa..c18c2d88 100644 --- a/smaug/tests/unit/fake_protection.py +++ b/karbor/tests/unit/fake_protection.py @@ -12,7 +12,7 @@ from oslo_config import cfg -from smaug.services.protection import protection_plugin +from karbor.services.protection import protection_plugin fake_plugin_opts = [ cfg.StrOpt('fake_user'), diff --git a/smaug/tests/unit/fake_providers/fake_provider1.conf b/karbor/tests/unit/fake_providers/fake_provider1.conf similarity index 54% rename from smaug/tests/unit/fake_providers/fake_provider1.conf rename to karbor/tests/unit/fake_providers/fake_provider1.conf index f2a4d6d0..ff28de2e 100644 --- a/smaug/tests/unit/fake_providers/fake_provider1.conf +++ b/karbor/tests/unit/fake_providers/fake_provider1.conf @@ -2,8 +2,8 @@ name = fake_provider1 id = fake_id1 description = Test Provider 1 -bank = smaug.tests.unit.fake_bank.FakeBankPlugin -plugin = smaug.tests.unit.fake_protection.FakeProtectionPlugin +bank = karbor.tests.unit.fake_bank.FakeBankPlugin +plugin = karbor.tests.unit.fake_protection.FakeProtectionPlugin [fake_plugin] fake_user = user diff --git a/smaug/tests/unit/fake_providers/fake_provider2.conf b/karbor/tests/unit/fake_providers/fake_provider2.conf similarity index 100% rename from smaug/tests/unit/fake_providers/fake_provider2.conf rename to karbor/tests/unit/fake_providers/fake_provider2.conf diff --git a/smaug/tests/unit/fake_restore.py b/karbor/tests/unit/fake_restore.py similarity index 98% rename from smaug/tests/unit/fake_restore.py rename to karbor/tests/unit/fake_restore.py index 82f5220b..bdc0784d 100644 --- a/smaug/tests/unit/fake_restore.py +++ b/karbor/tests/unit/fake_restore.py @@ -12,7 +12,7 @@ from oslo_versionedobjects import fields -from smaug import objects +from karbor import objects def fake_db_restore(**updates): diff --git a/smaug/tests/unit/fake_service.py b/karbor/tests/unit/fake_service.py similarity index 98% rename from smaug/tests/unit/fake_service.py rename to karbor/tests/unit/fake_service.py index ae21bc5f..c551f59c 100644 --- a/smaug/tests/unit/fake_service.py +++ b/karbor/tests/unit/fake_service.py @@ -13,7 +13,7 @@ from oslo_utils import timeutils from oslo_versionedobjects import fields -from smaug import objects +from karbor import objects def fake_db_service(**updates): diff --git a/smaug/tests/unit/objects/__init__.py b/karbor/tests/unit/objects/__init__.py similarity index 90% rename from smaug/tests/unit/objects/__init__.py rename to karbor/tests/unit/objects/__init__.py index 665e3db9..3d184593 100644 --- a/smaug/tests/unit/objects/__init__.py +++ b/karbor/tests/unit/objects/__init__.py @@ -13,9 +13,9 @@ from oslo_utils import timeutils from oslo_versionedobjects import fields -from smaug import context -from smaug.objects import base as obj_base -from smaug.tests import base +from karbor import context +from karbor.objects import base as obj_base +from karbor.tests import base class BaseObjectsTestCase(base.TestCase): @@ -26,7 +26,7 @@ class BaseObjectsTestCase(base.TestCase): self.context = context.RequestContext(self.user_id, self.project_id, is_admin=False) # We only test local right now. - self.assertIsNone(obj_base.SmaugObject.indirection_api) + self.assertIsNone(obj_base.KarborObject.indirection_api) @staticmethod def _compare(test, db, obj): diff --git a/smaug/tests/unit/objects/test_base.py b/karbor/tests/unit/objects/test_base.py similarity index 62% rename from smaug/tests/unit/objects/test_base.py rename to karbor/tests/unit/objects/test_base.py index 508e3cc8..c2da67a9 100644 --- a/smaug/tests/unit/objects/test_base.py +++ b/karbor/tests/unit/objects/test_base.py @@ -17,12 +17,12 @@ import uuid from iso8601 import iso8601 from oslo_versionedobjects import fields -from smaug import objects -from smaug.tests.unit import objects as test_objects +from karbor import objects +from karbor.tests.unit import objects as test_objects -@objects.base.SmaugObjectRegistry.register_if(False) -class TestObject(objects.base.SmaugObject): +@objects.base.KarborObjectRegistry.register_if(False) +class TestObject(objects.base.KarborObject): fields = { 'scheduled_at': objects.base.fields.DateTimeField(nullable=True), 'uuid': objects.base.fields.UUIDField(), @@ -30,86 +30,86 @@ class TestObject(objects.base.SmaugObject): } -class TestSmaugObject(test_objects.BaseObjectsTestCase): - """Tests methods from SmaugObject.""" +class TestKarborObject(test_objects.BaseObjectsTestCase): + """Tests methods from KarborObject.""" def setUp(self): - super(TestSmaugObject, self).setUp() + super(TestKarborObject, self).setUp() self.obj = TestObject( scheduled_at=None, uuid=uuid.uuid4(), text='text') self.obj.obj_reset_changes() - def test_smaug_obj_get_changes_no_changes(self): - self.assertDictEqual({}, self.obj.smaug_obj_get_changes()) + def test_karbor_obj_get_changes_no_changes(self): + self.assertDictEqual({}, self.obj.karbor_obj_get_changes()) - def test_smaug_obj_get_changes_other_changes(self): + def test_karbor_obj_get_changes_other_changes(self): self.obj.text = 'text2' self.assertDictEqual({'text': 'text2'}, - self.obj.smaug_obj_get_changes()) + self.obj.karbor_obj_get_changes()) - def test_smaug_obj_get_changes_datetime_no_tz(self): + def test_karbor_obj_get_changes_datetime_no_tz(self): now = datetime.datetime.utcnow() self.obj.scheduled_at = now self.assertDictEqual({'scheduled_at': now}, - self.obj.smaug_obj_get_changes()) + self.obj.karbor_obj_get_changes()) - def test_smaug_obj_get_changes_datetime_tz_utc(self): + def test_karbor_obj_get_changes_datetime_tz_utc(self): now_tz = iso8601.parse_date('2015-06-26T22:00:01Z') now = now_tz.replace(tzinfo=None) self.obj.scheduled_at = now_tz self.assertDictEqual({'scheduled_at': now}, - self.obj.smaug_obj_get_changes()) + self.obj.karbor_obj_get_changes()) - def test_smaug_obj_get_changes_datetime_tz_non_utc_positive(self): + def test_karbor_obj_get_changes_datetime_tz_non_utc_positive(self): now_tz = iso8601.parse_date('2015-06-26T22:00:01+01') now = now_tz.replace(tzinfo=None) - datetime.timedelta(hours=1) self.obj.scheduled_at = now_tz self.assertDictEqual({'scheduled_at': now}, - self.obj.smaug_obj_get_changes()) + self.obj.karbor_obj_get_changes()) - def test_smaug_obj_get_changes_datetime_tz_non_utc_negative(self): + def test_karbor_obj_get_changes_datetime_tz_non_utc_negative(self): now_tz = iso8601.parse_date('2015-06-26T10:00:01-05') now = now_tz.replace(tzinfo=None) + datetime.timedelta(hours=5) self.obj.scheduled_at = now_tz self.assertDictEqual({'scheduled_at': now}, - self.obj.smaug_obj_get_changes()) + self.obj.karbor_obj_get_changes()) def test_refresh(self): - @objects.base.SmaugObjectRegistry.register_if(False) - class MyTestObject(objects.base.SmaugObject, - objects.base.SmaugObjectDictCompat, - objects.base.SmaugComparableObject): + @objects.base.KarborObjectRegistry.register_if(False) + class MyTestObject(objects.base.KarborObject, + objects.base.KarborObjectDictCompat, + objects.base.KarborComparableObject): fields = {'id': fields.UUIDField(), 'name': fields.StringField()} test_obj = MyTestObject(id='1', name='foo') refresh_obj = MyTestObject(id='1', name='bar') with mock.patch( - 'smaug.objects.base.SmaugObject.get_by_id') as get_by_id: + 'karbor.objects.base.KarborObject.get_by_id') as get_by_id: get_by_id.return_value = refresh_obj test_obj.refresh() self._compare(self, refresh_obj, test_obj) def test_refresh_no_id_field(self): - @objects.base.SmaugObjectRegistry.register_if(False) - class MyTestObjectNoId(objects.base.SmaugObject, - objects.base.SmaugObjectDictCompat, - objects.base.SmaugComparableObject): + @objects.base.KarborObjectRegistry.register_if(False) + class MyTestObjectNoId(objects.base.KarborObject, + objects.base.KarborObjectDictCompat, + objects.base.KarborComparableObject): fields = {'uuid': fields.UUIDField()} test_obj = MyTestObjectNoId(uuid='1', name='foo') self.assertRaises(NotImplementedError, test_obj.refresh) -class TestSmaugComparableObject(test_objects.BaseObjectsTestCase): +class TestKarborComparableObject(test_objects.BaseObjectsTestCase): def test_comparable_objects(self): - @objects.base.SmaugObjectRegistry.register - class MyComparableObj(objects.base.SmaugObject, - objects.base.SmaugObjectDictCompat, - objects.base.SmaugComparableObject): + @objects.base.KarborObjectRegistry.register + class MyComparableObj(objects.base.KarborObject, + objects.base.KarborObjectDictCompat, + objects.base.KarborComparableObject): fields = {'foo': fields.Field(fields.Integer())} class NonVersionedObject(object): @@ -125,10 +125,10 @@ class TestSmaugComparableObject(test_objects.BaseObjectsTestCase): self.assertNotEqual(obj1, None) -class TestSmaugDictObject(test_objects.BaseObjectsTestCase): - @objects.base.SmaugObjectRegistry.register_if(False) - class TestDictObject(objects.base.SmaugObjectDictCompat, - objects.base.SmaugObject): +class TestKarborDictObject(test_objects.BaseObjectsTestCase): + @objects.base.KarborObjectRegistry.register_if(False) + class TestDictObject(objects.base.KarborObjectDictCompat, + objects.base.KarborObject): obj_extra_fields = ['foo'] fields = { diff --git a/smaug/tests/unit/objects/test_operation_log.py b/karbor/tests/unit/objects/test_operation_log.py similarity index 87% rename from smaug/tests/unit/objects/test_operation_log.py rename to karbor/tests/unit/objects/test_operation_log.py index 03a0d2c5..01c448c5 100644 --- a/smaug/tests/unit/objects/test_operation_log.py +++ b/karbor/tests/unit/objects/test_operation_log.py @@ -14,9 +14,9 @@ import mock -from smaug import objects -from smaug.tests.unit import fake_operation_log -from smaug.tests.unit import objects as test_objects +from karbor import objects +from karbor.tests.unit import fake_operation_log +from karbor.tests.unit import objects as test_objects class TestOperationLog(test_objects.BaseObjectsTestCase): @@ -25,7 +25,7 @@ class TestOperationLog(test_objects.BaseObjectsTestCase): db = {k: v for k, v in db.items()} test_objects.BaseObjectsTestCase._compare(test, db, obj) - @mock.patch('smaug.objects.OperationLog.get_by_id') + @mock.patch('karbor.objects.OperationLog.get_by_id') def test_get_by_id(self, operation_log_get): db_operation_log = fake_operation_log.fake_db_operation_log() operation_log_get.return_value = db_operation_log @@ -33,7 +33,7 @@ class TestOperationLog(test_objects.BaseObjectsTestCase): operation_log_get.assert_called_once_with(self.context, "1") self._compare(self, db_operation_log, operation_log) - @mock.patch('smaug.db.sqlalchemy.api.operation_log_create') + @mock.patch('karbor.db.sqlalchemy.api.operation_log_create') def test_create(self, operation_log_create): db_operation_log = fake_operation_log.fake_db_operation_log() operation_log_create.return_value = db_operation_log @@ -41,7 +41,7 @@ class TestOperationLog(test_objects.BaseObjectsTestCase): operation_log.create() self.assertEqual(db_operation_log['id'], operation_log.id) - @mock.patch('smaug.db.sqlalchemy.api.operation_log_update') + @mock.patch('karbor.db.sqlalchemy.api.operation_log_update') def test_save(self, operation_log_update): db_operation_log = fake_operation_log.fake_db_operation_log() operation_log = objects.OperationLog.\ @@ -52,7 +52,7 @@ class TestOperationLog(test_objects.BaseObjectsTestCase): operation_log_update.assert_called_once_with( self.context, operation_log.id, {'state': 'finished'}) - @mock.patch('smaug.db.sqlalchemy.api.operation_log_destroy') + @mock.patch('karbor.db.sqlalchemy.api.operation_log_destroy') def test_destroy(self, operation_log_destroy): db_operation_log = fake_operation_log.fake_db_operation_log() operation_log = objects.OperationLog.\ diff --git a/smaug/tests/unit/objects/test_plan.py b/karbor/tests/unit/objects/test_plan.py similarity index 89% rename from smaug/tests/unit/objects/test_plan.py rename to karbor/tests/unit/objects/test_plan.py index bf5a69b8..23ed23d0 100644 --- a/smaug/tests/unit/objects/test_plan.py +++ b/karbor/tests/unit/objects/test_plan.py @@ -16,9 +16,9 @@ import mock from oslo_serialization import jsonutils -from smaug import objects -from smaug.tests.unit import fake_plan -from smaug.tests.unit import objects as test_objects +from karbor import objects +from karbor.tests.unit import fake_plan +from karbor.tests.unit import objects as test_objects class TestPlan(test_objects.BaseObjectsTestCase): @@ -28,7 +28,7 @@ class TestPlan(test_objects.BaseObjectsTestCase): if not k.endswith('resources')} test_objects.BaseObjectsTestCase._compare(test, db, obj) - @mock.patch('smaug.objects.Plan.get_by_id') + @mock.patch('karbor.objects.Plan.get_by_id') def test_get_by_id(self, plan_get): db_plan = fake_plan.fake_db_plan() plan_get.return_value = db_plan @@ -36,7 +36,7 @@ class TestPlan(test_objects.BaseObjectsTestCase): plan_get.assert_called_once_with(self.context, "1") self._compare(self, db_plan, plan) - @mock.patch('smaug.db.sqlalchemy.api.plan_create') + @mock.patch('karbor.db.sqlalchemy.api.plan_create') def test_create(self, plan_create): db_plan = fake_plan.fake_db_plan() plan_create.return_value = db_plan @@ -44,7 +44,7 @@ class TestPlan(test_objects.BaseObjectsTestCase): plan.create() self.assertEqual(db_plan['id'], plan.id) - @mock.patch('smaug.db.sqlalchemy.api.plan_update') + @mock.patch('karbor.db.sqlalchemy.api.plan_update') def test_save(self, plan_update): db_plan = fake_plan.fake_db_plan() plan = objects.Plan._from_db_object(self.context, @@ -54,12 +54,12 @@ class TestPlan(test_objects.BaseObjectsTestCase): plan_update.assert_called_once_with(self.context, plan.id, {'name': 'planname'}) - @mock.patch('smaug.db.sqlalchemy.api.plan_resources_update', + @mock.patch('karbor.db.sqlalchemy.api.plan_resources_update', return_value=[ {'resource_id': 'key1', "resource_type": "value1"} ]) - @mock.patch('smaug.db.sqlalchemy.api.plan_update') + @mock.patch('karbor.db.sqlalchemy.api.plan_update') def test_save_with_resource(self, plan_update, resource_update): db_plan = fake_plan.fake_db_plan() plan = objects.Plan._from_db_object(self.context, @@ -78,7 +78,7 @@ class TestPlan(test_objects.BaseObjectsTestCase): [{'id': 'key1', "type": "value1"}]) - @mock.patch('smaug.db.sqlalchemy.api.plan_destroy') + @mock.patch('karbor.db.sqlalchemy.api.plan_destroy') def test_destroy(self, plan_destroy): db_plan = fake_plan.fake_db_plan() plan = objects.Plan._from_db_object(self.context, diff --git a/smaug/tests/unit/objects/test_restore.py b/karbor/tests/unit/objects/test_restore.py similarity index 87% rename from smaug/tests/unit/objects/test_restore.py rename to karbor/tests/unit/objects/test_restore.py index 8625581f..d53ae2f7 100644 --- a/smaug/tests/unit/objects/test_restore.py +++ b/karbor/tests/unit/objects/test_restore.py @@ -14,9 +14,9 @@ import mock -from smaug import objects -from smaug.tests.unit import fake_restore -from smaug.tests.unit import objects as test_objects +from karbor import objects +from karbor.tests.unit import fake_restore +from karbor.tests.unit import objects as test_objects class TestRestore(test_objects.BaseObjectsTestCase): @@ -25,7 +25,7 @@ class TestRestore(test_objects.BaseObjectsTestCase): db = {k: v for k, v in db.items()} test_objects.BaseObjectsTestCase._compare(test, db, obj) - @mock.patch('smaug.objects.Restore.get_by_id') + @mock.patch('karbor.objects.Restore.get_by_id') def test_get_by_id(self, restore_get): db_restore = fake_restore.fake_db_restore() restore_get.return_value = db_restore @@ -33,7 +33,7 @@ class TestRestore(test_objects.BaseObjectsTestCase): restore_get.assert_called_once_with(self.context, "1") self._compare(self, db_restore, restore) - @mock.patch('smaug.db.sqlalchemy.api.restore_create') + @mock.patch('karbor.db.sqlalchemy.api.restore_create') def test_create(self, restore_create): db_restore = fake_restore.fake_db_restore() restore_create.return_value = db_restore @@ -41,7 +41,7 @@ class TestRestore(test_objects.BaseObjectsTestCase): restore.create() self.assertEqual(db_restore['id'], restore.id) - @mock.patch('smaug.db.sqlalchemy.api.restore_update') + @mock.patch('karbor.db.sqlalchemy.api.restore_update') def test_save(self, restore_update): db_restore = fake_restore.fake_db_restore() restore = objects.Restore.\ @@ -52,7 +52,7 @@ class TestRestore(test_objects.BaseObjectsTestCase): restore_update.assert_called_once_with(self.context, restore.id, {'status': 'FAILED'}) - @mock.patch('smaug.db.sqlalchemy.api.restore_destroy') + @mock.patch('karbor.db.sqlalchemy.api.restore_destroy') def test_destroy(self, restore_destroy): db_restore = fake_restore.fake_db_restore() restore = objects.Restore.\ diff --git a/smaug/tests/unit/objects/test_scheduled_operation.py b/karbor/tests/unit/objects/test_scheduled_operation.py similarity index 91% rename from smaug/tests/unit/objects/test_scheduled_operation.py rename to karbor/tests/unit/objects/test_scheduled_operation.py index 8eb587b0..5a78fe54 100644 --- a/smaug/tests/unit/objects/test_scheduled_operation.py +++ b/karbor/tests/unit/objects/test_scheduled_operation.py @@ -14,8 +14,8 @@ import mock from oslo_serialization import jsonutils from oslo_utils import timeutils -from smaug import objects -from smaug.tests.unit import objects as test_objects +from karbor import objects +from karbor.tests.unit import objects as test_objects NOW = timeutils.utcnow().replace(microsecond=0) @@ -40,7 +40,7 @@ Fake_Operation = { class TestScheduledOperation(test_objects.BaseObjectsTestCase): Operation_Class = objects.ScheduledOperation - @mock.patch('smaug.db.scheduled_operation_get') + @mock.patch('karbor.db.scheduled_operation_get') def test_get_by_id(self, operation_get): db_op = Fake_Operation.copy() operation_get.return_value = db_op @@ -51,7 +51,7 @@ class TestScheduledOperation(test_objects.BaseObjectsTestCase): self._compare(self, db_op, op) operation_get.assert_called_once_with(self.context, Operation_ID, []) - @mock.patch('smaug.db.scheduled_operation_get') + @mock.patch('karbor.db.scheduled_operation_get') def test_get_join_trigger(self, operation_get): db_op = Fake_Operation.copy() db_op['trigger'] = { @@ -75,7 +75,7 @@ class TestScheduledOperation(test_objects.BaseObjectsTestCase): operation_get.assert_called_once_with(self.context, Operation_ID, ['trigger']) - @mock.patch('smaug.db.scheduled_operation_create') + @mock.patch('karbor.db.scheduled_operation_create') def test_create(self, operation_create): db_op = Fake_Operation.copy() operation_create.return_value = db_op @@ -87,7 +87,7 @@ class TestScheduledOperation(test_objects.BaseObjectsTestCase): self._compare(self, db_op, op) operation_create.assert_called_once_with(self.context, {}) - @mock.patch('smaug.db.scheduled_operation_update') + @mock.patch('karbor.db.scheduled_operation_update') def test_save(self, operation_update): db_op = Fake_Operation op = self.Operation_Class._from_db_object(self.context, @@ -100,7 +100,7 @@ class TestScheduledOperation(test_objects.BaseObjectsTestCase): op.id, {'name': 'protect volume'}) - @mock.patch('smaug.db.scheduled_operation_delete') + @mock.patch('karbor.db.scheduled_operation_delete') def test_destroy(self, operation_delete): db_op = Fake_Operation op = self.Operation_Class._from_db_object(self.context, diff --git a/smaug/tests/unit/objects/test_scheduled_operation_log.py b/karbor/tests/unit/objects/test_scheduled_operation_log.py similarity index 91% rename from smaug/tests/unit/objects/test_scheduled_operation_log.py rename to karbor/tests/unit/objects/test_scheduled_operation_log.py index 7fd3b264..6e024b34 100644 --- a/smaug/tests/unit/objects/test_scheduled_operation_log.py +++ b/karbor/tests/unit/objects/test_scheduled_operation_log.py @@ -13,9 +13,9 @@ import mock from oslo_utils import timeutils -from smaug import exception -from smaug import objects -from smaug.tests.unit import objects as test_objects +from karbor import exception +from karbor import objects +from karbor.tests.unit import objects as test_objects NOW = timeutils.utcnow().replace(microsecond=0) @@ -44,7 +44,7 @@ class TestScheduledOperationLog(test_objects.BaseObjectsTestCase): self.log_class = objects.ScheduledOperationLog self.db_log = Fake_Log - @mock.patch('smaug.db.scheduled_operation_log_get') + @mock.patch('karbor.db.scheduled_operation_log_get') def test_get_by_id(self, log_get): log_get.return_value = self.db_log @@ -57,7 +57,7 @@ class TestScheduledOperationLog(test_objects.BaseObjectsTestCase): self.log_class.get_by_id, self.context, Log_ID) - @mock.patch('smaug.db.scheduled_operation_log_create') + @mock.patch('karbor.db.scheduled_operation_log_create') def test_create(self, log_create): log_create.return_value = self.db_log @@ -69,7 +69,7 @@ class TestScheduledOperationLog(test_objects.BaseObjectsTestCase): self.assertRaises(exception.ObjectActionError, log.create) - @mock.patch('smaug.db.scheduled_operation_log_update') + @mock.patch('karbor.db.scheduled_operation_log_update') def test_save(self, log_update): log = self.log_class._from_db_object(self.context, self.log_class(), @@ -81,7 +81,7 @@ class TestScheduledOperationLog(test_objects.BaseObjectsTestCase): log.id, {'state': 'success'}) - @mock.patch('smaug.db.scheduled_operation_log_delete') + @mock.patch('karbor.db.scheduled_operation_log_delete') def test_destroy(self, log_delete): log = self.log_class._from_db_object(self.context, self.log_class(), diff --git a/smaug/tests/unit/objects/test_scheduled_operation_state.py b/karbor/tests/unit/objects/test_scheduled_operation_state.py similarity index 93% rename from smaug/tests/unit/objects/test_scheduled_operation_state.py rename to karbor/tests/unit/objects/test_scheduled_operation_state.py index f8a1930d..84f6a447 100644 --- a/smaug/tests/unit/objects/test_scheduled_operation_state.py +++ b/karbor/tests/unit/objects/test_scheduled_operation_state.py @@ -13,9 +13,9 @@ import mock from oslo_utils import timeutils -from smaug import context -from smaug import objects -from smaug.tests.unit import objects as test_objects +from karbor import context +from karbor import objects +from karbor.tests.unit import objects as test_objects NOW = timeutils.utcnow().replace(microsecond=0) @@ -37,7 +37,7 @@ Fake_State = { class TestScheduledOperationState(test_objects.BaseObjectsTestCase): State_Class = objects.ScheduledOperationState - @mock.patch('smaug.db.scheduled_operation_state_get') + @mock.patch('karbor.db.scheduled_operation_state_get') def test_get_by_operation_id(self, state_get): db_state = Fake_State state_get.return_value = db_state @@ -46,7 +46,7 @@ class TestScheduledOperationState(test_objects.BaseObjectsTestCase): self._compare(self, db_state, state) state_get.assert_called_once_with(self.context, Operation_ID, []) - @mock.patch('smaug.db.scheduled_operation_state_create') + @mock.patch('karbor.db.scheduled_operation_state_create') def test_create(self, state_create): db_state = Fake_State state_create.return_value = db_state @@ -55,7 +55,7 @@ class TestScheduledOperationState(test_objects.BaseObjectsTestCase): self._compare(self, db_state, state) state_create.assert_called_once_with(self.context, {}) - @mock.patch('smaug.db.scheduled_operation_state_update') + @mock.patch('karbor.db.scheduled_operation_state_update') def test_save(self, state_update): db_state = Fake_State state = self.State_Class._from_db_object(self.context, @@ -68,7 +68,7 @@ class TestScheduledOperationState(test_objects.BaseObjectsTestCase): state.operation_id, {'state': 'triggered'}) - @mock.patch('smaug.db.scheduled_operation_state_delete') + @mock.patch('karbor.db.scheduled_operation_state_delete') def test_destroy(self, state_delete): db_state = Fake_State state = self.State_Class._from_db_object(self.context, @@ -120,7 +120,7 @@ class FakeEnv(object): def _create_service(self): service_info = { 'host': "abc", - 'binary': 'smaug-operationengine' + 'binary': 'karbor-operationengine' } service = objects.Service(self.context, **service_info) service.create() diff --git a/smaug/tests/unit/objects/test_service.py b/karbor/tests/unit/objects/test_service.py similarity index 88% rename from smaug/tests/unit/objects/test_service.py rename to karbor/tests/unit/objects/test_service.py index bea85f7a..d3de9391 100644 --- a/smaug/tests/unit/objects/test_service.py +++ b/karbor/tests/unit/objects/test_service.py @@ -12,14 +12,14 @@ import mock -from smaug import objects -from smaug.tests.unit import fake_service -from smaug.tests.unit import objects as test_objects +from karbor import objects +from karbor.tests.unit import fake_service +from karbor.tests.unit import objects as test_objects class TestService(test_objects.BaseObjectsTestCase): - @mock.patch('smaug.db.sqlalchemy.api.service_get') + @mock.patch('karbor.db.sqlalchemy.api.service_get') def test_get_by_id(self, service_get): db_service = fake_service.fake_db_service() service_get.return_value = db_service @@ -27,7 +27,7 @@ class TestService(test_objects.BaseObjectsTestCase): self._compare(self, db_service, service) service_get.assert_called_once_with(self.context, 1) - @mock.patch('smaug.db.service_get_by_host_and_topic') + @mock.patch('karbor.db.service_get_by_host_and_topic') def test_get_by_host_and_topic(self, service_get_by_host_and_topic): db_service = fake_service.fake_db_service() service_get_by_host_and_topic.return_value = db_service @@ -37,7 +37,7 @@ class TestService(test_objects.BaseObjectsTestCase): service_get_by_host_and_topic.assert_called_once_with( self.context, 'fake-host', 'fake-topic') - @mock.patch('smaug.db.service_get_by_args') + @mock.patch('karbor.db.service_get_by_args') def test_get_by_args(self, service_get_by_args): db_service = fake_service.fake_db_service() service_get_by_args.return_value = db_service @@ -47,7 +47,7 @@ class TestService(test_objects.BaseObjectsTestCase): service_get_by_args.assert_called_once_with( self.context, 'fake-host', 'fake-key') - @mock.patch('smaug.db.service_create') + @mock.patch('karbor.db.service_create') def test_create(self, service_create): db_service = fake_service.fake_db_service() service_create.return_value = db_service @@ -56,7 +56,7 @@ class TestService(test_objects.BaseObjectsTestCase): self.assertEqual(db_service['id'], service.id) service_create.assert_called_once_with(self.context, {}) - @mock.patch('smaug.db.service_update') + @mock.patch('karbor.db.service_update') def test_save(self, service_update): db_service = fake_service.fake_db_service() service = objects.Service._from_db_object( @@ -66,7 +66,7 @@ class TestService(test_objects.BaseObjectsTestCase): service_update.assert_called_once_with(self.context, service.id, {'topic': 'foobar'}) - @mock.patch('smaug.db.service_destroy') + @mock.patch('karbor.db.service_destroy') def test_destroy(self, service_destroy): db_service = fake_service.fake_db_service() service = objects.Service._from_db_object( @@ -77,7 +77,7 @@ class TestService(test_objects.BaseObjectsTestCase): class TestServiceList(test_objects.BaseObjectsTestCase): - @mock.patch('smaug.db.service_get_all') + @mock.patch('karbor.db.service_get_all') def test_get_all(self, service_get_all): db_service = fake_service.fake_db_service() service_get_all.return_value = [db_service] @@ -87,7 +87,7 @@ class TestServiceList(test_objects.BaseObjectsTestCase): self.assertEqual(1, len(services)) TestService._compare(self, db_service, services[0]) - @mock.patch('smaug.db.service_get_all_by_topic') + @mock.patch('karbor.db.service_get_all_by_topic') def test_get_all_by_topic(self, service_get_all_by_topic): db_service = fake_service.fake_db_service() service_get_all_by_topic.return_value = [db_service] diff --git a/smaug/tests/unit/objects/test_trigger.py b/karbor/tests/unit/objects/test_trigger.py similarity index 91% rename from smaug/tests/unit/objects/test_trigger.py rename to karbor/tests/unit/objects/test_trigger.py index 46b98566..13114c6c 100644 --- a/smaug/tests/unit/objects/test_trigger.py +++ b/karbor/tests/unit/objects/test_trigger.py @@ -14,8 +14,8 @@ import mock from oslo_serialization import jsonutils from oslo_utils import timeutils -from smaug import objects -from smaug.tests.unit import objects as test_objects +from karbor import objects +from karbor.tests.unit import objects as test_objects NOW = timeutils.utcnow().replace(microsecond=0) @@ -37,7 +37,7 @@ Fake_Trigger = { class TestTrigger(test_objects.BaseObjectsTestCase): Trigger_Class = objects.Trigger - @mock.patch('smaug.db.trigger_get') + @mock.patch('karbor.db.trigger_get') def test_get_by_id(self, trigger_get): db_trigger = Fake_Trigger.copy() trigger_get.return_value = db_trigger @@ -47,7 +47,7 @@ class TestTrigger(test_objects.BaseObjectsTestCase): self._compare(self, db_trigger, trigger) trigger_get.assert_called_once_with(self.context, Trigger_ID) - @mock.patch('smaug.db.trigger_create') + @mock.patch('karbor.db.trigger_create') def test_create(self, trigger_create): db_trigger = Fake_Trigger.copy() trigger_create.return_value = db_trigger @@ -58,7 +58,7 @@ class TestTrigger(test_objects.BaseObjectsTestCase): self._compare(self, db_trigger, trigger) trigger_create.assert_called_once_with(self.context, {}) - @mock.patch('smaug.db.trigger_update') + @mock.patch('karbor.db.trigger_update') def test_save(self, trigger_update): db_trigger = Fake_Trigger trigger = self.Trigger_Class._from_db_object(self.context, @@ -71,7 +71,7 @@ class TestTrigger(test_objects.BaseObjectsTestCase): trigger.id, {'name': 'weekly'}) - @mock.patch('smaug.db.trigger_delete') + @mock.patch('karbor.db.trigger_delete') def test_destroy(self, trigger_delete): db_trigger = Fake_Trigger trigger = self.Trigger_Class._from_db_object(self.context, diff --git a/smaug/tests/unit/operationengine/__init__.py b/karbor/tests/unit/operationengine/__init__.py similarity index 100% rename from smaug/tests/unit/operationengine/__init__.py rename to karbor/tests/unit/operationengine/__init__.py diff --git a/smaug/tests/unit/operationengine/engine/executors/__init__.py b/karbor/tests/unit/operationengine/engine/executors/__init__.py similarity index 100% rename from smaug/tests/unit/operationengine/engine/executors/__init__.py rename to karbor/tests/unit/operationengine/engine/executors/__init__.py diff --git a/smaug/tests/unit/operationengine/engine/executors/test_thread_pool_executor.py b/karbor/tests/unit/operationengine/engine/executors/test_thread_pool_executor.py similarity index 95% rename from smaug/tests/unit/operationengine/engine/executors/test_thread_pool_executor.py rename to karbor/tests/unit/operationengine/engine/executors/test_thread_pool_executor.py index 559d8b0d..bd9cc4b4 100644 --- a/smaug/tests/unit/operationengine/engine/executors/test_thread_pool_executor.py +++ b/karbor/tests/unit/operationengine/engine/executors/test_thread_pool_executor.py @@ -14,12 +14,12 @@ from datetime import datetime from datetime import timedelta import time -from smaug.common import constants -from smaug import context -from smaug import objects -from smaug.services.operationengine.engine.executors import\ +from karbor.common import constants +from karbor import context +from karbor import objects +from karbor.services.operationengine.engine.executors import\ thread_pool_executor -from smaug.tests import base +from karbor.tests import base class FakeOperationManager(object): diff --git a/smaug/tests/unit/operationengine/engine/triggers/timetrigger/__init__.py b/karbor/tests/unit/operationengine/engine/triggers/timetrigger/__init__.py similarity index 100% rename from smaug/tests/unit/operationengine/engine/triggers/timetrigger/__init__.py rename to karbor/tests/unit/operationengine/engine/triggers/timetrigger/__init__.py diff --git a/smaug/tests/unit/operationengine/engine/triggers/timetrigger/test_time_format_manager.py b/karbor/tests/unit/operationengine/engine/triggers/timetrigger/test_time_format_manager.py similarity index 91% rename from smaug/tests/unit/operationengine/engine/triggers/timetrigger/test_time_format_manager.py rename to karbor/tests/unit/operationengine/engine/triggers/timetrigger/test_time_format_manager.py index 3a018547..df59a0eb 100644 --- a/smaug/tests/unit/operationengine/engine/triggers/timetrigger/test_time_format_manager.py +++ b/karbor/tests/unit/operationengine/engine/triggers/timetrigger/test_time_format_manager.py @@ -13,10 +13,10 @@ from datetime import datetime from datetime import timedelta -from smaug import exception -from smaug.services.operationengine.engine.triggers.timetrigger import\ +from karbor import exception +from karbor.services.operationengine.engine.triggers.timetrigger import\ time_format_manager -from smaug.tests import base +from karbor.tests import base class TimeFormatManagerTestCase(base.TestCase): diff --git a/smaug/tests/unit/operationengine/engine/triggers/timetrigger/test_time_trigger.py b/karbor/tests/unit/operationengine/engine/triggers/timetrigger/test_time_trigger.py similarity index 97% rename from smaug/tests/unit/operationengine/engine/triggers/timetrigger/test_time_trigger.py rename to karbor/tests/unit/operationengine/engine/triggers/timetrigger/test_time_trigger.py index 01e71e5f..19bfd8eb 100644 --- a/smaug/tests/unit/operationengine/engine/triggers/timetrigger/test_time_trigger.py +++ b/karbor/tests/unit/operationengine/engine/triggers/timetrigger/test_time_trigger.py @@ -14,10 +14,10 @@ from datetime import datetime from datetime import timedelta import eventlet -from smaug import exception -from smaug.services.operationengine.engine.triggers.timetrigger.time_trigger \ +from karbor import exception +from karbor.services.operationengine.engine.triggers.timetrigger.time_trigger \ import TimeTrigger -from smaug.tests import base +from karbor.tests import base class FakeExecutor(object): diff --git a/smaug/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/__init__.py b/karbor/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/__init__.py similarity index 100% rename from smaug/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/__init__.py rename to karbor/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/__init__.py diff --git a/smaug/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/test_crontab_time.py b/karbor/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/test_crontab_time.py similarity index 92% rename from smaug/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/test_crontab_time.py rename to karbor/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/test_crontab_time.py index 0b3f39dc..b0cb01e9 100644 --- a/smaug/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/test_crontab_time.py +++ b/karbor/tests/unit/operationengine/engine/triggers/timetrigger/timeformats/test_crontab_time.py @@ -13,10 +13,10 @@ from datetime import datetime from datetime import timedelta -from smaug import exception -from smaug.services.operationengine.engine.triggers.timetrigger.timeformats \ +from karbor import exception +from karbor.services.operationengine.engine.triggers.timetrigger.timeformats \ import crontab_time -from smaug.tests import base +from karbor.tests import base class CrontabTimeTestCase(base.TestCase): diff --git a/smaug/tests/unit/operationengine/operations/__init__.py b/karbor/tests/unit/operationengine/operations/__init__.py similarity index 100% rename from smaug/tests/unit/operationengine/operations/__init__.py rename to karbor/tests/unit/operationengine/operations/__init__.py diff --git a/smaug/tests/unit/operationengine/operations/test_operation.py b/karbor/tests/unit/operationengine/operations/test_operation.py similarity index 95% rename from smaug/tests/unit/operationengine/operations/test_operation.py rename to karbor/tests/unit/operationengine/operations/test_operation.py index b38e3fd6..94984a8b 100644 --- a/smaug/tests/unit/operationengine/operations/test_operation.py +++ b/karbor/tests/unit/operationengine/operations/test_operation.py @@ -13,11 +13,11 @@ from datetime import datetime from datetime import timedelta -from smaug.common import constants -from smaug import context -from smaug import objects -from smaug.services.operationengine.operations import base as base_operation -from smaug.tests import base +from karbor.common import constants +from karbor import context +from karbor import objects +from karbor.services.operationengine.operations import base as base_operation +from karbor.tests import base class OperationTestCase(base.TestCase): diff --git a/smaug/tests/unit/operationengine/operations/test_protect_operation.py b/karbor/tests/unit/operationengine/operations/test_protect_operation.py similarity index 88% rename from smaug/tests/unit/operationengine/operations/test_protect_operation.py rename to karbor/tests/unit/operationengine/operations/test_protect_operation.py index 99158268..1491174f 100644 --- a/smaug/tests/unit/operationengine/operations/test_protect_operation.py +++ b/karbor/tests/unit/operationengine/operations/test_protect_operation.py @@ -13,12 +13,12 @@ from datetime import datetime import mock -from smaug.common import constants -from smaug import context -from smaug import exception -from smaug import objects -from smaug.services.operationengine.operations import protect_operation -from smaug.tests import base +from karbor.common import constants +from karbor import context +from karbor import exception +from karbor import objects +from karbor.services.operationengine.operations import protect_operation +from karbor.tests import base class FakeCheckPoint(object): @@ -26,7 +26,7 @@ class FakeCheckPoint(object): return -class FakeSmaugClient(object): +class FakeKarborClient(object): def __init__(self): self._check_point = FakeCheckPoint() @@ -42,16 +42,16 @@ class ProtectOperationTestCase(base.TestCase): super(ProtectOperationTestCase, self).setUp() self._operation_class = protect_operation.ProtectOperation self._operation_db = self._create_operation() - self._fake_smaug_client = FakeSmaugClient() + self._fake_karbor_client = FakeKarborClient() def test_check_operation_definition(self): self.assertRaises(exception.InvalidOperationDefinition, self._operation_class.check_operation_definition, {}) - @mock.patch('smaug.services.operationengine.smaug_client.client') + @mock.patch('karbor.services.operationengine.karbor_client.client') def test_execute(self, client): - client.return_value = self._fake_smaug_client + client.return_value = self._fake_karbor_client now = datetime.utcnow() param = { 'operation_id': self._operation_db.id, @@ -75,10 +75,10 @@ class ProtectOperationTestCase(base.TestCase): log = logs.objects[0] self.assertTrue(now, log.triggered_time) - @mock.patch('smaug.services.operationengine.smaug_client.client') + @mock.patch('karbor.services.operationengine.karbor_client.client') def test_resume(self, client): log = self._create_operation_log(self._operation_db.id) - client.return_value = self._fake_smaug_client + client.return_value = self._fake_karbor_client now = datetime.utcnow() param = { 'operation_id': self._operation_db.id, diff --git a/smaug/tests/unit/operationengine/test_manager.py b/karbor/tests/unit/operationengine/test_manager.py similarity index 96% rename from smaug/tests/unit/operationengine/test_manager.py rename to karbor/tests/unit/operationengine/test_manager.py index 0aa79714..af61d809 100644 --- a/smaug/tests/unit/operationengine/test_manager.py +++ b/karbor/tests/unit/operationengine/test_manager.py @@ -12,11 +12,11 @@ from oslo_messaging.rpc import dispatcher as rpc_dispatcher -from smaug.common import constants -from smaug import context -from smaug import objects -from smaug.services.operationengine import manager as service_manager -from smaug.tests import base +from karbor.common import constants +from karbor import context +from karbor import objects +from karbor.services.operationengine import manager as service_manager +from karbor.tests import base class FakeTriggerManager(object): diff --git a/smaug/tests/unit/operationengine/test_operation_manager.py b/karbor/tests/unit/operationengine/test_operation_manager.py similarity index 92% rename from smaug/tests/unit/operationengine/test_operation_manager.py rename to karbor/tests/unit/operationengine/test_operation_manager.py index c8c7fddc..19835043 100644 --- a/smaug/tests/unit/operationengine/test_operation_manager.py +++ b/karbor/tests/unit/operationengine/test_operation_manager.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug import exception -from smaug.services.operationengine import operation_manager -from smaug.tests import base +from karbor import exception +from karbor.services.operationengine import operation_manager +from karbor.tests import base class OperationManagerTestCase(base.TestCase): diff --git a/smaug/tests/unit/operationengine/test_user_trust_manager.py b/karbor/tests/unit/operationengine/test_user_trust_manager.py similarity index 87% rename from smaug/tests/unit/operationengine/test_user_trust_manager.py rename to karbor/tests/unit/operationengine/test_user_trust_manager.py index bd4e0852..b449f4f5 100644 --- a/smaug/tests/unit/operationengine/test_user_trust_manager.py +++ b/karbor/tests/unit/operationengine/test_user_trust_manager.py @@ -12,10 +12,10 @@ import mock -from smaug.common import smaug_keystone_plugin -from smaug import context -from smaug.services.operationengine import user_trust_manager -from smaug.tests import base +from karbor.common import karbor_keystone_plugin +from karbor import context +from karbor.services.operationengine import user_trust_manager +from karbor.tests import base G_TOKEN_ID = 'abcdefg' @@ -28,10 +28,10 @@ class FakeSession(object): class FakeSKP(object): - def create_trust_to_smaug(self, context): + def create_trust_to_karbor(self, context): return G_TRUST_ID - def delete_trust_to_smaug(self, trust_id): + def delete_trust_to_karbor(self, trust_id): return def create_trust_session(self, trust_id): @@ -49,12 +49,12 @@ class UserTrustManagerTestCase(base.TestCase): self._ctx = context.RequestContext(user_id=self._user_id, project_id=self._project_id) - with mock.patch.object(smaug_keystone_plugin.SmaugKeystonePlugin, + with mock.patch.object(karbor_keystone_plugin.KarborKeystonePlugin, '_do_init'): self._manager = user_trust_manager.UserTrustManager() self._manager._skp = FakeSKP() - @mock.patch.object(smaug_keystone_plugin.SmaugKeystonePlugin, '_do_init') + @mock.patch.object(karbor_keystone_plugin.KarborKeystonePlugin, '_do_init') def test_singleton_user_trust_manager(self, do_init): second = user_trust_manager.UserTrustManager() self.assertTrue(id(self._manager) == id(second)) @@ -71,7 +71,7 @@ class UserTrustManagerTestCase(base.TestCase): manager.add_operation(self._ctx, operation_id) self.assertEqual(1, len(info['operation_ids'])) - @mock.patch.object(FakeSKP, 'delete_trust_to_smaug') + @mock.patch.object(FakeSKP, 'delete_trust_to_karbor') def test_delete_operation(self, del_trust): manager = self._manager op_ids = ['abc', '123'] diff --git a/smaug/tests/unit/plugins/__init__.py b/karbor/tests/unit/plugins/__init__.py similarity index 100% rename from smaug/tests/unit/plugins/__init__.py rename to karbor/tests/unit/plugins/__init__.py diff --git a/smaug/tests/unit/plugins/test_image_protectable_plugin.py b/karbor/tests/unit/plugins/test_image_protectable_plugin.py similarity index 96% rename from smaug/tests/unit/plugins/test_image_protectable_plugin.py rename to karbor/tests/unit/plugins/test_image_protectable_plugin.py index b6fa028c..3990f05f 100644 --- a/smaug/tests/unit/plugins/test_image_protectable_plugin.py +++ b/karbor/tests/unit/plugins/test_image_protectable_plugin.py @@ -12,15 +12,15 @@ from collections import namedtuple from glanceclient.v2 import images +from karbor.common import constants +from karbor.context import RequestContext +from karbor import resource +from karbor.services.protection.protectable_plugins.image import \ + ImageProtectablePlugin +from karbor.tests import base import mock from novaclient.v2 import servers from oslo_config import cfg -from smaug.common import constants -from smaug.context import RequestContext -from smaug import resource -from smaug.services.protection.protectable_plugins.image import \ - ImageProtectablePlugin -from smaug.tests import base CONF = cfg.CONF diff --git a/smaug/tests/unit/plugins/test_server_protectable_plugin.py b/karbor/tests/unit/plugins/test_server_protectable_plugin.py similarity index 96% rename from smaug/tests/unit/plugins/test_server_protectable_plugin.py rename to karbor/tests/unit/plugins/test_server_protectable_plugin.py index 0a503c7a..863cafa7 100644 --- a/smaug/tests/unit/plugins/test_server_protectable_plugin.py +++ b/karbor/tests/unit/plugins/test_server_protectable_plugin.py @@ -11,16 +11,15 @@ # under the License. import collections -import mock -from novaclient.v2 import servers - -from oslo_config import cfg -from smaug.context import RequestContext -from smaug.resource import Resource -from smaug.services.protection.protectable_plugins.server \ +from karbor.context import RequestContext +from karbor.resource import Resource +from karbor.services.protection.protectable_plugins.server \ import ServerProtectablePlugin -from smaug.tests import base +from karbor.tests import base +import mock +from novaclient.v2 import servers +from oslo_config import cfg class ServerProtectablePluginTest(base.TestCase): diff --git a/smaug/tests/unit/plugins/test_volume_protectable_plugin.py b/karbor/tests/unit/plugins/test_volume_protectable_plugin.py similarity index 96% rename from smaug/tests/unit/plugins/test_volume_protectable_plugin.py rename to karbor/tests/unit/plugins/test_volume_protectable_plugin.py index 55808277..412bb488 100644 --- a/smaug/tests/unit/plugins/test_volume_protectable_plugin.py +++ b/karbor/tests/unit/plugins/test_volume_protectable_plugin.py @@ -14,14 +14,14 @@ from cinderclient.v2 import volumes from collections import namedtuple import mock -from oslo_config import cfg -from smaug.common import constants -from smaug.context import RequestContext -from smaug.resource import Resource -from smaug.services.protection.protectable_plugins.volume \ +from karbor.common import constants +from karbor.context import RequestContext +from karbor.resource import Resource +from karbor.services.protection.protectable_plugins.volume \ import VolumeProtectablePlugin -from smaug.tests import base +from karbor.tests import base +from oslo_config import cfg project_info = namedtuple('project_info', field_names=['id', 'type', 'name']) vol_info = namedtuple('vol_info', ['id', 'attachments', 'name']) diff --git a/smaug/tests/unit/policy.json b/karbor/tests/unit/policy.json similarity index 100% rename from smaug/tests/unit/policy.json rename to karbor/tests/unit/policy.json diff --git a/smaug/tests/unit/protection/__init__.py b/karbor/tests/unit/protection/__init__.py similarity index 100% rename from smaug/tests/unit/protection/__init__.py rename to karbor/tests/unit/protection/__init__.py diff --git a/smaug/tests/unit/protection/fake_clients.py b/karbor/tests/unit/protection/fake_clients.py similarity index 100% rename from smaug/tests/unit/protection/fake_clients.py rename to karbor/tests/unit/protection/fake_clients.py diff --git a/smaug/tests/unit/protection/fake_swift_client.py b/karbor/tests/unit/protection/fake_swift_client.py similarity index 100% rename from smaug/tests/unit/protection/fake_swift_client.py rename to karbor/tests/unit/protection/fake_swift_client.py diff --git a/smaug/tests/unit/protection/fakes.py b/karbor/tests/unit/protection/fakes.py similarity index 95% rename from smaug/tests/unit/protection/fakes.py rename to karbor/tests/unit/protection/fakes.py index b919edb9..f0a68699 100644 --- a/smaug/tests/unit/protection/fakes.py +++ b/karbor/tests/unit/protection/fakes.py @@ -17,13 +17,13 @@ import futurist from oslo_log import log as logging -from smaug.i18n import _LE -from smaug.resource import Resource -from smaug.services.protection.bank_plugin import Bank -from smaug.services.protection.bank_plugin import BankPlugin -from smaug.services.protection.bank_plugin import BankSection -from smaug.services.protection.graph import build_graph -from smaug.services.protection import provider +from karbor.i18n import _LE +from karbor.resource import Resource +from karbor.services.protection.bank_plugin import Bank +from karbor.services.protection.bank_plugin import BankPlugin +from karbor.services.protection.bank_plugin import BankSection +from karbor.services.protection.graph import build_graph +from karbor.services.protection import provider from taskflow import engines from taskflow.patterns import graph_flow diff --git a/smaug/tests/unit/protection/test_bank.py b/karbor/tests/unit/protection/test_bank.py similarity index 94% rename from smaug/tests/unit/protection/test_bank.py rename to karbor/tests/unit/protection/test_bank.py index e0864321..9dbe3125 100644 --- a/smaug/tests/unit/protection/test_bank.py +++ b/karbor/tests/unit/protection/test_bank.py @@ -15,12 +15,12 @@ from copy import deepcopy import six from uuid import uuid4 as uuid -from smaug import exception -from smaug.services.protection.bank_plugin import Bank -from smaug.services.protection.bank_plugin import BankPlugin -from smaug.services.protection.bank_plugin import BankSection -from smaug.services.protection.bank_plugin import LeasePlugin -from smaug.tests import base +from karbor import exception +from karbor.services.protection.bank_plugin import Bank +from karbor.services.protection.bank_plugin import BankPlugin +from karbor.services.protection.bank_plugin import BankSection +from karbor.services.protection.bank_plugin import LeasePlugin +from karbor.tests import base class _InMemoryBankPlugin(BankPlugin): diff --git a/smaug/tests/unit/protection/test_build_task_flow.py b/karbor/tests/unit/protection/test_build_task_flow.py similarity index 88% rename from smaug/tests/unit/protection/test_build_task_flow.py rename to karbor/tests/unit/protection/test_build_task_flow.py index 3711942f..6abf1ea0 100644 --- a/smaug/tests/unit/protection/test_build_task_flow.py +++ b/karbor/tests/unit/protection/test_build_task_flow.py @@ -12,18 +12,18 @@ import mock -from smaug.common import constants -from smaug.services.protection.graph import build_graph -from smaug.services.protection.protectable_registry import ProtectableRegistry -from smaug.services.protection.provider import ProviderRegistry +from karbor.common import constants +from karbor.services.protection.graph import build_graph +from karbor.services.protection.protectable_registry import ProtectableRegistry +from karbor.services.protection.provider import ProviderRegistry -from smaug.tests import base -from smaug.tests.unit.protection.fakes import fake_protection_plan -from smaug.tests.unit.protection.fakes import fake_restore -from smaug.tests.unit.protection.fakes import FakeCheckpoint -from smaug.tests.unit.protection.fakes import FakeProtectionPlugin -from smaug.tests.unit.protection.fakes import plan_resources -from smaug.tests.unit.protection.fakes import resource_map +from karbor.tests import base +from karbor.tests.unit.protection.fakes import fake_protection_plan +from karbor.tests.unit.protection.fakes import fake_restore +from karbor.tests.unit.protection.fakes import FakeCheckpoint +from karbor.tests.unit.protection.fakes import FakeProtectionPlugin +from karbor.tests.unit.protection.fakes import plan_resources +from karbor.tests.unit.protection.fakes import resource_map class FakeWorkflowEngine(object): diff --git a/smaug/tests/unit/protection/test_checkpoint.py b/karbor/tests/unit/protection/test_checkpoint.py similarity index 88% rename from smaug/tests/unit/protection/test_checkpoint.py rename to karbor/tests/unit/protection/test_checkpoint.py index f628938f..f65c34f2 100644 --- a/smaug/tests/unit/protection/test_checkpoint.py +++ b/karbor/tests/unit/protection/test_checkpoint.py @@ -10,15 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug.resource import Resource -from smaug.services.protection import bank_plugin -from smaug.services.protection import checkpoint -from smaug.services.protection import graph +from karbor.resource import Resource +from karbor.services.protection import bank_plugin +from karbor.services.protection import checkpoint +from karbor.services.protection import graph -from smaug.tests import base -from smaug.tests.unit.protection.fakes import fake_protection_plan -from smaug.tests.unit.protection.test_bank import _InMemoryBankPlugin -from smaug.tests.unit.protection.test_bank import _InMemoryLeasePlugin +from karbor.tests import base +from karbor.tests.unit.protection.fakes import fake_protection_plan +from karbor.tests.unit.protection.test_bank import _InMemoryBankPlugin +from karbor.tests.unit.protection.test_bank import _InMemoryLeasePlugin A = Resource(id="A", type="fake", name="fake") B = Resource(id="B", type="fake", name="fake") diff --git a/smaug/tests/unit/protection/test_checkpoint_collection.py b/karbor/tests/unit/protection/test_checkpoint_collection.py similarity index 91% rename from smaug/tests/unit/protection/test_checkpoint_collection.py rename to karbor/tests/unit/protection/test_checkpoint_collection.py index acc3708a..951e60dd 100644 --- a/smaug/tests/unit/protection/test_checkpoint_collection.py +++ b/karbor/tests/unit/protection/test_checkpoint_collection.py @@ -15,12 +15,12 @@ import mock from oslo_utils import timeutils -from smaug.services.protection.bank_plugin import Bank -from smaug.services.protection.checkpoint import CheckpointCollection -from smaug.tests import base -from smaug.tests.unit.protection.fakes import fake_protection_plan -from smaug.tests.unit.protection.test_bank import _InMemoryBankPlugin -from smaug.tests.unit.protection.test_bank import _InMemoryLeasePlugin +from karbor.services.protection.bank_plugin import Bank +from karbor.services.protection.checkpoint import CheckpointCollection +from karbor.tests import base +from karbor.tests.unit.protection.fakes import fake_protection_plan +from karbor.tests.unit.protection.test_bank import _InMemoryBankPlugin +from karbor.tests.unit.protection.test_bank import _InMemoryLeasePlugin class CheckpointCollectionTest(base.TestCase): diff --git a/smaug/tests/unit/protection/test_cinder_protection_plugin.py b/karbor/tests/unit/protection/test_cinder_protection_plugin.py similarity index 88% rename from smaug/tests/unit/protection/test_cinder_protection_plugin.py rename to karbor/tests/unit/protection/test_cinder_protection_plugin.py index cc4528de..2419f38f 100644 --- a/smaug/tests/unit/protection/test_cinder_protection_plugin.py +++ b/karbor/tests/unit/protection/test_cinder_protection_plugin.py @@ -12,22 +12,21 @@ import collections import datetime -import mock - -from oslo_config import cfg -from smaug.common import constants -from smaug.context import RequestContext -from smaug.resource import Resource -from smaug.services.protection.bank_plugin import Bank -from smaug.services.protection.bank_plugin import BankPlugin -from smaug.services.protection.bank_plugin import BankSection -from smaug.services.protection.client_factory import ClientFactory -from smaug.services.protection.protection_plugins.volume. \ +from karbor.common import constants +from karbor.context import RequestContext +from karbor.resource import Resource +from karbor.services.protection.bank_plugin import Bank +from karbor.services.protection.bank_plugin import BankPlugin +from karbor.services.protection.bank_plugin import BankSection +from karbor.services.protection.client_factory import ClientFactory +from karbor.services.protection.protection_plugins.volume. \ cinder_protection_plugin import CinderProtectionPlugin -from smaug.services.protection.protection_plugins.volume \ +from karbor.services.protection.protection_plugins.volume \ import volume_plugin_cinder_schemas as cinder_schemas -from smaug.services.protection.restore_heat import HeatTemplate -from smaug.tests import base +from karbor.services.protection.restore_heat import HeatTemplate +from karbor.tests import base +import mock +from oslo_config import cfg class FakeBankPlugin(BankPlugin): @@ -168,8 +167,8 @@ class CinderProtectionPluginTest(base.TestCase): resource_definition = {"backup_id": "456"} kwargs = {"node": resource_node, "heat_template": heat_template, - "restore_name": "smaug restore volume", - "restore_description": "smaug restore"} + "restore_name": "karbor restore volume", + "restore_description": "karbor restore"} fake_bank_section.get_object = mock.MagicMock() fake_bank_section.get_object.return_value = resource_definition @@ -181,14 +180,14 @@ class CinderProtectionPluginTest(base.TestCase): heat_resource_id = heat_template._original_id_resource_map["123"] template_dict = { "heat_template_version": str(datetime.date(2015, 10, 15)), - "description": "smaug restore template", + "description": "karbor restore template", "resources": { heat_resource_id: { "type": "OS::Cinder::Volume", "properties": { - "description": "smaug restore", + "description": "karbor restore", "backup_id": "456", - "name": "smaug restore volume", + "name": "karbor restore volume", } } } diff --git a/smaug/tests/unit/protection/test_glance_protection_plugin.py b/karbor/tests/unit/protection/test_glance_protection_plugin.py similarity index 90% rename from smaug/tests/unit/protection/test_glance_protection_plugin.py rename to karbor/tests/unit/protection/test_glance_protection_plugin.py index e9e76ec9..c58b0044 100644 --- a/smaug/tests/unit/protection/test_glance_protection_plugin.py +++ b/karbor/tests/unit/protection/test_glance_protection_plugin.py @@ -11,21 +11,20 @@ # under the License. import collections -import mock - -from oslo_config import cfg -from smaug.common import constants -from smaug.context import RequestContext -from smaug.resource import Resource -from smaug.services.protection.bank_plugin import Bank -from smaug.services.protection.bank_plugin import BankPlugin -from smaug.services.protection.bank_plugin import BankSection -from smaug.services.protection.client_factory import ClientFactory -from smaug.services.protection.protection_plugins. \ +from karbor.common import constants +from karbor.context import RequestContext +from karbor.resource import Resource +from karbor.services.protection.bank_plugin import Bank +from karbor.services.protection.bank_plugin import BankPlugin +from karbor.services.protection.bank_plugin import BankSection +from karbor.services.protection.client_factory import ClientFactory +from karbor.services.protection.protection_plugins. \ image.image_protection_plugin import GlanceProtectionPlugin -from smaug.services.protection.protection_plugins.image \ +from karbor.services.protection.protection_plugins.image \ import image_plugin_schemas -from smaug.tests import base +from karbor.tests import base +import mock +from oslo_config import cfg class FakeBankPlugin(BankPlugin): diff --git a/smaug/tests/unit/protection/test_graph.py b/karbor/tests/unit/protection/test_graph.py similarity index 98% rename from smaug/tests/unit/protection/test_graph.py rename to karbor/tests/unit/protection/test_graph.py index 1b3f4911..38f1135a 100644 --- a/smaug/tests/unit/protection/test_graph.py +++ b/karbor/tests/unit/protection/test_graph.py @@ -13,9 +13,9 @@ from collections import namedtuple from oslo_serialization import jsonutils from oslo_serialization import msgpackutils -from smaug import exception -import smaug.services.protection.graph as graph -from smaug.tests import base +from karbor import exception +import karbor.services.protection.graph as graph +from karbor.tests import base class GraphBuilderTest(base.TestCase): diff --git a/smaug/tests/unit/protection/test_manager.py b/karbor/tests/unit/protection/test_manager.py similarity index 94% rename from smaug/tests/unit/protection/test_manager.py rename to karbor/tests/unit/protection/test_manager.py index a026976c..68f3119b 100644 --- a/smaug/tests/unit/protection/test_manager.py +++ b/karbor/tests/unit/protection/test_manager.py @@ -16,15 +16,15 @@ from oslo_config import cfg from oslo_log import log as logging import oslo_messaging -from smaug import exception -from smaug.resource import Resource -from smaug.services.protection.flows import worker as flow_manager -from smaug.services.protection import manager -from smaug.services.protection import protectable_registry -from smaug.services.protection import provider +from karbor import exception +from karbor.resource import Resource +from karbor.services.protection.flows import worker as flow_manager +from karbor.services.protection import manager +from karbor.services.protection import protectable_registry +from karbor.services.protection import provider -from smaug.tests import base -from smaug.tests.unit.protection import fakes +from karbor.tests import base +from karbor.tests.unit.protection import fakes LOG = logging.getLogger(__name__) diff --git a/smaug/tests/unit/protection/test_nova_protection_plugin.py b/karbor/tests/unit/protection/test_nova_protection_plugin.py similarity index 96% rename from smaug/tests/unit/protection/test_nova_protection_plugin.py rename to karbor/tests/unit/protection/test_nova_protection_plugin.py index bd8e3d33..3b387b30 100644 --- a/smaug/tests/unit/protection/test_nova_protection_plugin.py +++ b/karbor/tests/unit/protection/test_nova_protection_plugin.py @@ -11,19 +11,18 @@ # under the License. import collections -import mock - -from smaug.common import constants -from smaug.context import RequestContext -from smaug.resource import Resource -from smaug.services.protection.bank_plugin import Bank -from smaug.services.protection.bank_plugin import BankPlugin -from smaug.services.protection.bank_plugin import BankSection -from smaug.services.protection.protection_plugins.server.nova_protection_plugin \ +from karbor.common import constants +from karbor.context import RequestContext +from karbor.resource import Resource +from karbor.services.protection.bank_plugin import Bank +from karbor.services.protection.bank_plugin import BankPlugin +from karbor.services.protection.bank_plugin import BankSection +from karbor.services.protection.protection_plugins.server.nova_protection_plugin \ import NovaProtectionPlugin -from smaug.services.protection.protection_plugins.server \ +from karbor.services.protection.protection_plugins.server \ import server_plugin_schemas -from smaug.tests import base +from karbor.tests import base +import mock class Server(object): diff --git a/smaug/tests/unit/protection/test_protectable.py b/karbor/tests/unit/protection/test_protectable.py similarity index 90% rename from smaug/tests/unit/protection/test_protectable.py rename to karbor/tests/unit/protection/test_protectable.py index 93b4635d..0a768b8c 100644 --- a/smaug/tests/unit/protection/test_protectable.py +++ b/karbor/tests/unit/protection/test_protectable.py @@ -10,13 +10,13 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug.resource import Resource -from smaug.services.protection.protectable_plugin import ProtectablePlugin -from smaug.services.protection.protectable_registry import ProtectableRegistry +from karbor.resource import Resource +from karbor.services.protection.protectable_plugin import ProtectablePlugin +from karbor.services.protection.protectable_registry import ProtectableRegistry -from smaug.tests import base +from karbor.tests import base -_FAKE_TYPE = "Smaug::Test::Fake" +_FAKE_TYPE = "Karbor::Test::Fake" class _FakeProtectablePlugin(ProtectablePlugin): diff --git a/smaug/tests/unit/protection/test_provider.py b/karbor/tests/unit/protection/test_provider.py similarity index 93% rename from smaug/tests/unit/protection/test_provider.py rename to karbor/tests/unit/protection/test_provider.py index 3325a636..e746d6c9 100644 --- a/smaug/tests/unit/protection/test_provider.py +++ b/karbor/tests/unit/protection/test_provider.py @@ -10,11 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. +from karbor.services.protection import provider +from karbor.tests import base import mock from oslo_config import cfg -from smaug.services.protection import provider -from smaug.tests import base CONF = cfg.CONF @@ -43,7 +43,7 @@ class ProviderRegistryTest(base.TestCase): def test_provider_plugin_config(self): pr = provider.ProviderRegistry() provider1 = pr.show_provider('fake_id1') - plugin_name = 'smaug.tests.unit.fake_protection.FakeProtectionPlugin' + plugin_name = 'karbor.tests.unit.fake_protection.FakeProtectionPlugin' self.assertEqual( provider1.plugins[plugin_name]._config.fake_plugin.fake_user, 'user') diff --git a/smaug/tests/unit/protection/test_resource_graph.py b/karbor/tests/unit/protection/test_resource_graph.py similarity index 85% rename from smaug/tests/unit/protection/test_resource_graph.py rename to karbor/tests/unit/protection/test_resource_graph.py index 415bcf16..59426120 100644 --- a/smaug/tests/unit/protection/test_resource_graph.py +++ b/karbor/tests/unit/protection/test_resource_graph.py @@ -10,16 +10,16 @@ # License for the specific language governing permissions and limitations # under the License. -import smaug.services.protection.graph as graph -from smaug.services.protection.resource_graph import ResourceGraphContext -from smaug.services.protection.resource_graph \ +import karbor.services.protection.graph as graph +from karbor.services.protection.resource_graph import ResourceGraphContext +from karbor.services.protection.resource_graph \ import ResourceGraphWalkerListener -from smaug.tests import base -from smaug.tests.unit.protection.fakes import FakeProtectionPlugin -from smaug.tests.unit.protection.fakes import plan_resources -from smaug.tests.unit.protection.fakes import resource_graph -from smaug.tests.unit.protection.fakes import resource_map +from karbor.tests import base +from karbor.tests.unit.protection.fakes import FakeProtectionPlugin +from karbor.tests.unit.protection.fakes import plan_resources +from karbor.tests.unit.protection.fakes import resource_graph +from karbor.tests.unit.protection.fakes import resource_map class ResourceGraphWalkerListenerTest(base.TestCase): diff --git a/smaug/tests/unit/protection/test_restore_heat.py b/karbor/tests/unit/protection/test_restore_heat.py similarity index 95% rename from smaug/tests/unit/protection/test_restore_heat.py rename to karbor/tests/unit/protection/test_restore_heat.py index ec465a0a..72bb1bae 100644 --- a/smaug/tests/unit/protection/test_restore_heat.py +++ b/karbor/tests/unit/protection/test_restore_heat.py @@ -14,9 +14,9 @@ import datetime import tempfile import yaml -from smaug.services.protection.restore_heat import HeatResource -from smaug.services.protection.restore_heat import HeatTemplate -from smaug.tests import base +from karbor.services.protection.restore_heat import HeatResource +from karbor.services.protection.restore_heat import HeatTemplate +from karbor.tests import base class HeatResourceTest(base.TestCase): @@ -133,7 +133,7 @@ class HeatTemplateTest(base.TestCase): target_dict = { "heat_template_version": str(datetime.date(2015, 10, 15)), - "description": "smaug restore template", + "description": "karbor restore template", "resources": { "restore_123456": { "type": "OS::Cinder::Volume", @@ -168,7 +168,7 @@ class HeatTemplateTest(base.TestCase): template_dict = yaml.load(f) target_dict = { "heat_template_version": str(datetime.date(2015, 10, 15)), - "description": "smaug restore template", + "description": "karbor restore template", "resources": { "restore_123456": { "type": "OS::Cinder::Volume", diff --git a/smaug/tests/unit/protection/test_swift_bank_plugin.py b/karbor/tests/unit/protection/test_swift_bank_plugin.py similarity index 92% rename from smaug/tests/unit/protection/test_swift_bank_plugin.py rename to karbor/tests/unit/protection/test_swift_bank_plugin.py index e7d0cf63..5ee0c3ad 100644 --- a/smaug/tests/unit/protection/test_swift_bank_plugin.py +++ b/karbor/tests/unit/protection/test_swift_bank_plugin.py @@ -10,14 +10,14 @@ # License for the specific language governing permissions and limitations # under the License. +from karbor.services.protection.clients import swift +from karbor.tests import base +from karbor.tests.unit.protection.fake_swift_client import FakeSwiftClient import math import mock import os from oslo_config import cfg from oslo_utils import importutils -from smaug.services.protection.clients import swift -from smaug.tests import base -from smaug.tests.unit.protection.fake_swift_client import FakeSwiftClient import time CONF = cfg.CONF @@ -37,7 +37,7 @@ class SwiftBankPluginTest(base.TestCase): self.fake_connection = FakeSwiftClient.connection() swift.create = mock.MagicMock() swift.create.return_value = self.fake_connection - import_str = "smaug.services.protection.bank_plugins." \ + import_str = "karbor.services.protection.bank_plugins." \ "swift_bank_plugin.SwiftBankPlugin" self.object_container = "objects" swift_bank_plugin_cls = importutils.import_class( @@ -69,7 +69,7 @@ class SwiftBankPluginTest(base.TestCase): def test_create_object(self): self.swift_bank_plugin.create_object("key-1", "value-1") object_file = os.path.join(self.fake_connection.swiftdir, - "smaug", + "karbor", "key-1") with open(object_file, "r") as f: contents = f.read() @@ -79,7 +79,7 @@ class SwiftBankPluginTest(base.TestCase): self.swift_bank_plugin.create_object("key", "value") self.swift_bank_plugin.delete_object("key") object_file = os.path.join(self.fake_connection.swiftdir, - "smaug", + "karbor", "key") self.assertEqual(os.path.isfile(object_file), False) @@ -98,7 +98,7 @@ class SwiftBankPluginTest(base.TestCase): self.swift_bank_plugin.create_object("key-1", "value-1") self.swift_bank_plugin.update_object("key-1", "value-2") object_file = os.path.join(self.fake_connection.swiftdir, - "smaug", + "karbor", "key-1") with open(object_file, "r") as f: contents = f.read() diff --git a/smaug/tests/unit/protection/test_workflow.py b/karbor/tests/unit/protection/test_workflow.py similarity index 95% rename from smaug/tests/unit/protection/test_workflow.py rename to karbor/tests/unit/protection/test_workflow.py index 26b2cb7f..9dbea921 100644 --- a/smaug/tests/unit/protection/test_workflow.py +++ b/karbor/tests/unit/protection/test_workflow.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug.services.protection.flows import workflow -from smaug.tests import base +from karbor.services.protection.flows import workflow +from karbor.tests import base def fake_func(): diff --git a/smaug/tests/unit/test_cmd.py b/karbor/tests/unit/test_cmd.py similarity index 65% rename from smaug/tests/unit/test_cmd.py rename to karbor/tests/unit/test_cmd.py index 8ab5d3f2..b66c2820 100644 --- a/smaug/tests/unit/test_cmd.py +++ b/karbor/tests/unit/test_cmd.py @@ -18,27 +18,27 @@ except ImportError: import mock from oslo_config import cfg -from smaug.cmd import api as smaug_api -from smaug.tests import base -from smaug import version +from karbor.cmd import api as karbor_api +from karbor.tests import base +from karbor import version CONF = cfg.CONF -class TestSmaugApiCmd(base.TestCase): - """Unit test cases for python modules under smaug/cmd.""" +class TestKarborApiCmd(base.TestCase): + """Unit test cases for python modules under karbor/cmd.""" def setUp(self): - super(TestSmaugApiCmd, self).setUp() - sys.argv = ['smaug-api'] - CONF(sys.argv[1:], project='smaug', version=version.version_string()) + super(TestKarborApiCmd, self).setUp() + sys.argv = ['karbor-api'] + CONF(sys.argv[1:], project='karbor', version=version.version_string()) def tearDown(self): - super(TestSmaugApiCmd, self).tearDown() + super(TestKarborApiCmd, self).tearDown() - @mock.patch('smaug.service.WSGIService') - @mock.patch('smaug.service.process_launcher') - @mock.patch('smaug.rpc.init') + @mock.patch('karbor.service.WSGIService') + @mock.patch('karbor.service.process_launcher') + @mock.patch('karbor.rpc.init') @mock.patch('oslo_log.log.setup') def test_main(self, log_setup, rpc_init, process_launcher, wsgi_service): @@ -46,14 +46,14 @@ class TestSmaugApiCmd(base.TestCase): server = wsgi_service.return_value server.workers = mock.sentinel.worker_count - smaug_api.main() + karbor_api.main() - self.assertEqual('smaug', CONF.project) + self.assertEqual('karbor', CONF.project) self.assertEqual(CONF.version, version.version_string()) - log_setup.assert_called_once_with(CONF, "smaug") + log_setup.assert_called_once_with(CONF, "karbor") rpc_init.assert_called_once_with(CONF) process_launcher.assert_called_once_with() - wsgi_service.assert_called_once_with('osapi_smaug') + wsgi_service.assert_called_once_with('osapi_karbor') launcher.launch_service.assert_called_once_with(server, workers=server.workers) launcher.wait.assert_called_once_with() diff --git a/smaug/tests/unit/test_context.py b/karbor/tests/unit/test_context.py similarity index 98% rename from smaug/tests/unit/test_context.py rename to karbor/tests/unit/test_context.py index 2bca3079..8001a181 100644 --- a/smaug/tests/unit/test_context.py +++ b/karbor/tests/unit/test_context.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug import context -from smaug.tests import base +from karbor import context +from karbor.tests import base class ContextTestCase(base.TestCase): diff --git a/smaug/tests/unit/test_exception.py b/karbor/tests/unit/test_exception.py similarity index 71% rename from smaug/tests/unit/test_exception.py rename to karbor/tests/unit/test_exception.py index d0e21551..1e36f4cb 100644 --- a/smaug/tests/unit/test_exception.py +++ b/karbor/tests/unit/test_exception.py @@ -10,80 +10,80 @@ # License for the specific language governing permissions and limitations # under the License. -from smaug import exception -from smaug.tests import base +from karbor import exception +from karbor.tests import base import mock import six import webob.util -class SmaugExceptionTestCase(base.TestCase): +class KarborExceptionTestCase(base.TestCase): def test_default_error_msg(self): - class FakeSmaugException(exception.SmaugException): + class FakeKarborException(exception.KarborException): message = "default message" - exc = FakeSmaugException() + exc = FakeKarborException() self.assertEqual('default message', six.text_type(exc)) def test_error_msg(self): self.assertEqual('test', - six.text_type(exception.SmaugException('test'))) + six.text_type(exception.KarborException('test'))) def test_default_error_msg_with_kwargs(self): - class FakeSmaugException(exception.SmaugException): + class FakeKarborException(exception.KarborException): message = "default message: %(code)s" - exc = FakeSmaugException(code=500) + exc = FakeKarborException(code=500) self.assertEqual('default message: 500', six.text_type(exc)) def test_error_msg_exception_with_kwargs(self): # NOTE(dprince): disable format errors for this test self.flags(fatal_exception_format_errors=False) - class FakeSmaugException(exception.SmaugException): + class FakeKarborException(exception.KarborException): message = "default message: %(misspelled_code)s" - exc = FakeSmaugException(code=500) + exc = FakeKarborException(code=500) self.assertEqual('default message: %(misspelled_code)s', six.text_type(exc)) def test_default_error_code(self): - class FakeSmaugException(exception.SmaugException): + class FakeKarborException(exception.KarborException): code = 404 - exc = FakeSmaugException() + exc = FakeKarborException() self.assertEqual(404, exc.kwargs['code']) def test_error_code_from_kwarg(self): - class FakeSmaugException(exception.SmaugException): + class FakeKarborException(exception.KarborException): code = 500 - exc = FakeSmaugException(code=404) + exc = FakeKarborException(code=404) self.assertEqual(404, exc.kwargs['code']) def test_error_msg_is_exception_to_string(self): msg = 'test message' exc1 = Exception(msg) - exc2 = exception.SmaugException(exc1) + exc2 = exception.KarborException(exc1) self.assertEqual(msg, exc2.msg) def test_message_in_format_string(self): - class FakeSmaugException(exception.SmaugException): - message = 'FakeSmaugException: %(message)s' + class FakeKarborException(exception.KarborException): + message = 'FakeKarborException: %(message)s' - exc = FakeSmaugException(message='message') + exc = FakeKarborException(message='message') self.assertEqual('message', six.text_type(exc)) def test_message_and_kwarg_in_format_string(self): - class FakeSmaugException(exception.SmaugException): + class FakeKarborException(exception.KarborException): message = 'Error %(code)d: %(msg)s' - exc = FakeSmaugException(code=404, msg='message') + exc = FakeKarborException(code=404, msg='message') self.assertEqual('Error 404: message', six.text_type(exc)) -class SmaugConvertedExceptionTestCase(base.TestCase): +class KarborConvertedExceptionTestCase(base.TestCase): def test_default_args(self): exc = exception.ConvertedException() self.assertNotEqual('', exc.title) diff --git a/smaug/tests/unit/test_service.py b/karbor/tests/unit/test_service.py similarity index 81% rename from smaug/tests/unit/test_service.py rename to karbor/tests/unit/test_service.py index 53f8de30..e7a0564f 100644 --- a/smaug/tests/unit/test_service.py +++ b/karbor/tests/unit/test_service.py @@ -19,19 +19,19 @@ from oslo_concurrency import processutils from oslo_config import cfg from oslo_db import exception as db_exc -from smaug import context -from smaug import db -from smaug import exception -from smaug import manager -from smaug import rpc -from smaug import service -from smaug.tests import base -from smaug.wsgi import common as wsgi +from karbor import context +from karbor import db +from karbor import exception +from karbor import manager +from karbor import rpc +from karbor import service +from karbor.tests import base +from karbor.wsgi import common as wsgi test_service_opts = [ cfg.StrOpt("fake_manager", - default="smaug.tests.unit.test_service.FakeManager", + default="karbor.tests.unit.test_service.FakeManager", help="Manager for testing"), ] CONF = cfg.CONF @@ -61,7 +61,7 @@ class ServiceManagerTestCase(base.TestCase): serv = service.Service('test', 'test', 'test', - 'smaug.tests.unit.test_service.FakeManager') + 'karbor.tests.unit.test_service.FakeManager') serv.start() self.assertEqual('manager', serv.test_method()) @@ -69,7 +69,7 @@ class ServiceManagerTestCase(base.TestCase): serv = ExtendedService('test', 'test', 'test', - 'smaug.tests.unit.test_service.FakeManager') + 'karbor.tests.unit.test_service.FakeManager') serv.start() self.assertEqual('service', serv.test_method()) @@ -78,7 +78,7 @@ class ServiceFlagsTestCase(base.TestCase): def test_service_enabled_on_create_based_on_flag(self): self.flags(enable_new_services=True) host = 'foo' - binary = 'smaug-fake' + binary = 'karbor-fake' app = service.Service.create(host=host, binary=binary) app.start() app.stop() @@ -89,7 +89,7 @@ class ServiceFlagsTestCase(base.TestCase): def test_service_disabled_on_create_based_on_flag(self): self.flags(enable_new_services=False) host = 'foo' - binary = 'smaug-fake' + binary = 'karbor-fake' app = service.Service.create(host=host, binary=binary) app.start() app.stop() @@ -104,7 +104,7 @@ class ServiceTestCase(base.TestCase): def setUp(self): super(ServiceTestCase, self).setUp() self.host = 'foo' - self.binary = 'smaug-fake' + self.binary = 'karbor-fake' self.topic = 'fake' def test_create(self): @@ -129,7 +129,7 @@ class ServiceTestCase(base.TestCase): self.host, self.binary, self.topic, - 'smaug.tests.unit.test_service.FakeManager' + 'karbor.tests.unit.test_service.FakeManager' ) serv.start() serv.report_state() @@ -151,7 +151,7 @@ class ServiceTestCase(base.TestCase): self.host, self.binary, self.topic, - 'smaug.tests.unit.test_service.FakeManager' + 'karbor.tests.unit.test_service.FakeManager' ) serv.start() serv.report_state() @@ -173,7 +173,7 @@ class ServiceTestCase(base.TestCase): self.host, self.binary, self.topic, - 'smaug.tests.unit.test_service.FakeManager' + 'karbor.tests.unit.test_service.FakeManager' ) serv.start() serv.model_disconnected = True @@ -188,14 +188,14 @@ class ServiceTestCase(base.TestCase): 'topic': self.topic, 'report_count': 0, 'id': 1} - with mock.patch('smaug.db') as mock_db: + with mock.patch('karbor.db') as mock_db: mock_db.service_get.return_value = service_ref serv = service.Service( self.host, self.binary, self.topic, - 'smaug.tests.unit.test_service.FakeManager' + 'karbor.tests.unit.test_service.FakeManager' ) serv.manager.is_working = mock.Mock(return_value=False) serv.start() @@ -209,17 +209,17 @@ class ServiceTestCase(base.TestCase): self.override_config('report_interval', 10) service.Service.create( binary="test_service", - manager="smaug.tests.unit.test_service.FakeManager") + manager="karbor.tests.unit.test_service.FakeManager") self.assertEqual(25, CONF.service_down_time) @mock.patch.object(rpc, 'get_server') - @mock.patch('smaug.db') + @mock.patch('karbor.db') def test_service_stop_waits_for_rpcserver(self, mock_db, mock_rpc): serv = service.Service( self.host, self.binary, self.topic, - 'smaug.tests.unit.test_service.FakeManager' + 'karbor.tests.unit.test_service.FakeManager' ) serv.start() serv.stop() @@ -234,7 +234,7 @@ class TestWSGIService(base.TestCase): def setUp(self): super(TestWSGIService, self).setUp() - @mock.patch('smaug.utils.find_config') + @mock.patch('karbor.utils.find_config') def test_service_random_port(self, mock_find_config): with mock.patch.object(wsgi.Loader, 'load_app') as mock_load_app: test_service = service.WSGIService("test_service") @@ -244,7 +244,7 @@ class TestWSGIService(base.TestCase): test_service.stop() self.assertTrue(mock_load_app.called) - @mock.patch('smaug.utils.find_config') + @mock.patch('karbor.utils.find_config') def test_reset_pool_size_to_default(self, mock_find_config): with mock.patch.object(wsgi.Loader, 'load_app') as mock_load_app: test_service = service.WSGIService("test_service") @@ -260,43 +260,43 @@ class TestWSGIService(base.TestCase): self.assertEqual(1000, test_service.server._pool.size) self.assertTrue(mock_load_app.called) - @mock.patch('smaug.utils.find_config') - @mock.patch('smaug.wsgi.common.Loader.load_app') - @mock.patch('smaug.wsgi.eventlet_server.Server') + @mock.patch('karbor.utils.find_config') + @mock.patch('karbor.wsgi.common.Loader.load_app') + @mock.patch('karbor.wsgi.eventlet_server.Server') def test_workers_set_default(self, wsgi_server, mock_load_app, mock_find_config): - test_service = service.WSGIService("osapi_smaug") + test_service = service.WSGIService("osapi_karbor") self.assertEqual(processutils.get_worker_count(), test_service.workers) - @mock.patch('smaug.utils.find_config') - @mock.patch('smaug.wsgi.common.Loader.load_app') - @mock.patch('smaug.wsgi.eventlet_server.Server') + @mock.patch('karbor.utils.find_config') + @mock.patch('karbor.wsgi.common.Loader.load_app') + @mock.patch('karbor.wsgi.eventlet_server.Server') def test_workers_set_good_user_setting(self, wsgi_server, mock_load_app, mock_find_config): - self.override_config('osapi_smaug_workers', 8) - test_service = service.WSGIService("osapi_smaug") + self.override_config('osapi_karbor_workers', 8) + test_service = service.WSGIService("osapi_karbor") self.assertEqual(8, test_service.workers) - @mock.patch('smaug.utils.find_config') - @mock.patch('smaug.wsgi.common.Loader.load_app') - @mock.patch('smaug.wsgi.eventlet_server.Server') + @mock.patch('karbor.utils.find_config') + @mock.patch('karbor.wsgi.common.Loader.load_app') + @mock.patch('karbor.wsgi.eventlet_server.Server') def test_workers_set_zero_user_setting(self, wsgi_server, mock_load_app, mock_find_config): - self.override_config('osapi_smaug_workers', 0) - test_service = service.WSGIService("osapi_smaug") + self.override_config('osapi_karbor_workers', 0) + test_service = service.WSGIService("osapi_karbor") # If a value less than 1 is used, defaults to number of procs available self.assertEqual(processutils.get_worker_count(), test_service.workers) - @mock.patch('smaug.utils.find_config') - @mock.patch('smaug.wsgi.common.Loader.load_app') - @mock.patch('smaug.wsgi.eventlet_server.Server') + @mock.patch('karbor.utils.find_config') + @mock.patch('karbor.wsgi.common.Loader.load_app') + @mock.patch('karbor.wsgi.eventlet_server.Server') def test_workers_set_negative_user_setting(self, wsgi_server, mock_load_app, mock_find_config): - self.override_config('osapi_smaug_workers', -1) + self.override_config('osapi_karbor_workers', -1) self.assertRaises(exception.InvalidInput, service.WSGIService, - "osapi_smaug") + "osapi_karbor") self.assertFalse(wsgi_server.called) diff --git a/smaug/tests/unit/wsgi/__init__.py b/karbor/tests/unit/wsgi/__init__.py similarity index 100% rename from smaug/tests/unit/wsgi/__init__.py rename to karbor/tests/unit/wsgi/__init__.py diff --git a/smaug/tests/unit/wsgi/test_common.py b/karbor/tests/unit/wsgi/test_common.py similarity index 97% rename from smaug/tests/unit/wsgi/test_common.py rename to karbor/tests/unit/wsgi/test_common.py index 223e1127..9d5749ac 100644 --- a/smaug/tests/unit/wsgi/test_common.py +++ b/karbor/tests/unit/wsgi/test_common.py @@ -21,8 +21,8 @@ import tempfile import routes import webob -from smaug.tests import base -from smaug.wsgi import common as wsgi_common +from karbor.tests import base +from karbor.wsgi import common as wsgi_common class CommonTest(base.TestCase): diff --git a/smaug/tests/unit/wsgi/test_eventlet_server.py b/karbor/tests/unit/wsgi/test_eventlet_server.py similarity index 95% rename from smaug/tests/unit/wsgi/test_eventlet_server.py rename to karbor/tests/unit/wsgi/test_eventlet_server.py index ac0e1c40..64798969 100644 --- a/smaug/tests/unit/wsgi/test_eventlet_server.py +++ b/karbor/tests/unit/wsgi/test_eventlet_server.py @@ -10,15 +10,15 @@ # License for the specific language governing permissions and limitations # under the License. -"""Unit tests for `smaug.wsgi`.""" +"""Unit tests for `karbor.wsgi`.""" import mock from oslo_config import cfg import testtools -from smaug.tests import base -from smaug.wsgi import eventlet_server as wsgi +from karbor.tests import base +from karbor.wsgi import eventlet_server as wsgi CONF = cfg.CONF diff --git a/smaug/utils.py b/karbor/utils.py similarity index 94% rename from smaug/utils.py rename to karbor/utils.py index 635535f4..37fb860e 100644 --- a/smaug/utils.py +++ b/karbor/utils.py @@ -23,8 +23,8 @@ from oslo_utils import timeutils import six -from smaug import exception -from smaug.i18n import _, _LE +from karbor import exception +from karbor.i18n import _, _LE from stevedore import driver CONF = cfg.CONF @@ -36,15 +36,15 @@ def find_config(config_path): :param config_path: Full or relative path to the config. :returns: Full path of the config, if it exists. - :raises: `smaug.exception.ConfigNotFound` + :raises: `karbor.exception.ConfigNotFound` """ possible_locations = [ config_path, - os.path.join("/var/lib/smaug", "etc", "smaug", config_path), - os.path.join("/var/lib/smaug", "etc", config_path), - os.path.join("/var/lib/smaug", config_path), - "/etc/smaug/%s" % config_path, + os.path.join("/var/lib/karbor", "etc", "karbor", config_path), + os.path.join("/var/lib/karbor", "etc", config_path), + os.path.join("/var/lib/karbor", config_path), + "/etc/karbor/%s" % config_path, ] for path in possible_locations: diff --git a/smaug/version.py b/karbor/version.py similarity index 79% rename from smaug/version.py rename to karbor/version.py index 50bb09cb..19d4b28e 100644 --- a/smaug/version.py +++ b/karbor/version.py @@ -14,10 +14,10 @@ from pbr import version as pbr_version -SMAUG_VENDOR = "OpenStack Foundation" -SMAUG_PRODUCT = "OpenStack Smaug" -SMAUG_PACKAGE = None # OS distro package version suffix +KARBOR_VENDOR = "OpenStack Foundation" +KARBOR_PRODUCT = "OpenStack Karbor" +KARBOR_PACKAGE = None # OS distro package version suffix loaded = False -version_info = pbr_version.VersionInfo('Smaug') +version_info = pbr_version.VersionInfo('Karbor') version_string = version_info.version_string diff --git a/smaug/wsgi/__init__.py b/karbor/wsgi/__init__.py similarity index 100% rename from smaug/wsgi/__init__.py rename to karbor/wsgi/__init__.py diff --git a/smaug/wsgi/common.py b/karbor/wsgi/common.py similarity index 96% rename from smaug/wsgi/common.py rename to karbor/wsgi/common.py index 06d1a94a..e9b0ab14 100644 --- a/smaug/wsgi/common.py +++ b/karbor/wsgi/common.py @@ -24,9 +24,9 @@ import six import webob.dec import webob.exc -from smaug import exception -from smaug.i18n import _, _LE -from smaug import utils +from karbor import exception +from karbor.i18n import _, _LE +from karbor import utils CONF = cfg.CONF LOG = logging.getLogger(__name__) @@ -51,11 +51,11 @@ class Application(object): [app:wadl] latest_version = 1.3 - paste.app_factory = smaug.api.fancy_api:Wadl.factory + paste.app_factory = karbor.api.fancy_api:Wadl.factory which would result in a call to the `Wadl` class as - import smaug.api.fancy_api + import karbor.api.fancy_api fancy_api.Wadl(latest_version='1.3') You could of course re-implement the `factory` method in subclasses, @@ -123,11 +123,11 @@ class Middleware(Application): [filter:analytics] redis_host = 127.0.0.1 - paste.filter_factory = smaug.api.analytics:Analytics.factory + paste.filter_factory = karbor.api.analytics:Analytics.factory which would result in a call to the `Analytics` class as - import smaug.api.analytics + import karbor.api.analytics analytics.Analytics(app_from_paste, redis_host='127.0.0.1') You could of course re-implement the `factory` method in subclasses, @@ -280,7 +280,7 @@ class Loader(object): :param name: Name of the application to load. :returns: Paste URLMap object wrapping the requested application. - :raises: `smaug.exception.PasteAppNotFound` + :raises: `karbor.exception.PasteAppNotFound` """ try: diff --git a/smaug/wsgi/eventlet_server.py b/karbor/wsgi/eventlet_server.py similarity index 98% rename from smaug/wsgi/eventlet_server.py rename to karbor/wsgi/eventlet_server.py index dfde2c87..51e941be 100644 --- a/smaug/wsgi/eventlet_server.py +++ b/karbor/wsgi/eventlet_server.py @@ -30,8 +30,8 @@ from oslo_utils import excutils from oslo_utils import netutils -from smaug import exception -from smaug.i18n import _, _LE, _LI +from karbor import exception +from karbor.i18n import _, _LE, _LI socket_opts = [ @@ -180,7 +180,7 @@ class Server(service.ServiceBase): """Start serving a WSGI application. :returns: None - :raises: smaug.exception.InvalidInput + :raises: karbor.exception.InvalidInput """ # The server socket object will be closed after server exits, diff --git a/requirements.txt b/requirements.txt index f8448cef..819d7785 100644 --- a/requirements.txt +++ b/requirements.txt @@ -37,4 +37,4 @@ WebOb>=1.2.3 # MIT oslo.i18n>=2.1.0 # Apache-2.0 python-swiftclient>=2.2.0 # Apache-2.0 python-heatclient>=1.1.0 # Apache-2.0 -python-smaugclient>=0.0.5 # Apache-2.0 +#python-karborclient>=0.0.5 # Apache-2.0 diff --git a/setup.cfg b/setup.cfg index f448fbfd..8c5bd714 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = smaug +name = karbor version = 0.0.1 summary = Application Data Protection as a Service for OpenStack description-file = @@ -22,36 +22,36 @@ classifier = [files] packages = - smaug + karbor data_files = - /etc/smaug = + /etc/karbor = etc/api-paste.ini etc/policy.json - etc/smaug.conf - /etc/smaug/providers.d = + etc/karbor.conf + /etc/karbor/providers.d = etc/providers.d/openstack-infra.conf [entry_points] console_scripts = - smaug-api = smaug.cmd.api:main - smaug-manage = smaug.cmd.manage:main - smaug-operationengine = smaug.cmd.operationengine:main - smaug-protection = smaug.cmd.protection:main -smaug.database.migration_backend = + karbor-api = karbor.cmd.api:main + karbor-manage = karbor.cmd.manage:main + karbor-operationengine = karbor.cmd.operationengine:main + karbor-protection = karbor.cmd.protection:main +karbor.database.migration_backend = sqlalchemy = oslo_db.sqlalchemy.migration -smaug.protections = - smaug-swift-bank-plugin = smaug.services.protection.bank_plugins.swift_bank_plugin:SwiftBankPlugin - smaug-volume-protection-plugin = smaug.services.protection.protection_plugins.volume.cinder_protection_plugin:CinderProtectionPlugin - smaug-image-protection-plugin = smaug.services.protection.protection_plugins.image.image_protection_plugin:GlanceProtectionPlugin -smaug.provider = - provider-registry = smaug.services.protection.provider:ProviderRegistry -smaug.protectables = - project = smaug.services.protection.protectable_plugins.project:ProjectProtectablePlugin - server = smaug.services.protection.protectable_plugins.server:ServerProtectablePlugin - volume = smaug.services.protection.protectable_plugins.volume:VolumeProtectablePlugin - image = smaug.services.protection.protectable_plugins.image:ImageProtectablePlugin -smaug.operationengine.engine.executor = - executor = smaug.services.operationengine.engine.executors.thread_pool_executor:ThreadPoolExecutor +karbor.protections = + karbor-swift-bank-plugin = karbor.services.protection.bank_plugins.swift_bank_plugin:SwiftBankPlugin + karbor-volume-protection-plugin = karbor.services.protection.protection_plugins.volume.cinder_protection_plugin:CinderProtectionPlugin + karbor-image-protection-plugin = karbor.services.protection.protection_plugins.image.image_protection_plugin:GlanceProtectionPlugin +karbor.provider = + provider-registry = karbor.services.protection.provider:ProviderRegistry +karbor.protectables = + project = karbor.services.protection.protectable_plugins.project:ProjectProtectablePlugin + server = karbor.services.protection.protectable_plugins.server:ServerProtectablePlugin + volume = karbor.services.protection.protectable_plugins.volume:VolumeProtectablePlugin + image = karbor.services.protection.protectable_plugins.image:ImageProtectablePlugin +karbor.operationengine.engine.executor = + executor = karbor.services.operationengine.engine.executors.thread_pool_executor:ThreadPoolExecutor [build_sphinx] source-dir = doc/source @@ -62,15 +62,15 @@ all_files = 1 upload-dir = doc/build/html [compile_catalog] -directory = smaug/locale -domain = smaug +directory = karbor/locale +domain = karbor [update_catalog] -domain = smaug -output_dir = smaug/locale -input_file = smaug/locale/smaug.pot +domain = karbor +output_dir = karbor/locale +input_file = karbor/locale/karbor.pot [extract_messages] keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg -output_file = smaug/locale/smaug.pot +output_file = karbor/locale/karbor.pot diff --git a/tools/install_venv.py b/tools/install_venv.py index de8c3d03..a05f1dea 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -17,7 +17,7 @@ # License for the specific language governing permissions and limitations # under the License. -"""Installation script for Smaug's development virtualenv.""" +"""Installation script for karbor's development virtualenv.""" from __future__ import print_function @@ -29,12 +29,12 @@ import install_venv_common as install_venv def print_help(): help = """ - Smaug development environment setup is complete. + Karbor development environment setup is complete. - Smaug development uses virtualenv to track and manage Python dependencies + Karbor development uses virtualenv to track and manage Python dependencies while in development and testing. - To activate the Smaug virtualenv for the extent of your current shell + To activate the Karbor virtualenv for the extent of your current shell session you can run: $ source .venv/bin/activate @@ -56,7 +56,7 @@ def main(argv): venv = os.environ['venv'] pip_requires = os.path.join(root, 'requirements.txt') test_requires = os.path.join(root, 'test-requirements.txt') - project = 'Smaug' + project = 'Karbor' py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) install = install_venv.InstallVenv(root, venv, pip_requires, test_requires, py_version, project) diff --git a/tox.ini b/tox.ini index acd32899..a45656d5 100644 --- a/tox.ini +++ b/tox.ini @@ -8,13 +8,13 @@ usedevelop = True install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} - OS_TEST_PATH=./smaug/tests/unit + OS_TEST_PATH=./karbor/tests/unit deps = -r{toxinidir}/test-requirements.txt commands = python setup.py test --slowest --testr-args='{posargs}' [testenv:fullstack] basepython = python2.7 -setenv = OS_TEST_PATH=./smaug/tests/fullstack +setenv = OS_TEST_PATH=./karbor/tests/fullstack OS_TEST_TIMEOUT=1800 commands = python setup.py test --slowest --testr-args="--concurrency=1" @@ -40,4 +40,4 @@ builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build [hacking] -import_exceptions = smaug.i18n +import_exceptions = karbor.i18n