├── .coveragerc ├── .gitignore ├── .gitreview ├── .mailmap ├── .pre-commit-config.yaml ├── .stestr.conf ├── .yamllint ├── .zuul.yaml ├── CONTRIBUTING.rst ├── HACKING.rst ├── LICENSE ├── MANIFEST.in ├── README.rst ├── api-ref └── source │ ├── conf.py │ ├── failover-segments.inc │ ├── hosts.inc │ ├── index.rst │ ├── notifications.inc │ ├── parameters.yaml │ ├── status.yaml │ ├── versions.inc │ └── vmoves.inc ├── bindep.txt ├── devstack ├── README.rst ├── plugin.sh └── settings ├── doc ├── api_samples │ ├── hosts │ │ ├── host-create-req.json │ │ ├── host-create-resp.json │ │ ├── host-get-resp.json │ │ ├── host-update-req.json │ │ ├── host-update-resp.json │ │ └── hosts-list-resp.json │ ├── notifications │ │ ├── host-notification-create-req.json │ │ ├── host-notification-create-resp.json │ │ ├── notifcations-list-resp.json │ │ ├── notification-get-resp.json │ │ ├── process-notification-create-req.json │ │ ├── process-notification-create-resp.json │ │ ├── vm-notification-create-req.json │ │ └── vm-notification-create-resp.json │ ├── segments │ │ ├── segment-create-req.json │ │ ├── segment-create-resp.json │ │ ├── segment-get-resp.json │ │ ├── segment-update-req.json │ │ ├── segment-update-resp.json │ │ └── segments-list-resp.json │ ├── versions │ │ ├── v1-version-get-resp.json │ │ └── versions-get-resp.json │ └── vmoves │ │ ├── vmove-get-resp.json │ │ └── vmoves-list-resp.json ├── ext │ ├── __init__.py │ └── versioned_notifications.py ├── notification_samples │ ├── create-host-end.json │ ├── create-host-start.json │ ├── create-notification-end.json │ ├── create-notification-start.json │ ├── create-segment-end.json │ ├── create-segment-start.json │ ├── delete-host-end.json │ ├── delete-host-start.json │ ├── delete-segment-end.json │ ├── delete-segment-start.json │ ├── error-exception.json │ ├── process-notification-end.json │ ├── process-notification-error.json │ ├── process-notification-start.json │ ├── update-host-end.json │ ├── update-host-start.json │ ├── update-segment-end.json │ └── update-segment-start.json ├── requirements.txt └── source │ ├── _static │ ├── Masakari_spec_process.svg │ └── architecture.png │ ├── cli │ ├── index.rst │ ├── masakari-manage.rst │ ├── masakari-status.rst │ └── openstack-masakari.rst │ ├── conf.py │ ├── configuration │ ├── api-paste.ini.rst │ ├── config.rst │ ├── index.rst │ ├── policy.rst │ ├── recovery_config.rst │ ├── recovery_workflow_custom_task.rst │ ├── recovery_workflow_sample_config.rst │ ├── sample_config.rst │ └── sample_policy.rst │ ├── contributor │ ├── code_structure.rst │ ├── contributing.rst │ └── release_notes.rst │ ├── index.rst │ ├── install │ ├── development.environment.rst │ ├── index.rst │ ├── install_and_configure.rst │ ├── install_and_configure_ubuntu.rst │ ├── overview.rst │ └── verify.rst │ └── user │ ├── architecture.rst │ ├── how_to_get_involved.rst │ ├── notifications.rst │ └── process.rst ├── etc └── masakari │ ├── README-masakari.conf.txt │ ├── api-paste.ini │ ├── masakari-config-generator.conf │ ├── masakari-custom-recovery-methods.conf │ ├── masakari-customized-recovery-flow-config-generator.conf │ └── masakari-policy-generator.conf ├── masakari ├── __init__.py ├── api │ ├── __init__.py │ ├── api_version_request.py │ ├── auth.py │ ├── openstack │ │ ├── __init__.py │ │ ├── common.py │ │ ├── extensions.py │ │ ├── ha │ │ │ ├── __init__.py │ │ │ ├── extension_info.py │ │ │ ├── hosts.py │ │ │ ├── notifications.py │ │ │ ├── schemas │ │ │ │ ├── __init__.py │ │ │ │ ├── hosts.py │ │ │ │ ├── notifications.py │ │ │ │ ├── payload.py │ │ │ │ └── segments.py │ │ │ ├── segments.py │ │ │ ├── versions.py │ │ │ ├── versionsV1.py │ │ │ ├── views │ │ │ │ ├── __init__.py │ │ │ │ ├── hosts.py │ │ │ │ └── versions.py │ │ │ └── vmoves.py │ │ └── wsgi.py │ ├── urlmap.py │ ├── utils.py │ ├── validation │ │ ├── __init__.py │ │ ├── parameter_types.py │ │ └── validators.py │ ├── versioned_method.py │ └── wsgi.py ├── cmd │ ├── __init__.py │ ├── api.py │ ├── engine.py │ ├── manage.py │ └── status.py ├── common │ ├── __init__.py │ └── config.py ├── compute │ ├── __init__.py │ └── nova.py ├── conf │ ├── __init__.py │ ├── api.py │ ├── base.py │ ├── coordination.py │ ├── database.py │ ├── engine.py │ ├── engine_driver.py │ ├── exceptions.py │ ├── nova.py │ ├── opts.py │ ├── osapi_v1.py │ ├── paths.py │ ├── service.py │ ├── ssl.py │ └── wsgi.py ├── config.py ├── context.py ├── coordination.py ├── db │ ├── __init__.py │ ├── api.py │ ├── migration.py │ └── sqlalchemy │ │ ├── __init__.py │ │ ├── alembic.ini │ │ ├── api.py │ │ ├── migration.py │ │ ├── migrations │ │ ├── README.rst │ │ ├── env.py │ │ ├── script.py.mako │ │ └── versions │ │ │ ├── 8bdf5929c5a6_add_vm_moves_table.py │ │ │ └── 8f848eb45d03_initial_revision.py │ │ └── models.py ├── engine │ ├── __init__.py │ ├── driver.py │ ├── drivers │ │ ├── __init__.py │ │ └── taskflow │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── driver.py │ │ │ ├── host_failure.py │ │ │ ├── instance_failure.py │ │ │ ├── no_op.py │ │ │ └── process_failure.py │ ├── instance_events.py │ ├── manager.py │ ├── rpcapi.py │ └── utils.py ├── exception.py ├── ha │ ├── __init__.py │ └── api.py ├── hacking │ ├── __init__.py │ └── checks.py ├── i18n.py ├── manager.py ├── notifications │ ├── __init__.py │ └── objects │ │ ├── __init__.py │ │ ├── base.py │ │ ├── exception.py │ │ └── notification.py ├── objects │ ├── __init__.py │ ├── base.py │ ├── fields.py │ ├── host.py │ ├── notification.py │ ├── segment.py │ └── vmove.py ├── policies │ ├── __init__.py │ ├── base.py │ ├── extension_info.py │ ├── hosts.py │ ├── notifications.py │ ├── segments.py │ ├── versions.py │ └── vmoves.py ├── policy.py ├── rpc.py ├── safe_utils.py ├── service.py ├── test.py ├── tests │ ├── __init__.py │ ├── fixtures.py │ ├── functional │ │ ├── __init__.py │ │ ├── base.py │ │ ├── notification_base.py │ │ ├── test_hosts.py │ │ ├── test_process_notifications.py │ │ ├── test_segments.py │ │ └── test_vm_notifications.py │ ├── json_ref.py │ ├── unit │ │ ├── __init__.py │ │ ├── api │ │ │ ├── __init__.py │ │ │ ├── openstack │ │ │ │ ├── __init__.py │ │ │ │ ├── fakes.py │ │ │ │ ├── ha │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── test_extension_info.py │ │ │ │ │ ├── test_hosts.py │ │ │ │ │ ├── test_notifications.py │ │ │ │ │ ├── test_segments.py │ │ │ │ │ ├── test_versions.py │ │ │ │ │ └── test_vmoves.py │ │ │ │ ├── test_common.py │ │ │ │ ├── test_extensions.py │ │ │ │ └── test_wsgi.py │ │ │ ├── test_api_version_request.py │ │ │ ├── test_auth.py │ │ │ ├── test_utils.py │ │ │ └── test_wsgi.py │ │ ├── cmd │ │ │ ├── __init__.py │ │ │ ├── test_masakari_api.py │ │ │ └── test_status.py │ │ ├── compute │ │ │ ├── __init__.py │ │ │ └── test_nova.py │ │ ├── conf_fixture.py │ │ ├── db │ │ │ ├── __init__.py │ │ │ ├── test_db_api.py │ │ │ ├── test_migrations.py │ │ │ └── test_purge.py │ │ ├── engine │ │ │ ├── __init__.py │ │ │ ├── drivers │ │ │ │ ├── __init__.py │ │ │ │ └── taskflow │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── test_host_failure_flow.py │ │ │ │ │ ├── test_instance_failure_flow.py │ │ │ │ │ ├── test_process_failure_flow.py │ │ │ │ │ └── test_taskflow_driver.py │ │ │ ├── fake_engine.py │ │ │ ├── test_engine_mgr.py │ │ │ ├── test_rpcapi.py │ │ │ └── test_utils.py │ │ ├── fake_notifier.py │ │ ├── fake_policy.py │ │ ├── fakes.py │ │ ├── ha │ │ │ ├── __init__.py │ │ │ └── test_api.py │ │ ├── monkey_patch_example │ │ │ ├── __init__.py │ │ │ ├── example_a.py │ │ │ └── example_b.py │ │ ├── notifications │ │ │ ├── __init__.py │ │ │ └── objects │ │ │ │ ├── __init__.py │ │ │ │ └── test_notification.py │ │ ├── objects │ │ │ ├── __init__.py │ │ │ ├── fake_args.py │ │ │ ├── test_fields.py │ │ │ ├── test_hosts.py │ │ │ ├── test_notifications.py │ │ │ ├── test_objects.py │ │ │ ├── test_segments.py │ │ │ └── test_vmoves.py │ │ ├── policy_fixture.py │ │ ├── test_api_validation.py │ │ ├── test_conf.py │ │ ├── test_context.py │ │ ├── test_exception.py │ │ ├── test_hacking.py │ │ ├── test_masakari_manage.py │ │ ├── test_policy.py │ │ ├── test_rpc.py │ │ ├── test_safeutils.py │ │ ├── test_service.py │ │ ├── test_utils.py │ │ ├── test_versions.py │ │ └── utils.py │ └── uuidsentinel.py ├── utils.py ├── version.py └── wsgi │ ├── __init__.py │ └── api.py ├── playbooks └── devstack │ ├── post.yaml │ ├── pre.yaml │ ├── run-devstack.yaml │ ├── run-tox.yaml │ └── run-verify-config-is-ipv6-only.yaml ├── pyproject.toml ├── releasenotes ├── notes │ ├── .placeholder │ ├── add-masakari-wsgi-module-a5f5a649a2ec460c.yaml │ ├── add-periodic-tasks-0c96d6f620502a75.yaml │ ├── add-upgrade-check-framework-52268130b25317ab.yaml │ ├── add_evacuate_error_instances_conf_option-5b4d1906137395f0.yaml │ ├── add_ha_enabled_config_options-54a9270a5993d20a.yaml │ ├── add_reserved_host_to_aggregates-5f506d08354ec148.yaml │ ├── adopt-oslo-config-generator-cf2fdb17cf7f13db.yaml │ ├── auto_priority_and_rh_priority_recovery_methods-b88cc00041fa2c4d.yaml │ ├── blueprint-add-vmoves-348fd430aa936721.yaml │ ├── blueprint-support-nova-system-scope-policies-c4dbd244dd3fcf1a.yaml │ ├── bp-mutable-config-57efdd467c01aa7b.yaml │ ├── bug-1685145-3d93145bfc76c660.yaml │ ├── bug-1776385-0bcf0a0b3fad359e.yaml │ ├── bug-1782517-e4dc70bad9e4e131.yaml │ ├── bug-1856164-6601a6e6280eba4d.yaml │ ├── bug-1859406-6b041a26acf6c7f6.yaml │ ├── bug-1882516-e8dc7fd2b55f065f.yaml │ ├── bug-1932194-2b721860bbc26819.yaml │ ├── bug-1960619-4c2cc73483bdff86.yaml │ ├── bug-1980736-975ee013e4612062.yaml │ ├── bug-add-missing-domain-name-5181c02f3f033a22.yaml │ ├── compute-disable-reason-9570734c0bb888cf.yaml │ ├── compute_search-3da97e69e661a73f.yaml │ ├── coordination_for_host_notification-a156ec5a5839a781.yaml │ ├── correct_response_code-df8b43a201efa1b4.yaml │ ├── customisable-ha-enabled-instance-metadata-key-af511ea2aac96690.yaml │ ├── db-purge-support-7a33e2ea5d2a624b.yaml │ ├── deprecate-json-formatted-policy-file-57ad537ec19cc7e0.yaml │ ├── deprecate-topic-opt-af83f82143143c61.yaml │ ├── drop-py-2-7-059d3cd5e7cb4e1a.yaml │ ├── drop-python-38-39-deab0b81006bae48.yaml │ ├── enabled-to-segment-7e6184feb1e4f818.yaml │ ├── evacuation_in_threads-cc9c79b10acfb5f6.yaml │ ├── failover_segment_apis-f5bea1cd6d103048.yaml │ ├── fix-endless-periodic-f223845f3044b166.yaml │ ├── fix-notification-stuck-problem-fdb84bad8641384b.yaml │ ├── host-apis-46a87fcd56d8ed30.yaml │ ├── notifications-in-masakari-f5d79838fc23cb9b.yaml │ ├── notifications_apis-3c3d5055ae9c6649.yaml │ ├── policy-in-code-8740d51624055044.yaml │ ├── progress-details-recovery-workflows-5b14b7b3f87374f4.yaml │ ├── recovery-method-customization-3438b0e26e322b88.yaml │ ├── remove-masakari-wsgi-script-bb737746a17111ab.yaml │ ├── reserved_host_recovery_method-d2de1f205136c8d5.yaml │ ├── switch-to-alembic-b438de67c5b22a40.yaml │ └── wsgi-applications-3ed7d6b89f1a5785.yaml ├── source │ ├── 2023.1.rst │ ├── 2023.2.rst │ ├── 2024.1.rst │ ├── 2024.2.rst │ ├── 2025.1.rst │ ├── _static │ │ └── .placeholder │ ├── _templates │ │ └── .placeholder │ ├── conf.py │ ├── index.rst │ ├── ocata.rst │ ├── pike.rst │ ├── queens.rst │ ├── rocky.rst │ ├── stein.rst │ ├── train.rst │ ├── unreleased.rst │ ├── ussuri.rst │ ├── victoria.rst │ ├── wallaby.rst │ ├── xena.rst │ ├── yoga.rst │ └── zed.rst └── templates │ ├── feature.yml │ └── fix.yml ├── requirements.txt ├── roles └── devstack-config │ └── tasks │ └── main.yml ├── setup.cfg ├── setup.py ├── test-requirements.txt ├── tools └── test-setup.sh └── tox.ini /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = masakari 4 | omit = masakari/openstack/* 5 | 6 | [report] 7 | ignore_errors = True 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg* 8 | *.egg-info 9 | dist 10 | build 11 | eggs 12 | parts 13 | bin 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib 19 | lib64 20 | 21 | # Installer logs 22 | pip-log.txt 23 | 24 | # Unit test / coverage reports 25 | cover/ 26 | .coverage* 27 | !.coveragerc 28 | .tox 29 | nosetests.xml 30 | .stestr 31 | .venv 32 | 33 | # Translations 34 | *.mo 35 | 36 | # Mr Developer 37 | .mr.developer.cfg 38 | .project 39 | .pydevproject 40 | 41 | # Complexity 42 | output/*.html 43 | output/*/index.html 44 | 45 | # Sphinx 46 | doc/build 47 | 48 | # pbr generates these 49 | AUTHORS 50 | ChangeLog 51 | 52 | # Editors 53 | *~ 54 | .*.swp 55 | .*sw? 56 | 57 | # Files created by releasenotes build 58 | releasenotes/build 59 | 60 | # PyCharm IDE 61 | .idea/ 62 | 63 | # configuration sample generation 64 | etc/masakari/masakari.conf.sample 65 | etc/masakari/masakari-custom-recovery-methods.conf.sample 66 | 67 | # policy sample generation 68 | etc/masakari/policy.yaml.sample 69 | 70 | # Files created by doc build 71 | doc/source/_static/masakari.conf.sample 72 | doc/source/_static/masakari-custom-recovery-methods.conf.sample 73 | doc/source/_static/masakari.policy.yaml.sample 74 | 75 | # Files created by alembic 76 | /masakari.db 77 | -------------------------------------------------------------------------------- /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=review.opendev.org 3 | port=29418 4 | project=openstack/masakari.git 5 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | # Format is: 2 | # 3 | # 4 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | repos: 3 | - repo: https://github.com/pre-commit/pre-commit-hooks 4 | rev: v5.0.0 5 | hooks: 6 | - id: trailing-whitespace 7 | - id: mixed-line-ending 8 | args: ['--fix', 'lf'] 9 | exclude: '.*\.(svg)$' 10 | - id: check-byte-order-marker 11 | - id: check-merge-conflict 12 | - id: debug-statements 13 | - id: check-yaml 14 | files: .*\.(yaml|yml)$ 15 | - repo: https://opendev.org/openstack/hacking 16 | rev: 7.0.0 17 | hooks: 18 | - id: hacking 19 | additional_dependencies: [] 20 | exclude: '^(doc|releasenotes|tools)/.*$' 21 | -------------------------------------------------------------------------------- /.stestr.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | test_path=./masakari/tests/unit 3 | top_dir=./ 4 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | ignore: | 5 | .tox/ 6 | 7 | rules: 8 | line-length: disable 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | The source repository for this project can be found at: 2 | 3 | https://opendev.org/openstack/masakari 4 | 5 | Pull requests submitted through GitHub are not monitored. 6 | 7 | To start contributing to OpenStack, follow the steps in the contribution guide 8 | to set up and use Gerrit: 9 | 10 | https://docs.openstack.org/contributors/code-and-documentation/quick-start.html 11 | 12 | Bugs should be filed on Launchpad: 13 | 14 | https://bugs.launchpad.net/masakari 15 | 16 | For more specific information about contributing to this repository, see the 17 | masakari contributor guide: 18 | 19 | https://docs.openstack.org/masakari/latest/contributor/contributing.html 20 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/MANIFEST.in -------------------------------------------------------------------------------- /api-ref/source/index.rst: -------------------------------------------------------------------------------- 1 | :tocdepth: 2 2 | 3 | ============== 4 | Masakari API 5 | ============== 6 | 7 | This is a reference for the OpenStack Masakari API which is provided by the 8 | Masakari project. 9 | 10 | .. rest_expand_all:: 11 | 12 | .. include:: versions.inc 13 | .. include:: failover-segments.inc 14 | .. include:: hosts.inc 15 | .. include:: notifications.inc 16 | .. include:: vmoves.inc 17 | -------------------------------------------------------------------------------- /api-ref/source/status.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ################# 4 | # Success Codes # 5 | ################# 6 | 200: 7 | default: | 8 | Request was successful. 9 | 201: 10 | default: | 11 | Resource was created and is ready to use. 12 | 202: 13 | default: | 14 | Request was accepted for processing, but the processing has not been 15 | completed. A 'location' header is included in the response which contains 16 | a link to check the progress of the request. 17 | 204: 18 | default: | 19 | The server has fulfilled the request by deleting the resource. 20 | 300: 21 | default: | 22 | There are multiple choices for resources. The request has to be more 23 | specific to successfully retrieve one of these resources. 24 | 302: 25 | default: | 26 | The response is about a redirection hint. The header of the response 27 | usually contains a 'location' value where requesters can check to track 28 | the real location of the resource. 29 | 30 | ################# 31 | # Error Codes # 32 | ################# 33 | 34 | 400: 35 | default: | 36 | Some content in the request was invalid. 37 | resource_signal: | 38 | The target resource doesn't support receiving a signal. 39 | 401: 40 | default: | 41 | User must authenticate before making a request. 42 | 403: 43 | default: | 44 | Policy does not allow current user to do this operation. 45 | 404: 46 | default: | 47 | The requested resource could not be found. 48 | 405: 49 | default: | 50 | Method is not valid for this endpoint. 51 | 409: 52 | default: | 53 | This operation conflicted with another operation on this resource. 54 | duplicate_zone: | 55 | There is already a zone with this name. 56 | 500: 57 | default: | 58 | Something went wrong inside the service. This should not happen usually. 59 | If it does happen, it means the server has experienced some serious 60 | problems. 61 | 503: 62 | default: | 63 | Service is not available. This is mostly caused by service configuration 64 | errors which prevents the service from successful start up. 65 | -------------------------------------------------------------------------------- /bindep.txt: -------------------------------------------------------------------------------- 1 | # This is a cross-platform list tracking distribution packages needed for install and tests; 2 | # see https://docs.openstack.org/infra/bindep/ for additional information. 3 | 4 | # libpq-dev is needed by openstack-tox-py37 build only. 5 | libpq-dev [platform:dpkg test] 6 | python3-dev [platform:dpkg test] 7 | libmysqlclient-dev [platform:dpkg test !platform:debian] 8 | libmariadb-dev-compat [platform:debian] 9 | mysql [platform:rpm test] 10 | mysql-client [platform:dpkg test !platform:debian] 11 | mysql-devel [platform:rpm test] 12 | mysql-server [test !platform:debian] 13 | mariadb-server [platform:debian] 14 | postgresql [test] 15 | postgresql-client [platform:dpkg test] 16 | postgresql-devel [platform:rpm test] 17 | postgresql-server [platform:rpm test] 18 | libsqlite3-dev [platform:dpkg test] 19 | sqlite-devel [platform:rpm test] 20 | -------------------------------------------------------------------------------- /devstack/README.rst: -------------------------------------------------------------------------------- 1 | ============================= 2 | Enabling Masakari in DevStack 3 | ============================= 4 | 5 | To enable Masakari in DevStack, perform the following steps: 6 | 7 | 8 | Download DevStack 9 | ================= 10 | 11 | .. sourcecode:: bash 12 | 13 | export DEVSTACK_DIR=~/devstack 14 | git clone https://opendev.org/openstack/devstack.git $DEVSTACK_DIR 15 | 16 | Enable the Masakari plugin 17 | ========================== 18 | 19 | Enable the plugin by adding the following section to ``$DEVSTACK_DIR/local.conf`` 20 | 21 | .. sourcecode:: bash 22 | 23 | [[local|localrc]] 24 | enable_plugin masakari https://opendev.org/openstack/masakari 25 | 26 | Optionally, a git refspec (branch or tag or commit) may be provided as follows: 27 | 28 | .. sourcecode:: bash 29 | 30 | [[local|localrc]] 31 | enable_plugin masakari https://opendev.org/openstack/masakari 32 | 33 | Run the DevStack utility 34 | ======================== 35 | 36 | .. sourcecode:: bash 37 | 38 | cd $DEVSTACK_DIR 39 | ./stack.sh 40 | -------------------------------------------------------------------------------- /doc/api_samples/hosts/host-create-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": { 3 | "control_attributes": "SSH", 4 | "type": "COMPUTE", 5 | "name": "openstack-VirtualBox" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /doc/api_samples/hosts/host-create-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": { 3 | "reserved": false, 4 | "uuid": "083a8474-22c0-407f-b89b-c569134c3bfd", 5 | "deleted": false, 6 | "on_maintenance": false, 7 | "created_at": "2017-04-21T10:09:20.000000", 8 | "control_attributes": "SSH", 9 | "updated_at": null, 10 | "name": "openstack-VirtualBox", 11 | "failover_segment": { 12 | "uuid": "9e800031-6946-4b43-bf09-8b3d1cab792b", 13 | "deleted": false, 14 | "created_at": "2017-04-20T10:17:17.000000", 15 | "description": null, 16 | "recovery_method": "auto", 17 | "updated_at": null, 18 | "service_type": "COMPUTE", 19 | "deleted_at": null, 20 | "id": 2, 21 | "name": "segment2" 22 | }, 23 | "deleted_at": null, 24 | "type": "COMPUTE_HOST", 25 | "id": 1, 26 | "failover_segment_id": "9e800031-6946-4b43-bf09-8b3d1cab792b" 27 | } 28 | } -------------------------------------------------------------------------------- /doc/api_samples/hosts/host-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": { 3 | "reserved": false, 4 | "uuid": "083a8474-22c0-407f-b89b-c569134c3bfd", 5 | "deleted": false, 6 | "on_maintenance": false, 7 | "created_at": "2017-04-21T10:09:20.000000", 8 | "control_attributes": "SSH", 9 | "updated_at": null, 10 | "name": "openstack-VirtualBox", 11 | "failover_segment": { 12 | "uuid": "9e800031-6946-4b43-bf09-8b3d1cab792b", 13 | "deleted": false, 14 | "created_at": "2017-04-20T10:17:17.000000", 15 | "description": null, 16 | "recovery_method": "auto", 17 | "updated_at": null, 18 | "service_type": "COMPUTE", 19 | "deleted_at": null, 20 | "id": 2, 21 | "name": "segment2" 22 | }, 23 | "deleted_at": null, 24 | "type": "COMPUTE_HOST", 25 | "id": 1, 26 | "failover_segment_id": "9e800031-6946-4b43-bf09-8b3d1cab792b" 27 | } 28 | } -------------------------------------------------------------------------------- /doc/api_samples/hosts/host-update-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": { 3 | "reserved": "True" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /doc/api_samples/hosts/host-update-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": { 3 | "reserved": true, 4 | "uuid": "083a8474-22c0-407f-b89b-c569134c3bfd", 5 | "deleted": false, 6 | "on_maintenance": false, 7 | "created_at": "2017-04-21T10:09:20.000000", 8 | "control_attributes": "SSH", 9 | "updated_at": "2017-04-21T11:12:43.351320", 10 | "name": "openstack-VirtualBox", 11 | "failover_segment": { 12 | "uuid": "9e800031-6946-4b43-bf09-8b3d1cab792b", 13 | "deleted": false, 14 | "created_at": "2017-04-20T10:17:17.000000", 15 | "description": null, 16 | "recovery_method": "auto", 17 | "updated_at": null, 18 | "service_type": "Compute", 19 | "deleted_at": null, 20 | "id": 2, 21 | "name": "new_segment" 22 | }, 23 | "deleted_at": null, 24 | "type": "COMPUTE", 25 | "id": 1, 26 | "failover_segment_id": "9e800031-6946-4b43-bf09-8b3d1cab792b" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /doc/api_samples/hosts/hosts-list-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosts": [ 3 | { 4 | "reserved": false, 5 | "uuid": "083a8474-22c0-407f-b89b-c569134c3bfd", 6 | "deleted": false, 7 | "on_maintenance": false, 8 | "created_at": "2017-04-21T10:09:20.000000", 9 | "control_attributes": "SSH", 10 | "updated_at": null, 11 | "name": "openstack-VirtualBox", 12 | "failover_segment": { 13 | "uuid": "9e800031-6946-4b43-bf09-8b3d1cab792b", 14 | "deleted": false, 15 | "created_at": "2017-04-20T10:17:17.000000", 16 | "description": null, 17 | "recovery_method": "auto", 18 | "updated_at": null, 19 | "service_type": "COMPUTE", 20 | "deleted_at": null, 21 | "id": 2, 22 | "name": "segment2" 23 | }, 24 | "deleted_at": null, 25 | "type": "COMPUTE_HOST", 26 | "id": 1, 27 | "failover_segment_id": "9e800031-6946-4b43-bf09-8b3d1cab792b" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /doc/api_samples/notifications/host-notification-create-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "notification": { 3 | "type": "COMPUTE_HOST", 4 | "generated_time": "2017-04-24 08:34:46", 5 | "payload": { 6 | "event": "STOPPED", 7 | "host_status": "UNKNOWN", 8 | "cluster_status": "OFFLINE" 9 | }, 10 | "hostname": "openstack-VirtualBox" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /doc/api_samples/notifications/host-notification-create-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "notification": { 3 | "notification_uuid": "9e66b95d-45da-4695-bfb6-ace68b35d955", 4 | "status": "new", 5 | "source_host_uuid": "083a8474-22c0-407f-b89b-c569134c3bfd", 6 | "deleted": false, 7 | "created_at": "2017-04-24T06:37:37.396994", 8 | "updated_at": null, 9 | "id": 4, 10 | "generated_time": "2017-04-24T08:34:46.000000", 11 | "deleted_at": null, 12 | "type": "COMPUTE_HOST", 13 | "payload": { 14 | "host_status": "UNKNOWN", 15 | "event": "STOPPED", 16 | "cluster_status": "OFFLINE" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /doc/api_samples/notifications/notifcations-list-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "notifications": [ 3 | { 4 | "notification_uuid": "32bc95ac-858d-460a-b562-7e365391be64", 5 | "status": "new", 6 | "source_host_uuid": "083a8474-22c0-407f-b89b-c569134c3bfd", 7 | "deleted": false, 8 | "created_at": "2017-04-21T12:09:44.000000", 9 | "updated_at": null, 10 | "id": 1, 11 | "generated_time": "2017-04-21T17:29:55.000000", 12 | "deleted_at": null, 13 | "type": "PROCESS", 14 | "payload": { 15 | "process_name": "nova-compute", 16 | "event": "stopped" 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /doc/api_samples/notifications/notification-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "notification": { 3 | "notification_uuid": "07a331b8-df15-4582-b121-73ed3541a408", 4 | "status": "finished", 5 | "source_host_uuid": "b5bc49be-ea6f-472d-9240-968f75d7a16a", 6 | "deleted": false, 7 | "created_at": "2019-02-28T07:19:49.000000", 8 | "updated_at": "2019-02-28T07:19:59.000000", 9 | "payload": { 10 | "instance_uuid": "b9837317-a5b8-44f4-93b4-45500c562bb8", 11 | "vir_domain_event": "STOPPED_FAILED", 12 | "event": "LIFECYCLE" 13 | }, 14 | "recovery_workflow_details": [ 15 | { 16 | "progress": 1.0, 17 | "state": "SUCCESS", 18 | "name": "StopInstanceTask", 19 | "progress_details": [ 20 | {"timestamp": "2019-03-07 13:54:28.842031", "message": "Stopping instance: df528f02-2415-4a40-bad8-453ad6a519f7", "progress": "0.0"}, 21 | {"timestamp": "2019-03-07 13:54:34.442617", "message": "Stopped instance: 'df528f02-2415-4a40-bad8-453ad6a519f7'", "progress": "1.0"} 22 | ] 23 | }, 24 | { 25 | "progress": 1.0, 26 | "state": "SUCCESS", 27 | "name": "StartInstanceTask", 28 | "progress_details": [ 29 | {"timestamp": "2019-03-07 13:54:34.531755", "message": "Starting instance: 'df528f02-2415-4a40-bad8-453ad6a519f7'", "progress": "0.0"}, 30 | {"timestamp": "2019-03-07 13:54:35.930430", "message": "Instance started: 'df528f02-2415-4a40-bad8-453ad6a519f7'", "progress": "1.0"} 31 | ] 32 | }, 33 | { 34 | "progress": 1.0, 35 | "state": "SUCCESS", 36 | "name": "ConfirmInstanceActiveTask", 37 | "progress_details": [ 38 | {"timestamp": "2019-03-07 13:54:36.019208", "message": "Confirming instance 'df528f02-2415-4a40-bad8-453ad6a519f7' vm_state is ACTIVE", "progress": "0.0"}, 39 | {"timestamp": "2019-03-07 13:54:38.569373", "message": "Confirmed instance 'df528f02-2415-4a40-bad8-453ad6a519f7' vm_state is ACTIVE", "progress": "1.0"} 40 | ] 41 | } 42 | ], 43 | "generated_time": "2017-06-13T15:34:55.000000", 44 | "deleted_at": null, 45 | "type": "VM", 46 | "id": 13 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /doc/api_samples/notifications/process-notification-create-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "notification": { 3 | "type": "PROCESS", 4 | "generated_time": "2017-04-21 17:29:55", 5 | "payload": { 6 | "process_name": "nova-compute", 7 | "event": "stopped" 8 | }, 9 | "hostname": "openstack-VirtualBox" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /doc/api_samples/notifications/process-notification-create-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "notification": { 3 | "notification_uuid": "2b412acf-c55a-442d-8fd2-e823ec0d827f", 4 | "status": "new", 5 | "source_host_uuid": "083a8474-22c0-407f-b89b-c569134c3bfd", 6 | "deleted": false, 7 | "created_at": "2017-04-24T06:05:29.387678", 8 | "updated_at": null, 9 | "id": 2, 10 | "generated_time": "2017-04-21T17:29:55.000000", 11 | "deleted_at": null, 12 | "type": "PROCESS", 13 | "payload": { 14 | "process_name": "nova-compute", 15 | "event": "stopped" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /doc/api_samples/notifications/vm-notification-create-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "notification": { 3 | "type": "VM", 4 | "generated_time": "2017-04-23T07:18:51.523726", 5 | "payload": { 6 | "instance_uuid": "96ab1c42-668c-4f2d-8689-afa3301d4ee9", 7 | "vir_domain_event": "STOPPED_DESTROYED", 8 | "event": "LIFECYCLE" 9 | }, 10 | "hostname": "openstack-VirtualBox" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /doc/api_samples/notifications/vm-notification-create-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "notification": { 3 | "notification_uuid": "f4836386-7648-4395-89b6-75a2c5ca7ff2", 4 | "status": "new", 5 | "source_host_uuid": "083a8474-22c0-407f-b89b-c569134c3bfd", 6 | "deleted": false, 7 | "created_at": "2017-04-24T06:22:47.569979", 8 | "updated_at": null, 9 | "id": 3, 10 | "generated_time": "2017-04-23T07:18:51.523726", 11 | "deleted_at": null, 12 | "type": "VM", 13 | "payload": { 14 | "instance_uuid": "96ab1c42-668c-4f2d-8689-afa3301d4ee9", 15 | "vir_domain_event": "STOPPED_DESTROYED", 16 | "event": "LIFECYCLE" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /doc/api_samples/segments/segment-create-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "segment": { 3 | "service_type": "COMPUTE", 4 | "recovery_method": "auto", 5 | "name": "new_segment", 6 | "enabled": true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /doc/api_samples/segments/segment-create-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "segment": { 3 | "uuid": "5fd9f925-0379-40db-a7f8-786a0b655b2a", 4 | "deleted": false, 5 | "created_at": "2017-04-21T08:59:53.991030", 6 | "description": null, 7 | "recovery_method": "auto", 8 | "updated_at": null, 9 | "service_type": "COMPUTE", 10 | "deleted_at": null, 11 | "id": 4, 12 | "name": "new_segment", 13 | "enabled": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /doc/api_samples/segments/segment-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "segment": { 3 | "uuid": "5fd9f925-0379-40db-a7f8-786a0b655b2a", 4 | "deleted": false, 5 | "created_at": "2017-04-21T08:59:53.991030", 6 | "description": null, 7 | "recovery_method": "auto", 8 | "updated_at": null, 9 | "service_type": "COMPUTE", 10 | "deleted_at": null, 11 | "id": 4, 12 | "name": "new_segment", 13 | "enabled": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /doc/api_samples/segments/segment-update-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "segment": { 3 | "name": "new_segment", 4 | "enabled": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /doc/api_samples/segments/segment-update-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "segment": { 3 | "uuid": "5fd9f925-0379-40db-a7f8-786a0b655b2a", 4 | "deleted": false, 5 | "created_at": "2017-04-21T08:59:54.000000", 6 | "description": null, 7 | "recovery_method": "auto", 8 | "updated_at": "2017-04-21T09:47:03.748028", 9 | "service_type": "COMPUTE", 10 | "deleted_at": null, 11 | "id": 4, 12 | "name": "new_segment", 13 | "enabled": false 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /doc/api_samples/segments/segments-list-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "segments": [ 3 | { 4 | "uuid": "9e800031-6946-4b43-bf09-8b3d1cab792b", 5 | "deleted": false, 6 | "created_at": "2017-04-20T10:17:17.000000", 7 | "description": "Segment1", 8 | "recovery_method": "auto", 9 | "updated_at": null, 10 | "service_type": "Compute", 11 | "deleted_at": null, 12 | "id": 1, 13 | "name": "segment2", 14 | "enabled": true 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /doc/api_samples/versions/v1-version-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": { 3 | "id": "v1", 4 | "links": [ 5 | { 6 | "href": "http://openstack.example.com/v1/", 7 | "rel": "self" 8 | }, 9 | { 10 | "href": "http://docs.openstack.org/", 11 | "rel": "describedby", 12 | "type": "text/html" 13 | } 14 | ], 15 | "media-types": [ 16 | { 17 | "base": "application/json", 18 | "type": "application/vnd.openstack.masakari+json;version=1" 19 | } 20 | ], 21 | "status": "CURRENT", 22 | "version": "1.0", 23 | "min_version": "1.0", 24 | "updated": "2016-07-01T11:33:21Z" 25 | } 26 | } -------------------------------------------------------------------------------- /doc/api_samples/versions/versions-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "versions": [ 3 | { 4 | "id": "v1.0", 5 | "links": [ 6 | { 7 | "href": "http://openstack.example.com/v1/", 8 | "rel": "self" 9 | } 10 | ], 11 | "status": "CURRENT", 12 | "version": "1.0", 13 | "min_version": "1.0", 14 | "updated": "2016-07-01T11:33:21Z" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /doc/api_samples/vmoves/vmove-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "vmove": { 3 | "created_at": "2023-01-28T14:55:27.000000", 4 | "updated_at": null, 5 | "deleted_at": null, 6 | "deleted": false, 7 | "id": 1, 8 | "notification_uuid": "a0e70d3a-b3a2-4616-b65d-a7c03a2c85fc", 9 | "instance_uuid": "1c2f1795-ce78-4d4c-afd0-ce141fdb3952", 10 | "instance_name": "vm1", 11 | "source_host": "host1", 12 | "dest_host": "host2", 13 | "start_time": "2023-01-28T14:55:27.000000", 14 | "end_time": "2023-01-28T14:55:31.000000", 15 | "status": "succeeded", 16 | "type": "evacuation", 17 | "message": null 18 | } 19 | } -------------------------------------------------------------------------------- /doc/api_samples/vmoves/vmoves-list-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "vmoves": [ 3 | { 4 | "created_at": "2023-01-28T14:55:27.000000", 5 | "updated_at": null, 6 | "deleted_at": null, 7 | "deleted": false, 8 | "id": 1, 9 | "notification_uuid": "a0e70d3a-b3a2-4616-b65d-a7c03a2c85fc", 10 | "instance_uuid": "1c2f1795-ce78-4d4c-afd0-ce141fdb3952", 11 | "instance_name": "vm1", 12 | "source_host": "host1", 13 | "dest_host": "host2", 14 | "start_time": "2023-01-28T14:55:27.000000", 15 | "end_time": "2023-01-28T14:55:31.000000", 16 | "status": "succeeded", 17 | "type": "evacuation", 18 | "message": null 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /doc/ext/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/doc/ext/__init__.py -------------------------------------------------------------------------------- /doc/notification_samples/create-host-end.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "host.create.end", 3 | "timestamp": "2018-11-27 13:09:30.737034", 4 | "payload": { 5 | "masakari_object.name": "HostApiPayload", 6 | "masakari_object.data": { 7 | "reserved": false, 8 | "uuid": "d6a2d900-1977-48fd-aa52-ad7a41fc068b", 9 | "on_maintenance": false, 10 | "control_attributes": "TEST", 11 | "name": "fake-mini", 12 | "failover_segment": { 13 | "masakari_object.name": "FailoverSegment", 14 | "masakari_object.data": { 15 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e", 16 | "deleted": false, 17 | "created_at": "2018-11-27T09:26:30Z", 18 | "recovery_method": "auto", 19 | "updated_at": "2018-11-27T09:54:50Z", 20 | "name": "test", 21 | "service_type": "compute", 22 | "deleted_at": null, 23 | "id": 877, "description": null 24 | }, 25 | "masakari_object.version": "1.0", 26 | "masakari_object.namespace": "masakari" 27 | }, 28 | "fault": null, 29 | "type": "COMPUTE", 30 | "id": 70, 31 | "failover_segment_id": "89597691-bebd-4860-a93e-1b6e9de34b9e" 32 | }, 33 | "masakari_object.version": "1.0", 34 | "masakari_object.namespace": "masakari" 35 | }, 36 | "priority": "INFO", 37 | "publisher_id": "masakari-api:fake-mini", 38 | "message_id": "e437834a-73e1-4c47-939a-83f6aca2e7ac" 39 | } -------------------------------------------------------------------------------- /doc/notification_samples/create-host-start.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "host.create.start", 3 | "timestamp": "2018-11-27 13:09:30.716747", 4 | "payload": { 5 | "masakari_object.name": "HostApiPayload", 6 | "masakari_object.data": { 7 | "reserved": false, 8 | "name": "fake-mini", 9 | "on_maintenance": false, 10 | "control_attributes": "TEST", 11 | "failover_segment": { 12 | "masakari_object.name": "FailoverSegment", 13 | "masakari_object.data": { 14 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e", 15 | "deleted": false, 16 | "created_at": "2018-11-27T09:26:30Z", 17 | "recovery_method": "auto", 18 | "updated_at": "2018-11-27T09:54:50Z", 19 | "name": "test", 20 | "service_type": "compute", 21 | "deleted_at": null, 22 | "id": 877, "description": null 23 | }, 24 | "masakari_object.version": "1.0", 25 | "masakari_object.namespace": "masakari" 26 | }, 27 | "fault": null, 28 | "type": "COMPUTE", 29 | "failover_segment_id": "89597691-bebd-4860-a93e-1b6e9de34b9e" 30 | }, 31 | "masakari_object.version": "1.0", 32 | "masakari_object.namespace": "masakari" 33 | }, 34 | "priority": "INFO", 35 | "publisher_id": "masakari-api:fake-mini", 36 | "message_id": "0ed836cc-353a-40bc-b86b-d89e6632d838" 37 | } -------------------------------------------------------------------------------- /doc/notification_samples/create-notification-end.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "notification.create.end", 3 | "timestamp": "2018-11-27 13:46:25.496514", 4 | "payload": { 5 | "masakari_object.name": "NotificationApiPayload", 6 | "masakari_object.data": { 7 | "notification_uuid": "e6b1996f-7792-4a65-83c3-23f2d4721eb0", 8 | "status": "new", 9 | "source_host_uuid": "d4ffe3a4-b2a8-41f3-a2b0-bae3b06fc1a3", 10 | "fault": null, 11 | "id": 1, 12 | "generated_time": "2017-06-13T15:34:55Z", 13 | "type": "VM", 14 | "payload": {"process_name": "nova-compute"} 15 | }, 16 | "masakari_object.version": "1.0", 17 | "masakari_object.namespace": "masakari" 18 | }, 19 | "priority": "INFO", 20 | "publisher_id": "masakari-api:fake-mini", 21 | "message_id": "500447b9-4797-4090-9189-b56bc3521b75" 22 | } -------------------------------------------------------------------------------- /doc/notification_samples/create-notification-start.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "notification.create.start", 3 | "timestamp": "2018-11-27 13:46:23.060352", 4 | "payload": { 5 | "masakari_object.name": "NotificationApiPayload", 6 | "masakari_object.data": { 7 | "status": "new", 8 | "source_host_uuid": "d4ffe3a4-b2a8-41f3-a2b0-bae3b06fc1a3", 9 | "fault": null, 10 | "generated_time": "2017-06-13T15:34:55Z", 11 | "type": "VM", 12 | "payload": {"process_name": "nova-compute"} 13 | }, 14 | "masakari_object.version": "1.0", 15 | "masakari_object.namespace": "masakari" 16 | }, 17 | "priority": "INFO", 18 | "publisher_id": "masakari-api:fake-mini", 19 | "message_id": "5e2e4699-0bbd-4583-b1e2-a87c458f84eb" 20 | } -------------------------------------------------------------------------------- /doc/notification_samples/create-segment-end.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "segment.create.end", 3 | "timestamp": "2018-11-22 09:25:12.813483", 4 | "payload": { 5 | "masakari_object.name": "SegmentApiPayload", 6 | "masakari_object.data": { 7 | "description": null, 8 | "fault": null, 9 | "recovery_method": "auto", 10 | "name": "test", 11 | "service_type": "compute", 12 | "id": 850, 13 | "uuid": "5cce639c-da08-4e78-b615-66c88aa49d50" 14 | }, 15 | "masakari_object.version": "1.0", 16 | "masakari_object.namespace": "masakari" 17 | }, 18 | "priority": "INFO", 19 | "publisher_id": "masakari-api:fake-mini", 20 | "message_id": "b8478b31-5943-4495-8867-e8291655f660" 21 | } -------------------------------------------------------------------------------- /doc/notification_samples/create-segment-start.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "segment.create.start", 3 | "timestamp": "2018-11-22 09:25:12.393979", 4 | "payload": { 5 | "masakari_object.name": "SegmentApiPayload", 6 | "masakari_object.data": { 7 | "service_type": "compute", 8 | "fault": null, 9 | "recovery_method": "auto", 10 | "description": null, 11 | "name": "test" 12 | }, 13 | "masakari_object.version": "1.0", 14 | "masakari_object.namespace": "masakari" 15 | }, 16 | 17 | "publisher_id": "masakari-api:fake-mini", 18 | "message_id": "e44cb15b-dcba-409e-b0e1-9ee103b9a168" 19 | } 20 | -------------------------------------------------------------------------------- /doc/notification_samples/delete-host-end.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "host.delete.end", 3 | "timestamp": "2018-11-27 13:35:09.882636", 4 | "payload": { 5 | "masakari_object.name": "HostApiPayload", 6 | "masakari_object.data": { 7 | "reserved": false, 8 | "uuid": "3d8d1751-9cab-4a48-8801-96f102200077", 9 | "on_maintenance": false, 10 | "control_attributes": "TEST", 11 | "name": "fake-mini", 12 | "failover_segment": { 13 | "masakari_object.name": "FailoverSegment", 14 | "masakari_object.data": { 15 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e", 16 | "deleted": false, 17 | "created_at": "2018-11-27T09:26:30Z", 18 | "recovery_method": "auto", 19 | "updated_at": "2018-11-27T09:54:50Z", 20 | "name": "test", 21 | "service_type": "compute", 22 | "deleted_at": null, 23 | "id": 877, 24 | "description": null 25 | }, 26 | "masakari_object.version": "1.0", 27 | "masakari_object.namespace": "masakari" 28 | }, 29 | "fault": null, 30 | "type": "COMPUTE", 31 | "failover_segment_id": "89597691-bebd-4860-a93e-1b6e9de34b9e" 32 | }, 33 | "masakari_object.version": "1.0", 34 | "masakari_object.namespace": "masakari" 35 | }, 36 | "priority": "INFO", 37 | "publisher_id": "masakari-api:fake-mini", 38 | "message_id": "64d61bcf-c875-41c3-b795-19a076f6de96" 39 | } -------------------------------------------------------------------------------- /doc/notification_samples/delete-host-start.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "host.delete.start", 3 | "timestamp": "2018-11-27 13:31:47.451466", 4 | "payload": { 5 | "masakari_object.name": "HostApiPayload", 6 | "masakari_object.data": { 7 | "reserved": false, 8 | "uuid": "3d8d1751-9cab-4a48-8801-96f102200077", 9 | "on_maintenance": false, 10 | "control_attributes": "TEST", 11 | "name": "fake-mini", 12 | "failover_segment": { 13 | "masakari_object.name": "FailoverSegment", 14 | "masakari_object.data": { 15 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e", 16 | "deleted": false, 17 | "created_at": "2018-11-27T09:26:30Z", 18 | "recovery_method": "auto", 19 | "updated_at": "2018-11-27T09:54:50Z", 20 | "name": "test", 21 | "service_type": "compute", 22 | "deleted_at": null, 23 | "id": 877, 24 | "description": null 25 | }, 26 | "masakari_object.version": "1.0", 27 | "masakari_object.namespace": "masakari" 28 | }, 29 | "fault": null, 30 | "type": "COMPUTE", 31 | "id": 71, 32 | "failover_segment_id": "89597691-bebd-4860-a93e-1b6e9de34b9e" 33 | }, 34 | "masakari_object.version": "1.0", 35 | "masakari_object.namespace": "masakari" 36 | }, 37 | "priority": "INFO", 38 | "publisher_id": "masakari-api:fake-mini", 39 | "message_id": "b5914f94-99dd-42fa-aaf3-3cedacda6b67" 40 | } -------------------------------------------------------------------------------- /doc/notification_samples/delete-segment-end.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "segment.delete.end", 3 | "timestamp": "2018-11-27 14:36:07.457369", 4 | "payload": { 5 | "masakari_object.name": "SegmentApiPayload", 6 | "masakari_object.data": { 7 | "description": null, 8 | "fault": null, 9 | "recovery_method": "auto", 10 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e", 11 | "service_type": "compute", 12 | "name": "test2" 13 | }, 14 | "masakari_object.version": "1.0", 15 | "masakari_object.namespace": "masakari" 16 | }, 17 | "priority": "INFO", 18 | "publisher_id": "masakari-api:fake-mini", 19 | "message_id": "00184d05-7a96-4021-b44e-03912a6c0b0d" 20 | } -------------------------------------------------------------------------------- /doc/notification_samples/delete-segment-start.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "segment.delete.start", 3 | "timestamp": "2018-11-27 14:36:07.442538", 4 | "payload": { 5 | "masakari_object.name": "SegmentApiPayload", 6 | "masakari_object.data": { 7 | "description": null, 8 | "fault": null, 9 | "recovery_method": "auto", 10 | "name": "test2", 11 | "service_type": "compute", 12 | "id": 877, 13 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e" 14 | }, 15 | "masakari_object.version": "1.0", 16 | "masakari_object.namespace": "masakari" 17 | }, 18 | "priority": "INFO", 19 | "publisher_id": "masakari-api:fake-mini", 20 | "message_id": "e6c32ecb-eacc-433d-ba8c-6390ea3da6d2" 21 | } -------------------------------------------------------------------------------- /doc/notification_samples/error-exception.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "segment.create.error", 3 | "timestamp": "2018-11-28 14:24:27.902437", 4 | "payload": { 5 | "masakari_object.name": "SegmentApiPayload", 6 | "masakari_object.data": { 7 | "service_type": "compute", 8 | "fault": { 9 | "masakari_object.name": "ExceptionPayload", 10 | "masakari_object.data": { 11 | "module_name": "pymysql.err", 12 | "exception": "DBError", 13 | "traceback": "Traceback (most recent call last):\n File \"/opt/stack/masakari/masakari/ha/api.py\", line ...", 14 | "exception_message": "(pymysql.err.Internal Error) (1054, u\"Unknown column 'name' in 'field list'\" ...", 15 | "function_name": "raise_mysql_exception" 16 | }, 17 | "masakari_object.version": "1.0", 18 | "masakari_object.namespace": "masakari" 19 | }, 20 | "recovery_method": "auto", 21 | "description": null, 22 | "name": "testT6" 23 | }, 24 | "masakari_object.version": "1.0", 25 | "masakari_object.namespace": "masakari" 26 | }, 27 | "priority": "ERROR", 28 | "publisher_id": "masakari-api:fake-mini", 29 | "message_id": "e5405591-1d19-4a8c-aa92-4d551165d863" 30 | } -------------------------------------------------------------------------------- /doc/notification_samples/process-notification-end.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "notification.process.end", 3 | "timestamp": "2018-12-20 05:26:05.075917", 4 | "payload": { 5 | "masakari_object.name": "NotificationApiPayload", 6 | "masakari_object.data": { 7 | "notification_uuid": "15505a8c-8856-4f3d-9747-55b6e899c0f5", 8 | "status": "ignored", 9 | "source_host_uuid": "6bfaf80d-7592-4ea8-ad12-60d45476d056", 10 | "fault": null, 11 | "id": 47, 12 | "generated_time": "2017-06-13T15:34:55Z", 13 | "type": "VM", 14 | "payload": {"process_name": "nova-compute"} 15 | }, 16 | "masakari_object.version": "1.0", 17 | "masakari_object.namespace": "masakari" 18 | }, 19 | "priority": "INFO", 20 | "publisher_id": "masakari-engine:fake-mini", 21 | "message_id": "c081eb25-7450-4fa2-bb19-ae6d4466e14e" 22 | } -------------------------------------------------------------------------------- /doc/notification_samples/process-notification-error.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "notification.process.error", 3 | "timestamp": "2018-12-20 06:21:19.315761", 4 | "payload": { 5 | "masakari_object.name": "NotificationApiPayload", 6 | "masakari_object.data": { 7 | "notification_uuid": "0adb94e0-8283-4702-9793-186d4ed914e8", 8 | "status": "running", 9 | "source_host_uuid": "6bfaf80d-7592-4ea8-ad12-60d45476d056", 10 | "fault": { 11 | "masakari_object.name": "ExceptionPayload", 12 | "masakari_object.data": { 13 | "module_name": "masakari.engine.manager", 14 | "exception": "str", 15 | "traceback": "Traceback (most recent call last):\n File \"/opt/stack/masakari/masakari/engine/manager.py\", line ...", 16 | "exception_message": "Failed to execute process recovery workflow.", 17 | "function_name": "_handle_notification_type_process" 18 | }, 19 | "masakari_object.version": "1.0", 20 | "masakari_object.namespace": "masakari" 21 | }, 22 | "id": 51, 23 | "generated_time": "2017-06-13T15:34:55Z", 24 | "type": "PROCESS", 25 | "payload": {"process_name": "nova-compute"} 26 | }, 27 | "masakari_object.version": "1.0", 28 | "masakari_object.namespace": "masakari" 29 | }, 30 | "priority": "ERROR", 31 | "publisher_id": "masakari-engine:fake-mini", 32 | "message_id": "5f3c9705-b3fb-41f9-a4e0-4868db93178c" 33 | } -------------------------------------------------------------------------------- /doc/notification_samples/process-notification-start.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "notification.process.start", 3 | "timestamp": "2018-12-20 05:26:05.002421", 4 | "payload": { 5 | "masakari_object.name": "NotificationApiPayload", 6 | "masakari_object.data": { 7 | "notification_uuid": "15505a8c-8856-4f3d-9747-55b6e899c0f5", 8 | "status": "new", 9 | "source_host_uuid": "6bfaf80d-7592-4ea8-ad12-60d45476d056", 10 | "fault": null, 11 | "id": 47, 12 | "generated_time": "2017-06-13T15:34:55Z", 13 | "type": "VM", 14 | "payload": {"process_name": "nova-compute"} 15 | }, 16 | "masakari_object.version": "1.0", 17 | "masakari_object.namespace": "masakari" 18 | }, 19 | "priority": "INFO", 20 | "publisher_id": "masakari-engine:fake-mini", 21 | "message_id": "285be756-ac29-4b78-9e2b-9756f5077012" 22 | } -------------------------------------------------------------------------------- /doc/notification_samples/update-host-end.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "host.update.end", 3 | "timestamp": "2018-11-27 13:13:25.361394", 4 | "payload": { 5 | "masakari_object.name": "HostApiPayload", 6 | "masakari_object.data": { 7 | "reserved": false, 8 | "uuid": "d6a2d900-1977-48fd-aa52-ad7a41fc068b", 9 | "on_maintenance": false, 10 | "control_attributes": "TEST", 11 | "name": "fake-mini", 12 | "failover_segment": { 13 | "masakari_object.name": "FailoverSegment", 14 | "masakari_object.data": { 15 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e", 16 | "deleted": false, 17 | "created_at": "2018-11-27T09:26:30Z", 18 | "recovery_method": "auto", 19 | "updated_at": "2018-11-27T09:54:50Z", 20 | "name": "test", 21 | "service_type": "compute", 22 | "deleted_at": null, 23 | "id": 877, 24 | "description": null 25 | }, 26 | "masakari_object.version": "1.0", 27 | "masakari_object.namespace": "masakari" 28 | }, 29 | "fault": null, 30 | "type": "COMPUTE", 31 | "id": 70, 32 | "failover_segment_id": "89597691-bebd-4860-a93e-1b6e9de34b9e" 33 | }, 34 | "masakari_object.version": "1.0", 35 | "masakari_object.namespace": "masakari" 36 | }, 37 | "priority": "INFO", 38 | "publisher_id": "masakari-api:fake-mini", 39 | "message_id": "e7f85d49-7d02-4713-b90b-433f8e447558" 40 | } -------------------------------------------------------------------------------- /doc/notification_samples/update-host-start.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "host.update.start", 3 | "timestamp": "2018-11-27 13:13:25.298007", 4 | "payload": { 5 | "masakari_object.name": "HostApiPayload", 6 | "masakari_object.data": { 7 | "reserved": false, 8 | "uuid": "d6a2d900-1977-48fd-aa52-ad7a41fc068b", 9 | "on_maintenance": false, 10 | "control_attributes": "TEST", 11 | "name": "fake-mini", 12 | "failover_segment": { 13 | "masakari_object.name": "FailoverSegment", 14 | "masakari_object.data": { 15 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e", 16 | "deleted": false, 17 | "created_at": "2018-11-27T09:26:30Z", 18 | "recovery_method": "auto", 19 | "updated_at": "2018-11-27T09:54:50Z", 20 | "name": "test", 21 | "service_type": "compute", 22 | "deleted_at": null, 23 | "id": 877, "description": null 24 | }, 25 | "masakari_object.version": "1.0", 26 | "masakari_object.namespace": "masakari" 27 | }, 28 | "fault": null, 29 | "type": "COMPUTE", 30 | "id": 70, 31 | "failover_segment_id": "89597691-bebd-4860-a93e-1b6e9de34b9e" 32 | }, 33 | "masakari_object.version": "1.0", 34 | "masakari_object.namespace": "masakari" 35 | }, 36 | "priority": "INFO", 37 | "publisher_id": "masakari-api:fake-mini", 38 | "message_id": "d1a3ae84-7f41-4884-bc3f-fa34c7cd1424" 39 | } -------------------------------------------------------------------------------- /doc/notification_samples/update-segment-end.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "segment.update.end", 3 | "timestamp": "2018-11-27 14:32:20.417745", 4 | "payload": { 5 | "masakari_object.name": "SegmentApiPayload", 6 | "masakari_object.data": { 7 | "description": null, 8 | "fault": null, 9 | "recovery_method": "auto", 10 | "name": "test2", 11 | "service_type": "compute", 12 | "id": 877, 13 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e" 14 | }, 15 | "masakari_object.version": "1.0", 16 | "masakari_object.namespace": "masakari" 17 | }, 18 | "priority": "INFO", 19 | "publisher_id": "masakari-api:fake-mini", 20 | "message_id": "3fbe50a5-9175-4161-85f0-e502f9024657" 21 | } -------------------------------------------------------------------------------- /doc/notification_samples/update-segment-start.json: -------------------------------------------------------------------------------- 1 | { 2 | "event_type": "segment.update.start", 3 | "timestamp": "2018-11-27 14:32:20.396940", 4 | "payload": { 5 | "masakari_object.name": "SegmentApiPayload", 6 | "masakari_object.data": { 7 | "description": null, 8 | "fault": null, 9 | "recovery_method": "auto", 10 | "name": "test", 11 | "service_type": "compute", 12 | "id": 877, 13 | "uuid": "89597691-bebd-4860-a93e-1b6e9de34b9e" 14 | }, 15 | "masakari_object.version": "1.0", 16 | "masakari_object.namespace": "masakari" 17 | }, 18 | "priority": "INFO", 19 | "publisher_id": "masakari-api:fake-mini", 20 | "message_id": "e6322900-025d-4dd6-a3a1-3e0e1e9badeb" 21 | } -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | # The order of packages is significant, because pip processes them in the order 2 | # of appearance. Changing the order has an impact on the overall integration 3 | # process, which may cause wedges in the gate later. 4 | sphinx>=2.0.0,!=2.1.0 # BSD 5 | openstackdocstheme>=2.2.1 # Apache-2.0 6 | os-api-ref>=1.4.0 # Apache-2.0 7 | sphinxcontrib-apidoc>=0.2.0 # BSD 8 | 9 | # releasenotes 10 | reno>=3.1.0 # Apache-2.0 11 | 12 | # PDF Docs 13 | sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD 14 | -------------------------------------------------------------------------------- /doc/source/_static/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/doc/source/_static/architecture.png -------------------------------------------------------------------------------- /doc/source/cli/index.rst: -------------------------------------------------------------------------------- 1 | ========================== 2 | Masakari CLI Documentation 3 | ========================== 4 | 5 | In this section you will find information on Masakari's command line 6 | interface. 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | masakari-status 12 | masakari-manage 13 | openstack-masakari 14 | -------------------------------------------------------------------------------- /doc/source/cli/masakari-manage.rst: -------------------------------------------------------------------------------- 1 | =============== 2 | masakari-manage 3 | =============== 4 | 5 | ------------------------------------- 6 | Control and manage masakari database 7 | ------------------------------------- 8 | 9 | Synopsis 10 | ======== 11 | 12 | :: 13 | 14 | masakari-manage [] 15 | 16 | Description 17 | =========== 18 | 19 | :program:`masakari-manage` controls DB by managing various admin-only aspects 20 | of masakari. 21 | 22 | Options 23 | ======= 24 | 25 | The standard pattern for executing a masakari-manage command is:: 26 | 27 | masakari-manage [] 28 | 29 | Run without arguments to see a list of available command categories:: 30 | 31 | masakari-manage 32 | 33 | You can also run with a category argument such as db to see a list of all 34 | commands in that category:: 35 | 36 | masakari-manage db 37 | 38 | These sections describe the available categories and arguments for masakari-manage. 39 | 40 | Masakari Database 41 | ~~~~~~~~~~~~~~~~~ 42 | 43 | ``masakari-manage db version`` 44 | Print the current main database version. 45 | 46 | ``masakari-manage db sync [--version ]`` 47 | Upgrade the main database schema up to the most recent version or 48 | ``--version`` if specified. 49 | 50 | ``masakari-manage db purge`` 51 | Deleting rows older than 30 day(s) from table hosts, failover_segments and 52 | notifications. 53 | -------------------------------------------------------------------------------- /doc/source/cli/masakari-status.rst: -------------------------------------------------------------------------------- 1 | =============== 2 | masakari-status 3 | =============== 4 | 5 | ------------------------------------------ 6 | CLI interface for Masakari status commands 7 | ------------------------------------------ 8 | 9 | Synopsis 10 | ======== 11 | 12 | :: 13 | 14 | masakari-status [] 15 | 16 | Description 17 | =========== 18 | 19 | :program:`masakari-status` is a tool that provides routines for checking the 20 | status of a Masakari deployment. 21 | 22 | Options 23 | ======= 24 | 25 | The standard pattern for executing a :program:`masakari-status` command is:: 26 | 27 | masakari-status [] 28 | 29 | Run without arguments to see a list of available command categories:: 30 | 31 | masakari-status 32 | 33 | Categories are: 34 | 35 | * ``upgrade`` 36 | 37 | Detailed descriptions are below: 38 | 39 | You can also run with a category argument such as ``upgrade`` to see a list of 40 | all commands in that category:: 41 | 42 | masakari-status upgrade 43 | 44 | These sections describe the available categories and arguments for 45 | :program:`masakari-status`. 46 | 47 | Upgrade 48 | ~~~~~~~ 49 | 50 | .. _masakari-status-checks: 51 | 52 | ``masakari-status upgrade check`` 53 | Performs a release-specific readiness check before restarting services with 54 | new code. For example, missing or changed configuration options, 55 | incompatible object states, or other conditions that could lead to 56 | failures while upgrading. 57 | 58 | **Return Codes** 59 | 60 | .. list-table:: 61 | :widths: 20 80 62 | :header-rows: 1 63 | 64 | * - Return code 65 | - Description 66 | * - 0 67 | - All upgrade readiness checks passed successfully and there is nothing 68 | to do. 69 | * - 1 70 | - At least one check encountered an issue and requires further 71 | investigation. This is considered a warning but the upgrade may be OK. 72 | * - 2 73 | - There was an upgrade status check failure that needs to be 74 | investigated. This should be considered something that stops an 75 | upgrade. 76 | * - 255 77 | - An unexpected error occurred. 78 | 79 | **History of Checks** 80 | 81 | **7.0.0 (Stein)** 82 | 83 | * Sample check to be filled in with checks as they are added in Stein. 84 | -------------------------------------------------------------------------------- /doc/source/cli/openstack-masakari.rst: -------------------------------------------------------------------------------- 1 | ================== 2 | openstack masakari 3 | ================== 4 | 5 | To control and manage masakari operations, the extended `command list 6 | `_ 7 | available in openstack command. 8 | -------------------------------------------------------------------------------- /doc/source/configuration/api-paste.ini.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | api-paste.ini 3 | ============= 4 | 5 | The masakari service stores its API configuration settings in the 6 | ``api-paste.ini`` file. 7 | 8 | .. literalinclude:: /../../etc/masakari/api-paste.ini 9 | -------------------------------------------------------------------------------- /doc/source/configuration/config.rst: -------------------------------------------------------------------------------- 1 | ===================== 2 | Configuration Options 3 | ===================== 4 | 5 | The following is an overview of all available configuration options in 6 | Masakari. 7 | 8 | .. only:: html 9 | 10 | For a sample configuration file, refer to :doc:`sample_config`. 11 | 12 | .. show-options:: 13 | :config-file: etc/masakari/masakari-config-generator.conf 14 | -------------------------------------------------------------------------------- /doc/source/configuration/index.rst: -------------------------------------------------------------------------------- 1 | =================== 2 | Configuration Guide 3 | =================== 4 | 5 | The configuration for masakari lies in below described files. 6 | 7 | Configuration 8 | ------------- 9 | 10 | Masakari has two main config files: 11 | ``masakari.conf`` and ``recovery_workflow_sample_config.conf``. 12 | 13 | * :doc:`Config Reference `: A complete reference of all 14 | config points in masakari and what they impact. 15 | 16 | .. only:: html 17 | 18 | * :doc:`Sample Config File `: A sample config 19 | file with inline documentation. 20 | 21 | * :doc:`Recovery Config Reference `: A complete reference of all 22 | config points in masakari and what they impact. 23 | 24 | .. only:: html 25 | 26 | * :doc:`Sample recovery workflow File `: A 27 | complete reference of defining the monitoring processes. 28 | 29 | Policy 30 | ------ 31 | 32 | Masakari, like most OpenStack projects, uses a policy language to restrict 33 | permissions on REST API actions. 34 | 35 | * :doc:`Policy Reference `: A complete reference of all 36 | policy points in masakari and what they impact. 37 | 38 | * :doc:`Sample policy File `: A sample policy 39 | file with inline documentation. 40 | 41 | 42 | API configuration settings 43 | -------------------------- 44 | 45 | * :doc:`API configuration `: A complete reference of API 46 | configuration settings. 47 | -------------------------------------------------------------------------------- /doc/source/configuration/policy.rst: -------------------------------------------------------------------------------- 1 | ================= 2 | Masakari Policies 3 | ================= 4 | 5 | .. warning:: 6 | 7 | JSON formatted policy file is deprecated since Masakari 11.0.0 (Wallaby). 8 | This `oslopolicy-convert-json-to-yaml`__ tool will migrate your existing 9 | JSON-formatted policy file to YAML in a backward-compatible way. 10 | 11 | .. __: https://docs.openstack.org/oslo.policy/latest/cli/oslopolicy-convert-json-to-yaml.html 12 | 13 | The following is an overview of all available policies in masakari. 14 | For a sample configuration file, refer to :doc:`sample_policy`. 15 | 16 | .. show-policy:: 17 | :config-file: etc/masakari/masakari-policy-generator.conf 18 | -------------------------------------------------------------------------------- /doc/source/configuration/recovery_config.rst: -------------------------------------------------------------------------------- 1 | ===================== 2 | Configuration Options 3 | ===================== 4 | 5 | The following is an overview of all available configuration options in 6 | Masakari. 7 | 8 | .. only:: html 9 | 10 | For a sample configuration file, refer to :doc:`recovery_workflow_sample_config`. 11 | 12 | .. show-options:: 13 | :config-file: etc/masakari/masakari-customized-recovery-flow-config-generator.conf 14 | -------------------------------------------------------------------------------- /doc/source/configuration/recovery_workflow_sample_config.rst: -------------------------------------------------------------------------------- 1 | =========================================================== 2 | Masakari Customized Recovery Workflow Configuration Options 3 | =========================================================== 4 | masakari-custom-recovery-methods.conf.sample 5 | The following is a sample Masakari recovery workflow configuration for 6 | adaptation and use. 7 | 8 | The sample configuration can also be downloaded from :download:`here 9 | `. 10 | 11 | .. literalinclude:: /_static/masakari-custom-recovery-methods.conf.sample 12 | -------------------------------------------------------------------------------- /doc/source/configuration/sample_config.rst: -------------------------------------------------------------------------------- 1 | ============================== 2 | Masakari Configuration Options 3 | ============================== 4 | 5 | The following is a sample Masakari configuration for adaptation and use. It is 6 | auto-generated from Masakari when this documentation is built, so 7 | if you are having issues with an option, please compare your version of 8 | Masakari with the version of this documentation. 9 | 10 | The sample configuration can also be downloaded from :download:`here 11 | `. 12 | 13 | .. literalinclude:: /_static/masakari.conf.sample 14 | 15 | Minimal Configuration 16 | ===================== 17 | 18 | Edit the ``/etc/masakari/masakari.conf`` file and complete the following actions 19 | 20 | In the ``[DEFAULT]`` section, set following options: 21 | 22 | .. code-block:: bash 23 | 24 | auth_strategy = keystone 25 | masakari_topic = ha_engine 26 | os_privileged_user_tenant = service 27 | os_privileged_user_auth_url = http://controller/identity 28 | os_privileged_user_name = nova 29 | os_privileged_user_password = PRIVILEGED_USER_PASS 30 | 31 | Replace ``PRIVILEGED_USER_PASS`` with the password you chose for the privileged user in the 32 | Identity service. 33 | 34 | In the ``[database]`` section, configure database access: 35 | 36 | .. code-block:: bash 37 | 38 | connection = mysql+pymysql://root:MASAKARI_DBPASS@controller/masakari?charset=utf8 39 | 40 | In the ``[keystone_authtoken]`` sections, configure Identity service access: 41 | 42 | .. code-block:: bash 43 | 44 | auth_url = http://controller/identity 45 | memcached_servers = controller:11211 46 | signing_dir = /var/cache/masakari 47 | project_domain_name = Default 48 | user_domain_name = Default 49 | project_name = service 50 | username = masakari 51 | password = MASAKARI_PASS 52 | auth_type = password 53 | cafile = /opt/stack/data/ca-bundle.pem 54 | 55 | Replace ``MASAKARI_PASS`` with the password you chose for the ``masakari`` user in the Identity service. 56 | 57 | In the ``[coordination]`` section, set 'backend_url' if use coordination for Masakari-api service. 58 | 59 | .. note:: 60 | Additional packages may be required depending on the tooz backend used in 61 | the installation. For example, ``etcd3gw`` is required if the backend driver 62 | is configured to use ``etcd3+http://``. Supported drivers are listed at 63 | `Tooz drivers `_. 64 | -------------------------------------------------------------------------------- /doc/source/configuration/sample_policy.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | Sample Masakari Policy File 3 | =========================== 4 | 5 | .. warning:: 6 | 7 | JSON formatted policy file is deprecated since Masakari 11.0.0 (Wallaby). 8 | This `oslopolicy-convert-json-to-yaml`__ tool will migrate your existing 9 | JSON-formatted policy file to YAML in a backward-compatible way. 10 | 11 | .. __: https://docs.openstack.org/oslo.policy/latest/cli/oslopolicy-convert-json-to-yaml.html 12 | 13 | The following is a sample masakari policy file for adaptation and use. 14 | 15 | The sample policy can also be viewed in :download:`file form 16 | `. 17 | 18 | .. important:: 19 | 20 | The sample policy file is auto-generated from masakari when this 21 | documentation is built. 22 | 23 | .. literalinclude:: /_static/masakari.policy.yaml.sample 24 | -------------------------------------------------------------------------------- /doc/source/contributor/contributing.rst: -------------------------------------------------------------------------------- 1 | ============================ 2 | So You Want to Contribute... 3 | ============================ 4 | For general information on contributing to OpenStack, please check out the 5 | `contributor guide `_ to get started. 6 | It covers all the basics that are common to all OpenStack projects: the accounts 7 | you need, the basics of interacting with our Gerrit review system, how we 8 | communicate as a community, etc. 9 | Below will cover the more project specific information you need to get started 10 | with masakari. 11 | 12 | Communication 13 | ~~~~~~~~~~~~~ 14 | * IRC channel #openstack-masakari at OFTC 15 | * Mailing list (prefix subjects with ``[masakari]`` for faster responses) 16 | http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-discuss 17 | 18 | Contacting the Core Team 19 | ~~~~~~~~~~~~~~~~~~~~~~~~ 20 | Please refer the `masakari Core Team 21 | `_ contacts. 22 | 23 | New Feature Planning 24 | ~~~~~~~~~~~~~~~~~~~~ 25 | masakari features are tracked on `Launchpad `_. 26 | 27 | Task Tracking 28 | ~~~~~~~~~~~~~ 29 | We track our tasks in `Launchpad `_. 30 | If you're looking for some smaller, easier work item to pick up and get started 31 | on, search for the 'low-hanging-fruit' tag. 32 | 33 | Reporting a Bug 34 | ~~~~~~~~~~~~~~~ 35 | You found an issue and want to make sure we are aware of it? You can do so on 36 | `Launchpad `_. 37 | 38 | Getting Your Patch Merged 39 | ~~~~~~~~~~~~~~~~~~~~~~~~~ 40 | All changes proposed to the masakari project require one or two +2 votes 41 | from masakari core reviewers before one of the core reviewers can approve 42 | patch by giving ``Workflow +1`` vote. 43 | 44 | Project Team Lead Duties 45 | ~~~~~~~~~~~~~~~~~~~~~~~~ 46 | All common PTL duties are enumerated in the `PTL guide 47 | `_. 48 | -------------------------------------------------------------------------------- /doc/source/install/index.rst: -------------------------------------------------------------------------------- 1 | ================= 2 | Masakari services 3 | ================= 4 | 5 | .. toctree:: 6 | 7 | overview 8 | install_and_configure 9 | verify 10 | -------------------------------------------------------------------------------- /doc/source/install/install_and_configure.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017 NTT DATA 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | not use this file except in compliance with the License. You may obtain 6 | a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | License for the specific language governing permissions and limitations 14 | under the License. 15 | 16 | ===================== 17 | Install and configure 18 | ===================== 19 | 20 | This section describes how to install and configure Masakari services 21 | on the compute node. 22 | 23 | This section assumes that you already have a working OpenStack environment with 24 | the following components installed: 25 | Nova, Glance, Cinder, Neutron and Identity. 26 | 27 | The installation and configuration vary by distribution. 28 | 29 | .. toctree:: 30 | :maxdepth: 1 31 | 32 | install_and_configure_ubuntu 33 | -------------------------------------------------------------------------------- /doc/source/install/overview.rst: -------------------------------------------------------------------------------- 1 | ========================= 2 | Masakari service overview 3 | ========================= 4 | 5 | Masakari provides Virtual Machines High Availability(VMHA), and rescues 6 | KVM-based Virtual Machines(VM) from a failure events described below: 7 | 8 | * ``VM process down`` - 9 | restart vm (use nova stop API, and nova start API). 10 | Libvirt events will be also emitted by other failures. 11 | * ``Provisioning process down`` - 12 | restarts process, changes nova-compute service status to maintenance mode 13 | (use nova service-disable). 14 | * ``nova-compute host failure`` - 15 | evacuate all the VMs from failure host according to the following recovery 16 | methods (use nova evacuate API). 17 | 18 | * ``auto`` - 19 | evacuate all the VMs with no destination node for nova scheduler. 20 | * ``reserved_host`` - 21 | evacuate all the VMs with reserved hosts as the destination nodes for 22 | nova scheduler. 23 | * ``auto_priority`` - 24 | evacuate all the VMs by using ``auto`` recovery method firstly. 25 | If failed, then using ``reserved_host`` recovery method. 26 | * ``rh_priority`` - 27 | evacuate all the VMs by using ``reserved_host`` recovery method firstly. 28 | If failed, then using ``auto`` recovery method. 29 | 30 | The below services enables deplores to integrate with the Masakari directly 31 | or through custom plug-ins. 32 | 33 | The Masakari service consists of the following components: 34 | 35 | ``masakari-api`` 36 | An OpenStack-native REST API that processes API requests by sending 37 | them to the ``masakari-engine`` over `Remote Procedure Call (RPC)`. 38 | 39 | ``masakari-engine`` 40 | Processes the notifications received from ``masakari-api`` by executing the 41 | recovery workflow in asynchronous way. 42 | -------------------------------------------------------------------------------- /doc/source/user/architecture.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Copyright 2017 NTT DATA 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | not use this file except in compliance with the License. You may obtain 6 | a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | License for the specific language governing permissions and limitations 14 | under the License. 15 | 16 | Masakari System Architecture 17 | ============================ 18 | 19 | Masakari comprises of two services api and engine, each performing different 20 | functions. The user-facing interface is a REST API, while internally Masakari 21 | communicates via an RPC message passing mechanism. 22 | 23 | The API servers process REST requests, which typically involve database 24 | reads/writes, sending RPC messages to other Masakari engine, 25 | and generating responses to the REST calls. 26 | RPC messaging is done via the **oslo.messaging** library, 27 | an abstraction on top of message queues. 28 | The Masakari engine will run on the same host where the Masakari api is 29 | running, and has a `manager` that is listening for `RPC` messages. 30 | The manager too has periodic tasks. 31 | 32 | Components 33 | ---------- 34 | 35 | Below you will find a helpful explanation of the key components 36 | of a typical Masakari deployment. 37 | 38 | .. image:: /_static/architecture.png 39 | :width: 100% 40 | 41 | * DB: sql database for data storage. 42 | * API: component that receives HTTP requests, converts commands and 43 | communicates with masakari engine via the **oslo.messaging** queue. 44 | * Engine: Executes recovery workflow and communicates with nova via HTTP. 45 | -------------------------------------------------------------------------------- /etc/masakari/README-masakari.conf.txt: -------------------------------------------------------------------------------- 1 | To generate the sample masakari.conf file, run the following command from the top 2 | level of the masakari directory: 3 | 4 | tox -egenconfig 5 | -------------------------------------------------------------------------------- /etc/masakari/api-paste.ini: -------------------------------------------------------------------------------- 1 | [composite:masakari_api] 2 | use = call:masakari.api.urlmap:urlmap_factory 3 | /: apiversions 4 | /v1: masakari_api_v1 5 | 6 | 7 | [composite:masakari_api_v1] 8 | use = call:masakari.api.auth:pipeline_factory_v1 9 | keystone = cors http_proxy_to_wsgi request_id faultwrap sizelimit authtoken keystonecontext osapi_masakari_app_v1 10 | noauth2 = cors http_proxy_to_wsgi request_id faultwrap sizelimit noauth2 osapi_masakari_app_v1 11 | 12 | # filters 13 | [filter:cors] 14 | paste.filter_factory = oslo_middleware.cors:filter_factory 15 | oslo_config_project = masakari 16 | 17 | [filter:http_proxy_to_wsgi] 18 | paste.filter_factory = oslo_middleware.http_proxy_to_wsgi:HTTPProxyToWSGI.factory 19 | 20 | [filter:request_id] 21 | paste.filter_factory = oslo_middleware:RequestId.factory 22 | 23 | [filter:faultwrap] 24 | paste.filter_factory = masakari.api.openstack:FaultWrapper.factory 25 | 26 | [filter:sizelimit] 27 | paste.filter_factory = oslo_middleware:RequestBodySizeLimiter.factory 28 | 29 | [filter:authtoken] 30 | paste.filter_factory = keystonemiddleware.auth_token:filter_factory 31 | 32 | [filter:keystonecontext] 33 | paste.filter_factory = masakari.api.auth:MasakariKeystoneContext.factory 34 | 35 | [filter:noauth2] 36 | paste.filter_factory = masakari.api.auth:NoAuthMiddleware.factory 37 | 38 | # apps 39 | [app:osapi_masakari_app_v1] 40 | paste.app_factory = masakari.api.openstack.ha:APIRouterV1.factory 41 | 42 | [pipeline:apiversions] 43 | pipeline = faultwrap http_proxy_to_wsgi apiversionsapp 44 | 45 | [app:apiversionsapp] 46 | paste.app_factory = masakari.api.openstack.ha.versions:Versions.factory 47 | -------------------------------------------------------------------------------- /etc/masakari/masakari-config-generator.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | output_file = etc/masakari/masakari.conf.sample 3 | wrap_width = 80 4 | namespace = keystonemiddleware.auth_token 5 | namespace = masakari.conf 6 | namespace = oslo.db 7 | namespace = oslo.db.concurrency 8 | namespace = oslo.log 9 | namespace = oslo.messaging 10 | namespace = oslo.middleware 11 | namespace = oslo.policy 12 | namespace = oslo.service.service 13 | namespace = oslo.service.wsgi 14 | namespace = oslo.versionedobjects 15 | -------------------------------------------------------------------------------- /etc/masakari/masakari-customized-recovery-flow-config-generator.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | wrap_width = 80 3 | output_file = etc/masakari/masakari-custom-recovery-methods.conf.sample 4 | namespace = customized_recovery_flow_opts -------------------------------------------------------------------------------- /etc/masakari/masakari-policy-generator.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | output_file = etc/masakari/policy.yaml.sample 3 | namespace = masakari 4 | -------------------------------------------------------------------------------- /masakari/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 NTT Data 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | """ 17 | :mod:`masakari` -- Cloud IaaS Platform 18 | =================================== 19 | 20 | .. automodule:: masakari 21 | :platform: Unix 22 | :synopsis: Infrastructure-as-a-Service Cloud platform. 23 | """ 24 | 25 | import os 26 | 27 | os.environ['EVENTLET_NO_GREENDNS'] = 'yes' 28 | 29 | # NOTE(rpodolyaka): import oslo_service first, so that it makes eventlet hub 30 | # use a monotonic clock to avoid issues with drifts of system time (see 31 | # LP 1510234 for details) 32 | import oslo_service # noqa 33 | 34 | import eventlet # noqa 35 | -------------------------------------------------------------------------------- /masakari/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/api/__init__.py -------------------------------------------------------------------------------- /masakari/api/openstack/ha/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 NTT Data 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | """ 17 | WSGI middleware for OpenStack Masakari API. 18 | """ 19 | 20 | import masakari.api.openstack 21 | from masakari.api.openstack.ha import extension_info 22 | import masakari.conf 23 | 24 | 25 | CONF = masakari.conf.CONF 26 | 27 | 28 | class APIRouterV1(masakari.api.openstack.APIRouterV1): 29 | """Routes requests on the OpenStack API to the appropriate controller 30 | and method. 31 | """ 32 | def __init__(self, init_only=None): 33 | self._loaded_extension_info = extension_info.LoadedExtensionInfo() 34 | super(APIRouterV1, self).__init__(init_only) 35 | 36 | def _register_extension(self, ext): 37 | return self.loaded_extension_info.register_extension(ext.obj) 38 | 39 | @property 40 | def loaded_extension_info(self): 41 | return self._loaded_extension_info 42 | -------------------------------------------------------------------------------- /masakari/api/openstack/ha/schemas/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/api/openstack/ha/schemas/__init__.py -------------------------------------------------------------------------------- /masakari/api/openstack/ha/schemas/hosts.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | import copy 16 | 17 | from masakari.api.validation import parameter_types 18 | 19 | 20 | _base = { 21 | 'type': 'object', 22 | 'properties': { 23 | 'host': { 24 | 'type': 'object', 25 | 'properties': { 26 | 'name': parameter_types.name, 27 | 'type': parameter_types.type, 28 | 'control_attributes': parameter_types.description, 29 | 'reserved': parameter_types.boolean, 30 | 'on_maintenance': parameter_types.boolean 31 | }, 32 | 'additionalProperties': False 33 | } 34 | }, 35 | 'required': ['host'], 36 | 'additionalProperties': False 37 | } 38 | 39 | 40 | create = copy.deepcopy(_base) 41 | create['properties']['host']['required'] = ['name', 'type', 42 | 'control_attributes'] 43 | 44 | 45 | update = copy.deepcopy(_base) 46 | update['properties']['host']['anyOf'] = [{'required': ['name']}, 47 | {'required': ['type']}, 48 | {'required': ['control_attributes']}, 49 | {'required': ['reserved']}, 50 | {'required': ['on_maintenance']}, 51 | ] 52 | -------------------------------------------------------------------------------- /masakari/api/openstack/ha/schemas/notifications.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from masakari.api.validation import parameter_types 16 | from masakari.objects import fields 17 | 18 | create = { 19 | 'type': 'object', 20 | 'properties': { 21 | 'notification': { 22 | 'type': 'object', 23 | 'properties': { 24 | 'type': { 25 | 'type': 'string', 26 | 'enum': fields.NotificationType.ALL, 27 | }, 28 | 'hostname': parameter_types.hostname, 29 | 'generated_time': { 30 | 'type': 'string', 31 | 'format': 'date-time', 32 | }, 33 | 'payload': parameter_types.payload, 34 | }, 35 | 'required': ['type', 'hostname', 'generated_time', 'payload'], 36 | 'additionalProperties': False 37 | } 38 | }, 39 | 'required': ['notification'], 40 | 'additionalProperties': False 41 | } 42 | -------------------------------------------------------------------------------- /masakari/api/openstack/ha/schemas/payload.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 NTT DATA. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from masakari.objects import fields 16 | 17 | 18 | create_compute_host_payload = { 19 | 'type': 'object', 20 | 'properties': { 21 | 'host_status': { 22 | 'enum': fields.HostStatusType.ALL, 23 | 'type': 'string'}, 24 | 'cluster_status': { 25 | 'enum': fields.ClusterStatusType.ALL, 26 | 'type': 'string'}, 27 | 'event': { 28 | 'enum': fields.EventType.ALL, 29 | 'type': 'string'}, 30 | }, 31 | 'required': ['event'], 32 | 'additionalProperties': False 33 | } 34 | 35 | create_process_payload = { 36 | 'type': 'object', 37 | 'properties': { 38 | 'process_name': { 39 | 'type': 'string', 40 | 'minLength': 1, 41 | 'maxLength': 4096}, 42 | 'event': { 43 | 'enum': fields.EventType.ALL, 44 | 'type': 'string'}, 45 | }, 46 | 'required': ['process_name', 'event'], 47 | 'additionalProperties': False 48 | } 49 | 50 | create_vm_payload = { 51 | 'type': 'object', 52 | 'properties': { 53 | 'instance_uuid': { 54 | 'type': 'string', 55 | 'format': 'uuid'}, 56 | 'vir_domain_event': { 57 | 'type': 'string', 58 | 'minLength': 1, 59 | 'maxLength': 255}, 60 | 'event': { 61 | 'type': 'string', 62 | 'minLength': 1, 63 | 'maxLength': 255}, 64 | }, 65 | 'required': ['instance_uuid', 'vir_domain_event', 'event'], 66 | 'additionalProperties': False 67 | } 68 | -------------------------------------------------------------------------------- /masakari/api/openstack/ha/schemas/segments.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA. 2 | # All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import copy 17 | 18 | from masakari.api.validation import parameter_types 19 | 20 | 21 | _base = { 22 | 'type': 'object', 23 | 'properties': { 24 | 'segment': { 25 | 'type': 'object', 26 | 'properties': { 27 | 'name': parameter_types.name, 28 | 'description': parameter_types.description, 29 | 'recovery_method': { 30 | 'type': 'string', 31 | 'enum': ["auto", "reserved_host", 32 | "auto_priority", "rh_priority"] 33 | }, 34 | 'service_type': parameter_types.name 35 | }, 36 | 'additionalProperties': False 37 | } 38 | }, 39 | 'required': ['segment'], 40 | 'additionalProperties': False 41 | } 42 | 43 | 44 | create = copy.deepcopy(_base) 45 | create['properties']['segment']['required'] = ['name', 'recovery_method', 46 | 'service_type'] 47 | 48 | create_v12 = copy.deepcopy(create) 49 | create_v12['properties']['segment']['properties']['enabled'] = \ 50 | parameter_types.boolean 51 | 52 | update = copy.deepcopy(_base) 53 | update['properties']['segment']['anyOf'] = [{'required': ['name']}, 54 | {'required': ['description']}, 55 | {'required': ['recovery_method']}, 56 | {'required': ['service_type']}, 57 | ] 58 | 59 | update_v12 = copy.deepcopy(update) 60 | update_v12['properties']['segment']['properties']['enabled'] = \ 61 | parameter_types.boolean 62 | update_v12['properties']['segment']['anyOf'].append({'required': ['enabled']}) 63 | -------------------------------------------------------------------------------- /masakari/api/openstack/ha/versionsV1.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 NTT Data 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from http import HTTPStatus 17 | 18 | import webob.exc 19 | 20 | from masakari.api.openstack import extensions 21 | from masakari.api.openstack.ha import versions 22 | from masakari.api.openstack.ha.views import versions as views_versions 23 | from masakari.api.openstack import wsgi 24 | 25 | 26 | ALIAS = "versions" 27 | 28 | 29 | class VersionsController(wsgi.Controller): 30 | @extensions.expected_errors(HTTPStatus.NOT_FOUND) 31 | def show(self, req, id='v1.0'): 32 | builder = views_versions.get_view_builder(req) 33 | if id not in versions.VERSIONS: 34 | raise webob.exc.HTTPNotFound() 35 | 36 | return builder.build_version(versions.VERSIONS[id]) 37 | 38 | 39 | class Versions(extensions.V1APIExtensionBase): 40 | """API Version information.""" 41 | 42 | name = "Versions" 43 | alias = ALIAS 44 | version = 1 45 | 46 | def get_resources(self): 47 | resources = [ 48 | extensions.ResourceExtension(ALIAS, VersionsController(), 49 | custom_routes_fn=self.version_map)] 50 | return resources 51 | 52 | def get_controller_extensions(self): 53 | return [] 54 | 55 | def version_map(self, mapper, wsgi_resource): 56 | self.map_path(mapper, wsgi_resource, '/') 57 | self.map_path(mapper, wsgi_resource, '') 58 | 59 | @staticmethod 60 | def map_path(mapper, wsgi_resource, path): 61 | mapper.connect("versions", path, 62 | controller=wsgi_resource, 63 | action='show', conditions={"method": ['GET']}) 64 | -------------------------------------------------------------------------------- /masakari/api/openstack/ha/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/api/openstack/ha/views/__init__.py -------------------------------------------------------------------------------- /masakari/api/openstack/ha/views/hosts.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 NTT Data 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from masakari.api.openstack import common 17 | 18 | 19 | def get_view_builder(req): 20 | base_url = req.application_url 21 | return ViewBuilder(base_url) 22 | 23 | 24 | class ViewBuilder(common.ViewBuilder): 25 | 26 | def __init__(self, base_url): 27 | """:param base_url: url of the root wsgi application.""" 28 | self.prefix = self._update_masakari_link_prefix(base_url) 29 | self.base_url = base_url 30 | 31 | def _host_details(self, host): 32 | return { 33 | 'id': host.id, 34 | 'uuid': host.uuid, 35 | 'name': host.name, 36 | 'failover_segment_id': host.failover_segment.uuid, 37 | 'failover_segment': host.failover_segment, 38 | 'type': host.type, 39 | 'reserved': host.reserved, 40 | 'control_attributes': host.control_attributes, 41 | 'on_maintenance': host.on_maintenance, 42 | 'created_at': host.created_at, 43 | 'updated_at': host.updated_at, 44 | 'deleted_at': host.deleted_at, 45 | 'deleted': host.deleted 46 | } 47 | 48 | def build_host(self, host): 49 | get_host_response = self._host_details(host) 50 | return get_host_response 51 | 52 | def build_hosts(self, hosts): 53 | host_objs = [] 54 | for host in hosts: 55 | get_host_response = self._host_details(host) 56 | host_objs.append(get_host_response) 57 | return dict(hosts=host_objs) 58 | -------------------------------------------------------------------------------- /masakari/api/validation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | """ 17 | Request Body validating middleware. 18 | 19 | """ 20 | 21 | import functools 22 | 23 | from masakari.api import api_version_request as api_version 24 | from masakari.api.validation.validators import _SchemaValidator 25 | 26 | 27 | def schema(request_body_schema, min_version=None, max_version=None): 28 | """Register a schema to validate request body. 29 | 30 | Registered schema will be used for validating request body just before 31 | API method executing. 32 | 33 | :argument dict request_body_schema: a schema to validate request body 34 | 35 | """ 36 | 37 | def add_validator(func): 38 | @functools.wraps(func) 39 | def wrapper(*args, **kwargs): 40 | min_ver = api_version.APIVersionRequest(min_version) 41 | max_ver = api_version.APIVersionRequest(max_version) 42 | 43 | if 'req' in kwargs: 44 | ver = kwargs['req'].api_version_request 45 | else: 46 | ver = args[1].api_version_request 47 | 48 | # Only validate against the schema if it lies within 49 | # the version range specified. Note that, if both min 50 | # and max are not specified, the validator will always 51 | # be run. 52 | if ver.matches(min_ver, max_ver): 53 | schema_validator = _SchemaValidator(request_body_schema) 54 | schema_validator.validate(kwargs['body']) 55 | 56 | return func(*args, **kwargs) 57 | return wrapper 58 | 59 | return add_validator 60 | -------------------------------------------------------------------------------- /masakari/api/versioned_method.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | 16 | class VersionedMethod(object): 17 | 18 | def __init__(self, name, start_version, end_version, func): 19 | """Versioning information for a single method 20 | 21 | @name: Name of the method 22 | @start_version: Minimum acceptable version 23 | @end_version: Maximum acceptable_version 24 | @func: Method to call 25 | 26 | Minimum and maximums are inclusive 27 | """ 28 | self.name = name 29 | self.start_version = start_version 30 | self.end_version = end_version 31 | self.func = func 32 | 33 | def __str__(self): 34 | return ("Version Method %s: min: %s, max: %s" 35 | % (self.name, self.start_version, self.end_version)) 36 | -------------------------------------------------------------------------------- /masakari/cmd/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import eventlet 17 | 18 | eventlet.monkey_patch() 19 | -------------------------------------------------------------------------------- /masakari/cmd/engine.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | """Starter script for Masakari Engine.""" 17 | 18 | import sys 19 | 20 | from oslo_log import log as logging 21 | 22 | import masakari.conf 23 | from masakari import config 24 | from masakari import objects 25 | from masakari import service 26 | from masakari import utils 27 | 28 | 29 | CONF = masakari.conf.CONF 30 | 31 | 32 | def main(): 33 | config.parse_args(sys.argv) 34 | logging.setup(CONF, "masakari") 35 | utils.monkey_patch() 36 | objects.register_all() 37 | 38 | server = service.Service.create(binary='masakari-engine', 39 | topic=CONF.masakari_topic) 40 | service.serve(server) 41 | service.wait() 42 | -------------------------------------------------------------------------------- /masakari/cmd/status.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 NEC, Corp. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | import sys 16 | 17 | from oslo_upgradecheck import common_checks 18 | from oslo_upgradecheck import upgradecheck 19 | 20 | from masakari import conf 21 | from masakari.i18n import _ 22 | 23 | CONF = conf.CONF 24 | 25 | 26 | class Checks(upgradecheck.UpgradeCommands): 27 | 28 | """Contains upgrade checks 29 | 30 | Various upgrade checks should be added as separate methods in this class 31 | and added to _upgrade_checks tuple. 32 | """ 33 | 34 | _upgrade_checks = ( 35 | (_('Policy File JSON to YAML Migration'), 36 | (common_checks.check_policy_json, {'conf': CONF})), 37 | ) 38 | 39 | 40 | def main(): 41 | return upgradecheck.main( 42 | CONF, project='masakari', upgrade_command=Checks()) 43 | 44 | 45 | if __name__ == '__main__': 46 | sys.exit(main()) 47 | -------------------------------------------------------------------------------- /masakari/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/common/__init__.py -------------------------------------------------------------------------------- /masakari/common/config.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from oslo_config import cfg 16 | from oslo_middleware import cors 17 | from oslo_policy import opts 18 | 19 | 20 | def set_lib_defaults(): 21 | """Update default value for configuration options from other namespace. 22 | 23 | Example, oslo lib config options. This is needed for 24 | config generator tool to pick these default value changes. 25 | https://docs.openstack.org/oslo.config/latest/cli/ 26 | generator.html#modifying-defaults-from-other-namespaces 27 | """ 28 | 29 | set_middleware_defaults() 30 | 31 | # TODO(gmann): Remove setting the default value of config policy_file 32 | # once oslo_policy change the default value to 'policy.yaml'. 33 | # https://github.com/openstack/oslo.policy/blob/a626ad12fe5a3abd49d70e3e5b95589d279ab578/oslo_policy/opts.py#L49 34 | opts.set_defaults(cfg.CONF, 'policy.yaml') 35 | 36 | 37 | def set_middleware_defaults(): 38 | """Update default configuration options for oslo.middleware.""" 39 | # CORS Defaults 40 | cfg.set_defaults(cors.CORS_OPTS, 41 | allow_headers=['X-Auth-Token', 42 | 'X-Openstack-Request-Id', 43 | 'X-Identity-Status', 44 | 'X-Roles', 45 | 'X-Service-Catalog', 46 | 'X-User-Id', 47 | 'X-Tenant-Id'], 48 | expose_headers=['X-Auth-Token', 49 | 'X-Openstack-Request-Id', 50 | 'X-Subject-Token', 51 | 'X-Service-Token'], 52 | allow_methods=['GET', 53 | 'PUT', 54 | 'POST', 55 | 'DELETE', 56 | 'PATCH'] 57 | ) 58 | -------------------------------------------------------------------------------- /masakari/compute/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from oslo_utils import importutils 17 | 18 | 19 | def API(): 20 | cls = importutils.import_class("masakari.compute.nova.API") 21 | return cls() 22 | -------------------------------------------------------------------------------- /masakari/conf/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from oslo_config import cfg 17 | 18 | from masakari.conf import api 19 | from masakari.conf import base 20 | from masakari.conf import coordination 21 | from masakari.conf import database 22 | from masakari.conf import engine 23 | from masakari.conf import engine_driver 24 | from masakari.conf import exceptions 25 | from masakari.conf import nova 26 | from masakari.conf import osapi_v1 27 | from masakari.conf import paths 28 | from masakari.conf import service 29 | from masakari.conf import ssl 30 | from masakari.conf import wsgi 31 | 32 | CONF = cfg.CONF 33 | 34 | api.register_opts(CONF) 35 | base.register_opts(CONF) 36 | coordination.register_opts(CONF) 37 | database.register_opts(CONF) 38 | engine.register_opts(CONF) 39 | engine_driver.register_opts(CONF) 40 | exceptions.register_opts(CONF) 41 | nova.register_opts(CONF) 42 | osapi_v1.register_opts(CONF) 43 | paths.register_opts(CONF) 44 | ssl.register_opts(CONF) 45 | service.register_opts(CONF) 46 | wsgi.register_opts(CONF) 47 | -------------------------------------------------------------------------------- /masakari/conf/base.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from oslo_config import cfg 17 | 18 | base_options = [ 19 | cfg.StrOpt( 20 | 'tempdir', 21 | help='Explicitly specify the temporary working directory.'), 22 | cfg.BoolOpt( 23 | 'monkey_patch', 24 | default=False, 25 | help=""" 26 | Determine if monkey patching should be applied. 27 | 28 | Related options: 29 | 30 | * ``monkey_patch_modules``: This must have values set for this option to have 31 | any effect 32 | """), 33 | cfg.ListOpt( 34 | 'monkey_patch_modules', 35 | default=['masakari.api:masakari.cmd'], 36 | help=""" 37 | List of modules/decorators to monkey patch. 38 | 39 | This option allows you to patch a decorator for all functions in specified 40 | modules. 41 | 42 | Related options: 43 | 44 | * ``monkey_patch``: This must be set to ``True`` for this option to 45 | have any effect 46 | """), 47 | ] 48 | 49 | 50 | def register_opts(conf): 51 | conf.register_opts(base_options) 52 | 53 | 54 | def list_opts(): 55 | return {'DEFAULT': base_options} 56 | -------------------------------------------------------------------------------- /masakari/conf/coordination.py: -------------------------------------------------------------------------------- 1 | # All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from oslo_config import cfg 16 | 17 | 18 | coordination_opts = [ 19 | cfg.StrOpt('backend_url', 20 | default=None, 21 | help="The backend URL to use for distributed coordination." 22 | "By default it's None which means that coordination is " 23 | "disabled. The coordination is implemented for " 24 | "distributed lock management and was tested with etcd." 25 | "Coordination doesn't work for file driver because lock " 26 | "files aren't removed after lock releasing."), 27 | ] 28 | 29 | 30 | def register_opts(conf): 31 | """Registers coordination configuration options 32 | :param conf: configuration 33 | """ 34 | conf.register_opts(coordination_opts, group="coordination") 35 | 36 | 37 | def list_opts(): 38 | """Lists coordination configuration options 39 | :return: coordination configuration options 40 | """ 41 | return {"coordination": coordination_opts} 42 | -------------------------------------------------------------------------------- /masakari/conf/database.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from masakari.conf import paths 17 | 18 | from oslo_db import options as oslo_db_options 19 | 20 | _DEFAULT_SQL_CONNECTION = 'sqlite:///' + paths.state_path_def( 21 | 'masakari.sqlite') 22 | 23 | 24 | def register_opts(conf): 25 | oslo_db_options.set_defaults(conf, connection=_DEFAULT_SQL_CONNECTION) 26 | 27 | 28 | def list_opts(): 29 | return {'DEFAULT': []} 30 | -------------------------------------------------------------------------------- /masakari/conf/exceptions.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from oslo_config import cfg 17 | 18 | exc_log_opts = [ 19 | cfg.BoolOpt('fatal_exception_format_errors', 20 | default=False, 21 | help='Make exception message format errors fatal'), 22 | ] 23 | 24 | 25 | def register_opts(conf): 26 | conf.register_opts(exc_log_opts) 27 | 28 | 29 | def list_opts(): 30 | return {'DEFAULT': exc_log_opts} 31 | -------------------------------------------------------------------------------- /masakari/conf/paths.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | import os 16 | import sys 17 | 18 | from oslo_config import cfg 19 | 20 | path_opts = [ 21 | cfg.StrOpt('pybasedir', 22 | default=os.path.abspath(os.path.join(os.path.dirname(__file__), 23 | '../../')), 24 | help='Directory where the masakari python module is installed'), 25 | cfg.StrOpt('bindir', 26 | default=os.path.join(sys.prefix, 'local', 'bin'), 27 | help='Directory where masakari binaries are installed'), 28 | cfg.StrOpt('state_path', 29 | default='$pybasedir', 30 | help="Top-level directory for maintaining masakari's state"), 31 | ] 32 | 33 | 34 | def basedir_def(*args): 35 | """Return an uninterpolated path relative to $pybasedir.""" 36 | return os.path.join('$pybasedir', *args) 37 | 38 | 39 | def bindir_def(*args): 40 | """Return an uninterpolated path relative to $bindir.""" 41 | return os.path.join('$bindir', *args) 42 | 43 | 44 | def state_path_def(*args): 45 | """Return an uninterpolated path relative to $state_path.""" 46 | return os.path.join('$state_path', *args) 47 | 48 | 49 | def register_opts(conf): 50 | conf.register_opts(path_opts) 51 | 52 | 53 | def list_opts(): 54 | return {"DEFAULT": path_opts} 55 | -------------------------------------------------------------------------------- /masakari/conf/ssl.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from oslo_service import sslutils 17 | 18 | 19 | def register_opts(conf): 20 | sslutils.register_opts(conf) 21 | 22 | 23 | def list_opts(): 24 | return sslutils.list_opts() 25 | -------------------------------------------------------------------------------- /masakari/config.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | from oslo_log import log 15 | 16 | from masakari.common import config 17 | import masakari.conf 18 | from masakari.db.sqlalchemy import api as sqlalchemy_api 19 | from masakari import rpc 20 | from masakari import version 21 | 22 | 23 | CONF = masakari.conf.CONF 24 | 25 | 26 | def parse_args(argv, default_config_files=None, configure_db=True, 27 | init_rpc=True): 28 | log.register_options(CONF) 29 | # We use the oslo.log default log levels which includes suds=INFO 30 | # and add only the extra levels that Masakari needs 31 | log.set_defaults(default_log_levels=log.get_default_log_levels()) 32 | rpc.set_defaults(control_exchange='masakari') 33 | config.set_middleware_defaults() 34 | 35 | CONF(argv[1:], 36 | project='masakari', 37 | version=version.version_string(), 38 | default_config_files=default_config_files) 39 | 40 | if init_rpc: 41 | rpc.init(CONF) 42 | 43 | if configure_db: 44 | sqlalchemy_api.configure(CONF) 45 | -------------------------------------------------------------------------------- /masakari/db/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT Data. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | """ 16 | DB abstraction for Masakari 17 | """ 18 | 19 | from masakari.db.api import * # noqa 20 | -------------------------------------------------------------------------------- /masakari/db/migration.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT Data. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | """Database setup and migration commands.""" 17 | 18 | from masakari.db.sqlalchemy import migration 19 | 20 | IMPL = migration 21 | 22 | 23 | def db_sync(version=None): 24 | """Migrate the database to `version` or the most recent version.""" 25 | return IMPL.db_sync(version=version) 26 | -------------------------------------------------------------------------------- /masakari/db/sqlalchemy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/db/sqlalchemy/__init__.py -------------------------------------------------------------------------------- /masakari/db/sqlalchemy/alembic.ini: -------------------------------------------------------------------------------- 1 | [alembic] 2 | script_location = %(here)s/migrations 3 | prepend_sys_path = . 4 | version_path_separator = os 5 | sqlalchemy.url = sqlite:///masakari.db 6 | 7 | # Logging configuration 8 | [loggers] 9 | keys = root,sqlalchemy,alembic 10 | 11 | [handlers] 12 | keys = console 13 | 14 | [formatters] 15 | keys = generic 16 | 17 | [logger_root] 18 | level = WARN 19 | handlers = console 20 | qualname = 21 | 22 | [logger_sqlalchemy] 23 | level = WARN 24 | handlers = 25 | qualname = sqlalchemy.engine 26 | 27 | [logger_alembic] 28 | level = INFO 29 | handlers = 30 | qualname = alembic 31 | 32 | [handler_console] 33 | class = StreamHandler 34 | args = (sys.stderr,) 35 | level = NOTSET 36 | formatter = generic 37 | 38 | [formatter_generic] 39 | format = %(levelname)-5.5s [%(name)s] %(message)s 40 | datefmt = %H:%M:%S 41 | -------------------------------------------------------------------------------- /masakari/db/sqlalchemy/migrations/README.rst: -------------------------------------------------------------------------------- 1 | Database migrations 2 | =================== 3 | 4 | This directory contains migrations for the database. These are implemented 5 | using `alembic`__, a lightweight database migration tool designed for usage 6 | with `SQLAlchemy`__. 7 | 8 | The best place to start understanding Alembic is with its own `tutorial`__. You 9 | can also play around with the :command:`alembic` command:: 10 | 11 | $ alembic --help 12 | 13 | .. __: https://alembic.sqlalchemy.org/en/latest/ 14 | .. __: https://www.sqlalchemy.org/ 15 | .. __: https://alembic.sqlalchemy.org/en/latest/tutorial.html 16 | -------------------------------------------------------------------------------- /masakari/db/sqlalchemy/migrations/script.py.mako: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """${message} 14 | 15 | Revision ID: ${up_revision} 16 | Revises: ${down_revision | comma,n} 17 | Create Date: ${create_date} 18 | """ 19 | 20 | from alembic import op 21 | import sqlalchemy as sa 22 | ${imports if imports else ""} 23 | 24 | # revision identifiers, used by Alembic. 25 | revision = ${repr(up_revision)} 26 | down_revision = ${repr(down_revision)} 27 | branch_labels = ${repr(branch_labels)} 28 | depends_on = ${repr(depends_on)} 29 | 30 | 31 | def upgrade() -> None: 32 | ${upgrades if upgrades else "pass"} 33 | -------------------------------------------------------------------------------- /masakari/db/sqlalchemy/migrations/versions/8bdf5929c5a6_add_vm_moves_table.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """Add vm moves table 14 | 15 | Revision ID: 8bdf5929c5a6 16 | Revises: 8f848eb45d03 17 | Create Date: 2023-07-13 12:13:42.240598 18 | """ 19 | 20 | from alembic import op 21 | from oslo_db.sqlalchemy import types as oslo_db_types 22 | import sqlalchemy as sa 23 | 24 | # revision identifiers, used by Alembic. 25 | revision = '8bdf5929c5a6' 26 | down_revision = '8f848eb45d03' 27 | branch_labels = None 28 | depends_on = None 29 | 30 | 31 | def upgrade() -> None: 32 | op.create_table( 33 | 'vmoves', 34 | sa.Column('created_at', sa.DateTime(), nullable=True), 35 | sa.Column('updated_at', sa.DateTime(), nullable=True), 36 | sa.Column('deleted_at', sa.DateTime(), nullable=True), 37 | sa.Column( 38 | 'deleted', 39 | oslo_db_types.SoftDeleteInteger(), 40 | nullable=True, 41 | ), 42 | sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), 43 | sa.Column('uuid', sa.String(length=36), nullable=False), 44 | sa.Column('notification_uuid', sa.String(length=36), nullable=False), 45 | sa.Column('instance_uuid', sa.String(length=36), nullable=False), 46 | sa.Column('instance_name', sa.String(length=255), nullable=False), 47 | sa.Column('source_host', sa.String(length=255), nullable=True), 48 | sa.Column('dest_host', sa.String(length=255), nullable=True), 49 | sa.Column('start_time', sa.DateTime(), nullable=True), 50 | sa.Column('end_time', sa.DateTime(), nullable=True), 51 | sa.Column('type', sa.String(length=36), nullable=True), 52 | sa.Column('status', sa.String(length=255), nullable=True), 53 | sa.Column('message', sa.Text(), nullable=True), 54 | sa.PrimaryKeyConstraint('id'), 55 | sa.UniqueConstraint('uuid', name='uniq_vmove0uuid'), 56 | ) 57 | -------------------------------------------------------------------------------- /masakari/engine/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/engine/__init__.py -------------------------------------------------------------------------------- /masakari/engine/drivers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | __import__('pkg_resources').declare_namespace(__name__) 17 | -------------------------------------------------------------------------------- /masakari/engine/drivers/taskflow/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from masakari.engine.drivers.taskflow import driver 17 | 18 | TaskFlowDriver = driver.TaskFlowDriver 19 | -------------------------------------------------------------------------------- /masakari/engine/drivers/taskflow/no_op.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 NTT DATA. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from oslo_log import log as logging 17 | from taskflow import task 18 | 19 | LOG = logging.getLogger(__name__) 20 | 21 | 22 | class Noop(task.Task): 23 | 24 | def __init__(self, context, novaclient, **kwargs): 25 | self.context = context 26 | self.novaclient = novaclient 27 | super(Noop, self).__init__() 28 | 29 | def execute(self, **kwargs): 30 | LOG.info("Custom task executed successfully..!!") 31 | return 32 | -------------------------------------------------------------------------------- /masakari/engine/instance_events.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | """ VM libvirt events 17 | 18 | These are the events which needs to be processed by masakari in case of 19 | instance recovery failure. 20 | """ 21 | 22 | INSTANCE_EVENTS = { 23 | # Add QEMU guest agent events here. 24 | 'QEMU_GUEST_AGENT_ERROR': ['STOPPED_FAILED'], 25 | # Add more events and vir_domain_events here. 26 | 'LIFECYCLE': ['STOPPED_FAILED'], 27 | 'IO_ERROR': ['IO_ERROR_REPORT'] 28 | } 29 | 30 | 31 | def is_valid_event(payload): 32 | vir_domain_event_list = INSTANCE_EVENTS.get(payload.get('event')) 33 | if vir_domain_event_list and payload.get( 34 | 'vir_domain_event') in vir_domain_event_list: 35 | return True 36 | return False 37 | -------------------------------------------------------------------------------- /masakari/engine/rpcapi.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import oslo_messaging as messaging 17 | 18 | import masakari.conf 19 | from masakari.objects import base as objects_base 20 | from masakari import rpc 21 | 22 | CONF = masakari.conf.CONF 23 | 24 | 25 | class EngineAPI(rpc.RPCAPI): 26 | """Client side of the engine rpc API. 27 | 28 | API version history: 29 | 30 | .. code-block:: none 31 | 32 | 1.0 - Initial version. 33 | 1.1 - Added get_notification_recovery_workflow_details method to 34 | retrieve progress details from notification driver. 35 | """ 36 | 37 | RPC_API_VERSION = '1.1' 38 | TOPIC = CONF.masakari_topic 39 | BINARY = 'masakari-engine' 40 | 41 | def __init__(self): 42 | super(EngineAPI, self).__init__() 43 | target = messaging.Target(topic=self.TOPIC, 44 | version=self.RPC_API_VERSION) 45 | serializer = objects_base.MasakariObjectSerializer() 46 | self.client = rpc.get_client(target, serializer=serializer) 47 | 48 | def process_notification(self, context, notification): 49 | version = '1.0' 50 | cctxt = self.client.prepare(version=version) 51 | cctxt.cast(context, 'process_notification', notification=notification) 52 | 53 | def get_notification_recovery_workflow_details(self, context, 54 | notification): 55 | version = '1.1' 56 | cctxt = self.client.prepare(version=version) 57 | return cctxt.call(context, 58 | 'get_notification_recovery_workflow_details', 59 | notification=notification) 60 | -------------------------------------------------------------------------------- /masakari/engine/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 NTT DATA 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | import socket 17 | 18 | from masakari.notifications.objects import base as notification_base 19 | from masakari.notifications.objects import exception as notification_exception 20 | from masakari.notifications.objects import notification as event_notification 21 | from masakari.objects import fields 22 | 23 | 24 | def _get_fault_and_priority_from_exc_and_tb(exception, tb): 25 | fault = None 26 | priority = fields.EventNotificationPriority.INFO 27 | 28 | if exception: 29 | priority = fields.EventNotificationPriority.ERROR 30 | fault = notification_exception.ExceptionPayload.from_exc_and_traceback( 31 | exception, tb) 32 | 33 | return fault, priority 34 | 35 | 36 | def notify_about_notification_update(context, notification, action, phase=None, 37 | binary='masakari-engine', exception=None, tb=None): 38 | """Send versioned notification about a notification update. 39 | 40 | :param notification: Notification object 41 | :param action: the name of the action 42 | :param phase: the phase of the action 43 | :param binary: the binary emitting the notification 44 | :param exception: the thrown exception (used in error notifications) 45 | :param tb: the traceback (used in error notifications) 46 | """ 47 | fault, priority = _get_fault_and_priority_from_exc_and_tb(exception, tb) 48 | payload = event_notification.NotificationApiPayload( 49 | notification=notification, fault=fault) 50 | engine_notification = event_notification.NotificationApiNotification( 51 | context=context, 52 | priority=priority, 53 | publisher=notification_base.NotificationPublisher( 54 | context=context, host=socket.gethostname(), binary=binary), 55 | event_type=notification_base.EventType( 56 | action=action, 57 | phase=phase), 58 | payload=payload) 59 | engine_notification.emit(context) 60 | -------------------------------------------------------------------------------- /masakari/ha/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/ha/__init__.py -------------------------------------------------------------------------------- /masakari/hacking/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/hacking/__init__.py -------------------------------------------------------------------------------- /masakari/i18n.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | """oslo.i18n integration module. 16 | 17 | See https://docs.openstack.org/oslo.i18n/latest/user/usage.html. 18 | 19 | """ 20 | 21 | import oslo_i18n 22 | 23 | DOMAIN = 'masakari' 24 | 25 | _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN) 26 | 27 | # The primary translation function using the well-known name "_" 28 | _ = _translators.primary 29 | 30 | 31 | def translate(value, user_locale): 32 | return oslo_i18n.translate(value, user_locale) 33 | 34 | 35 | def get_available_languages(): 36 | return oslo_i18n.get_available_languages(DOMAIN) 37 | -------------------------------------------------------------------------------- /masakari/notifications/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/notifications/__init__.py -------------------------------------------------------------------------------- /masakari/notifications/objects/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/notifications/objects/__init__.py -------------------------------------------------------------------------------- /masakari/objects/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT Data. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | 17 | def register_all(): 18 | # NOTE(Dinesh_Bhor): You must make sure your object gets imported in this 19 | # function in order for it to be registered by services that may 20 | # need to receive it via RPC. 21 | __import__('masakari.objects.host') 22 | __import__('masakari.objects.notification') 23 | __import__('masakari.objects.segment') 24 | __import__('masakari.objects.vmove') 25 | -------------------------------------------------------------------------------- /masakari/policies/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2018 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | 17 | import itertools 18 | 19 | from masakari.policies import base 20 | from masakari.policies import extension_info 21 | from masakari.policies import hosts 22 | from masakari.policies import notifications 23 | from masakari.policies import segments 24 | from masakari.policies import versions 25 | from masakari.policies import vmoves 26 | 27 | 28 | def list_rules(): 29 | return itertools.chain( 30 | base.list_rules(), 31 | extension_info.list_rules(), 32 | hosts.list_rules(), 33 | notifications.list_rules(), 34 | segments.list_rules(), 35 | versions.list_rules(), 36 | vmoves.list_rules() 37 | ) 38 | -------------------------------------------------------------------------------- /masakari/policies/base.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2018 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from oslo_policy import policy 17 | 18 | MASAKARI_API = 'os_masakari_api' 19 | 20 | RULE_ADMIN_OR_OWNER = 'rule:admin_or_owner' 21 | RULE_ADMIN_API = 'rule:admin_api' 22 | RULE_ANY = '@' 23 | 24 | rules = [ 25 | policy.RuleDefault( 26 | "context_is_admin", 27 | "role:admin", 28 | "Decides what is required for the 'is_admin:True' check to succeed."), 29 | policy.RuleDefault( 30 | "admin_or_owner", 31 | "is_admin:True or project_id:%(project_id)s", 32 | "Default rule for most non-Admin APIs."), 33 | policy.RuleDefault( 34 | "admin_api", 35 | "is_admin:True", 36 | "Default rule for most Admin APIs.") 37 | ] 38 | 39 | 40 | def list_rules(): 41 | return rules 42 | -------------------------------------------------------------------------------- /masakari/policies/extension_info.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2018 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | 17 | from oslo_policy import policy 18 | 19 | from masakari.policies import base 20 | 21 | EXTENSIONS = 'os_masakari_api:extensions:%s' 22 | 23 | rules = [ 24 | policy.DocumentedRuleDefault( 25 | name=EXTENSIONS % 'index', 26 | check_str=base.RULE_ADMIN_API, 27 | description="List available extensions.", 28 | operations=[ 29 | { 30 | 'method': 'GET', 31 | 'path': '/extensions' 32 | } 33 | ]), 34 | policy.DocumentedRuleDefault( 35 | name=EXTENSIONS % 'detail', 36 | check_str=base.RULE_ADMIN_API, 37 | description="Shows information for an extension.", 38 | operations=[ 39 | { 40 | 'method': 'GET', 41 | 'path': '/extensions/{extensions_id}' 42 | } 43 | ]), 44 | policy.RuleDefault( 45 | name=EXTENSIONS % 'discoverable', 46 | check_str=base.RULE_ADMIN_API, 47 | description="Extension Info API extensions to change the API.", 48 | ), 49 | ] 50 | 51 | 52 | def list_rules(): 53 | return rules 54 | -------------------------------------------------------------------------------- /masakari/policies/notifications.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2018 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | 17 | from oslo_policy import policy 18 | 19 | from masakari.policies import base 20 | 21 | 22 | NOTIFICATIONS = 'os_masakari_api:notifications:%s' 23 | 24 | rules = [ 25 | policy.DocumentedRuleDefault( 26 | name=NOTIFICATIONS % 'index', 27 | check_str=base.RULE_ADMIN_API, 28 | description="Lists IDs, notification types, host_name, generated_time," 29 | " payload and status for all notifications.", 30 | operations=[ 31 | { 32 | 'method': 'GET', 33 | 'path': '/notifications' 34 | } 35 | ]), 36 | policy.DocumentedRuleDefault( 37 | name=NOTIFICATIONS % 'detail', 38 | check_str=base.RULE_ADMIN_API, 39 | description="Shows details for a notification.", 40 | operations=[ 41 | { 42 | 'method': 'GET', 43 | 'path': '/notifications/{notification_id}' 44 | } 45 | ]), 46 | policy.DocumentedRuleDefault( 47 | name=NOTIFICATIONS % 'create', 48 | check_str=base.RULE_ADMIN_API, 49 | description="Creates a notification.", 50 | operations=[ 51 | { 52 | 'method': 'POST', 53 | 'path': '/notifications' 54 | } 55 | ]), 56 | policy.RuleDefault( 57 | name=NOTIFICATIONS % 'discoverable', 58 | check_str=base.RULE_ADMIN_API, 59 | description="Notification API extensions to change the API.", 60 | ), 61 | ] 62 | 63 | 64 | def list_rules(): 65 | return rules 66 | -------------------------------------------------------------------------------- /masakari/policies/versions.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2018 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | 17 | from oslo_policy import policy 18 | 19 | from masakari.policies import base 20 | 21 | 22 | VERSIONS = 'os_masakari_api:versions:%s' 23 | 24 | rules = [ 25 | policy.DocumentedRuleDefault( 26 | name=VERSIONS % 'index', 27 | check_str=base.RULE_ANY, 28 | description="List all versions.", 29 | operations=[ 30 | { 31 | 'method': 'GET', 32 | 'path': '/' 33 | } 34 | ]), 35 | policy.RuleDefault( 36 | name=VERSIONS % 'discoverable', 37 | check_str=base.RULE_ANY, 38 | description="Version API extensions to change the API.", 39 | ), 40 | ] 41 | 42 | 43 | def list_rules(): 44 | return rules 45 | -------------------------------------------------------------------------------- /masakari/policies/vmoves.py: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022 Inspur 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from oslo_policy import policy 16 | 17 | from masakari.policies import base 18 | 19 | 20 | VMOVES = 'os_masakari_api:vmoves:%s' 21 | 22 | rules = [ 23 | policy.DocumentedRuleDefault( 24 | name=VMOVES % 'index', 25 | check_str=base.RULE_ADMIN_API, 26 | description="Lists IDs, notification_id, instance_id, source_host, " 27 | "dest_host, status and type for all VM moves.", 28 | operations=[ 29 | { 30 | 'method': 'GET', 31 | 'path': '/notifications/{notification_id}/vmoves' 32 | } 33 | ]), 34 | policy.DocumentedRuleDefault( 35 | name=VMOVES % 'detail', 36 | check_str=base.RULE_ADMIN_API, 37 | description="Shows details for one VM move.", 38 | operations=[ 39 | { 40 | 'method': 'GET', 41 | 'path': '/notifications/{notification_id}/vmoves/' 42 | '{vmove_id}' 43 | } 44 | ]), 45 | policy.RuleDefault( 46 | name=VMOVES % 'discoverable', 47 | check_str=base.RULE_ADMIN_API, 48 | description="VM moves API extensions to change the API.", 49 | ), 50 | ] 51 | 52 | 53 | def list_rules(): 54 | return rules 55 | -------------------------------------------------------------------------------- /masakari/safe_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | """Utilities and helper functions that won't produce circular imports.""" 17 | 18 | 19 | def get_wrapped_function(function): 20 | """Get the method at the bottom of a stack of decorators.""" 21 | if not hasattr(function, '__closure__') or not function.__closure__: 22 | return function 23 | 24 | def _get_wrapped_function(function): 25 | if not hasattr(function, '__closure__') or not function.__closure__: 26 | return None 27 | 28 | for closure in function.__closure__: 29 | func = closure.cell_contents 30 | 31 | deeper_func = _get_wrapped_function(func) 32 | if deeper_func: 33 | return deeper_func 34 | elif hasattr(closure.cell_contents, '__call__'): 35 | return closure.cell_contents 36 | 37 | return _get_wrapped_function(function) 38 | -------------------------------------------------------------------------------- /masakari/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/__init__.py -------------------------------------------------------------------------------- /masakari/tests/functional/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/functional/__init__.py -------------------------------------------------------------------------------- /masakari/tests/functional/base.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import os 17 | import sys 18 | 19 | import openstack 20 | from oslotest import base 21 | 22 | openstack.enable_logging( 23 | debug=True, 24 | http_debug=True, 25 | stream=sys.stdout, 26 | format_stream=True, 27 | format_template='%(asctime)s %(name)-32s %(message)s', 28 | ) 29 | #: Defines the OpenStack Client Config (OCC) cloud keys in your OCC config 30 | #: file, typically in /etc/openstack/clouds.yaml. That configuration 31 | #: will determine where the functional tests will be run and what resource 32 | #: defaults will be used to run the functional tests. 33 | ADMIN_CLOUD_NAME = os.getenv( 34 | "MASAKARI_FUNCTIONAL_TESTS_ADMIN", "devstack-admin" 35 | ) 36 | USER_CLOUD_NAME = os.getenv("MASAKARI_FUNCTIONAL_TESTS_USER", "devstack") 37 | 38 | 39 | class BaseFunctionalTest(base.BaseTestCase): 40 | 41 | def setUp(self, ha_api_version="1.0"): 42 | super(BaseFunctionalTest, self).setUp() 43 | 44 | self.admin_conn = openstack.connect( 45 | cloud=ADMIN_CLOUD_NAME, 46 | ha_api_version=ha_api_version, 47 | ) 48 | self.conn = openstack.connect(cloud=USER_CLOUD_NAME) 49 | self.hypervisors = self.admin_conn.list_hypervisors() 50 | -------------------------------------------------------------------------------- /masakari/tests/unit/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT Data 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | """ 17 | :mod:`masakari.tests.unit` -- Masakari Unittests 18 | ===================================================== 19 | 20 | .. automodule:: masakari.tests.unit 21 | :platform: Unix 22 | """ 23 | 24 | import eventlet 25 | 26 | eventlet.monkey_patch(os=False) 27 | -------------------------------------------------------------------------------- /masakari/tests/unit/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/api/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/api/openstack/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/api/openstack/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/api/openstack/ha/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/api/openstack/ha/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/cmd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/cmd/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/cmd/test_masakari_api.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | # not use this file except in compliance with the License. You may obtain 4 | # a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | # License for the specific language governing permissions and limitations 12 | # under the License. 13 | 14 | from unittest import mock 15 | 16 | from masakari.cmd import api 17 | from masakari import config 18 | from masakari import exception 19 | from masakari import test 20 | 21 | 22 | @mock.patch.object(config, 'parse_args', new=lambda *args, **kwargs: None) 23 | class TestMasakariAPI(test.NoDBTestCase): 24 | 25 | def test_continues_without_failure(self): 26 | 27 | fake_server = mock.MagicMock() 28 | fake_server.workers = 123 29 | 30 | def fake_service(api, **kw): 31 | return fake_server 32 | 33 | with mock.patch.object(api, 'service') as mock_service: 34 | mock_service.WSGIService.side_effect = fake_service 35 | api.main() 36 | mock_service.WSGIService.assert_has_calls([ 37 | mock.call('masakari_api', use_ssl=False, coordination=False) 38 | ]) 39 | launcher = mock_service.process_launcher.return_value 40 | launcher.launch_service.assert_called_once_with( 41 | fake_server, workers=123) 42 | self.assertTrue(launcher.wait.called) 43 | 44 | @mock.patch('sys.exit') 45 | def test_fails_if_all_failed(self, mock_exit): 46 | mock_exit.side_effect = exception.MasakariException 47 | with mock.patch.object(api, 'service') as mock_service: 48 | mock_service.WSGIService.side_effect = exception.PasteAppNotFound( 49 | name='masakari_api', path='/') 50 | self.assertRaises(exception.MasakariException, api.main) 51 | mock_exit.assert_called_once_with(1) 52 | launcher = mock_service.process_launcher.return_value 53 | self.assertFalse(launcher.wait.called) 54 | -------------------------------------------------------------------------------- /masakari/tests/unit/cmd/test_status.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 NEC, Corp. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from oslo_upgradecheck.upgradecheck import Code 16 | 17 | from masakari.cmd import status 18 | from masakari import test 19 | 20 | 21 | class TestUpgradeChecks(test.TestCase): 22 | 23 | def setUp(self): 24 | super(TestUpgradeChecks, self).setUp() 25 | self.cmd = status.Checks() 26 | 27 | def test_checks(self): 28 | for name, func in self.cmd._upgrade_checks: 29 | if isinstance(func, tuple): 30 | func_name, kwargs = func 31 | result = func_name(self, **kwargs) 32 | else: 33 | result = func(self) 34 | self.assertEqual(Code.SUCCESS, result.code) 35 | -------------------------------------------------------------------------------- /masakari/tests/unit/compute/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/compute/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/conf_fixture.py: -------------------------------------------------------------------------------- 1 | # Copyright 2010 United States Government as represented by the 2 | # Administrator of the National Aeronautics and Space Administration. 3 | # All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 6 | # not use this file except in compliance with the License. You may obtain 7 | # a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations 15 | # under the License. 16 | 17 | from oslo_config import fixture as config_fixture 18 | from oslo_policy import opts as policy_opts 19 | 20 | import masakari.conf 21 | from masakari.conf import paths 22 | from masakari import config 23 | 24 | CONF = masakari.conf.CONF 25 | 26 | 27 | class ConfFixture(config_fixture.Config): 28 | """Fixture to manage global conf settings.""" 29 | def setUp(self): 30 | super(ConfFixture, self).setUp() 31 | self.conf.set_default('api_paste_config', 32 | paths.state_path_def('etc/masakari/api-paste.ini' 33 | ), 34 | group='wsgi') 35 | 36 | config.parse_args([], default_config_files=[], configure_db=False, 37 | init_rpc=False) 38 | self.conf.set_default('connection', "sqlite://", group='database') 39 | policy_opts.set_defaults(self.conf) 40 | -------------------------------------------------------------------------------- /masakari/tests/unit/db/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/db/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/engine/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/engine/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/engine/drivers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/engine/drivers/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/engine/drivers/taskflow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/engine/drivers/taskflow/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/engine/fake_engine.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 NTT DATA 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from oslo_utils import timeutils 16 | from oslo_versionedobjects import fields 17 | 18 | from masakari import objects 19 | from masakari.tests import uuidsentinel 20 | 21 | NOW = timeutils.utcnow().replace(microsecond=0) 22 | 23 | 24 | def fake_db_notification(**updates): 25 | db_notification = { 26 | "type": "VM", 27 | "id": 1, 28 | "payload": 29 | {'event': 'STOPPED', 'host_status': 'NORMAL', 30 | 'cluster_status': 'ONLINE' 31 | }, 32 | "source_host_uuid": uuidsentinel.fake_host, 33 | "generated_time": NOW, 34 | "status": "running", 35 | "notification_uuid": uuidsentinel.fake_notification, 36 | "created_at": NOW, 37 | "updated_at": None, 38 | "deleted_at": None, 39 | "deleted": 0 40 | } 41 | 42 | for name, field in objects.Notification.fields.items(): 43 | if name in db_notification: 44 | continue 45 | if field.nullable: 46 | db_notification[name] = None 47 | elif field.default != fields.UnspecifiedDefault: 48 | db_notification[name] = field.default 49 | else: 50 | raise Exception('fake_db_notification needs help with %s' % name) 51 | 52 | if updates: 53 | db_notification.update(updates) 54 | 55 | return db_notification 56 | 57 | 58 | def fake_notification_obj(context, **updates): 59 | return objects.Notification(**updates) 60 | -------------------------------------------------------------------------------- /masakari/tests/unit/fake_policy.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 NTT DATA 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | 16 | policy_data = """ 17 | { 18 | "context_is_admin": "role:admin or role:administrator", 19 | 20 | "os_masakari_api:extensions:index": "", 21 | "os_masakari_api:extensions:detail": "", 22 | "os_masakari_api:segments:index": "", 23 | "os_masakari_api:segments:detail": "", 24 | "os_masakari_api:segments:create": "", 25 | "os_masakari_api:segments:update": "", 26 | "os_masakari_api:segments:delete": "", 27 | "os_masakari_api:os-hosts:index": "", 28 | "os_masakari_api:os-hosts:detail": "", 29 | "os_masakari_api:os-hosts:create": "", 30 | "os_masakari_api:os-hosts:update": "", 31 | "os_masakari_api:os-hosts:delete": "", 32 | "os_masakari_api:notifications:index": "", 33 | "os_masakari_api:notifications:detail": "", 34 | "os_masakari_api:notifications:create": "" 35 | } 36 | """ 37 | -------------------------------------------------------------------------------- /masakari/tests/unit/ha/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/ha/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/monkey_patch_example/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | """Example Module for testing utils.monkey_patch().""" 16 | 17 | 18 | CALLED_FUNCTION = [] 19 | 20 | 21 | def example_decorator(name, function): 22 | """decorator for notify which is used from utils.monkey_patch() 23 | 24 | :param name: name of the function 25 | :param function: - object of the function 26 | :returns: function -- decorated function 27 | """ 28 | def wrapped_func(*args, **kwarg): 29 | CALLED_FUNCTION.append(name) 30 | return function(*args, **kwarg) 31 | return wrapped_func 32 | -------------------------------------------------------------------------------- /masakari/tests/unit/monkey_patch_example/example_a.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | """Example Module A for testing utils.monkey_patch().""" 16 | 17 | 18 | def example_function_a(): 19 | return 'Example function' 20 | 21 | 22 | class ExampleClassA(object): 23 | def example_method(self): 24 | return 'Example method' 25 | 26 | def example_method_add(self, arg1, arg2): 27 | return arg1 + arg2 28 | -------------------------------------------------------------------------------- /masakari/tests/unit/monkey_patch_example/example_b.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | """Example Module B for testing utils.monkey_patch().""" 17 | 18 | 19 | def example_function_b(): 20 | return 'Example function' 21 | 22 | 23 | class ExampleClassB(object): 24 | def example_method(self): 25 | return 'Example method' 26 | 27 | def example_method_add(self, arg1, arg2): 28 | return arg1 + arg2 29 | -------------------------------------------------------------------------------- /masakari/tests/unit/notifications/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/notifications/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/notifications/objects/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/notifications/objects/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/objects/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/tests/unit/objects/__init__.py -------------------------------------------------------------------------------- /masakari/tests/unit/test_versions.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import builtins 17 | import io 18 | from oslo_config import cfg 19 | 20 | from masakari import test 21 | from masakari import version 22 | 23 | 24 | class VersionTestCase(test.NoDBTestCase): 25 | """Test cases for Versions code.""" 26 | 27 | def test_version_string_with_package_is_good(self): 28 | """Ensure uninstalled code get version string.""" 29 | 30 | self.stub_out('masakari.version.version_info.version_string', 31 | lambda: '5.5.5.5') 32 | self.stub_out('masakari.version.MASAKARI_PACKAGE', 'g9ec3421') 33 | self.assertEqual("5.5.5.5-g9ec3421", 34 | version.version_string_with_package()) 35 | 36 | def test_release_file(self): 37 | version.loaded = False 38 | real_open = builtins.open 39 | real_find_file = cfg.CONF.find_file 40 | 41 | def fake_find_file(self, name): 42 | if name == "release": 43 | return "/etc/masakari/release" 44 | return real_find_file(self, name) 45 | 46 | def fake_open(path, *args, **kwargs): 47 | if path == "/etc/masakari/release": 48 | data = """[Masakari] 49 | vendor = ACME Corporation 50 | product = ACME Masakari 51 | package = 1337""" 52 | return io.StringIO(data) 53 | 54 | return real_open(path, *args, **kwargs) 55 | 56 | self.stub_out('builtins.open', fake_open) 57 | self.stub_out('oslo_config.cfg.ConfigOpts.find_file', fake_find_file) 58 | 59 | self.assertEqual(version.vendor_string(), "ACME Corporation") 60 | self.assertEqual(version.product_string(), "ACME Masakari") 61 | self.assertEqual(version.package_string(), "1337") 62 | -------------------------------------------------------------------------------- /masakari/tests/unit/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright 2011 OpenStack Foundation 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | import errno 16 | import platform 17 | import socket 18 | import sys 19 | 20 | import masakari.conf 21 | import masakari.context 22 | import masakari.utils 23 | 24 | CONF = masakari.conf.CONF 25 | 26 | 27 | def get_test_admin_context(): 28 | return masakari.context.get_admin_context() 29 | 30 | 31 | def is_linux(): 32 | return platform.system() == 'Linux' 33 | 34 | 35 | def coreutils_readlink_available(): 36 | _out, err = masakari.utils.trycmd('readlink', '-nm', '/') 37 | return err == '' 38 | 39 | 40 | def is_ipv6_supported(): 41 | has_ipv6_support = socket.has_ipv6 42 | try: 43 | s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) 44 | s.close() 45 | except socket.error as e: 46 | if e.errno == errno.EAFNOSUPPORT: 47 | has_ipv6_support = False 48 | else: 49 | raise 50 | 51 | # check if there is at least one interface with ipv6 52 | if has_ipv6_support and sys.platform.startswith('linux'): 53 | try: 54 | with open('/proc/net/if_inet6') as f: 55 | if not f.read(): 56 | has_ipv6_support = False 57 | except IOError: 58 | has_ipv6_support = False 59 | 60 | return has_ipv6_support 61 | 62 | 63 | def get_api_version(request): 64 | if request.path[2:3].isdigit(): 65 | return int(request.path[2:3]) 66 | 67 | 68 | def _compare_args(args1, args2, cmp): 69 | return all(cmp(*pair) for pair in zip(args1, args2)) 70 | 71 | 72 | def _compare_kwargs(kwargs1, kwargs2, cmp): 73 | return all(cmp(kwargs1[k], kwargs2[k]) 74 | for k in set(list(kwargs1.keys()) + list(kwargs2.keys()))) 75 | -------------------------------------------------------------------------------- /masakari/tests/uuidsentinel.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NTT DATA 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import sys 17 | 18 | 19 | class UUIDSentinels(object): 20 | def __init__(self): 21 | from oslo_utils import uuidutils 22 | self._uuid_module = uuidutils 23 | self._sentinels = {} 24 | 25 | def __getattr__(self, name): 26 | if name.startswith('_'): 27 | raise ValueError('Sentinels must not start with _') 28 | if name not in self._sentinels: 29 | self._sentinels[name] = self._uuid_module.generate_uuid() 30 | return self._sentinels[name] 31 | 32 | 33 | sys.modules[__name__] = UUIDSentinels() 34 | -------------------------------------------------------------------------------- /masakari/wsgi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/masakari/wsgi/__init__.py -------------------------------------------------------------------------------- /masakari/wsgi/api.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """WSGI application entry-point for Masakari API.""" 14 | 15 | import threading 16 | 17 | from masakari.cmd import api 18 | 19 | 20 | application = None 21 | lock = threading.Lock() 22 | with lock: 23 | if application is None: 24 | application = api.initialize_application() 25 | -------------------------------------------------------------------------------- /playbooks/devstack/post.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | roles: 4 | - fetch-subunit-output 5 | - devstack-config 6 | -------------------------------------------------------------------------------- /playbooks/devstack/pre.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: controller 3 | roles: 4 | - ensure-tox 5 | -------------------------------------------------------------------------------- /playbooks/devstack/run-devstack.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | roles: 4 | - orchestrate-devstack 5 | -------------------------------------------------------------------------------- /playbooks/devstack/run-tox.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: controller 3 | roles: 4 | - role: tox 5 | vars: 6 | # NOTE(yoctozepto): We need to run this play in other projects but it is 7 | # meant to run tox from this project, not the "current one". 8 | zuul_work_dir: "{{ zuul.projects['opendev.org/openstack/masakari'].src_dir }}" 9 | -------------------------------------------------------------------------------- /playbooks/devstack/run-verify-config-is-ipv6-only.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: all 3 | roles: 4 | - devstack-ipv6-only-deployments-verification 5 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["pbr>=6.1.1"] 3 | build-backend = "pbr.build" 4 | -------------------------------------------------------------------------------- /releasenotes/notes/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/releasenotes/notes/.placeholder -------------------------------------------------------------------------------- /releasenotes/notes/add-masakari-wsgi-module-a5f5a649a2ec460c.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | A new module, ``masakari.wsgi``, has been added as a place to gather WSGI 5 | ``application`` objects. This is intended to ease deployment by providing 6 | a consistent location for these objects. For example, if using uWSGI then 7 | instead of: 8 | 9 | .. code-block:: ini 10 | 11 | [uwsgi] 12 | wsgi-file = /bin/masakari-wsgi 13 | 14 | You can now use: 15 | 16 | .. code-block:: ini 17 | 18 | [uwsgi] 19 | module = masakari.wsgi.api:application 20 | 21 | This also simplifies deployment with other WSGI servers that expect module 22 | paths such as gunicorn. 23 | -------------------------------------------------------------------------------- /releasenotes/notes/add-periodic-tasks-0c96d6f620502a75.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Added _process_unfinished_notifications to process notifications 5 | which are in error or new state. This periodic task will execute at 6 | regular interval defined by new config option 7 | 'process_unfinished_notifications_interval' defaults to 120 seconds. The 8 | notifications which are in ‘new’ status will be picked up based on a new 9 | config option ‘retry_notification_new_status_interval’ defaults 10 | to 60 seconds. 11 | 12 | To change the default execution time of periodic task, following config 13 | option needs to be set with desirable time under 'DEFAULT' section in 14 | 'masakari.conf' file:: 15 | 16 | [DEFAULT] 17 | process_unfinished_notifications_interval = 120 18 | 19 | To change the default identification time of notifications which are stuck 20 | in 'NEW' state, following config option needs to be set with desirable 21 | time under 'DEFAULT' section in 'masakari.conf' file:: 22 | 23 | [DEFAULT] 24 | retry_notification_new_status_interval = 60 25 | -------------------------------------------------------------------------------- /releasenotes/notes/add-upgrade-check-framework-52268130b25317ab.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | prelude: > 3 | Added new tool ``masakari-status upgrade check``. 4 | features: 5 | - | 6 | New framework for ``masakari-status upgrade check`` command is added. 7 | This framework allows adding various checks which can be run before a 8 | Masakari upgrade to ensure if the upgrade can be performed safely. 9 | upgrade: 10 | - | 11 | Operator can now use new CLI tool ``masakari-status upgrade check`` 12 | to check if Masakari deployment can be safely upgraded from 13 | N-1 to N release. 14 | -------------------------------------------------------------------------------- /releasenotes/notes/add_evacuate_error_instances_conf_option-5b4d1906137395f0.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Operators can decide whether error instances should be allowed for 5 | evacuation along with other instances from a failed source compute node 6 | or not. Added a new config option ``ignore_instances_in_error_state`` to 7 | achieve this. When set to True, masakari will skip the recovery of error 8 | instances otherwise it will evacuate error instances as well from a failed 9 | source compute node. 10 | 11 | To use this feature, following config option need to be set under 12 | ``host_failure`` section in 'masakari.conf' file:: 13 | 14 | [host_failure] 15 | ignore_instances_in_error_state = False 16 | 17 | The default value for this config option is set to False. 18 | -------------------------------------------------------------------------------- /releasenotes/notes/add_ha_enabled_config_options-54a9270a5993d20a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Operators can decide whether all instances or only those instances which 5 | contain metadata key 'HA_Enabled=True' should be allowed for evacuation 6 | from a failed source compute node. When set to True, it will evacuate all 7 | instances from a failed source compute node. First preference will be 8 | given to those instances which contain 'HA_Enabled=True' metadata key, 9 | and then it will evacuate the remaining ones. When set to False, it will 10 | evacuate only those instances which contain 'HA_Enabled=True' metadata 11 | key. 12 | 13 | To use this feature, following config option need to be set under 14 | ``host_failure`` section in 'masakari.conf' file:: 15 | 16 | [host_failure] 17 | evacuate_all_instances = True 18 | 19 | - | 20 | Operators can decide whether all instances or only those instances which 21 | contain metadata key 'HA_Enabled=True' should be taken into account to 22 | recover from instance failure events. When set to True, it will execute 23 | instance failure recovery actions for an instance irrespective of whether 24 | that particular instance contains metadata key 'HA_Enabled=True' or not. 25 | When set to False, it will only execute instance failure recovery action 26 | for an instance which contain metadata key 'HA_Enabled=True'. 27 | 28 | To use this feature, following config option need to be set under 29 | ``instance_failure`` section in 'masakari.conf' file:: 30 | 31 | [instance_failure] 32 | process_all_instances = True 33 | -------------------------------------------------------------------------------- /releasenotes/notes/add_reserved_host_to_aggregates-5f506d08354ec148.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Operators can now decide based on the new config option 5 | 'add_reserved_host_to_aggregate' whether to add or not a reserved_host 6 | to all host aggregates which failed compute host belongs to. 7 | 8 | To use this feature, following config option need to be set under 9 | ``host_failure`` section in 'masakari.conf' file:: 10 | 11 | [host_failure] 12 | add_reserved_host_to_aggregate = True 13 | -------------------------------------------------------------------------------- /releasenotes/notes/adopt-oslo-config-generator-cf2fdb17cf7f13db.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | other: 3 | - | 4 | Adopt oslo-config-generator to generate sample config files. 5 | New config options from masakari code should register with 6 | masakari/conf/opts.py. A deprecated option should add a 7 | deprecated group even if it didn't alter its group, otherwise 8 | the deprecated group will use 'DEFAULT' by default. 9 | -------------------------------------------------------------------------------- /releasenotes/notes/auto_priority_and_rh_priority_recovery_methods-b88cc00041fa2c4d.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Implemented workflow for 'auto_priority' and 'rh_priority' recovery methods 5 | in case of host failure recovery. Operators can set failover_segment's 6 | recovery_method as 'auto_priority' and 'rh_priority' now. In case of 7 | 'auto_priority' the 'auto' workflow will be executed first to recover the 8 | instances from failed compute host. If 'auto' workflow fails to recover 9 | the instances then 'reserved_host' workflow will be tried. In case of 10 | 'rh_priority' the 'reserved_host' workflow will be executed first to 11 | recover the instances from failed compute host. If 'reserved_host' workflow 12 | fails to recover the instances then 'auto' workflow will be tried. 13 | -------------------------------------------------------------------------------- /releasenotes/notes/blueprint-add-vmoves-348fd430aa936721.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | It persists vm moves information for one host failure notification 5 | into the database, which could help users to insight the process 6 | or result of the host recovery workflow, such as which vms evacuated 7 | succeed or failed, and which ones are still evacuating. 8 | 9 | Added VMove API in microversion 1.3, please refer to .. _`VMoves`: 10 | https://docs.openstack.org/api-ref/instance-ha/#vmoves-vmoves 11 | -------------------------------------------------------------------------------- /releasenotes/notes/blueprint-support-nova-system-scope-policies-c4dbd244dd3fcf1a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Allows to use system-scoped tokens when contacting Nova. 5 | `Blueprint support-nova-system-scope-policies `__ 6 | -------------------------------------------------------------------------------- /releasenotes/notes/bp-mutable-config-57efdd467c01aa7b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Masakari has been enabled for mutable config. 5 | Below option may be reloaded by sending SIGHUP to the correct process. 6 | 7 | 'retry_notification_new_status_interval' option will apply to process 8 | unfinished notifications. 9 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-1685145-3d93145bfc76c660.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes ``/v1/`` API path which returned 404 ResourceNotFound preventing 5 | microversion discovery. 6 | `LP#1685145 `__ 7 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-1776385-0bcf0a0b3fad359e.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Allows segment description to contain new line characters. 5 | `LP#1776385 `__ 6 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-1782517-e4dc70bad9e4e131.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes Masakari Engine not to try to stop an already stopped instance 5 | and fail with 409 from Nova. 6 | `LP#1782517 `__ 7 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-1856164-6601a6e6280eba4d.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Adds ``reserved_host`` to all aggregates of the failing host, instead of 5 | just the first one. 6 | `LP#1856164 `__ 7 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-1859406-6b041a26acf6c7f6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes Masakari Engine not to wait for timeout when it's known that 5 | the evacuation has failed. 6 | `LP#1859406 `__ 7 | (This fix has already been included in the first Victoria release, 8 | 10.0.0, but it was not mentioned in the release notes previously.) 9 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-1882516-e8dc7fd2b55f065f.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes API microversion reporting to report the latest supported 5 | microversion. 6 | `LP#1882516 `__ 7 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-1932194-2b721860bbc26819.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes Masakari API to properly return error codes for invalid requests 5 | to the user instead of 500. 6 | `LP#1932194 `__ 7 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-1960619-4c2cc73483bdff86.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes an issue that could be caused by a user sending a malformed 5 | host notification missing host status. Such notification would 6 | block the host from being added back from maintenance until 7 | manual intervention or notification expiration. 8 | `LP#1960619 `__ 9 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-1980736-975ee013e4612062.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes "Instance stopping fails randomly due to already stopped instances". 5 | `LP#1980736 `__ 6 | -------------------------------------------------------------------------------- /releasenotes/notes/bug-add-missing-domain-name-5181c02f3f033a22.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | prelude: > 3 | Domain name is needed when using keystone v3 to create keystone session, 4 | if not provided, InvalidInput exception will be raised. Two new options 5 | "os_user_domain_name" and "os_project_domain_name" with default value 6 | "default" are added to fix the issue. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/compute-disable-reason-9570734c0bb888cf.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Nova compute service "disable reason" is now set 5 | in case of host or process failure. 6 | It can be customised per type of failure via config. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/compute_search-3da97e69e661a73f.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes validation of compute host existence from checking hypervisor list 5 | to compute service list. Since masakari needs to match nova compute service 6 | hostname with the one in pacemaker cluster and added to API for correctly 7 | processing hostmonitors failover notifications. 8 | -------------------------------------------------------------------------------- /releasenotes/notes/coordination_for_host_notification-a156ec5a5839a781.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes an issue which triggers two recovery workflows for the same 5 | host failure. `LP#1961110 6 | `__ 7 | 8 | It introduces distributed lock for Masakari-api services when handle 9 | the concurrent notifications for the same host failure from multiple 10 | Masakari-hostmonitor services. To enable coordination, the user needs 11 | to set the new configuration option ``[coordination]backend_url``, 12 | which specifies the backend. 13 | -------------------------------------------------------------------------------- /releasenotes/notes/correct_response_code-df8b43a201efa1b4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes `bug 1645699`_ which will return correct response codes for below 5 | apis: 6 | 7 | - POST /v1/notification - old_response: 200, new_response: 202 8 | - DELETE /v1/notification - old_response: 404, new_response: 405 9 | - PUT /v1/notification/ - old_response: 404, 10 | new_response: 405 11 | - POST /v1/host - old_response: 200, new_response: 201 12 | - DELETE /v1/host/ - old_response: 200, new_response: 204 13 | - POST /v1/segment - old_response: 200, new_response: 201 14 | - DELETE /v1/segment/ - old_response: 200, new_response: 204 15 | 16 | .. _bug 1645699: https://bugs.launchpad.net/masakari/+bug/1645699 17 | -------------------------------------------------------------------------------- /releasenotes/notes/customisable-ha-enabled-instance-metadata-key-af511ea2aac96690.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Adds ``ha_enabled_instance_metadata_key`` config option to ``host_failure`` 5 | and ``instance_failure`` config groups. This option allows operators to 6 | override the default ``HA_Enabled`` instance metadata key which controls 7 | the behaviour of Masakari towards the instance. This way one can have 8 | different keys for different failure types (host vs instance failures). 9 | -------------------------------------------------------------------------------- /releasenotes/notes/db-purge-support-7a33e2ea5d2a624b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Operators can now purge the soft-deleted records from the database tables. 5 | Added below command to purge the records: 6 | 7 | ``masakari-manage db purge --age_in_days --max_rows `` 8 | 9 | NOTE: ``notifications`` db records will be purged on the basis of ``update_at`` 10 | and ``status`` fields (finished, ignored, failed) as these records will not be 11 | automatically soft-deleted by the system. 12 | -------------------------------------------------------------------------------- /releasenotes/notes/deprecate-json-formatted-policy-file-57ad537ec19cc7e0.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | The default value of ``[oslo_policy] policy_file`` config option has 5 | been changed from ``policy.json`` to ``policy.yaml``. 6 | Operators who are utilizing customized or previously generated 7 | static policy JSON files (which are not needed by default), should 8 | generate new policy files or convert them in YAML format. Use the 9 | `oslopolicy-convert-json-to-yaml 10 | `_ 11 | tool to convert a JSON to YAML formatted policy file in 12 | backward compatible way. 13 | deprecations: 14 | - | 15 | Use of JSON policy files was deprecated by the ``oslo.policy`` library 16 | during the Victoria development cycle. As a result, this deprecation is 17 | being noted in the Wallaby cycle with an anticipated future removal of support 18 | by ``oslo.policy``. As such operators will need to convert to YAML policy 19 | files. Please see the upgrade notes for details on migration of any 20 | custom policy files. 21 | -------------------------------------------------------------------------------- /releasenotes/notes/deprecate-topic-opt-af83f82143143c61.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | deprecations: 3 | - | 4 | The ``masakari_topic`` config option is now deprecated and will be removed 5 | in the Queens release. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/drop-py-2-7-059d3cd5e7cb4e1a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | Python 2.7 support has been dropped. Last release of Masakari 5 | to support python 2.7 is OpenStack Train. The minimum version of Python now 6 | supported by Masakari is Python 3.6. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/drop-python-38-39-deab0b81006bae48.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | Support for Python 3.8 and Python 3.9 has been removed. The minimum 5 | supported version of Python is now Python 3.10. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/enabled-to-segment-7e6184feb1e4f818.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | features: 4 | - | 5 | Sometimes, operators want to temporarily disable instance-ha function. 6 | This version adds 'enabled' to segment. If the segment 'enabled' value 7 | is set False, all notifications of this segment will be ignored 8 | and no recovery methods will execute. 9 | -------------------------------------------------------------------------------- /releasenotes/notes/evacuation_in_threads-cc9c79b10acfb5f6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes `bug 1693728`_ which will fix the race condition where after 5 | evacuation of an instance to other host user might perform some actions on 6 | that instance which gives wrong instance vm_state to ConfirmEvacuationTask 7 | that results into notification failure. 8 | 9 | To fix this issue, following config option is added under ``DEFAULT`` 10 | section in 'masakari.conf' file:: 11 | 12 | [DEFAULT] 13 | host_failure_recovery_threads = 3 14 | 15 | This config option decides the number of threads going to be used for 16 | evacuating the instances. 17 | 18 | .. _`bug 1693728`: https://bugs.launchpad.net/masakari/+bug/1693728 19 | -------------------------------------------------------------------------------- /releasenotes/notes/failover_segment_apis-f5bea1cd6d103048.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Added following new REST API's for masakari operators: 5 | 6 | - GET /v1/segments - Returns list of all failover segments. 7 | - GET /v1/segments/ - Returns specific failover segment 8 | with uuid. 9 | - POST /v1/segments - Creates a new failover segment 10 | - PUT /v1/segments/ - Updates a failover segment by uuid 11 | - DELETE /v1/segments/ - Delete a failover segment by uuid 12 | -------------------------------------------------------------------------------- /releasenotes/notes/fix-endless-periodic-f223845f3044b166.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes an issue where a periodic task in Masakari Engine could loop forever 5 | querying Nova API following a failed evacuation. `LP#1897888 6 | `__ 7 | -------------------------------------------------------------------------------- /releasenotes/notes/fix-notification-stuck-problem-fdb84bad8641384b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes an issue where failure notification stuck into running status 5 | when timeout. `LP#1996835 6 | `__ 7 | -------------------------------------------------------------------------------- /releasenotes/notes/host-apis-46a87fcd56d8ed30.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Added following new REST API's for masakari operators: 5 | 6 | - GET /v1/segments//hosts - Returns list of all hosts 7 | associated with failover segment. 8 | - GET /v1/segments//hosts/ - Returns specific host 9 | from the failover segment with uuid. 10 | - POST /v1/segments//hosts - Creates a new host in failover 11 | segment 12 | - PUT /v1/segments//hosts/ - Updates a host in 13 | failover segment by uuid 14 | - DELETE /v1/segments//hosts/ - Delete a host from 15 | failover segment by uuid 16 | -------------------------------------------------------------------------------- /releasenotes/notes/notifications-in-masakari-f5d79838fc23cb9b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Added support to emit event notifications whenever user interacts with 5 | Masakari restFul APIs. The emitted notifications are documented at 6 | `sample_payloads`_. 7 | 8 | To enable this feature one should set `driver` config option under the 9 | `oslo_messaging_notifications` section as shown below:: 10 | 11 | [oslo_messaging_notifications] 12 | driver = log 13 | 14 | Note: Possible values are `messaging`, `messagingv2`, `routing`, `log`, 15 | `test`, `noop`. 16 | Notifications can be completely disabled by setting `driver` value as `noop` 17 | 18 | .. _`sample_payloads`: https://docs.openstack.org/masakari/latest/#versioned-notifications 19 | -------------------------------------------------------------------------------- /releasenotes/notes/notifications_apis-3c3d5055ae9c6649.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Added following new REST API's related to notifications: 5 | 6 | - GET /v1/notifications - Returns list of all notifications. 7 | - GET /v1/notifications/ - Returns specific notification 8 | with uuid. 9 | - POST /v1/notifications - Creates a new notification. 10 | -------------------------------------------------------------------------------- /releasenotes/notes/policy-in-code-8740d51624055044.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Masakari now support policy in code, which means if operators doesn't need to 5 | modify any of the default policy rules, they do not need a policy file. 6 | Operators can modify/generate a ``policy.yaml.sample`` file which will override 7 | specific policy rules from their defaults. 8 | 9 | Masakari is now configured to work with two oslo.policy CLI scripts that 10 | have been added: 11 | 12 | - The first of these can be called like 13 | ``oslopolicy-list-redundant --namespace masakari`` and will output a list of 14 | policy rules in policy.[json|yaml] that match the project defaults. These 15 | rules can be removed from the policy file as they have no effect there. 16 | - The second script can be called like 17 | ``oslopolicy-policy-generator --namespace masakari --output-file policy-merged.yaml`` 18 | and will populate the policy-merged.yaml file with the effective policy. 19 | This is the merged results of project defaults and config file overrides. 20 | 21 | NOTE: Default `policy.json` file is now removed as Masakari now uses default 22 | policies. A policy file is only needed if overriding one of the defaults. 23 | -------------------------------------------------------------------------------- /releasenotes/notes/progress-details-recovery-workflows-5b14b7b3f87374f4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Added support to record the recovery workflow details of the notification 5 | which will be returned in a new microversion 1.1 in 6 | `GET /notifications/{notification_id}` API. 7 | 8 | For example, GET /notifications/ response will contain 9 | `recovery_workflow_details` parameter as shown here `notification_details`_ 10 | 11 | Added a new config section in Masakari conf file for configuring the back 12 | end to be used by taskflow driver:: 13 | 14 | [taskflow] 15 | # The back end for storing recovery_workflow details of the notification. 16 | # (string value) 17 | 18 | connection = mysql+pymysql://root:admin@127.0.0.1/?charset=utf8 19 | 20 | # Where db_name, can be a new database or you can also specify masakari 21 | # database. 22 | 23 | Operator should run `masakari-manage db sync` command to add new db tables 24 | required for storing recovery_workflow_details. 25 | 26 | Note: When you run `masakari-manage db sync`, make sure you have 27 | `notification_driver=taskflow_driver` set in masakari.conf. 28 | 29 | .. _`notification_details`: https://developer.openstack.org/api-ref/instance-ha/?expanded=show-notification-details-detail#show-notification-details 30 | -------------------------------------------------------------------------------- /releasenotes/notes/recovery-method-customization-3438b0e26e322b88.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Operator can now customize workflows to process each type of failure 5 | notifications (hosts, instance and process) as per their requirements. 6 | Added below new config section for customized recovery flow in a new conf 7 | file masakari-custom-recovery-methods.conf 8 | 9 | - [taskflow_driver_recovery_flows] 10 | 11 | Under [taskflow_driver_recovery_flows] is added below five new config options 12 | 13 | - 'instance_failure_recovery_tasks' is a dict of tasks which will recover 14 | instance failure. 15 | - 'process_failure_recovery_tasks' is a dict of tasks which will recover 16 | process failure. 17 | - 'host_auto_failure_recovery_tasks' is a dict of tasks which will recover 18 | host failure for auto recovery. 19 | - 'host_rh_failure_recovery_tasks' is a dict of tasks which will recover 20 | host failure for rh recovery on failure host. 21 | -------------------------------------------------------------------------------- /releasenotes/notes/remove-masakari-wsgi-script-bb737746a17111ab.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | The WSGI script ``masakari-wsgi`` has been removed. Deployment tooling 5 | should instead reference the Python module path for the wsgi module in 6 | Masakari, ``masakari.wsgi.api:application`` if their chosen WSGI server 7 | supports this (gunicorn, uWSGI, etc.) or implement a ``.wsgi`` script 8 | themselves if not (mod_wsgi). 9 | -------------------------------------------------------------------------------- /releasenotes/notes/reserved_host_recovery_method-d2de1f205136c8d5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Implemented workflow for 'reserved_host' recovery method in case of host 5 | failure. Now operator can create or update failover segment with 6 | 'reserved_host' recovery method along with the existing 'auto' method. 7 | When 'reserved_host' recovery_method is set to a failover segment, 8 | operators should also add one or more hosts with reserved flag set as True. 9 | -------------------------------------------------------------------------------- /releasenotes/notes/switch-to-alembic-b438de67c5b22a40.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | The database migration engine has changed from `sqlalchemy-migrate`__ to 5 | `alembic`__. For most deployments, this should have minimal to no impact 6 | and the switch should be mostly transparent. The main user-facing impact is 7 | the change in schema versioning. While sqlalchemy-migrate used a linear, 8 | integer-based versioning scheme, which required placeholder migrations to 9 | allow for potential migration backports, alembic uses a distributed version 10 | control-like schema where a migration's ancestor is encoded in the file and 11 | branches are possible. The alembic migration files therefore use a 12 | arbitrary UUID-like naming scheme and the ``masakari-manage db_sync`` 13 | command now expects such an version when manually specifying the version 14 | that should be applied. For example:: 15 | 16 | $ masakari-manage db sync c6214ca60943 17 | 18 | Attempting to specify an sqlalchemy-migrate-based version will result in an 19 | error. 20 | 21 | .. __: https://sqlalchemy-migrate.readthedocs.io/en/latest/ 22 | .. __: https://alembic.sqlalchemy.org/en/latest/ 23 | -------------------------------------------------------------------------------- /releasenotes/notes/wsgi-applications-3ed7d6b89f1a5785.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | WSGI application script ``masakari-wsgi`` is now available. It allows 5 | running the masakari APIs using a WSGI server of choice (for example 6 | nginx and uwsgi, apache2 with mod_proxy_uwsgi or gunicorn). 7 | The eventlet-based servers are still available, but the WSGI options will 8 | allow greater deployment flexibility. 9 | -------------------------------------------------------------------------------- /releasenotes/source/2023.1.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2023.1 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/2023.1 7 | -------------------------------------------------------------------------------- /releasenotes/source/2023.2.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2023.2 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2023.2 7 | -------------------------------------------------------------------------------- /releasenotes/source/2024.1.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2024.1 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2024.1 7 | -------------------------------------------------------------------------------- /releasenotes/source/2024.2.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2024.2 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2024.2 7 | -------------------------------------------------------------------------------- /releasenotes/source/2025.1.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2025.1 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2025.1 7 | -------------------------------------------------------------------------------- /releasenotes/source/_static/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/releasenotes/source/_static/.placeholder -------------------------------------------------------------------------------- /releasenotes/source/_templates/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/masakari/807c55944d2779d497502fdd321b2c8272cfc12d/releasenotes/source/_templates/.placeholder -------------------------------------------------------------------------------- /releasenotes/source/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to Masakari Release Notes documentation! 2 | ================================================ 3 | 4 | Contents 5 | ======== 6 | 7 | .. toctree:: 8 | :maxdepth: 1 9 | 10 | unreleased 11 | 2025.1 12 | 2024.2 13 | 2024.1 14 | 2023.2 15 | 2023.1 16 | zed 17 | yoga 18 | xena 19 | wallaby 20 | victoria 21 | ussuri 22 | train 23 | stein 24 | rocky 25 | queens 26 | pike 27 | ocata 28 | 29 | -------------------------------------------------------------------------------- /releasenotes/source/ocata.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | Ocata Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: origin/stable/ocata 7 | 8 | -------------------------------------------------------------------------------- /releasenotes/source/pike.rst: -------------------------------------------------------------------------------- 1 | ========================== 2 | Pike Series Release Notes 3 | ========================== 4 | 5 | .. release-notes:: 6 | :branch: origin/stable/pike 7 | 8 | -------------------------------------------------------------------------------- /releasenotes/source/queens.rst: -------------------------------------------------------------------------------- 1 | ============================ 2 | Queens Series Release Notes 3 | ============================ 4 | 5 | .. release-notes:: 6 | :branch: origin/stable/queens 7 | 8 | -------------------------------------------------------------------------------- /releasenotes/source/rocky.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Rocky Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/rocky 7 | -------------------------------------------------------------------------------- /releasenotes/source/stein.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Stein Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/stein 7 | -------------------------------------------------------------------------------- /releasenotes/source/train.rst: -------------------------------------------------------------------------------- 1 | ========================== 2 | Train Series Release Notes 3 | ========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/train 7 | -------------------------------------------------------------------------------- /releasenotes/source/unreleased.rst: -------------------------------------------------------------------------------- 1 | ============================== 2 | Current Series Release Notes 3 | ============================== 4 | 5 | .. release-notes:: 6 | -------------------------------------------------------------------------------- /releasenotes/source/ussuri.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | Ussuri Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/ussuri 7 | -------------------------------------------------------------------------------- /releasenotes/source/victoria.rst: -------------------------------------------------------------------------------- 1 | ============================= 2 | Victoria Series Release Notes 3 | ============================= 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/victoria 7 | -------------------------------------------------------------------------------- /releasenotes/source/wallaby.rst: -------------------------------------------------------------------------------- 1 | ============================ 2 | Wallaby Series Release Notes 3 | ============================ 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/wallaby 7 | -------------------------------------------------------------------------------- /releasenotes/source/xena.rst: -------------------------------------------------------------------------------- 1 | ========================= 2 | Xena Series Release Notes 3 | ========================= 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/xena 7 | -------------------------------------------------------------------------------- /releasenotes/source/yoga.rst: -------------------------------------------------------------------------------- 1 | ========================= 2 | Yoga Series Release Notes 3 | ========================= 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/yoga 7 | -------------------------------------------------------------------------------- /releasenotes/source/zed.rst: -------------------------------------------------------------------------------- 1 | ======================== 2 | Zed Series Release Notes 3 | ======================== 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/zed 7 | -------------------------------------------------------------------------------- /releasenotes/templates/feature.yml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Implements [some feature]. 5 | [Can be described using multiple sentences if necessary.] 6 | [Limitations worth mentioning can be included as well.] 7 | `Blueprint [blueprint id] `__ 8 | -------------------------------------------------------------------------------- /releasenotes/templates/fix.yml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fixes [some bug]. 5 | [Can be described using multiple sentences if necessary.] 6 | [Possibly also giving the previous behaviour description.] 7 | `LP#[bug number] `__ 8 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | alembic>=1.8.0 # MIT 2 | iso8601>=0.1.11 # MIT 3 | jsonschema>=3.2.0 # MIT 4 | keystoneauth1>=3.4.0 # Apache-2.0 5 | keystonemiddleware>=4.17.0 # Apache-2.0 6 | WebOb>=1.7.1 # MIT 7 | microversion-parse>=0.2.1 # Apache-2.0 8 | oslo.config>=5.2.0 # Apache-2.0 9 | oslo.context>=2.19.2 # Apache-2.0 10 | oslo.db>=4.44.0 # Apache-2.0 11 | oslo.messaging>=14.1.0 # Apache-2.0 12 | oslo.i18n>=3.15.3 # Apache-2.0 13 | oslo.log>=3.36.0 # Apache-2.0 14 | oslo.middleware>=3.31.0 # Apache-2.0 15 | oslo.policy>=4.5.0 # Apache-2.0 16 | oslo.service!=1.28.1,>=1.24.0 # Apache-2.0 17 | oslo.upgradecheck>=1.3.0 # Apache-2.0 18 | oslo.utils>=4.7.0 # Apache-2.0 19 | oslo.versionedobjects>=1.31.2 # Apache-2.0 20 | pbr!=2.1.0,>=2.0.0 # Apache-2.0 21 | python-novaclient>=9.1.0 # Apache-2.0 22 | stevedore>=1.20.0 # Apache-2.0 23 | SQLAlchemy>=1.2.19 # MIT 24 | SQLAlchemy-Utils>=0.33.10 # Apache-2.0 25 | taskflow>=2.16.0 # Apache-2.0 26 | tooz>=2.10.1 # Apache-2.0 27 | -------------------------------------------------------------------------------- /roles/devstack-config/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Collect devstack stackenv file 3 | fetch: 4 | flat: true 5 | dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/-stackenv" 6 | src: "/opt/stack/devstack/.stackenv" 7 | 8 | - name: Collect devstack config files 9 | synchronize: 10 | dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/" 11 | mode: pull 12 | src: "/opt/stack/devstack/{{ item }}" 13 | with_items: 14 | - local.conf 15 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | import setuptools 17 | 18 | setuptools.setup( 19 | setup_requires=['pbr>=2.0.0'], 20 | pbr=True) 21 | -------------------------------------------------------------------------------- /test-requirements.txt: -------------------------------------------------------------------------------- 1 | hacking>=6.1.0,<6.2.0 # Apache-2.0 2 | 3 | coverage!=4.4,>=4.0 # Apache-2.0 4 | ddt>=1.0.1 # MIT 5 | doc8>=0.6.0 # Apache-2.0 6 | pep8>=1.5.7 7 | psycopg2>=2.8 # LGPL/ZPL 8 | PyMySQL>=0.7.6 # MIT License 9 | python-subunit>=1.0.0 # Apache-2.0/BSD 10 | openstacksdk>=0.35.0 # Apache-2.0 11 | oslotest>=3.2.0 # Apache-2.0 12 | stestr>=1.0.0 # Apache-2.0 13 | SQLAlchemy-Utils>=0.33.10 # Apache-2.0 14 | requests-mock>=1.2.0 # Apache-2.0 15 | testresources>=2.0.0 # Apache-2.0/BSD 16 | testscenarios>=0.4 # Apache-2.0/BSD 17 | testtools>=2.2.0 # MIT 18 | yamllint>=1.22.0 # GPLv3 19 | -------------------------------------------------------------------------------- /tools/test-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | # This script will be run by OpenStack CI before unit tests are run, 4 | # it sets up the test system as needed. 5 | # Developers should setup their test systems in a similar way. 6 | 7 | # This setup needs to be run as a user that can run sudo. 8 | 9 | # The root password for the MySQL database; pass it in via 10 | # MYSQL_ROOT_PW. 11 | DB_ROOT_PW=${MYSQL_ROOT_PW:-insecure_slave} 12 | 13 | # This user and its password are used by the tests, if you change it, 14 | # your tests might fail. 15 | DB_USER=openstack_citest 16 | DB_PW=openstack_citest 17 | 18 | sudo -H mysqladmin -u root password $DB_ROOT_PW 19 | 20 | # It's best practice to remove anonymous users from the database. If 21 | # an anonymous user exists, then it matches first for connections and 22 | # other connections from that host will not work. 23 | sudo -H mysql -u root -p$DB_ROOT_PW -h localhost -e " 24 | DELETE FROM mysql.user WHERE User=''; 25 | FLUSH PRIVILEGES; 26 | CREATE USER '$DB_USER'@'%' IDENTIFIED BY '$DB_PW'; 27 | GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'%' WITH GRANT OPTION;" 28 | 29 | # Now create our database. 30 | mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e " 31 | SET default_storage_engine=MYISAM; 32 | DROP DATABASE IF EXISTS openstack_citest; 33 | CREATE DATABASE openstack_citest CHARACTER SET utf8;" 34 | 35 | # Same for PostgreSQL 36 | 37 | # Setup user 38 | root_roles=$(sudo -H -u postgres psql -t -c " 39 | SELECT 'HERE' from pg_roles where rolname='$DB_USER'") 40 | if [[ ${root_roles} == *HERE ]];then 41 | sudo -H -u postgres psql -c "ALTER ROLE $DB_USER WITH SUPERUSER LOGIN PASSWORD '$DB_PW'" 42 | else 43 | sudo -H -u postgres psql -c "CREATE ROLE $DB_USER WITH SUPERUSER LOGIN PASSWORD '$DB_PW'" 44 | fi 45 | 46 | # Store password for tests 47 | cat << EOF > $HOME/.pgpass 48 | *:*:*:$DB_USER:$DB_PW 49 | EOF 50 | chmod 0600 $HOME/.pgpass 51 | 52 | # Now create our database 53 | psql -h 127.0.0.1 -U $DB_USER -d template1 -c "DROP DATABASE IF EXISTS openstack_citest" 54 | createdb -h 127.0.0.1 -U $DB_USER -l C -T template0 -E utf8 openstack_citest 55 | --------------------------------------------------------------------------------